bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: Compilation: save file xxx]


From: Kevin Rodgers
Subject: [Fwd: Re: Compilation: save file xxx]
Date: Fri, 21 Mar 2003 09:16:08 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

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>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]