代码之家  ›  专栏  ›  技术社区  ›  Liran Orevi

Emacs如何在C上自动完成包含文件的单词?

  •  4
  • Liran Orevi  · 技术社区  · 16 年前

    #include <stdio.h>
    int main(){
    print//<-- this is where I want it to complete printf
    

    Cedet )

    4 回复  |  直到 16 年前
        1
  •  4
  •   justinhj    16 年前

    using tags 如果你以前没有使用标签表。

    现在,如果你有一个包含stdio.h的TAGS表,那么你可以使用命令“complete tag”自动完成“printf”。

    也许将“complete tag”绑定到密钥:

    (global-set-key [f3] 'complete-tag) 
    
        2
  •  4
  •   Eric    16 年前

    CEDET还做了很多其他与完成相关的事情,这些事情将提供非常集中和正确的建议,而不仅仅是模糊相似的建议。一个副作用是CEDET需要更多的努力来设置。例如,你需要教它包含文件的位置,有时还需要教它如何处理宏,以及你正在做的项目是什么样的。

    这里有更多细节: link text

        3
  •  0
  •   Dale Hagglund    16 年前

    printf 如果(a)您使用过 您正在编辑的缓冲区中的任何其他位置,或者(b)它出现在您在emacs中打开的任何其他.c或.h文件中。

        4
  •  0
  •   Marc    16 年前

    hippie-expand ,它具有关于在哪里查找完成信息的附加选项。我将M-/绑定到 ,然后修改了中元素的顺序 hippie-expand-try-functions-list 如下:

    (global-set-key (kbd "M-/") 'hippie-expand)
    (setq hippie-expand-try-functions-list '(try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol))
    

    嬉皮士扩张 起初,其行为类似于正常的M-/,但重复按压会产生更多可能的膨胀。