* key binding two commands
@ 2003-11-21 9:11 Kester Clegg
2003-11-21 9:49 ` Reiner Steib
0 siblings, 1 reply; 5+ messages in thread
From: Kester Clegg @ 2003-11-21 9:11 UTC (permalink / raw)
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.
I have:
(defun save-and-compileTex () ; automatic save and compile
(save-buffer)
(TeX-command-master))
(global-set-key "\C-c \C-c" 'save-and-compileTex)
but it doesn't work. What's wrong?
--
************************************************************************
Kester Clegg Dept. of Computer Science,
Research Assistant (UTC) University of York,
Tel (01904) 43 27 49 email: kester at cs.york.ac.uk
************************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: key binding two commands
2003-11-21 9:11 key binding two commands Kester Clegg
@ 2003-11-21 9:49 ` Reiner Steib
2003-11-21 11:50 ` Kester Clegg
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Reiner Steib @ 2003-11-21 9:49 UTC (permalink / raw)
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: key binding two commands
2003-11-21 9:49 ` Reiner Steib
@ 2003-11-21 11:50 ` Kester Clegg
2003-11-21 16:49 ` Kevin Rodgers
2003-11-25 14:11 ` Reiner Steib
2 siblings, 0 replies; 5+ messages in thread
From: Kester Clegg @ 2003-11-21 11:50 UTC (permalink / raw)
Reiner Steib <4.uce.03.r.s@nurfuerspam.de> writes:
> 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.
Excellent - thanks for that.
--
************************************************************************
Kester Clegg Dept. of Computer Science,
Research Assistant (UTC) University of York,
Tel (01904) 43 27 49 email: kester at cs.york.ac.uk
************************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: key binding two commands
2003-11-21 9:49 ` Reiner Steib
2003-11-21 11:50 ` Kester Clegg
@ 2003-11-21 16:49 ` Kevin Rodgers
2003-11-25 14:11 ` Reiner Steib
2 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-11-21 16:49 UTC (permalink / raw)
Reiner Steib wrote:
> 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)
If there aren't any forms after ad-do-it, you can just define a before
advice (and vice versa):
(defadvice TeX-command-master (before save-buffer activate)
"Save the buffer first."
(save-buffer))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: key binding two commands
2003-11-21 9:49 ` Reiner Steib
2003-11-21 11:50 ` Kester Clegg
2003-11-21 16:49 ` Kevin Rodgers
@ 2003-11-25 14:11 ` Reiner Steib
2 siblings, 0 replies; 5+ messages in thread
From: Reiner Steib @ 2003-11-25 14:11 UTC (permalink / raw)
On Fri, Nov 21 2003, Reiner Steib wrote:
> 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.
[...]
> But a better solution IMHO would be to advice `TeX-command-master':
[...]
I guess the best solution is...
,----[ C-h v TeX-save-query RET ]
| TeX-save-query's value is t
|
| Documentation:
| *If non-nil, ask user for permission to save files before starting TeX.
`----
I intended to add this to AUCTeX, but it was already there. :-)
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- PGP key available via WWW http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-11-25 14:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-21 9:11 key binding two commands Kester Clegg
2003-11-21 9:49 ` Reiner Steib
2003-11-21 11:50 ` Kester Clegg
2003-11-21 16:49 ` Kevin Rodgers
2003-11-25 14:11 ` Reiner Steib
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).