From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: advising jde-compile -- a better way?
Date: Mon, 25 Oct 2004 15:43:10 -0600 [thread overview]
Message-ID: <2u5abgF25s7dvU1@uni-berlin.de> (raw)
In-Reply-To: <uoeiqy9p4.fsf@terrapin.northbound-train.com>
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
next prev parent reply other threads:[~2004-10-25 21:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-25 17:44 advising jde-compile -- a better way? Joe Casadonte
2004-10-25 21:43 ` Kevin Rodgers [this message]
2004-10-25 23:13 ` Michael Slass
2004-10-26 1:04 ` Daniel Pittman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2u5abgF25s7dvU1@uni-berlin.de \
--to=ihs_4664@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).