鍵組合CC CC在Emacs/AucTeX運行它決定什麼命令應該運行(膠乳,中文提供,視圖或其他)的函數TeX-command-master
,然後詢問用戶在運行命令之前進行確認。運行TEX-命令主而不emacs的查詢
我想這個結合除了一個鍵(比如F9)無請求確認。這樣我只要按F9並且最合適的命令將被運行。我怎樣才能做到這一點?
鍵組合CC CC在Emacs/AucTeX運行它決定什麼命令應該運行(膠乳,中文提供,視圖或其他)的函數TeX-command-master
,然後詢問用戶在運行命令之前進行確認。運行TEX-命令主而不emacs的查詢
我想這個結合除了一個鍵(比如F9)無請求確認。這樣我只要按F9並且最合適的命令將被運行。我怎樣才能做到這一點?
我有這個片段(取自下面的Emacswiki鏈接),它做任何事情都無法打擾我現在要做什麼。我勢必C-c C-a
;;; http://www.emacswiki.org/emacs/TN
(require 'tex-buf)
(defun TeX-command-default (name)
"Next TeX command to use. Most of the code is stolen from `TeX-command-query'."
(cond ((if (string-equal name TeX-region)
(TeX-check-files (concat name "." (TeX-output-extension))
(list name)
TeX-file-extensions)
(TeX-save-document (TeX-master-file)))
TeX-command-default)
((and (memq major-mode '(doctex-mode latex-mode))
(TeX-check-files (concat name ".bbl")
(mapcar 'car
(LaTeX-bibliography-list))
BibTeX-file-extensions))
;; We should check for bst files here as well.
TeX-command-BibTeX)
((TeX-process-get-variable name
'TeX-command-next
TeX-command-Show))
(TeX-command-Show)))
;;; from wiki
(defcustom TeX-texify-Show t
"Start view-command at end of TeX-texify?"
:type 'boolean
:group 'TeX-command)
(defcustom TeX-texify-max-runs-same-command 5
"Maximal run number of the same command"
:type 'integer
:group 'TeX-command)
(defun TeX-texify-sentinel (&optional proc sentinel)
"Non-interactive! Call the standard-sentinel of the current LaTeX-process.
If there is still something left do do start the next latex-command."
(set-buffer (process-buffer proc))
(funcall TeX-texify-sentinel proc sentinel)
(let ((case-fold-search nil))
(when (string-match "\\(finished\\|exited\\)" sentinel)
(set-buffer TeX-command-buffer)
(unless (plist-get TeX-error-report-switches (intern (TeX-master-file)))
(TeX-texify)))))
(defun TeX-texify()
"Get everything done."
(interactive)
(let ((nextCmd (TeX-command-default (TeX-master-file)))
proc)
(if (and (null TeX-texify-Show)
(equal nextCmd TeX-command-Show))
(when (called-interactively-p 'any)
(message "TeX-texify: Nothing to be done."))
(TeX-command nextCmd 'TeX-master-file)
(when (or (called-interactively-p 'any)
(null (boundp 'TeX-texify-count-same-command))
(null (boundp 'TeX-texify-last-command))
(null (equal nextCmd TeX-texify-last-command)))
(mapc 'make-local-variable '(TeX-texify-sentinel TeX-texify-count-same-command TeX-texify-last-command))
(setq TeX-texify-count-same-command 1))
(if (>= TeX-texify-count-same-command TeX-texify-max-runs-same-command)
(message "TeX-texify: Did %S already %d times. Don't want to do it anymore." TeX-texify-last-command TeX-texify-count-same-command)
(setq TeX-texify-count-same-command (1+ TeX-texify-count-same-command))
(setq TeX-texify-last-command nextCmd)
(and (null (equal nextCmd TeX-command-Show))
(setq proc (get-buffer-process (current-buffer)))
(setq TeX-texify-sentinel (process-sentinel proc))
(set-process-sentinel proc 'TeX-texify-sentinel))))))
(add-hook 'LaTeX-mode-hook
'(lambda()
(define-key LaTeX-mode-map (kbd "C-c C-a") 'TeX-texify)))
我有幾個AUCTeX/RefTeX設置here,複製如果你喜歡。
不是最優雅的解決方案,但你可以定義一個鍵盤宏包含以下命令:
C-x C-s
保存文件M-x TeX-command-master <RET>
運行預選(由AucTeX)命令。定義後,M-x insert-kbd-macro
將宏定義插入當前緩衝區(作爲Lisp代碼)。然後,您可以將其添加到您的.emacs
並將其綁定到F9
。
AUCTeX的哪個版本? – Thomas 2012-04-13 02:21:09
@Thomas我認爲它是'11.86-3'。這是否有道理?] – Malabarba 2012-04-13 12:29:16