all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: emacs-devel@gnu.org
Subject: Re: next-error use cases
Date: Thu, 12 Apr 2018 23:27:16 +0300	[thread overview]
Message-ID: <87r2nknpaz.fsf@mail.linkov.net> (raw)
In-Reply-To: <87zi2esn7l.fsf@mail.linkov.net> (Juri Linkov's message of "Sun,  08 Apr 2018 00:47:42 +0300")

Since we removed the rule of visibility of next-error-function buffers
as a criteria for deciding what navigation to use for next-error,
so e.g. next-error in *Occur* or *Diff* that is the current buffer
and a single visible buffer on the frame will still use the last next-error
buffer that might be e.g. *compilation* or *grep* buffer buried long ago,
now we need to support the same way to switch next-error navigation as
already is possible in *compilation* and *grep* by typing RET or ‘C-c C-c’
that sets next-error-last-buffer in next-error-internal among other things.

Tried to pass goto-source commands thru next-error-internal that works fine
for change-log-goto-source but has problems in diff-goto-source
because next-error-internal has no arguments but diff-goto-source
expects ‘other-file’ as an arg.

Another solution is to call a special function like next-error-internal
explicitly from all such goto-source commands.  This function could also
set next-error-last-buffer to the current buffer.

Anyway here is the patch that shows the problem with the first solution:

diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index 175c82f..671f971 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -471,6 +471,9 @@ change-log-goto-source
 comma-separated list.  If no suitable tag can be found nearby,
 try to visit the file for the change under `point' instead."
   (interactive)
+  (next-error-internal))
+
+(defun change-log-goto-source-internal ()
   (if (and (eq last-command 'change-log-goto-source)
 	   change-log-find-tail)
       (setq change-log-find-tail
@@ -539,7 +542,7 @@ change-log-next-error
   ;; if we found a place to visit...
   (when (looking-at change-log-file-names-re)
     (let (change-log-find-window)
-      (change-log-goto-source)
+      (change-log-goto-source-internal)
       (when change-log-find-window
 	;; Select window displaying source file.
 	(select-window change-log-find-window)))))
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index ef13f55..2a70563 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1349,7 +1349,7 @@ diff-next-error
   (pop-to-buffer (current-buffer))
   (if reset (goto-char (point-min)))
   (diff-hunk-next arg)
-  (diff-goto-source))
+  (diff-goto-source-internal))
 
 (defvar whitespace-style)
 (defvar whitespace-trailing-regexp)
@@ -1874,6 +1874,11 @@ diff-goto-source
   ;; the old location, and else to the new (i.e. as if reverting).
   ;; This is a convenient detail when using smerge-diff.
   (if event (posn-set-point (event-end event)))
+  (if other-file
+      (diff-goto-source-internal other-file)
+    (next-error-internal)))
+
+(defun diff-goto-source-internal (&optional other-file)
   (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
     (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
                  (diff-find-source-location other-file rev)))



  parent reply	other threads:[~2018-04-12 20:27 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 21:47 next-error use cases Juri Linkov
2018-04-08 13:48 ` Eli Zaretskii
2018-04-08 19:56   ` Juri Linkov
2018-04-08 20:26     ` Clément Pit-Claudel
2018-04-08 20:35       ` Dmitry Gutov
2018-04-10  4:19         ` Stephen Leake
2018-04-10 14:28           ` Drew Adams
2018-04-09  2:24       ` Eli Zaretskii
2018-04-08 20:36   ` Dmitry Gutov
2018-04-09 14:48     ` Eli Zaretskii
2018-04-09 18:44       ` Charles A. Roelli
2018-04-09 20:47         ` Juri Linkov
2018-04-10  4:24           ` Stephen Leake
2018-04-10 20:06             ` Juri Linkov
     [not found]               ` <86woxe1l0l.fsf@stephe-leake.org>
2018-04-11  7:29                 ` Dmitry Gutov
2018-04-11 20:46                   ` Juri Linkov
2018-04-12 15:31                     ` Stephen Leake
2018-04-12 15:25                   ` Stephen Leake
2018-04-12 16:51                     ` Dmitry Gutov
2018-04-13 16:22                       ` Stephen Leake
2018-04-13 16:26                         ` Dmitry Gutov
2018-04-10 23:06       ` Dmitry Gutov
2018-04-12 20:27 ` Juri Linkov [this message]
2018-04-13  7:45   ` Eli Zaretskii
2018-04-13 19:48     ` Juri Linkov
2020-05-19  1:10       ` Dmitry Gutov
2020-05-19 22:12         ` Juri Linkov
2020-05-21  1:57           ` Dmitry Gutov
2020-05-21 20:33             ` Vladimir Sedach
2020-05-21 21:02               ` Stefan Monnier
2020-05-21 21:53               ` Dmitry Gutov
2020-05-21 22:06                 ` Juri Linkov
2020-05-21 22:49                   ` Dmitry Gutov
2020-05-22  1:31                     ` Clément Pit-Claudel
2020-05-22 19:10                       ` Vladimir Sedach
2020-05-23  1:22                         ` Clément Pit-Claudel
2020-05-23  1:27                           ` Dmitry Gutov
     [not found]                             ` <b386929f-4412-860d-343f-a728d6d7e816@gmail.com>
     [not found]                               ` <c6c941bb-a160-f767-b266-6a17f4b4c2ca@yandex.ru>
     [not found]                                 ` <152f1200-a2d0-e137-418f-18ceb14fbbe3@gmail.com>
2020-05-23 15:29                                   ` Drew Adams
2020-05-24  1:36                                   ` Dmitry Gutov
2020-05-24  1:41                                     ` Clément Pit-Claudel
2020-05-24 14:25                                       ` Dmitry Gutov
2020-05-22 23:50                       ` Dmitry Gutov
2020-05-23  1:25                         ` Clément Pit-Claudel
2020-05-23  1:29                           ` Dmitry Gutov

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=87r2nknpaz.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.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 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.