* How to pre-load compile command history?
@ 2011-11-16 17:16 Roy Smith
2011-11-16 17:54 ` Drew Adams
2011-11-16 19:58 ` Tom
0 siblings, 2 replies; 6+ messages in thread
From: Roy Smith @ 2011-11-16 17:16 UTC (permalink / raw)
To: help-gnu-emacs
I'm running GNU Emacs 23.1.1. In my init.el file, I set my default compile command:
(global-set-key "\C-cm" 'compile)
(setq compile-command "cd /home/roy/songza/code/radio/api/mobile/test; python test_api.py")
That works fine, but now I've got several different commands that I run often. Is there some way to pre-load them into the compile history, so I can just do c-c m, then up-arrow though the history to pick the one I want?
---
Roy Smith
roy@panix.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: How to pre-load compile command history?
2011-11-16 17:16 How to pre-load compile command history? Roy Smith
@ 2011-11-16 17:54 ` Drew Adams
2011-11-16 18:36 ` Roy Smith
2011-11-16 19:58 ` Tom
1 sibling, 1 reply; 6+ messages in thread
From: Drew Adams @ 2011-11-16 17:54 UTC (permalink / raw)
To: 'Roy Smith', help-gnu-emacs
> (global-set-key "\C-cm" 'compile)
> (setq compile-command "cd
> /home/roy/songza/code/radio/api/mobile/test; python test_api.py")
>
> That works fine, but now I've got several different commands
> that I run often. Is there some way to pre-load them into
> the compile history, so I can just do c-c m, then up-arrow
> though the history to pick the one I want?
If option `compilation-read-command' is non-nil then you are prompted with
completion for the compilation command to use. You can set the history variable
`compile-history' ahead of time, so you can then use `M-n', `M-p', `M-s', and
`M-r' to access the commands on your list.
(This is according to what I see in the code in `compile.el'. I don't often use
`compile' myself.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to pre-load compile command history?
2011-11-16 17:54 ` Drew Adams
@ 2011-11-16 18:36 ` Roy Smith
2011-11-16 19:08 ` Drew Adams
0 siblings, 1 reply; 6+ messages in thread
From: Roy Smith @ 2011-11-16 18:36 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]
Hmmm, my lisp is really rusty, and I'm struggling with the syntax. The following doesn't seem to work.
(setq compile-history (cons '("cd /home/roy/songza/pyza/djapi; python test_api.py"
"cd /home/roy/songza/code/radio/api/mobile/test; python test_api.py"
)
))
On Nov 16, 2011, at 12:54 PM, Drew Adams wrote:
>> (global-set-key "\C-cm" 'compile)
>> (setq compile-command "cd
>> /home/roy/songza/code/radio/api/mobile/test; python test_api.py")
>>
>> That works fine, but now I've got several different commands
>> that I run often. Is there some way to pre-load them into
>> the compile history, so I can just do c-c m, then up-arrow
>> though the history to pick the one I want?
>
> If option `compilation-read-command' is non-nil then you are prompted with
> completion for the compilation command to use. You can set the history variable
> `compile-history' ahead of time, so you can then use `M-n', `M-p', `M-s', and
> `M-r' to access the commands on your list.
>
> (This is according to what I see in the code in `compile.el'. I don't often use
> `compile' myself.)
>
---
Roy Smith
roy@panix.com
[-- Attachment #2: Type: text/html, Size: 5240 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: How to pre-load compile command history?
2011-11-16 18:36 ` Roy Smith
@ 2011-11-16 19:08 ` Drew Adams
2011-11-17 1:11 ` Roy Smith
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2011-11-16 19:08 UTC (permalink / raw)
To: 'Roy Smith'; +Cc: help-gnu-emacs
> The following doesn't seem to work.
> (setq compile-history (cons '("..." "...")))
Try this:
(setq compile-history
'("cd /home/roy/songza/pyza/djapi; python test_api.py"
"cd /home/roy/songza/code/radio/api/mobile/test; python test_api.py"))
Then use `M-p' to cycle backward through the history.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to pre-load compile command history?
2011-11-16 17:16 How to pre-load compile command history? Roy Smith
2011-11-16 17:54 ` Drew Adams
@ 2011-11-16 19:58 ` Tom
1 sibling, 0 replies; 6+ messages in thread
From: Tom @ 2011-11-16 19:58 UTC (permalink / raw)
To: help-gnu-emacs
Roy Smith <roy <at> panix.com> writes:
>
> I'm running GNU Emacs 23.1.1. In my init.el file, I set my default compile
command:
>
> (global-set-key "\C-cm" 'compile)
> (setq compile-command "cd /home/roy/songza/code/radio/api/mobile/test; python
test_api.py")
>
> That works fine, but now I've got several different commands that I run often.
Is there some way to pre-load
> them into the compile history, so I can just do c-c m, then up-arrow though
the history to pick the one I want?
>
The simplest solution is to use savehist mode to save and restore minibuffer
histories. This is really useful in case of other history prompts too.
http://www.emacswiki.org/emacs/SaveHist
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to pre-load compile command history?
2011-11-16 19:08 ` Drew Adams
@ 2011-11-17 1:11 ` Roy Smith
0 siblings, 0 replies; 6+ messages in thread
From: Roy Smith @ 2011-11-17 1:11 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs
Yup, that did it. Exactly what I was looking for! Much obliged.
On Nov 16, 2011, at 2:08 PM, Drew Adams wrote:
>> The following doesn't seem to work.
>> (setq compile-history (cons '("..." "...")))
>
> Try this:
>
> (setq compile-history
> '("cd /home/roy/songza/pyza/djapi; python test_api.py"
> "cd /home/roy/songza/code/radio/api/mobile/test; python test_api.py"))
>
> Then use `M-p' to cycle backward through the history.
>
--
Roy Smith
roy@panix.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-11-17 1:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16 17:16 How to pre-load compile command history? Roy Smith
2011-11-16 17:54 ` Drew Adams
2011-11-16 18:36 ` Roy Smith
2011-11-16 19:08 ` Drew Adams
2011-11-17 1:11 ` Roy Smith
2011-11-16 19:58 ` Tom
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).