在Emacs / AucTeX组合键CC CC运行功能TeX-command-master
这决定什么命令应该运行(胶乳,中文提供,浏览,或其它),然后要求用户进行确认运行该命令之前。
我想这个结合除了一个关键(比如F9) 不要求确认。 这样,我就只要按F9和最适当的命令将被运行。 我怎样才能做到这一点?
在Emacs / AucTeX组合键CC CC运行功能TeX-command-master
这决定什么命令应该运行(胶乳,中文提供,浏览,或其它),然后要求用户进行确认运行该命令之前。
我想这个结合除了一个关键(比如F9) 不要求确认。 这样,我就只要按F9和最适当的命令将被运行。 我怎样才能做到这一点?
我有这个片段中,这确实与每一件事情困扰我现在做什么(从下面Emacswiki链接获取)。 我必然要Cc Ca
;;; 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设置在这里 ,复制,如果你喜欢。
没有最完美的解决方案,但你可以定义一个键盘宏包含以下命令:
Cx Cs
保存文件 Mx TeX-command-master <RET>
运行预选(由AucTeX)命令。 定义后, Mx insert-kbd-macro
将插入宏定义进当前缓冲区(如Lisp代码)。 然后,你可以把它添加到您.emacs
并将其绑定到F9
。