在我的.emacs我有以下功能调换线路的.emacs全球设置键,调用交互功能与参数
(defun move-line (n)
"Move the current line up or down by N lines."
(interactive "p")
(let ((col (current-column))
start
end)
(beginning-of-line)
(setq start (point))
(end-of-line)
(forward-char)
(setq end (point))
(let ((line-text (delete-and-extract-region start end)))
(forward-line n)
(insert line-text)
;; restore point to original column in moved line
(forward-line -1)
(forward-char col))))
我一个密钥绑定像这样
(global-set-key (kbd "M-<down>") 'move-line)
;; this is the same as M-x global-set-key <return>
不过,我想结合M-了移动线(-1),但我不能似乎能够正确地做到这一点:
;; M-- M-1 M-x global-set-key <return>
我如何使用global-set-key来定义上述调用move-line-1?
仅供参考:emacs中内置了转置线路功能。尝试快捷方式C-x C-t。 – polyglot 2009-06-23 04:05:46