unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12492: 24.2.50; Open vc-dir buffer easier and faster
@ 2012-09-22 23:04 Dmitry Gutov
       [not found] ` <handler.12492.B.13483551567692.ack@debbugs.gnu.org>
                   ` (3 more replies)
  0 siblings, 4 replies; 100+ messages in thread
From: Dmitry Gutov @ 2012-09-22 23:04 UTC (permalink / raw)
  To: 12492

[-- Attachment #1: Type: text/plain, Size: 914 bytes --]

Tags: patch

Two changes:
1) All version controlled buffers have after-save-hook set up to call 
vc-dir-resynch-file. So if we're just bringing up a buried vc-dir 
buffer, we (almost?) never need to refresh it. This cuts about 1 second 
or more on my machine, depending on the backend.
2) For almost all backends we can easily deduce the repository root 
directory (exceptions: cvs, rcs, sccs), and I believe that in almost all 
cases the user wants to see the status of this directory, not of some 
subdirectory or any directory unrelated to the current buffer.
Hence the function vc-root-dir, which I think should be bound to 'C-x v 
d' and the respective menu item.
In the rare case when the user need to do something unusual, they can do 
M-x vc-dir.
When the backend doesn't have the function vc-xx-root, vc-root-dir 
interactively delegates to vc-dir, so for CVS, for example, the behavior 
will not change.

[-- Attachment #2: vc-dir.diff --]
[-- Type: text/plain, Size: 2297 bytes --]

=== modified file 'lisp/vc/vc-dir.el'
--- lisp/vc/vc-dir.el	2012-08-13 21:31:56 +0000
+++ lisp/vc/vc-dir.el	2012-09-22 22:43:38 +0000
@@ -1227,12 +1227,25 @@
     (setq backend (vc-responsible-backend dir)))
   (let (pop-up-windows)		      ; based on cvs-examine; bug#6204
     (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend)))
