unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.rodgers@ihs.com>
Subject: [Fwd: Re: Compilation: save file xxx]
Date: Fri, 21 Mar 2003 09:16:08 -0700	[thread overview]
Message-ID: <3E7B3AC8.2030905@ihs.com> (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>

                 reply	other threads:[~2003-03-21 16:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3E7B3AC8.2030905@ihs.com \
    --to=kevin.rodgers@ihs.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.
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).