![carbon emacs 拉取图片结果](https://linux22.com/image/1221579/carbon%20emacs%20%E6%8B%89%E5%8F%96%E5%9B%BE%E7%89%87%E7%BB%93%E6%9E%9C.png)
在 OS X 上默认安装的 Carbon Emacs 中,从 Finder 复制文件并将其拖入 emacs 只会显示图标。
我该如何定制它以便它提供文件路径?
答案1
我设法通过覆盖 mac-win.el(默认安装中不包含未编译的文件)中声明的函数来禁用所有图像拖放(如果我真的想要在其中放置图像,拖放仍然有效)。
在我的.emacs中:
;; prohibit pasting of TIFFs
(defun x-selection-value (type)
(let ((data-types '(public.file-url
public.utf16-plain-text
com.apple.traditional-mac-plain-text))
text)
(while (and (null text) data-types)
(setq text (condition-case nil
(x-get-selection type (car data-types))
(error nil)))
(setq data-types (cdr data-types)))
(if text
(remove-text-properties 0 (length text) '(foreign-selection nil) text))
text))
原文是:
(defun x-selection-value (type)
(let ((data-types '(public.utf16-plain-text
com.apple.traditional-mac-plain-text
public.file-url))
text tiff-image)
(while (and (null text) data-types)
(setq text (condition-case nil
(x-get-selection type (car data-types))
(error nil)))
(setq data-types (cdr data-types)))
(if text
(remove-text-properties 0 (length text) '(foreign-selection nil) text))
(setq tiff-image (condition-case nil
(x-get-selection type 'public.tiff)
(error nil)))
(when tiff-image
(remove-text-properties 0 (length tiff-image)
'(foreign-selection nil) tiff-image)
(setq text (mac-TIFF-to-string tiff-image text)))
text))