代码之家  ›  专栏  ›  技术社区  ›  Android Eve

从emacs21.2升级时,minibuffer中的动态扩展不再工作

  •  0
  • Android Eve  · 技术社区  · 14 年前

    在微型缓冲区中 不再有效!

    我所说的“minibuffer中的动态扩展”是指让你盲目地点击空格键来完成文件名、变量等的特性。

    Emacs的默认行为发生了一些变化,但它是什么?

    3 回复  |  直到 14 年前
        1
  •  2
  •   scottfrazer    14 年前

    从(22.1)新闻文件:

    ** When Emacs prompts for file names, SPC no longer completes the file name.
    This is so filenames with embedded spaces could be input without the
    need to quote the space with a C-q.  The underlying changes in the
    keymaps that are active in the minibuffer are described below under
    "New keymaps for typing file names".
    
    If you want the old behavior back, add these two key bindings to your
    ~/.emacs init file:
    
      (define-key minibuffer-local-filename-completion-map
             " " 'minibuffer-complete-word)
      (define-key minibuffer-local-must-match-filename-map
             " " 'minibuffer-complete-word)
    
        2
  •  1
  •   Sicco    12 年前

    发布的解决方案可以工作,但是一旦我们到达emacsv24和更高版本,它就会中断。我建议你把你的头发绑起来 define-key 呼吁出现新地图,因此:

    (if (boundp 'minibuffer-local-filename-completion-map) 
       (define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word))
    
    (if (boundp 'minibuffer-local-must-match-filename-map)
       (define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word))
    

        3
  •  0
  •   Android Eve    14 年前

    回答我的第二个问题(在评论中):

    (defmacro GNUEmacs23 (&rest body)
      (list 'if (string-match "GNU Emacs 23" (version))
            (cons 'progn body)))
    
    (defmacro GNUEmacs22 (&rest body)
      (list 'if (string-match "GNU Emacs 22" (version))
            (cons 'progn body)))
    
    (GNUEmacs22
      (define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word)
      (define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word)
    )
    
    (GNUEmacs23
      (define-key minibuffer-local-filename-completion-map " " 'minibuffer-complete-word)
      (define-key minibuffer-local-must-match-filename-map " " 'minibuffer-complete-word)
    )
    

    如果你能想出一个更优雅的解决方案,那就太好了,但以上的方法对我来说(目前)是有效的。