1

ctags ファイルを作成し、それを非同期的に Emacs にロードする関数があります。ctags は、非常に大きなファイルで呼び出された場合、実行に時間がかかる可能性があり、関数でブロックを実行したくないため、start-process. これはすべてのように見えるものです:

(defun temp-tags-file-for-file (file)
  "Generate a temporary tags file for FILE.
Add the file to tags list and return the name of the file."
  (if (not (boundp 'ctags-command))
      (setq ctags-command "/usr/bin/ctags"))
  (let* ((temp-file (make-temp-file "EMACS_TAGS"))
         (proc (start-process "temp-tags-proc" nil ctags-command
                              "-f" temp-file file)))
    (set-process-sentinel proc
                          (lambda (proc msg)
                            (when (eq (process-status proc) 'exit)
                              (if (boundp 'temp-tags-file)
                                  (progn
                                    (add-to-list 'tags-table-list
                                                 temp-tags-file)
                                    (makunbound 'temp-tags-file))))))
    (setq temp-tags-file temp-file)
    temp-file))

何らかの理由で、タグ ファイルは常に空白です。シェルからまったく同じパラメーターを使用して ctags を呼び出すと、空白ではない作業タグ ファイルが生成されます。ctags で出力を適切に印刷するにはどうすればよいですか?

4

1 に答える 1

1

シェルが必要な場合ctagsは、シェルに渡すだけです。

(start-process "temp-tags-proc" nil shell-file-name shell-command-switch
         (format "/usr/bin/ctags ~/Dropbox/source/c/*.c -f %s"
                 (make-temp-file "EMACS_TAGS")))
于 2013-11-14T09:32:48.447 に答える