[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: key binding two commands
From: |
Reiner Steib |
Subject: |
Re: key binding two commands |
Date: |
Fri, 21 Nov 2003 10:49:19 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
On Fri, Nov 21 2003, Kester Clegg wrote:
> Trying to bind C-c C-c so that while I'm editing latex files with auctex
> it will save each time I compile the file.
[...]
> (defun save-and-compileTex () ; automatic save and compile
(interactive)
> (save-buffer)
> (TeX-command-master))
>
> (global-set-key "\C-c \C-c" 'save-and-compileTex)
"\C-c\C-c"
It makes no sense to use a global binding for this command.
(Additionally, your function should be renamed to, say kg-... (wrong
namespace)).
(add-hook
'TeX-mode-hook
(lambda ()
(local-set-key (kbd "C-c C-c") 'save-and-compileTex)))
But a better solution IMHO would be to advice `TeX-command-master':
(defadvice TeX-command-master (around rs-TeX-command-master-save activate)
"Save buffer before `TeX-command-master'"
(message "Saving buffer")
(save-buffer)
ad-do-it)
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/