例如,我在.emacs
中进行了此设置(defun gtags-create-or-update ()
"Create or update the gnu global tag file."
(interactive)
(if (y-or-n-p-with-timeout
(format "Run gtags to create/update tag file for code at %s (default no)? "
default-directory)
5 nil) ; default - no run
(unless (= 0 (call-process "global" nil nil nil " -p")) ; tagfile doesn't exist?
(let ((olddir default-directory)
(topdir (read-directory-name
"gtags: top of source tree: " default-directory)))
(cd topdir)
(shell-command "gtags -v")
;; (shell-command "gtags && echo 'created tagfile'")
(cd olddir)) ; restore
;; tagfile already exists; update it
(shell-command "global -uv"))))
;; (shell-command "global -u && echo 'updated tagfile'")))
(add-hook 'c-mode-common-hook
(lambda ()
(require 'gtags)
(gtags-mode t)
(gtags-create-or-update)))
当我明确地运行gtags-create-or-update
时,emacs会在迷你缓冲区中提示我是否要创建/更新标记文件。但是,当我打开一个c / cpp文件时,它总是会弹出一个GUI窗口,问我是或否,这太烦人了。我想知道为什么会这样。
答案 0 :(得分:0)
@phils在评论中说了什么。要避免GUI Emacs中的对话框,您可以将use-dialog-box
设置为nil
将行(setq use-dialog-box nil)
放入初始化文件中。