unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* [Fwd: Re: Compilation: save file xxx]
@ 2003-03-21 16:16 Kevin Rodgers
  0 siblings, 0 replies; only message in thread
From: Kevin Rodgers @ 2003-03-21 16:16 UTC (permalink / raw)


It would be nice if one could call save-some-buffers like this:

(save-some-buffers nil nil 'c-mode) ; all C Mode buffers

or:

(save-some-buffers nil nil "\\`/home/project/foo/") ; all Foo project files

or:

(save-some-buffers nil nil (lambda ()
			     (and (eq major-mode 'c-mode)
				  (string-match "\\`/home/project/foo/"
						buffer-file-name)))) ; both

Then the compile function could be smarter about what files it offers to save
(see below).  But save-some-buffers only allows the caller to distinguish which
buffers are saved via the EXITING argument; I'm proposing adding an optional
MODE, REGEXP, or PREDICATE argument.

-------- Original Message --------
Subject: Re: Compilation: save file xxx
Date: 19 Mar 2003 14:58:48 +0200
From: Ittay Dror <ittay@qlusters.com>
Organization: Qlusters Inc.
To: help-gnu-emacs@gnu.org
Newsgroups: gnu.emacs.help
References: <4yr893tu5d.fsf@skjellgran.ii.uib.no>

On Wed, 2003-03-19 at 14:31, Joakim Hove wrote:
 > Hello,
 >
 > I find compiling programs from within emacs very useful, however I
 > have one small grievance:
 >
 > When I invoke the compile command emacs offers to save all buffers,
 > including buffers which are *totally* unrelated to the current
 > compilation. Is it possible to limit this questioning to a set of
 > files/directories/regexp/...?
 >
 >
 > Regards - Joakim Hove
you can define a function which looks at the current buffer and returns
t if it should be saved. say its name is 'save-my-buffers'

then do
(defun compile (command)
   (interactive
    (if (or compilation-read-command current-prefix-arg)
        (list (read-from-minibuffer "Compile command: "
                                  (eval compile-command) nil nil
                                  '(compile-history . 1)))
      (list (eval compile-command))))
   (unless (equal command (eval compile-command))
     (setq compile-command command))
   (save-some-buffers (not compilation-ask-about-save) 'save-my-buffers)
;; <--- this is the change from the original compile
   (compile-internal command "No more errors"))

hope it helps,
ittay
-- 
===================================
Ittay Dror (ittay@qlusters.com)
User Space Team, R&D
Qlusters Inc.
+972-3-6081976 Fax: +972-3-6081841




-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-21 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-21 16:16 [Fwd: Re: Compilation: save file xxx] Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).