Emacs 在特定情况下禁用ido使用文件名

Emacs 在特定情况下禁用ido使用文件名,emacs,Emacs,我使用emacs在Verilog/SystemVerilog中编码,注释行以/开头 我喜欢使用“ido find files at point”,因此我在自定义设置变量中有(ido使用filename at point(quote guess)) 它工作得非常好,除非当我试图打开另一个文件时,光标位于注释的第一个单词上,如//修订控制:。它尝试在/路径中查找名为Revision的文件 如何禁用根路径/和/路径的ido ffap功能?提供该功能的另一种方式是,如果ido ffap在以/开头的行上自

我使用emacs在Verilog/SystemVerilog中编码,注释行以
/
开头

我喜欢使用“ido find files at point”,因此我在
自定义设置变量中有
(ido使用filename at point(quote guess))

它工作得非常好,除非当我试图打开另一个文件时,光标位于注释的第一个单词上,如
//修订控制:
。它尝试在
/
路径中查找名为Revision的文件


如何禁用根路径
/
/
路径的ido ffap功能?提供该功能的另一种方式是,如果ido ffap在以
/

开头的行上自动禁用,则假定
verilog模式
没有特殊的ffap处理程序,但在
ffap列表
中,以下代码应起作用:

(defun ffap-verilog (name)
  (let ((inhibit-changing-match-data t) ;; string-match should not change match data
    (ppss (syntax-ppss)))
    (if (and (eq (syntax-ppss-context ppss) 'comment) ;; we are inside a comment
         (= (line-number-at-pos (nth 8 ppss)) (line-number-at-pos (point))) ;; limit the match to the line starting the comment
         (string-match "/[/*]\\([[:alnum:]_.]\\)+$"
               (buffer-substring-no-properties (nth 8 ppss) (point))))
    ""
      name)))


(add-to-list 'ffap-alist '(verilog-mode . ffap-verilog) 'append)
特殊情况是检查注释的前导
/
/*
后面是否紧跟一个字符串,该字符串可能被
ffap
误解释为url或带有通配符的路径。但是请注意,注释中以
\\
开头的其他字符串不会被处理,因为这些字符串实际上可能是URL