From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: Introducing 'unrecognized and 'ignored Date: Sun, 20 Jan 2008 12:45:37 -0700 Message-ID: References: <17EA38DF-BCC1-4565-8510-5DD10DD667E3@mac.com> <20071229114551.GD9794@thyrsus.com> <20080102021907.GA15494@thyrsus.com> <200801020445.m024jWU2008538@oogie-boogie.ics.uci.edu> <200801031805.m03I5SBf022748@oogie-boogie.ics.uci.edu> <200801050901.m0591mQj011970@oogie-boogie.ics.uci.edu> <20080105143415.GG30869@thyrsus.com> <200801061037.m06AbIRD004966@oogie-boogie.ics.uci.edu> <200801182346.m0INkiEg022130@sallyv1.ics.uci.edu> <200801191705.m0JH5WOU026943@sallyv1.ics.uci.edu> Reply-To: Tom Tromey NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1200860506 29779 80.91.229.12 (20 Jan 2008 20:21:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2008 20:21:46 +0000 (UTC) Cc: esr@thyrsus.com, harsanyi@mac.com, Dan Nicolaescu , rms@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 20 21:22:04 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JGgg5-0002Lk-L1 for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2008 21:22:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGgfg-0006cl-2V for ged-emacs-devel@m.gmane.org; Sun, 20 Jan 2008 15:21:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGgfb-0006cf-Di for emacs-devel@gnu.org; Sun, 20 Jan 2008 15:21:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGgfa-0006cL-51 for emacs-devel@gnu.org; Sun, 20 Jan 2008 15:21:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGgfa-0006cC-22 for emacs-devel@gnu.org; Sun, 20 Jan 2008 15:21:30 -0500 Original-Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JGgfW-0004YY-Kn; Sun, 20 Jan 2008 15:21:26 -0500 Original-Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m0KKLP4i026812; Sun, 20 Jan 2008 15:21:25 -0500 Original-Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0KKLP99021272; Sun, 20 Jan 2008 15:21:25 -0500 Original-Received: from opsy.redhat.com (ton.yyz.redhat.com [10.15.16.15]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0KKLOhr031534; Sun, 20 Jan 2008 15:21:25 -0500 Original-Received: by opsy.redhat.com (Postfix, from userid 500) id C18AF5089A4; Sun, 20 Jan 2008 12:45:37 -0700 (MST) X-Attribution: Tom In-Reply-To: (Stefan Monnier's message of "Sun\, 20 Jan 2008 15\:14\:22 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.990 (gnu/linux) X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:87123 Archived-At: >> I hook into vc-do-command... I'm not sure if that is really a good idea. >> I guess that's why we have patch review :-) Stefan> I general it doesn't sound like a bad idea, but I'll reserve Stefan> my judgment until I see the code. Here's the patch I've got. Note there is a bug fix to vc-update-vc-status-buffer in here... this should go in even if the rest of the patch does not. You can see this bug by running vc-status in a directory with no modifications and no unrecognized files. Stefan> PCL-CVS used to clear the ewoc, so I obviously believe it's Stefan> worth the effort to not clear it, so as to preserve mark and Stefan> such. Yeah. In general I think vc-status should follow PCL-CVS unless there is a really good reason to be different. Tom 2008-01-20 Tom Tromey * vc.el (vc-status-report-buffer): New variable. (vc-do-command): Display command in vc-status buffer. (vc-status-headers): Add 'command' argument. (vc-status-footers): New function. (vc-status-mode): Create footer. (vc-status-refresh): Bind vc-status-report-buffer. (vc-status-start-command): New function. (vc-status-command-finished): Likewise. (vc-update-vc-status-buffer): Avoid error if no nodes in ewoc. Index: vc.el =================================================================== RCS file: /sources/emacs/emacs/lisp/vc.el,v retrieving revision 1.516 diff -u -c -r1.516 vc.el cvs diff: conflicting specifications of output style *** vc.el 18 Jan 2008 23:32:57 -0000 1.516 --- vc.el 20 Jan 2008 20:11:34 -0000 *************** *** 1020,1025 **** --- 1020,1028 ---- ;; FIXME what about file names with spaces? (if (not filelist) "." (mapconcat 'identity filelist " "))) + ;; This is let-bound when vc-do-command should report the command. + (defvar vc-status-report-buffer nil) + ;;;###autoload (defun vc-do-command (buffer okstatus command file-or-list &rest flags) "Execute a VC command, notifying user and checking for errors. *************** *** 1050,1055 **** --- 1053,1064 ---- " " (vc-delistify (mapcar (lambda (s) (if (> (length s) 20) (concat (substring s 0 2) "...") s)) flags)) " " (vc-delistify files)))) + ;; Update the vc-status buffer, if requested. Only do this for + ;; async commands; for synchronous commands the normal message is + ;; enough. + (if (and vc-status-report-buffer (eq okstatus 'async)) + (with-current-buffer vc-status-report-buffer + (vc-status-start-command full-command))) (save-current-buffer (unless (or (eq buffer t) (and (stringp buffer) *************** *** 1091,1097 **** (set-process-filter proc 'vc-process-filter) (vc-exec-after `(if vc-command-messages ! (message "Running %s in background... done" ',full-command)))) ;; Run synchrously (if vc-command-messages (message "Running %s in foreground..." full-command)) --- 1100,1110 ---- (set-process-filter proc 'vc-process-filter) (vc-exec-after `(if vc-command-messages ! (message "Running %s in background... done" ',full-command))) ! (if vc-status-report-buffer ! (vc-exec-after ! `(with-current-buffer ,vc-status-report-buffer ! (vc-status-command-finished))))) ;; Run synchrously (if vc-command-messages (message "Running %s in foreground..." full-command)) *************** *** 2543,2553 **** (defvar vc-status nil) ! (defun vc-status-headers (backend dir) (concat (format "VC backend : %s\n" backend) "Repository : The repository goes here\n" ! (format "Working dir: %s\n" dir))) (defun vc-status-printer (fileentry) "Pretty print FILEENTRY." --- 2558,2579 ---- (defvar vc-status nil) ! (defun vc-status-headers (backend dir command) (concat (format "VC backend : %s\n" backend) "Repository : The repository goes here\n" ! (format "Working dir: %s\n" dir) ! "\n" ! (if command (concat "-- Running: " command " ...") ! "") ! "\n")) ! ! (defun vc-status-footers (command) ! (concat ! "\n--------------------- End ---------------------\n" ! (if command (concat "-- Last command: " command " --") ! "") ! "\n")) (defun vc-status-printer (fileentry) "Pretty print FILEENTRY." *************** *** 2615,2621 **** (erase-buffer) (set (make-local-variable 'vc-status) (ewoc-create #'vc-status-printer ! (vc-status-headers backend default-directory))) (vc-status-refresh))) (put 'vc-status-mode 'mode-class 'special) --- 2641,2648 ---- (erase-buffer) (set (make-local-variable 'vc-status) (ewoc-create #'vc-status-printer ! (vc-status-headers backend default-directory nil) ! (vc-status-footers nil))) (vc-status-refresh))) (put 'vc-status-mode 'mode-class 'special) *************** *** 2625,2638 **** (dolist (entry entries) (ewoc-enter-last vc-status (vc-status-create-fileinfo (cdr entry) (car entry)))) ! (ewoc-goto-node vc-status (ewoc-nth vc-status 0)))) (defun vc-status-refresh () "Refresh the contents of the VC status buffer." (interactive) ;; This is not very efficient; ewoc could use a new function here. (ewoc-filter vc-status (lambda (node) nil)) ! (let ((backend (vc-responsible-backend default-directory))) ;; Call the dir-status backend function. dir-status is supposed to ;; be asynchronous. It should compute the results and call the ;; function passed as a an arg to update the vc-status buffer with --- 2652,2668 ---- (dolist (entry entries) (ewoc-enter-last vc-status (vc-status-create-fileinfo (cdr entry) (car entry)))) ! (let ((node (ewoc-nth vc-status 0))) ! (if node ! (ewoc-goto-node vc-status node))))) (defun vc-status-refresh () "Refresh the contents of the VC status buffer." (interactive) ;; This is not very efficient; ewoc could use a new function here. (ewoc-filter vc-status (lambda (node) nil)) ! (let ((backend (vc-responsible-backend default-directory)) ! (vc-status-report-buffer (current-buffer))) ;; Call the dir-status backend function. dir-status is supposed to ;; be asynchronous. It should compute the results and call the ;; function passed as a an arg to update the vc-status buffer with *************** *** 2641,2646 **** --- 2671,2691 ---- backend 'dir-status default-directory #'vc-update-vc-status-buffer (current-buffer)))) + (defun vc-status-start-command (command) + "Update the vc-status header with the current back-end command." + (let ((backend (vc-responsible-backend default-directory))) + (set (make-local-variable 'vc-running-command) command) + (ewoc-set-hf vc-status + (vc-status-headers backend default-directory command) + (vc-status-footers nil)))) + + (defun vc-status-command-finished () + "Update the vc-status footer with previous command, and clear the header." + (let ((backend (vc-responsible-backend default-directory))) + (ewoc-set-hf vc-status + (vc-status-headers backend default-directory nil) + (vc-status-footers vc-running-command)))) + (defun vc-status-next-line (arg) "Go to the next line. If a prefix argument is given, move by that many lines."