10

The C-c C-c bind runs TeX-command-master. It always asks me "is this what you want to do?" and I'm always hitting return to do it. I'd like a version of this command which just does it without asking.

  • 2
    you can click on the TeX or LaTeX icon in the tool bar to by-pass the C-cC-c access to these specific commands. Besides C-cC-c has automatic completion which is useful as you only need to type the first or first view later of the command you need from the command menu. –  Nov 16 '13 at 10:05
  • 2
    C-c C-c is not only used to launch LaTeX but also Bibtex, Biber, cleaning, ... This is why pressing Return is important (it shows that you selected one choice). – ppr Nov 16 '13 at 15:15
  • @ ppr: I understand the command, and that it has its place. I will use the TeX-command-master command sometimes, but I would like a different command in addition. I know ahead of time that I want the default, so pressing return is not "important", it is an annoying waste of my time. – Ian Kelling Nov 16 '13 at 22:44
  • @ jfbu: I understand that, and I do not want that. – Ian Kelling Nov 16 '13 at 22:46
  • @IanKelling See http://stackoverflow.com/questions/10132927/run-tex-command-master-without-querying-in-emacs – giordano Nov 17 '13 at 00:10
  • @IanKelling ok, (advice: no space between the @ and the intended recipient). In my comment above first view later meant first few letters (took me 5 minutes to figure it out), sorry about this discomforting sample of the functioning of my brain ... –  Nov 17 '13 at 09:44

4 Answers4

2

This does C-c C-c return, and then return again if we are still in the minibuffer.

It is not extensively tested. A more proper solution would not use keyboard macros, but this works fine.

Standard elisp disclaimer: You may want to change the binding, or make it into a named function instead of a lambda.

(add-hook
 'LaTeX-mode-hook
 (define-key LaTeX-mode-map
   (kbd "<f7>")
   (lambda (&optional arg) "Keyboard macro." (interactive "p")
     (progn
       (kmacro-exec-ring-item (quote ([3 3 return] 0 "%d")) arg)
       (and
        (derived-mode-p 'minibuffer-inactive-mode)
        (kmacro-exec-ring-item (quote ([return] 0 "%d")) arg))))))
2

I recently found C-c C-a (bound to TeX-command-run-all) which does exactly this.

1

Set the TeX command you want, mine is XeLaTex. Then you don't need to hit return.

(setq TeX-command-force "XeLaTeX")  
Torbjørn T.
  • 206,688
  • I think the OP wants the command to still make the appropriate choice (LaTeX, Biber, View,...), not just run one fixed command. – Andrew Swann Nov 19 '13 at 14:30
1

Put his in your .emacs or init.el, you can get all info from the comment

;; compile documents to PDF by default
(setq TeX-PDF-mode t)
;; C-c C-c without prompt, use LaTex by default
(setq TeX-command-force "LaTex")
;; Use C-c C-c to compile the tex file into pdf file automatically using LaTex,
;; and C-c C-v to view it using okular
;; NOTE: C-c C-a to combine C-c C-c and C-c C-v"
(setq TeX-view-program-list
      '(("PDF Viewer" "okular -p %(outpage) %o")))

If you use evince, change the "PDF Viewer..." line into

'(("PDF viewer" "evince --page-index=%(outpage) %o")))
CodyChan
  • 111