Subject: Re: bug#19101: 25.0.50; vc-print-log puts wrong buffer into log-view-mode

From: Ivan Shmakov <[email-masked]>
Date: Wed, 19 Nov 2014 16:51:13 +0000

>>>>> Eli Zaretskii <[email-masked]> writes:
>>>>> From: Ivan Shmakov <[email-masked]>
>>>>> Richard Copley <[email-masked]> writes:

 >>> Visit a file under Subversion or RCS (not Git or Bazaar) and invoke
 >>> `vc-print-log'.  The log buffer should be put into log-view-mode,
 >>> but it isn't.  The buffer visiting the file is put into
 >>> log-view-mode instead.

 >> This is likely to be caused by VC assuming that the ‘print-log’
 >> backend function leaves the log buffer as the current one.

 > No, it's because Stefan moved the call to pop-to-buffer so that the
 > part that turned on the mode was running in the wrong buffer.

	ACK, but that change seem to be dated 2014-11-05, while I’ve
	observed a similar issue (with non-Emacs code, though) before.
	Or so I think.

 > As for print-log backend function, those that I saw run inside
 > with-temp-buffer, so they don't switch buffers.

	There’re several which use vc-setup-buffer, which in turn calls
	set-buffer.  Consider, e. g.:

(defun vc-setup-buffer (buf)
  "Prepare BUF for executing a slave command and make it current."
  (let ((camefrom (current-buffer))
	(olddir default-directory))
    (set-buffer (get-buffer-create buf))

(defun vc-bzr-print-log (files buffer &optional shortlog start-revision limit)
  …
  ;; `vc-do-command' creates the buffer, but we need it before running
  ;; the command.
  (vc-setup-buffer buffer)

(defun vc-git-print-log (files buffer &optional shortlog start-revision limit)
  …
  (let ((coding-system-for-read vc-git-commits-coding-system))
    ;; `vc-do-command' creates the buffer, but we need it before running
    ;; the command.
    (vc-setup-buffer buffer)

(defun vc-hg-print-log (files buffer &optional shortlog start-revision limit)
  …
  ;; `vc-do-command' creates the buffer, but we need it before running
  ;; the command.
  (vc-setup-buffer buffer)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A