如何在osx上配置emacs 23.1.1,以便在emacs窗口上拖放文件时在新的缓冲区中打开该文件,而不是将其附加到当前缓冲区?
发布于 2010-09-27 16:54:07
您可以尝试:
(global-set-key [ns-drag-file] 'ns-find-file)
它在Emacs 23.2.1上对我有效
发布于 2012-01-22 10:56:11
我使用:
(if (fboundp 'ns-find-file)
(global-set-key [ns-drag-file] 'ns-find-file))
这(基本上与其他答案中给出的相同)确保创建一个新的缓冲区。if
部分确保代码即使在非Mac环境中也能正常工作。
(setq ns-pop-up-frames nil)
这样可以确保新的缓冲区显示在现有窗口中,这样就不会打开新的Emacs帧。(我在评论中注意到您在这方面遇到了问题。)
发布于 2012-01-22 10:10:18
我在我的.emacs中使用:
; Upon drag-and-drop: Find the file, w/shift insert filename; w/meta insert file contents
; note that the emacs window must be selected (CMD-TAB) for the modifiers to register
(define-key global-map [M-ns-drag-file] 'ns-insert-file)
(define-key global-map [S-ns-drag-file] 'ns-insert-filename)
(define-key global-map [ns-drag-file] 'ns-find-file-in-frame)
(defun ns-insert-filename ()
"Insert contents of first element of `ns-input-file' at point."
(interactive)
(let ((f (pop ns-input-file)))
(insert f))
(if ns-input-file ; any more? Separate by " "
(insert " ")))
(defun ns-find-file-in-frame ()
"Do a `find-file' with the `ns-input-file' as argument; staying in frame."
(interactive)
(let ((ns-pop-up-frames nil))
(ns-find-file)))
https://stackoverflow.com/questions/3805658
复制相似问题