From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de> Newsgroups: gmane.emacs.help Subject: Re: key binding two commands Date: Fri, 21 Nov 2003 10:49:19 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: Reply-To: reiner.steib@gmx.de NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069409281 32224 80.91.224.253 (21 Nov 2003 10:08:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 21 Nov 2003 10:08:01 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 21 11:07:59 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AN8Ck-000869-00 for ; Fri, 21 Nov 2003 11:07:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AN937-00049p-GR for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Nov 2003 06:02:05 -0500 Original-Newsgroups: gnu.emacs.help X-Face: .*T0'iU(sujq_j9\J>-d4fg; N/1++U#U$_5ii6k.=|"-n'?5O:Hyz&wi'-!I~,}7~GgT=0S /&-R5sbkNy5+Xo1y{Tw2KKxi@Xh"g@]Qc|.U<*]WDd)qvGowFDvfU1F]{EDho:7P0@|oOD=Bc{K4?> WP68K[Mx:}=`ZT'6g4'f+g?;`vri2!)xGy}3:=l'(/Cea0l4lo^H5#@/Z3ev Mail-Copies-To: nobody User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:vDnX47qgHCufgk3Kn+Nrsh1y3MM= Original-NNTP-Posting-Host: dialin-145-254-250-075.arcor-ip.net Original-X-Trace: news.uni-ulm.de 1069408238 145.254.250.75 (21 Nov 2003 10:50:38 +0100) Original-Lines: 35 X-Authenticated-User: rsteib Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!newsfeed.mathworks.com!news.tele.dk!news.tele.dk!small.news.tele.dk!irazu.switch.ch!switch.ch!news.belwue.de!news.uni-ulm.de!marauder.physik.uni-ulm.de!not-for-mail Original-Xref: shelby.stanford.edu gnu.emacs.help:118524 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:14466 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14466 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/