-
-
Save jnpn/9f1152783c494ac52719b13b059d6c8e to your computer and use it in GitHub Desktop.
line templating utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; quick naive contextual template WIP | |
(defun replace-by-transient-overlay () | |
"copy word at point as w | |
kill-word | |
create overlay with text `w' | |
overlay map -> any char -> delete overlay" | |
:todo) | |
(defun l/line-template-at-point () | |
(interactive) | |
(let* ((bol (line-beginning-position)) | |
(eol (line-end-position)) | |
(pt (point)) | |
(delta (- pt bol)) | |
(current-line (buffer-substring-no-properties bol eol))) | |
(end-of-line) | |
(newline) | |
(insert current-line) | |
(beginning-of-line) | |
(forward-char delta) | |
;; (replace-by-transient-overlay) | |
(kill-word 1))) | |
;;; example, '.' indicates cursor position | |
"here comes .the sun" | |
"here comes . sun" | |
"my friends are so different" | |
"my fri are so different" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment