首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >如何在osx上将emacs拖放配置为打开而不是追加

如何在osx上将emacs拖放配置为打开而不是追加
EN

Stack Overflow用户
提问于 2010-09-27 16:08:34
回答 3查看 1.4K关注 0票数 6

如何在osx上配置emacs 23.1.1,以便在emacs窗口上拖放文件时在新的缓冲区中打开该文件,而不是将其附加到当前缓冲区?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2010-09-27 16:54:07

您可以尝试:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
(global-set-key [ns-drag-file] 'ns-find-file)

它在Emacs 23.2.1上对我有效

票数 5
EN

Stack Overflow用户

发布于 2012-01-22 10:56:11

我使用:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
(if (fboundp 'ns-find-file)
    (global-set-key [ns-drag-file] 'ns-find-file))

这(基本上与其他答案中给出的相同)确保创建一个新的缓冲区。if部分确保代码即使在非Mac环境中也能正常工作。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
(setq ns-pop-up-frames nil)

这样可以确保新的缓冲区显示在现有窗口中,这样就不会打开新的Emacs帧。(我在评论中注意到您在这方面遇到了问题。)

票数 3
EN

Stack Overflow用户

发布于 2012-01-22 10:10:18

我在我的.emacs中使用:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
; 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)))
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3805658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文