ido(查找文件)中带有空格的路径(在 MS Windows 上)

发布于 2024-08-07 10:29:39 字数 454 浏览 3 评论 0原文

我在 Windows 机器上运行 GNU Emacs 23,并且在获取 ido-find-file 来匹配包含空格的文件时遇到问题。

在我的 .emacs 中,我 (setq ido-use-filename-at-point t) 想要匹配像 "D:\Dokumente und Einstellungen\Username\Eigene Dateien\Scratch 这样的字符串\ipswitch.bat" 当点击 Cx Cf 时。

当点位于 "D:\ 之间时,IDO 建议 d:/Dokumente[Dokumente und Einstellungen],即模式“中断” )

我希望匹配并建议整个字符串(如果需要,可能仅限于某些模式(例如组织模式)

I am running GNU Emacs 23 on a Windows-machine and having problems getting ido-find-file to match files that contain whitespaces.

In my .emacs I (setq ido-use-filename-at-point t) and would like to match a string like "D:\Dokumente und Einstellungen\Username\Eigene Dateien\Scratch\ipswitch.bat" when hitting C-x C-f.

When point is located between " and D:\, IDO suggests d:/Dokumente[Dokumente und Einstellungen], i.e. the pattern "breaks" on the whitespaces.

I would like the whole string (maybe restricted to certain modes (like org-mode) if that is necessary) to be matched and suggested.

How could I get that working?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人 2024-08-14 10:29:39

我还没有找到 ffap/thingatpt 的解决方案,但对于 ido 模式, init.el 中的以下代码可以产生奇迹。

我在 Windows 上使用 Gnu Emacs 和 ido 模式,并且在更改迷你缓冲区完成映射中找到了乐趣:

;; EXPERIMENTAL: unbind SPACE and ? in minibuffer, to allow typing in completions with those chars
(add-hook 'minibuffer-setup-hook (lambda () 
                                   (define-key minibuffer-local-completion-map " " nil)
                                   (define-key minibuffer-local-must-match-map " " nil)
                                   (define-key minibuffer-local-completion-map "?" nil)
                                   (define-key minibuffer-local-must-match-map "?" nil)))

注释警告说它是“实验性的”,因此我可以在遇到奇怪行为时反转它。但我已经使用了一年多了,没有任何问题。

现在,当我执行 Cx Cf C:/Doc

ido-mode 时,建议 C:/Documents and Settings/

I have not found a solution for ffap/thingatpt, but for ido-mode the following code in init.el works wonders.

I use Gnu Emacs on Windows with ido-mode, and have found joy in changing the minibuffer completion map:

;; EXPERIMENTAL: unbind SPACE and ? in minibuffer, to allow typing in completions with those chars
(add-hook 'minibuffer-setup-hook (lambda () 
                                   (define-key minibuffer-local-completion-map " " nil)
                                   (define-key minibuffer-local-must-match-map " " nil)
                                   (define-key minibuffer-local-completion-map "?" nil)
                                   (define-key minibuffer-local-must-match-map "?" nil)))

The comment warns it is "experimental" so I can reverse it in case I ever encounter strange behavior. But I have used this for over a year now with no problems.

Now when I do C-x C-f C:/Doc

ido-mode suggests C:/Documents and Settings/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文