-  (if (derived-mode-p 'vc-dir-mode)
-      (vc-dir-refresh)
+  ;; If the mode matches, the buffer was only buried and should be up to date.
+  (unless (derived-mode-p 'vc-dir-mode)
     ;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
     (let ((use-vc-backend backend))
       (vc-dir-mode))))
 
+;;;###autoload
+(defun vc-root-dir ()
+  "Show the VC status of the current buffer's repository.
+If the buffer is not visiting a version controlled file, or if
+the backend does not support function `root', prompt for
+directory.  See `vc-dir' for more details."
+  (interactive)
+  (let* ((backend (vc-backend (buffer-file-name)))
+         (dir (and backend (vc-call-backend backend 'root buffer-file-name))))
+    (if dir
+        (vc-dir dir backend)
+      (call-interactively 'vc-dir))))
+
 (defun vc-default-dir-extra-headers (_backend _dir)
   ;; Be loud by default to remind people to add code to display
   ;; backend specific headers.

=== modified file 'lisp/vc/vc-hooks.el'
--- lisp/vc/vc-hooks.el	2012-07-11 23:13:41 +0000
+++ lisp/vc/vc-hooks.el	2012-09-22 21:31:00 +0000
@@ -923,7 +923,7 @@
     (define-key map "a" 'vc-update-change-log)
     (define-key map "b" 'vc-switch-backend)
     (define-key map "c" 'vc-rollback)
-    (define-key map "d" 'vc-dir)
+    (define-key map "d" 'vc-root-dir)
     (define-key map "g" 'vc-annotate)
     (define-key map "h" 'vc-insert-headers)
     (define-key map "i" 'vc-register)
@@ -1005,9 +1005,9 @@
     (bindings--define-key map [vc-register]
       '(menu-item "Register" vc-register
 		  :help "Register file set into a version control system"))
-    (bindings--define-key map [vc-dir]
-      '(menu-item "VC Dir"  vc-dir
-		  :help "Show the VC status of files in a directory"))
+    (bindings--define-key map [vc-root-dir]
+      '(menu-item "VC Dir"  vc-root-dir
+		  :help "Show the VC status of the repository"))
     map))
 
 (defalias 'vc-menu-map vc-menu-map)


^ permalink raw reply	[flat|nested] 100+ messages in thread

end of thread, other threads:[~2020-06-24 23:32 UTC | newest]

Thread overview: 100+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-22 23:04 bug#12492: 24.2.50; Open vc-dir buffer easier and faster Dmitry Gutov
     [not found] ` <handler.12492.B.13483551567692.ack@debbugs.gnu.org>
2012-09-22 23:31   ` bug#12492: Acknowledgement (24.2.50; Open vc-dir buffer easier and faster) Dmitry Gutov
2016-02-24  6:07     ` Lars Ingebrigtsen
2016-02-24 14:59       ` Dmitry Gutov
2016-02-24 23:46         ` Lars Ingebrigtsen
2019-06-27 14:49     ` Lars Ingebrigtsen
2019-06-27 21:16       ` Juri Linkov
2019-06-27 22:14         ` Lars Ingebrigtsen
2019-06-28 19:16           ` Juri Linkov
2019-06-28 19:30           ` Dmitry Gutov
2019-06-28 13:21         ` Dmitry Gutov
2019-06-28 19:17           ` Juri Linkov
2019-06-28 19:29             ` Dmitry Gutov
2019-06-29 10:19               ` Lars Ingebrigtsen
2019-06-30 20:53                 ` Juri Linkov
2019-07-02 12:39                   ` Lars Ingebrigtsen
2019-07-04 20:17                     ` Juri Linkov
2019-07-05 13:09                       ` Lars Ingebrigtsen
2019-07-05 13:41                         ` Dmitry Gutov
2019-07-05 18:53                           ` Juri Linkov
2019-07-06 11:59                             ` Lars Ingebrigtsen
2019-07-07 22:56                               ` Juri Linkov
2019-07-07 23:09                                 ` Dmitry Gutov
2020-06-09 23:35                                 ` bug#41779: Fall back between vc-diff and diff-backup Juri Linkov
2020-06-10 19:05                                   ` Dmitry Gutov
2020-06-10 21:53                                     ` Juri Linkov
2020-06-10 22:18                                       ` Dmitry Gutov
2020-06-10 23:17                                         ` Juri Linkov
2020-06-10 23:26                                           ` Dmitry Gutov
2020-06-24 23:32                                             ` Juri Linkov
2019-07-07 23:11                             ` bug#12492: Acknowledgement (24.2.50; Open vc-dir buffer easier and faster) Dmitry Gutov
2020-02-25  0:10                       ` Juri Linkov
2020-02-25 10:35                         ` Dmitry Gutov
2020-02-25 21:27                           ` Juri Linkov
2020-02-26 22:51                             ` Dmitry Gutov
2020-02-26 23:41                               ` Juri Linkov
2020-02-27  7:27                                 ` Dmitry Gutov
2020-02-29 21:16                               ` Juri Linkov
2020-03-02 22:11                                 ` Dmitry Gutov
2020-03-02 23:05                                   ` Juri Linkov
2020-03-03 11:33                                     ` Dmitry Gutov
2020-03-03 13:31                                       ` Dmitry Gutov
2020-03-03 23:19                                       ` Juri Linkov
2020-03-04 12:05                                         ` Dmitry Gutov
2020-03-05  0:04                                           ` Juri Linkov
2020-03-05 23:15                                             ` Dmitry Gutov
2020-03-05 23:59                                               ` Juri Linkov
2020-03-06 15:33                                                 ` Dmitry Gutov
2020-03-08  0:47                                                   ` Juri Linkov
2020-03-08  9:57                                                     ` Dmitry Gutov
2020-03-29  0:08                                                       ` Juri Linkov
2020-03-29 11:09                                                         ` Dmitry Gutov
2020-03-06  9:40                                   ` Eli Zaretskii
2020-03-06 16:01                                     ` Dmitry Gutov
2020-03-06 16:14                                       ` Eli Zaretskii
2020-03-06 16:53                                         ` Dmitry Gutov
2020-03-06 17:12                                           ` Eli Zaretskii
2020-03-06 22:34                                             ` Dmitry Gutov
2020-03-07  7:37                                               ` Eli Zaretskii
2020-03-08  0:49                                                 ` Dmitry Gutov
2020-03-09 17:24                                                   ` Eli Zaretskii
2020-03-09 22:47                                                     ` Dmitry Gutov
2020-03-10 18:18                                                       ` Eli Zaretskii
2020-03-11 13:35                                                         ` Dmitry Gutov
2020-03-11 16:14                                                           ` Eli Zaretskii
2020-03-11 23:54                                                             ` Dmitry Gutov
2020-03-12 14:57                                                               ` Eli Zaretskii
2020-03-13 12:23                                                                 ` Dmitry Gutov
2020-03-13 14:30                                                                   ` Eli Zaretskii
2020-03-15 21:57                                                                     ` Dmitry Gutov
2020-03-16  3:25                                                                       ` Eli Zaretskii
2020-03-16  8:02                                                                         ` Dmitry Gutov
2020-03-21 11:28                                                                           ` Eli Zaretskii
2019-07-01 13:01                 ` Dmitry Gutov
2020-02-27 22:50         ` Juri Linkov
2020-03-02 22:17           ` Dmitry Gutov
2020-03-02 22:57             ` Juri Linkov
2020-03-03 11:27               ` Dmitry Gutov
2020-03-03 23:27                 ` Juri Linkov
2020-03-04 11:51                   ` Dmitry Gutov
2020-03-05  0:06                     ` Juri Linkov
2019-07-01  8:02     ` Andreas Schwab
2019-07-01 12:56       ` Dmitry Gutov
2019-07-04 20:25         ` Juri Linkov
2019-07-04 22:05           ` Juri Linkov
2019-07-05 13:44             ` Dmitry Gutov
2019-07-05 13:43           ` Dmitry Gutov
2019-07-05 18:56             ` Juri Linkov
2019-07-06  8:37               ` Dmitry Gutov
2012-09-23  7:01 ` bug#12492: 24.2.50; Open vc-dir buffer easier and faster Andreas Schwab
2012-09-23  8:38   ` Dmitry Gutov
2012-09-23  8:46     ` Andreas Schwab
2012-09-23 11:46       ` Dmitry Gutov
2012-09-23 11:54         ` Andreas Schwab
2012-09-23 12:26           ` Dmitry Gutov
2015-01-21 20:55 ` bug#12492: vc-dir vs. vc-root-dir Ivan Shmakov
     [not found] ` <87sif3rh00.fsf@violet.siamics.net>
2015-01-21 21:55   ` Stefan Monnier
2015-01-22  5:40     ` Ivan Shmakov
2015-01-22 17:04       ` Stefan Monnier
2015-01-23 12:12         ` Ivan Shmakov

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