- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想配置 emacs 以使用外部应用程序
当我从直接模式打开图像文件时。
另一方面,我也想在 emacs 缓冲区中使用内联图像。
要在外部应用程序中打开文件,我使用 openwith.el
包裹http://www.emacswiki.org/emacs/OpenWith
openwith minor 模式的问题在于它是
全局以及当它由 dired-mode-hook 启用时
(add-hook 'dired-mode-hook
(lambda ()
(setq truncate-lines t)
(openwith-mode t)
))
:global t
:global nil
最佳答案
openwith-mode 的工作方式有点奇怪:它确实假设您要么全局使用它,要么根本不使用它。然而,您在这里想要的是在本地使用它,即仅在 dired 缓冲区内使用它。
这不是很容易实现,但这里有一个方法。
打开 openwith-mode 的源文件 openwith.el。然后一直向下滚动,直到找到实际次要模式的定义。然后通过在每行的开头放置一个分号来注释该定义:
;;;###autoload
; (define-minor-mode openwith-mode
; "Automatically open files with external programs."
; :lighter ""
; :global t
; (if openwith-mode
; (progn
; ;; register `openwith-file-handler' for all files
; (put 'openwith-file-handler 'safe-magic t)
; (put 'openwith-file-handler 'operations '(insert-file-contents))
; (add-to-list 'file-name-handler-alist '("" . openwith-file-handler)))
; (setq file-name-handler-alist
; (delete '("" . openwith-file-handler) file-name-handler-alist))))
(provide 'openwith)
之前),插入以下代码:
(defvar openwith-mode nil)
(mapc (lambda (function)
(ad-add-advice function
'(dired-openwith nil t (advice . (lambda () (let ((openwith-mode t)) ad-do-it))))
'around 0))
'(dired-find-alternate-file
dired-find-file
dired-find-file-other-window
dired-mouse-find-file-other-window
dired-view-file))
(put 'openwith-file-handler 'safe-magic t)
(put 'openwith-file-handler 'operations '(insert-file-contents))
(add-to-list 'file-name-handler-alist '("" . openwith-file-handler))
(mapc ...)
表达。我们在这里做的是迭代五个函数的列表:
(ad-add-advice...)
确实设置了变量
openwith-mode
至
t
每当调用这五个函数之一时。在函数调用之外,变量仍然设置为
nil
.
t
。如果它知道一个外部应用程序,并立即尝试打开它。
fundamental-mode
。)
open-with-filehandler
-- 是所谓的文件处理程序。它对于实际访问文件并没有真正做任何特殊的事情,因此我们设置了
safe-magic
对于该功能
t
.此外,我们声明操作
insert-file-contents
由我们的函数以一种非平凡的方式处理。 (有关这些属性的更多信息,请参阅
here。)
(require 'openwith)
(openwith-mode t)
openwith-mode
再多(在我们注释掉它的定义之后),请确保删除第二行,例如通过评论它太:
;; (openwith-mode t)
关于emacs dired 和 openwith,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11218316/
我设置了 (setq find-args "-iname ") 以便 M-x find-dired 给我 ... "Run find (with args): -iname “作为默认值。然而,它似乎
启用 global-auto-revert-mode是使用其他工具进行开发/调试的绝妙方式。对磁盘上的文件所做的更改被镜像回相应的 emacs 缓冲区。 dired-auto-revert-buffe
我在网上搜索过。我已经尝试过颜色主题(也许我需要创建自己的主题,但实际上我已经按照我想要的方式设置了我的 emacs,除了这一点,我找不到我可以接受的颜色主题)。 我只想在 dired 模式下更改目录
在 emacs 中,我想做一些我经常在 Microsoft PowerShell 中做的事情。 在 PowerShell 中,我有一组我经常使用的文件夹,我将它们的完整路径分配给我的配置文件脚本中的全
我刚刚更新到最新版本的 Dired+ 和 Emacs(来自每晚构建),出于某种原因,当我在任何路径上打开 Dired 时,我没有看到详细信息(例如文件大小、权限、大小等) 最新版本的 Dired+ 有
用例: 在dired缓冲区标记删除目标文件和目录; 执行'dired-do-flagged-delete'(输入'x'); 结果:有人询问我是否确认要删除的每个非空目录。 问题:有没有简单的方法说"i
在 dired 中,您只需编辑目录列表然后保存即可重命名文件。 在使用dired重命名时是否可以使用替代方法来重命名?我想使用“svn mv”、“bzr mv”或“git mv”而不仅仅是重命名,这样
当我输入C-x d时,内置的 Dired 就会启动。 dired+已加载,因为我可以运行 diredp-* 命令,但 dired+ 仅在我运行 diredp 之后启动命令。问题是什么?我使用的是 Em
如附件图片,如果有的话,控制目录标题行颜色的变量是什么?我正在尝试将深绿色更改为灰色。 最佳答案 您显示的屏幕截图表明您正在使用库 Dired+ . 有问题的脸是 diredp-dir-heading
是否有一个 emacs 命令可以将 kbd 宏应用于 dired 中的每个文件? 例如query-replace-regexp有 dired-do-query-replace-regexp 我在找 d
我想在当前缓冲区的位置运行一个脚本,或者,如果它是一个 dired 缓冲区 - 在当前 dired 目录上运行脚本。当前目录似乎存储在 dired-directory多变的。确实如此 - 但是当我尝试
当我浏览文件系统时,我设法在一个窗口中完成了繁琐的工作。 改善人体工程学,我决定为我最常用的目录创建书签,其短名称如:'lwt'、'eve' 等。但每次打开书签时,都会创建新的目录缓冲区,即使旧缓冲区
我想配置 emacs 以使用外部应用程序 当我从直接模式打开图像文件时。 另一方面,我也想在 emacs 缓冲区中使用内联图像。 要在外部应用程序中打开文件,我使用 openwith.el 包裹htt
显然 auto-revert-mode 应该在 dired 缓冲区中工作。 我从来没有听说过这个,但是 the doc says it works . 然后我又读了一点,发现了一些小字: Auto-r
假设我正在编辑 blah.txt使用 Emacs,我决定 open dired to rename the file废话.txt。当我按下 C-x d RET (或 C-x C-f RET ),会出现
很难说出这里问的是什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或言辞激烈,无法以目前的形式合理回答。如需帮助澄清此问题以便可以重新打开,visit the help center . 8年前关闭
我想在 dired 模式下创建一个新文件。 Dired 模式下是否有“创建新文件”命令?例如,当我在 Dired 模式下键入“c”时,它会创建“untitled.txt”。很简单,但是我找不到。 最佳
如何让 Dired 使用任意函数或列集显示其文件?基本上我想改变: -rw-r--r-- 1 konrad konrad 3847863 Out 18 14:17 ClojureinAction
我正在尝试将网站转换为电子书,并且每个页面的开头都有一大块我想要删除的 html。正如您可以想象的那样,由于大块中的某些内容未正确转义,因此使用 Q 会导致不匹配。当我尝试用正则表达式解决问题时,出现
如何将 globalff 的输出传递给 emacs-dired。本质上,我正在寻找与 find-name-dired 对应的东西,它适用于 globalff 的输出。 最佳答案 我刚刚试过了。我有一个
我是一名优秀的程序员,十分优秀!