From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: patch: vc.el annotation prev/next "in place" Date: Wed, 05 Apr 2006 16:37:24 -0600 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1144276743 15145 80.91.229.2 (5 Apr 2006 22:39:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Apr 2006 22:39:03 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 06 00:39:02 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FRGeS-0008FN-1x for ged-emacs-devel@m.gmane.org; Thu, 06 Apr 2006 00:39:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRGeR-0006c2-En for ged-emacs-devel@m.gmane.org; Wed, 05 Apr 2006 18:38:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FRGeH-0006bw-CR for emacs-devel@gnu.org; Wed, 05 Apr 2006 18:38:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FRGeF-0006ba-Kj for emacs-devel@gnu.org; Wed, 05 Apr 2006 18:38:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FRGeF-0006bX-H1 for emacs-devel@gnu.org; Wed, 05 Apr 2006 18:38:47 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FRGhq-0006aP-R7 for emacs-devel@gnu.org; Wed, 05 Apr 2006 18:42:31 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FRGdg-00089P-V0 for emacs-devel@gnu.org; Thu, 06 Apr 2006 00:38:12 +0200 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Apr 2006 00:38:12 +0200 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 06 Apr 2006 00:38:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 98 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:52460 Archived-At: Thien-Thi Nguyen wrote: > i month or so ago, i complained about the P and N (and J) commands in > vc-annotate buffer ending up (selecting) another buffer/window. the > following patch reverts the old behavior, according to my tastes, but > i suspect there is a better way, by avoiding `switch-to-buffer', for > example. what do you think? vc-annotate binds temp-buffer-show-function to vc-annotate-display-select in order to display the annotation buffer, which basically just delegates to vc-annotate-display-default or -autoscale; those in turn call vc-annotate-display, which depends on font-lock-mode to do the work. From its name we can assume vc-annotate-display-select is supposed to select the annotation buffer as well as display it, but it doesn't. In fact, it doesn't even make sure the current buffer is displayed. Wouldn't it make more sense if this bit in vc-annotate-display-select: (when buffer (set-buffer buffer) (display-buffer buffer)) were changed to: (pop-to-buffer (or buffer (current-buffer))) > Index: vc.el > =================================================================== > RCS file: /sources/emacs/emacs/lisp/vc.el,v > retrieving revision 1.414 > diff -w -b -B -c -r1.414 vc.el > *** vc.el 7 Feb 2006 16:59:01 -0000 1.414 > --- vc.el 5 Apr 2006 21:05:34 -0000 > *************** > *** 3076,3083 **** > nil nil "20"))))))) > (vc-ensure-vc-buffer) > (setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef > ! (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev)) > ! (temp-buffer-show-function 'vc-annotate-display-select)) > (message "Annotating...") > ;; If BUF is specified it tells in which buffer we should put the > ;; annotations. This is used when switching annotations to another > --- 3076,3087 ---- > nil nil "20"))))))) > (vc-ensure-vc-buffer) > (setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef > ! (let* ((temp-buffer-setup-hook nil) > ! (temp-buffer-name (format "*Annotate %s (rev %s)*" > ! (buffer-name) rev)) > ! (temp-buffer-show-function (lambda (buf) > ! (switch-to-buffer buf) > ! (vc-annotate-display-select)))) > (message "Annotating...") > ;; If BUF is specified it tells in which buffer we should put the > ;; annotations. This is used when switching annotations to another > *************** > *** 3086,3101 **** > (rename-buffer temp-buffer-name t) > ;; In case it had to be uniquified. > (setq temp-buffer-name (buffer-name)))) > ! (with-output-to-temp-buffer temp-buffer-name > ! (vc-call annotate-command file (get-buffer temp-buffer-name) rev)) > (with-current-buffer temp-buffer-name > (set (make-local-variable 'vc-annotate-backend) (vc-backend file)) > (set (make-local-variable 'vc-annotate-parent-file) file) > (set (make-local-variable 'vc-annotate-parent-rev) rev) > (set (make-local-variable 'vc-annotate-parent-display-mode) > ! display-mode)) > > ! (message "Annotating... done"))) > > (defun vc-annotate-prev-version (prefix) > "Visit the annotation of the version previous to this one. > --- 3090,3108 ---- > (rename-buffer temp-buffer-name t) > ;; In case it had to be uniquified. > (setq temp-buffer-name (buffer-name)))) > ! (vc-call annotate-command file (get-buffer-create temp-buffer-name) rev) > ! (switch-to-buffer temp-buffer-name) > ! (delete-other-windows) > ! (vc-annotate-display-select) > ! (goto-char (point-min)) > (with-current-buffer temp-buffer-name > (set (make-local-variable 'vc-annotate-backend) (vc-backend file)) > (set (make-local-variable 'vc-annotate-parent-file) file) > (set (make-local-variable 'vc-annotate-parent-rev) rev) > (set (make-local-variable 'vc-annotate-parent-display-mode) > ! display-mode))) > > ! (message "Annotating... done")) > > (defun vc-annotate-prev-version (prefix) > "Visit the annotation of the version previous to this one. -- Kevin Rodgers