unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 20608@debbugs.gnu.org
Subject: bug#20608: 25.0.50; vc-git-log-view-mode inserts "Show 2X entries" at bob when interrupted
Date: Mon, 25 May 2015 00:42:33 +0300	[thread overview]
Message-ID: <556245C9.5040606@yandex.ru> (raw)
In-Reply-To: <jwvd21wjwom.fsf-monnier+emacsbugs@gnu.org>

On 05/19/2015 08:40 PM, Stefan Monnier wrote:
>> It seems like a general problem, to be fixed either in vc-do-command (by
>> unsetting the process sentinel before deleting the process), or in
>> vc--process-sentinel. Here's the patch for the second option:
>
> Indeed, it's a general problem.  Maybe handling it in vc-do-command
> would be a good idea, but unsetting the process sentinel altogether
> sounds a bit dangerous (the sentinel might also be used to clear the
> ":running" annotation in the modeline and other such things).

I think it's only dangerous if the sentinel is used to clean up some 
other buffer than the one where the process is running (vc-do-command 
will take care about the latter, and anyway it's launching a new 
process, so mode-line-process will be set either way). Do we know of the 
instances of the former?

Doing it in vc--process-sentinel indeed seems more dangerous, because 
it'll preclude doing cleanup even when no new process is being launched.

As far as the current (Show 2X entries) problem goes, we should've been 
able to use a more direct approach, and make the choice inside the 
delayed code, but unfortunately the buffer process is already nil in there.

So, this doesn't work:

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 1bd04e1..88bd335 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2263,13 +2263,15 @@ earlier revisions.  Show up to LIMIT entries 
(non-nil means unlimited)."
      ;; the major-mode.
      (pop-to-buffer buffer-name)
      (vc-run-delayed
-     (let ((inhibit-read-only t))
-       (funcall setup-buttons-func backend files retval)
-       (shrink-window-if-larger-than-buffer)
-       (when goto-location-func
-         (funcall goto-location-func backend)
-         (setq vc-sentinel-movepoint (point)))
-       (set-buffer-modified-p nil)))))
+      (let ((inhibit-read-only t)
+            (proc (get-buffer-process buffer-name)))
+        (when (or (null proc) (eq (process-status proc) 'exit))
+          (funcall setup-buttons-func backend files retval)
+          (shrink-window-if-larger-than-buffer)
+          (when goto-location-func
+            (funcall goto-location-func backend)
+            (setq vc-sentinel-movepoint (point)))
+          (set-buffer-modified-p nil))))))

  (defun vc-incoming-outgoing-internal (backend remote-location 
buffer-name type)
    (vc-log-internal-common






  reply	other threads:[~2015-05-24 21:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19 11:43 bug#20608: 25.0.50; vc-git-log-view-mode inserts "Show 2X entries" at bob when interrupted Dmitry Gutov
2015-05-19 13:01 ` martin rudalics
2015-05-19 13:03   ` Dmitry Gutov
2015-05-19 17:40 ` Stefan Monnier
2015-05-24 21:42   ` Dmitry Gutov [this message]
2015-05-25  2:57 ` Stefan Monnier
2015-05-25 23:41   ` Dmitry Gutov
2015-05-26 20:53     ` Stefan Monnier
2015-05-27 14:14       ` Dmitry Gutov
2015-05-27 16:26         ` Stefan Monnier
2015-05-27 23: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

  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=556245C9.5040606@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=20608@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).