all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hugh Brown <aardvark@saintaardvarkthecarpeted.com>
To: Tom Tromey <tromey@redhat.com>
Cc: 96@debbugs.gnu.org
Subject: bug#96: lgrep/rgrep not asking to save buffers
Date: Sun, 25 Jan 2015 07:54:07 -0800	[thread overview]
Message-ID: <87a916c0v4.fsf@tethys.saintaardvarkthecarpeted.com> (raw)
In-Reply-To: <m3fxu98faj.fsf@fleche.redhat.com> (Tom Tromey's message of "Sat,  29 Mar 2008 14:07:48 -0600")

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]


Hi there -- I'm submitting a patch for this bug.  It applies cleanly
against the HEAD of the master branch right now
(f67446455fc0ec59f5c25c90a8783e571b60dc8f).

I'm following the directions in Lars Ingebrigtsen's "Welcome New Emacs
Developers" post, and copyright assignment is on file with the FSF (RT
#966206).  If you need anything else from me, please let me know.

Thanks,
Hugh


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for bug #96 --]
[-- Type: text/x-diff, Size: 2559 bytes --]

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 048fa11..27afc80 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -227,6 +227,28 @@ to determine whether cdr should not be excluded."
 		 (const :tag "No ignored files" nil))
   :group 'grep)
 
+;;;###autoload
+(defcustom grep-ask-about-save t
+  "Non-nil means \\[grep], \\[lgrep] and \\[rgrep] ask which buffers to save before running.
+Otherwise, it saves all modified buffers without asking."
+  :type 'boolean
+  :group 'grep)
+
+(defcustom grep-save-buffers-predicate nil
+  "The second argument (PRED) passed to `save-some-buffers' before compiling.
+E.g., one can set this to
+  (lambda ()
+    (string-prefix-p my-grep-root (file-truename (buffer-file-name))))
+to limit saving to files located under `my-grep-root'.
+Note, that, in general, `grep-directory' cannot be used instead
+of `my-grep-root' here."
+  :type '(choice
+          (const :tag "Default (save all file-visiting buffers)" nil)
+          (const :tag "Save all buffers" t)
+          function)
+  :group 'grep
+  :version "25.1")
+
 (defcustom grep-error-screen-columns nil
   "If non-nil, column numbers in grep hits are screen columns.
 See `compilation-error-screen-columns'"
@@ -753,6 +775,8 @@ list is empty)."
                                  'grep-history
                                  (if current-prefix-arg nil default))))))
 
+  (save-some-buffers (not grep-ask-about-save)
+		     grep-save-buffers-predicate)
   ;; Setting process-setup-function makes exit-message-function work
   ;; even when async processes aren't supported.
   (compilation-start (if (and grep-use-null-device null-device)
@@ -937,6 +961,8 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
 	(let ((default-directory dir))
 	  ;; Setting process-setup-function makes exit-message-function work
 	  ;; even when async processes aren't supported.
+	  (save-some-buffers (not grep-ask-about-save)
+			     grep-save-buffers-predicate)
 	  (compilation-start (if (and grep-use-null-device null-device)
 				 (concat command " " null-device)
 			       command)
@@ -1050,6 +1076,8 @@ to specify a command to run."
 		    (read-from-minibuffer "Confirm: "
 					  command nil nil 'grep-find-history))
 	    (add-to-history 'grep-find-history command))
+	  (save-some-buffers (not grep-ask-about-save)
+			     grep-save-buffers-predicate)
 	  (let ((default-directory dir))
 	    (compilation-start command 'grep-mode))
 	  ;; Set default-directory if we started rgrep in the *grep* buffer.

[-- Attachment #3: Type: text/plain, Size: 131 bytes --]



-- 
Hugh Brown
aardvark@saintaardvarkthecarpeted.com
http://saintaardvarkthecarpeted.com
Because the plural of Anecdote is Myth.

  reply	other threads:[~2015-01-25 15:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 20:07 lgrep/rgrep not asking to save buffers Tom Tromey
2015-01-25 15:54 ` Hugh Brown [this message]
2015-01-25 17:58   ` bug#96: " Eli Zaretskii
2016-02-29  5:20   ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a916c0v4.fsf@tethys.saintaardvarkthecarpeted.com \
    --to=aardvark@saintaardvarkthecarpeted.com \
    --cc=96@debbugs.gnu.org \
    --cc=tromey@redhat.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.