unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: 33618@debbugs.gnu.org
Cc: Stephen Leake <stephen_leake@member.fsf.org>
Subject: bug#33618: 27.0.50; ada-mode breaks M-x grep
Date: Tue, 04 Dec 2018 19:02:35 -0500	[thread overview]
Message-ID: <jwvy394c06q.fsf-monnier+bug#33618@gnu.org> (raw)
In-Reply-To: <jwvbm60n9cg.fsf@iro.umontreal.ca> (Stefan Monnier's message of "Tue, 04 Dec 2018 18:46:55 -0500")

> Opening a file in ada-mode using the new ada-mode from GNU ELPA globally
> sets compilation-search-path (for me, it got set to `("~/tmp")`
> probably because the Ada file was in ~/tmp), which in
> turn breaks M-x grep in the sense that clicking on a match doesn't jump
> to the file but prompts you to find the file (unless you happened to
> grep from one of the directories mentioned in the
> compilation-search-path, of course).

I use the patch below currently to work around this problem.
Should I install it into `master` (with a few more comments and
probably etc/NEWS or even manual updates)?


        Stefan


diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 359c187d85..d31e614f14 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -943,7 +943,7 @@ ada-select-prj-file
 	;; FIXME: use ada-get-absolute-dir, mapconcat here
 	(setenv "ADA_PROJECT_PATH" ada_project_path)))
 
-  (setq compilation-search-path (ada-xref-get-src-dir-field))
+  (setq-local compilation-search-path (ada-xref-get-src-dir-field))
 
   (setq ada-search-directories-internal
 	;; FIXME: why do we need directory-file-name here?
@@ -1208,9 +1208,8 @@ ada-compile-application
   (ada-require-project-file)
   (let ((cmd (ada-xref-get-project-field 'make_cmd))
 	(process-environment (ada-set-environment))
-	(compilation-scroll-output t))
-
-    (setq compilation-search-path (ada-xref-get-src-dir-field))
+	(compilation-scroll-output t)
+        (compilation-search-path (ada-xref-get-src-dir-field)))
 
     ;;  If no project file was found, ask the user
     (unless cmd
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index c7c510f7a3..f5627e10ce 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1614,7 +1614,7 @@ recompile
       (setq command (compilation-read-command (or (car compilation-arguments)
 						  command)))
       (if compilation-arguments (setcar compilation-arguments command)))
-    (apply 'compilation-start (or compilation-arguments (list command)))))
+    (apply #'compilation-start (or compilation-arguments (list command)))))
 
 (defcustom compilation-scroll-output nil
   "Non-nil to scroll the *compilation* buffer window as output appears.
@@ -1682,6 +1682,7 @@ compilation-start
 	    (replace-regexp-in-string "-mode\\'" "" (symbol-name mode))))
 	 (thisdir default-directory)
 	 (thisenv compilation-environment)
+         (this-search-path compilation-search-path)
 	 outwin outbuf)
     (with-current-buffer
 	(setq outbuf
@@ -1749,6 +1750,8 @@ compilation-start
         ;; NB: must be done after (funcall mode) as that resets local variables
         (set (make-local-variable 'compilation-directory) thisdir)
 	(set (make-local-variable 'compilation-environment) thisenv)
+        (unless (local-variable-p 'compilation-search-path)
+          (setq-local compilation-search-path this-search-path))
 	(if highlight-regexp
 	    (set (make-local-variable 'compilation-highlight-regexp)
 		 highlight-regexp))
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 331eeec01b..16b54081ae 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -834,7 +834,8 @@ grep-mode
   (set (make-local-variable 'compilation-disable-input) t)
   (set (make-local-variable 'compilation-error-screen-columns)
        grep-error-screen-columns)
-  (add-hook 'compilation-filter-hook 'grep-filter nil t))
+  (setq-local compilation-search-path '(nil))
+  (add-hook 'compilation-filter-hook #'grep-filter nil t))
 
 (defun grep--save-buffers ()
   (when grep-save-buffers





  reply	other threads:[~2018-12-05  0:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 23:46 bug#33618: 27.0.50; ada-mode breaks M-x grep Stefan Monnier
2018-12-05  0:02 ` Stefan Monnier [this message]
2018-12-05  6:41   ` Eli Zaretskii
2018-12-05 14:26     ` Stefan Monnier
2018-12-05 14:37       ` Eli Zaretskii
2018-12-05 14:41         ` Eli Zaretskii
2018-12-05 16:10         ` Stefan Monnier
2018-12-20 20:17 ` bug#33618: emacs ada-mode bug 33618 Stephen Leake
2018-12-21  0:08   ` Dmitry Gutov
2018-12-21 23:19 ` bug#33618: update Stephen Leake
2019-01-04 17:27 ` bug#33618: 27.0.50; ada-mode breaks M-x grep Ludovic Brenta
2019-04-20 16:47 ` bug#33618: better fix Stephen Leake
2019-04-20 17:24   ` Eli Zaretskii
2019-04-25 22:52 ` bug#33618: fixed in commit 1486eadf7c9469f873fcd04beafd03f21564d580 Stephen Leake

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='jwvy394c06q.fsf-monnier+bug#33618@gnu.org' \
    --to=monnier@iro.umontreal.ca \
    --cc=33618@debbugs.gnu.org \
    --cc=stephen_leake@member.fsf.org \
    /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).