unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Gutov <dgutov@yandex.ru>
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: Tue, 19 May 2015 13:40:03 -0400	[thread overview]
Message-ID: <jwvd21wjwom.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <86d21weqsc.fsf@yandex.ru> (Dmitry Gutov's message of "Tue, 19 May 2015 14:43:31 +0300")

> 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).


        Stefan


> diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
> index a2c1cba..d6b50b7 100644
> --- a/lisp/vc/vc-dispatcher.el
> +++ b/lisp/vc/vc-dispatcher.el
> @@ -183,35 +183,36 @@ Another is that undo information is not kept."
>  (defvar vc-sentinel-movepoint)          ;Dynamically scoped.
 
>  (defun vc--process-sentinel (p code)
> -  (let ((buf (process-buffer p)))
> +  (let ((buf (process-buffer p))
> +        (status (process-status p)))
>      ;; Impatient users sometime kill "slow" buffers; check liveness
>      ;; to avoid "error in process sentinel: Selecting deleted buffer".
>      (when (buffer-live-p buf)
>        (with-current-buffer buf
>          (setq mode-line-process
> -              (let ((status (process-status p)))
> -                ;; Leave mode-line uncluttered, normally.
> -                (unless (eq 'exit status)
> -                  (format " (%s)" status))))
> -        (let (vc-sentinel-movepoint
> -              (m (process-mark p)))
> -          ;; Normally, we want async code such as sentinels to not move point.
> -          (save-excursion
> -            (goto-char m)
> -            ;; Each sentinel may move point and the next one should be run
> -            ;; at that new point.  We could get the same result by having
> -            ;; each sentinel read&set process-mark, but since `cmd' needs
> -            ;; to work both for async and sync processes, this would be
> -            ;; difficult to achieve.
> -            (vc-exec-after code)
> -            (move-marker m (point)))
> -          ;; But sometimes the sentinels really want to move point.
> -          (when vc-sentinel-movepoint
> -	    (let ((win (get-buffer-window (current-buffer) 0)))
> -	      (if (not win)
> -		  (goto-char vc-sentinel-movepoint)
> -		(with-selected-window win
> -		  (goto-char vc-sentinel-movepoint))))))))))
> +              ;; Leave mode-line uncluttered, normally.
> +              (unless (eq 'exit status)
> +                (format " (%s)" status)))
> +        (unless (eq 'signal status)
> +          (let (vc-sentinel-movepoint
> +                (m (process-mark p)))
> +            ;; Normally, we want async code such as sentinels to not move point.
> +            (save-excursion
> +              (goto-char m)
> +              ;; Each sentinel may move point and the next one should be run
> +              ;; at that new point.  We could get the same result by having
> +              ;; each sentinel read&set process-mark, but since `cmd' needs
> +              ;; to work both for async and sync processes, this would be
> +              ;; difficult to achieve.
> +              (vc-exec-after code)
> +              (move-marker m (point)))
> +            ;; But sometimes the sentinels really want to move point.
> +            (when vc-sentinel-movepoint
> +              (let ((win (get-buffer-window (current-buffer) 0)))
> +                (if (not win)
> +                    (goto-char vc-sentinel-movepoint)
> +                  (with-selected-window win
> +                    (goto-char vc-sentinel-movepoint)))))))))))
 
>  (defun vc-set-mode-line-busy-indicator ()
>    (setq mode-line-process







  parent reply	other threads:[~2015-05-19 17:40 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 [this message]
2015-05-24 21:42   ` Dmitry Gutov
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=jwvd21wjwom.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=20608@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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).