From: Tom Tromey <tromey@redhat.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: esr@thyrsus.com, harsanyi@mac.com,
Dan Nicolaescu <dann@ics.uci.edu>,
rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Introducing 'unrecognized and 'ignored
Date: Sun, 20 Jan 2008 12:45:37 -0700 [thread overview]
Message-ID: <m3ve5oz3fi.fsf@fleche.redhat.com> (raw)
In-Reply-To: <jwvtzl845rh.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun\, 20 Jan 2008 15\:14\:22 -0500")
>> 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 <tromey@redhat.com>
* 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."
next prev parent reply other threads:[~2008-01-20 19:45 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-28 17:45 Introducing 'unrecognized and 'ignored Eric S. Raymond
2007-12-28 23:01 ` Dan Nicolaescu
2007-12-29 2:48 ` Alexandru Harsanyi
2007-12-29 11:45 ` Eric S. Raymond
2008-01-02 2:02 ` Stefan Monnier
2008-01-02 2:19 ` Eric S. Raymond
2008-01-02 4:16 ` Stefan Monnier
2008-01-02 4:45 ` Dan Nicolaescu
2008-01-02 11:50 ` Eric S. Raymond
2008-01-02 17:31 ` Dan Nicolaescu
2008-01-03 9:50 ` Richard Stallman
2008-01-03 18:05 ` Dan Nicolaescu
2008-01-03 18:19 ` Eric S. Raymond
2008-01-05 5:54 ` Richard Stallman
2008-01-05 9:01 ` Dan Nicolaescu
2008-01-05 14:34 ` Eric S. Raymond
2008-01-05 22:25 ` Stefan Monnier
2008-01-06 10:37 ` Dan Nicolaescu
2008-01-06 15:57 ` Eric S. Raymond
2008-01-18 23:31 ` Dan Nicolaescu
2008-01-06 20:00 ` Tom Tromey
2008-01-06 21:03 ` Stefan Monnier
2008-01-07 2:59 ` Dan Nicolaescu
2008-01-07 3:26 ` Eric S. Raymond
2008-01-07 3:36 ` Dan Nicolaescu
2008-01-07 3:59 ` Stefan Monnier
2008-01-07 12:56 ` Eric S. Raymond
2008-01-07 15:31 ` Stefan Monnier
2008-01-07 11:30 ` Richard Stallman
2008-01-07 12:54 ` Eric S. Raymond
2008-01-07 15:32 ` Stefan Monnier
2008-01-08 19:06 ` Richard Stallman
2008-01-08 19:34 ` Miles Bader
2008-01-07 3:22 ` Dan Nicolaescu
2008-01-07 3:03 ` Tom Tromey
2008-01-07 4:01 ` Stefan Monnier
2008-01-07 21:15 ` PCL-CVS buffers (was: Introducing 'unrecognized and 'ignored) Reiner Steib
2008-01-08 2:33 ` PCL-CVS buffers Stefan Monnier
2008-01-18 23:46 ` Introducing 'unrecognized and 'ignored Dan Nicolaescu
2008-01-19 0:10 ` Tom Tromey
2008-01-19 1:20 ` Dan Nicolaescu
2008-01-19 6:00 ` Tom Tromey
2008-01-19 17:05 ` Dan Nicolaescu
2008-01-19 19:40 ` Stefan Monnier
2008-01-19 21:01 ` Thien-Thi Nguyen
2008-01-20 17:18 ` Dan Nicolaescu
2008-01-20 20:24 ` Thien-Thi Nguyen
2008-01-20 17:08 ` Dan Nicolaescu
2008-01-20 19:08 ` Tom Tromey
2008-01-20 20:14 ` Stefan Monnier
2008-01-20 19:45 ` Tom Tromey [this message]
2008-01-22 1:35 ` Dan Nicolaescu
2008-01-19 20:03 ` Thien-Thi Nguyen
2008-01-20 19:24 ` Stefan Monnier
2008-01-20 20:30 ` Thien-Thi Nguyen
2008-01-21 15:18 ` Stefan Monnier
2008-01-21 15:30 ` Dan Nicolaescu
2008-01-21 15:56 ` Stefan Monnier
2008-01-21 15:34 ` Thien-Thi Nguyen
2008-01-06 8:09 ` Richard Stallman
2008-01-02 11:46 ` Eric S. Raymond
2008-01-02 20:38 ` Stefan Monnier
2008-01-02 22:11 ` Eric S. Raymond
2008-01-02 23:06 ` Stefan Monnier
2008-01-02 23:29 ` Eric S. Raymond
2008-01-03 14:30 ` Stefan Monnier
2008-01-03 17:41 ` Eric S. Raymond
2008-01-05 5:54 ` Richard Stallman
2008-01-02 23:13 ` Dan Nicolaescu
2008-01-02 23:33 ` Eric S. Raymond
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=m3ve5oz3fi.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
--cc=esr@thyrsus.com \
--cc=harsanyi@mac.com \
--cc=monnier@iro.umontreal.ca \
--cc=rms@gnu.org \
/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).