当我意识到我需要(编辑)上面一行的变量定义(或类似的东西)时,我经常发现自己在一条线上打字.我想要的是
我已经设法做到了#1,但是我的emacs-fu还不够强大,无法完成剩下的工作.
这是我谦虚的解决方案:
(defun my-insert-before-line ()
(interactive)
(save-excursion
(beginning-of-line)
; I've changed the order of (yank) and (indent-according-to-mode)
; in order to handle the case when yanked line comes with its own indent
(yank)(indent-according-to-mode)
; could be as well changed to simple (newline) it's metter of taste
; and of usage
(newline-and-indent)))
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你.