* advising jde-compile -- a better way?
@ 2004-10-25 17:44 Joe Casadonte
2004-10-25 21:43 ` Kevin Rodgers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Joe Casadonte @ 2004-10-25 17:44 UTC (permalink / raw)
jde-compile prompts me to save buffers before compiling, a practice
that I find personally annoying. I've come up with the following, but
it seems ugly:
(defadvice jde-compile (around jde-compile-no-save-prompt act)
"Supresses the save-buffer prompting."
(fset 'save-some-buffers-old-fn-def (symbol-function 'save-some-buffers))
(fset 'save-some-buffers 'ignore)
ad-do-it
(fset 'save-some-buffers (symbol-function 'save-some-buffers-old-fn-def)))
Is there a better or more elegant way to accomplish the same thing?
--
Regards,
joe
Joe Casadonte
jcasadonte@northbound-train.com
------------------------------------------------------------------------------
Llama Fresh Farms => http://www.northbound-train.com
Gay Media Resource List => http://www.northbound-train.com/gaymedia.html
Perl for Win32 => http://www.northbound-train.com/perlwin32.html
Emacs Stuff => http://www.northbound-train.com/emacs.html
Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
Live Free, that's the message!
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: advising jde-compile -- a better way?
2004-10-25 17:44 advising jde-compile -- a better way? Joe Casadonte
@ 2004-10-25 21:43 ` Kevin Rodgers
2004-10-25 23:13 ` Michael Slass
2004-10-26 1:04 ` Daniel Pittman
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2004-10-25 21:43 UTC (permalink / raw)
Joe Casadonte wrote:
> jde-compile prompts me to save buffers before compiling, a practice
> that I find personally annoying.
(setq compilation-ask-about-save nil)
or
(add-hook 'java-mode-hook
(lambda ()
(set (make-local-variable 'compilation-ask-about-save) nil)))
> I've come up with the following, but it seems ugly:
>
> (defadvice jde-compile (around jde-compile-no-save-prompt act)
> "Supresses the save-buffer prompting."
> (fset 'save-some-buffers-old-fn-def (symbol-function
'save-some-buffers))
> (fset 'save-some-buffers 'ignore)
> ad-do-it
> (fset 'save-some-buffers (symbol-function
'save-some-buffers-old-fn-def)))
> Is there a better or more elegant way to accomplish the same thing?
It sure is ugly. First, you should use a local variable binding instead
of a global function binding to save the original definition, and you
should make sure to restore the original binding in case of an error:
(defadvice jde-compile (around ignore-save-some-buffers activate)
"Don't call `save-some-buffers'."
(let ((save-some-buffers (symbol-function 'save-some-buffers)))
(fset 'save-some-buffers 'ignore)
(unwind-protect
ad-do-it
(fset 'save-some-buffers save-some-buffers))))
The flet Common Lisp emulation macro basically does that.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: advising jde-compile -- a better way?
2004-10-25 17:44 advising jde-compile -- a better way? Joe Casadonte
2004-10-25 21:43 ` Kevin Rodgers
@ 2004-10-25 23:13 ` Michael Slass
2004-10-26 1:04 ` Daniel Pittman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Slass @ 2004-10-25 23:13 UTC (permalink / raw)
"Joe Casadonte" <jcasadonte@northbound-train.com> writes:
>jde-compile prompts me to save buffers before compiling, a practice
>that I find personally annoying. I've come up with the following, but
>it seems ugly:
>
>(defadvice jde-compile (around jde-compile-no-save-prompt act)
> "Supresses the save-buffer prompting."
> (fset 'save-some-buffers-old-fn-def (symbol-function 'save-some-buffers))
> (fset 'save-some-buffers 'ignore)
> ad-do-it
> (fset 'save-some-buffers (symbol-function 'save-some-buffers-old-fn-def)))
>
>Is there a better or more elegant way to accomplish the same thing?
>
If JDE uses the compile package, then this variable will do what you
want, if you set it to a regex that matches anything.
,----[ C-h v compile-ignore-buffers-list RET ]
| compile-ignore-buffers-list's value is
| (".bbdb" ".newsrc-dribble")
|
|
| Documentation:
| List of buffer names to ignore when offering to save before compilation
|
| You can customize this variable.
|
| Defined in `compile'.
`----
--
Mike Slass
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: advising jde-compile -- a better way?
2004-10-25 17:44 advising jde-compile -- a better way? Joe Casadonte
2004-10-25 21:43 ` Kevin Rodgers
2004-10-25 23:13 ` Michael Slass
@ 2004-10-26 1:04 ` Daniel Pittman
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Pittman @ 2004-10-26 1:04 UTC (permalink / raw)
On 26 Oct 2004, Joe Casadonte wrote:
> jde-compile prompts me to save buffers before compiling, a practice
> that I find personally annoying. I've come up with the following, but
> it seems ugly:
>
> (defadvice jde-compile (around jde-compile-no-save-prompt act)
> "Supresses the save-buffer prompting." (fset 'save-some-buffers-old-fn-def
> (symbol-function 'save-some-buffers)) (fset 'save-some-buffers
> 'ignore) ad-do-it (fset 'save-some-buffers (symbol-function
> 'save-some-buffers-old-fn-def)))
(require 'cl)
(defadvice jde-compile (around jde-compile-no-save-prompt act)
"Supresses the save-buffer prompting."
(flet ((save-some-buffers (&rest)))
ad-do-it))
> Is there a better or more elegant way to accomplish the same thing?
Untested, but Common Lisp flet is a way of doing what you wrote
automatically. There may even be a non-CL mechanism, named something
else, in Emacs somewhere.
Daniel
--
Yet, I am the necessary angel of earth,
Since, in my sight, you see the earth again...
-- Wallace Stevens
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-10-26 1:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-25 17:44 advising jde-compile -- a better way? Joe Casadonte
2004-10-25 21:43 ` Kevin Rodgers
2004-10-25 23:13 ` Michael Slass
2004-10-26 1:04 ` Daniel Pittman
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).