aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond2008-05-09 18:47:36 +0000
committerEric S. Raymond2008-05-09 18:47:36 +0000
commite4ba96dcd1a2490f10d5817da6b7c0efbfda286e (patch)
tree57769d6ac9325ff65c31aafb0737946c60dc1e55
parentc22b0a7da32360e34f6f0ff86a886c9028b3d863 (diff)
downloademacs-e4ba96dcd1a2490f10d5817da6b7c0efbfda286e.tar.gz
emacs-e4ba96dcd1a2490f10d5817da6b7c0efbfda286e.zip
Remove the vc-dir-insert-directories global.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-dispatcher.el250
2 files changed, 112 insertions, 143 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index da24d8b153d..fb87eef929a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-05-09 Eric S. Raymond <esr@snark.thyrsus.com>
2
3 * vc-dispatcher.el (vc-dir-update, vc-dir-parent-marked-p,
4 vc-dir-children-marked-p): Remove the vc-dir-insert-directories global.
5
12008-05-09 Michael Albinus <michael.albinus@gmx.de> 62008-05-09 Michael Albinus <michael.albinus@gmx.de>
2 7
3 * simple.el (start-file-process): Clarify docstring. 8 * simple.el (start-file-process): Clarify docstring.
diff --git a/lisp/vc-dispatcher.el b/lisp/vc-dispatcher.el
index 2537c5265ca..ffe3582763d 100644
--- a/lisp/vc-dispatcher.el
+++ b/lisp/vc-dispatcher.el
@@ -117,9 +117,6 @@
117;; 117;;
118;; - the *VC-log* buffer needs font-locking. 118;; - the *VC-log* buffer needs font-locking.
119;; 119;;
120;; - Set `vc-dir-insert-directories' to t and check what operations
121;; and backends do not support directory arguments and fix them.
122;;
123;; - vc-dir needs mouse bindings. 120;; - vc-dir needs mouse bindings.
124;; 121;;
125;; - vc-dir needs more key bindings for VC actions. 122;; - vc-dir needs more key bindings for VC actions.
@@ -816,11 +813,6 @@ If `body' uses `event', it should be a variable,
816 map vc-dir-mode-map) 813 map vc-dir-mode-map)
817 map)) 814 map))
818 815
819;; t if directories should be shown in vc-dir.
820;; WORK IN PROGRESS! This variable will likely disappear when the
821;; work is done.
822(defvar vc-dir-insert-directories t)
823
824(defun vc-dir-update (entries buffer &optional noinsert) 816(defun vc-dir-update (entries buffer &optional noinsert)
825 "Update BUFFER's ewoc from the list of ENTRIES. 817 "Update BUFFER's ewoc from the list of ENTRIES.
826If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." 818If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
@@ -841,100 +833,74 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
841 ((string< dir1 dir2) t) 833 ((string< dir1 dir2) t)
842 ((not (string= dir1 dir2)) nil) 834 ((not (string= dir1 dir2)) nil)
843 ((string< (car entry1) (car entry2)))))))) 835 ((string< (car entry1) (car entry2))))))))
844 (if (not vc-dir-insert-directories) 836 ;; Insert directory entries in the right places.
845 (let ((entry (car entries)) 837 (let ((entry (car entries))
846 (node (ewoc-nth vc-ewoc 0))) 838 (node (ewoc-nth vc-ewoc 0)))
847 (while (and entry node) 839 ;; Insert . if it is not present.
848 (let ((entryfile (car entry)) 840 (unless node
849 (nodefile (vc-dir-fileinfo->name (ewoc-data node)))) 841 (let ((rd (file-relative-name default-directory)))
842 (ewoc-enter-last
843 vc-ewoc (vc-dir-create-fileinfo
844 rd nil nil nil (expand-file-name default-directory))))
845 (setq node (ewoc-nth vc-ewoc 0)))
846
847 (while (and entry node)
848 (let* ((entryfile (car entry))
849 (entrydir (file-name-directory (expand-file-name entryfile)))
850 (nodedir
851 (or (vc-dir-fileinfo->directory (ewoc-data node))
852 (file-name-directory
853 (expand-file-name
854 (vc-dir-fileinfo->name (ewoc-data node)))))))
855 (cond
856 ;; First try to find the directory.
857 ((string-lessp nodedir entrydir)
858 (setq node (ewoc-next vc-ewoc node)))
859 ((string-equal nodedir entrydir)
860 ;; Found the directory, find the place for the file name.
861 (let ((nodefile (vc-dir-fileinfo->name (ewoc-data node))))
850 (cond 862 (cond
851 ((string-lessp nodefile entryfile) 863 ((string-lessp nodefile entryfile)
852 (setq node (ewoc-next vc-ewoc node))) 864 (setq node (ewoc-next vc-ewoc node)))
853 ((string-lessp entryfile nodefile) 865 ((string-equal nodefile entryfile)
854 (unless noinsert
855 (ewoc-enter-before vc-ewoc node
856 (apply 'vc-dir-create-fileinfo entry)))
857 (setq entries (cdr entries) entry (car entries)))
858 (t
859 (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry)) 866 (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
860 (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry)) 867 (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
861 (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil) 868 (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
862 (ewoc-invalidate vc-ewoc node) 869 (ewoc-invalidate vc-ewoc node)
863 (setq entries (cdr entries) entry (car entries)) 870 (setq entries (cdr entries) entry (car entries))
864 (setq node (ewoc-next vc-ewoc node)))))) 871 (setq node (ewoc-next vc-ewoc node)))
865 (unless (or node noinsert) 872 (t
866 ;; We're past the last node, all remaining entries go to the end. 873 (ewoc-enter-before vc-ewoc node
867 (while entries 874 (apply 'vc-dir-create-fileinfo entry))
868 (ewoc-enter-last vc-ewoc 875 (setq entries (cdr entries) entry (car entries))))))
869 (apply 'vc-dir-create-fileinfo (pop entries)))))) 876 (t
870 ;; Insert directory entries in the right places. 877 ;; We need to insert a directory node
871 (let ((entry (car entries)) 878 (let ((rd (file-relative-name entrydir)))
872 (node (ewoc-nth vc-ewoc 0))) 879 (ewoc-enter-last
873 ;; Insert . if it is not present. 880 vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir)))
874 (unless node
875 (let ((rd (file-relative-name default-directory)))
876 (ewoc-enter-last
877 vc-ewoc (vc-dir-create-fileinfo
878 rd nil nil nil (expand-file-name default-directory))))
879 (setq node (ewoc-nth vc-ewoc 0)))
880
881 (while (and entry node)
882 (let* ((entryfile (car entry))
883 (entrydir (file-name-directory (expand-file-name entryfile)))
884 (nodedir
885 (or (vc-dir-fileinfo->directory (ewoc-data node))
886 (file-name-directory
887 (expand-file-name
888 (vc-dir-fileinfo->name (ewoc-data node)))))))
889 (cond
890 ;; First try to find the directory.
891 ((string-lessp nodedir entrydir)
892 (setq node (ewoc-next vc-ewoc node)))
893 ((string-equal nodedir entrydir)
894 ;; Found the directory, find the place for the file name.
895 (let ((nodefile (vc-dir-fileinfo->name (ewoc-data node))))
896 (cond
897 ((string-lessp nodefile entryfile)
898 (setq node (ewoc-next vc-ewoc node)))
899 ((string-equal nodefile entryfile)
900 (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
901 (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
902 (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
903 (ewoc-invalidate vc-ewoc node)
904 (setq entries (cdr entries) entry (car entries))
905 (setq node (ewoc-next vc-ewoc node)))
906 (t
907 (ewoc-enter-before vc-ewoc node
908 (apply 'vc-dir-create-fileinfo entry))
909 (setq entries (cdr entries) entry (car entries))))))
910 (t
911 ;; We need to insert a directory node
912 (let ((rd (file-relative-name entrydir)))
913 (ewoc-enter-last
914 vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir)))
915 ;; Now insert the node itself.
916 (ewoc-enter-before vc-ewoc node
917 (apply 'vc-dir-create-fileinfo entry))
918 (setq entries (cdr entries) entry (car entries))))))
919 ;; We're past the last node, all remaining entries go to the end.
920 (unless (or node noinsert)
921 (let* ((lastnode (ewoc-nth vc-ewoc -1))
922 (lastdir
923 (or (vc-dir-fileinfo->directory (ewoc-data lastnode))
924 (file-name-directory
925 (expand-file-name
926 (vc-dir-fileinfo->name (ewoc-data lastnode)))))))
927 (dolist (entry entries)
928 (let ((entrydir (file-name-directory (expand-file-name (car entry)))))
929 ;; Insert a directory node if needed.
930 (unless (string-equal lastdir entrydir)
931 (setq lastdir entrydir)
932 (let ((rd (file-relative-name entrydir)))
933 (ewoc-enter-last
934 vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir))))
935 ;; Now insert the node itself. 881 ;; Now insert the node itself.
936 (ewoc-enter-last vc-ewoc 882 (ewoc-enter-before vc-ewoc node
937 (apply 'vc-dir-create-fileinfo entry)))))))))) 883 (apply 'vc-dir-create-fileinfo entry))
884 (setq entries (cdr entries) entry (car entries))))))
885 ;; We're past the last node, all remaining entries go to the end.
886 (unless (or node noinsert)
887 (let* ((lastnode (ewoc-nth vc-ewoc -1))
888 (lastdir
889 (or (vc-dir-fileinfo->directory (ewoc-data lastnode))
890 (file-name-directory
891 (expand-file-name
892 (vc-dir-fileinfo->name (ewoc-data lastnode)))))))
893 (dolist (entry entries)
894 (let ((entrydir (file-name-directory (expand-file-name (car entry)))))
895 ;; Insert a directory node if needed.
896 (unless (string-equal lastdir entrydir)
897 (setq lastdir entrydir)
898 (let ((rd (file-relative-name entrydir)))
899 (ewoc-enter-last
900 vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir))))
901 ;; Now insert the node itself.
902 (ewoc-enter-last vc-ewoc
903 (apply 'vc-dir-create-fileinfo entry)))))))))
938 904
939(defun vc-dir-busy () 905(defun vc-dir-busy ()
940 (and (buffer-live-p vc-dir-process-buffer) 906 (and (buffer-live-p vc-dir-process-buffer)
@@ -983,62 +949,60 @@ If a prefix argument is given, move by that many lines."
983 (funcall mark-unmark-function))) 949 (funcall mark-unmark-function)))
984 950
985(defun vc-dir-parent-marked-p (arg) 951(defun vc-dir-parent-marked-p (arg)
986 (when vc-dir-insert-directories 952 ;; Return nil if none of the parent directories of arg is marked.
987 ;; Return nil if none of the parent directories of arg is marked. 953 (let* ((argdata (ewoc-data arg))
988 (let* ((argdata (ewoc-data arg)) 954 (argdir
989 (argdir 955 (let ((crtdir (vc-dir-fileinfo->directory argdata)))
990 (let ((crtdir (vc-dir-fileinfo->directory argdata))) 956 (if crtdir
957 crtdir
958 (file-name-directory (expand-file-name
959 (vc-dir-fileinfo->name argdata))))))
960 (arglen (length argdir))
961 (crt arg)
962 data dir)
963 ;; Go through the predecessors, checking if any directory that is
964 ;; a parent is marked.
965 (while (setq crt (ewoc-prev vc-ewoc crt))
966 (setq data (ewoc-data crt))
967 (setq dir
968 (let ((crtdir (vc-dir-fileinfo->directory data)))
991 (if crtdir 969 (if crtdir
992 crtdir 970 crtdir
993 (file-name-directory (expand-file-name 971 (file-name-directory (expand-file-name
994 (vc-dir-fileinfo->name argdata)))))) 972 (vc-dir-fileinfo->name data))))))
995 (arglen (length argdir)) 973
996 (crt arg) 974 (when (and (vc-dir-fileinfo->directory data)
997 data dir) 975 (string-equal (substring argdir 0 (length dir)) dir))
998 ;; Go through the predecessors, checking if any directory that is 976 (when (vc-dir-fileinfo->marked data)
999 ;; a parent is marked. 977 (error "Cannot mark `%s', parent directory `%s' marked"
1000 (while (setq crt (ewoc-prev vc-ewoc crt)) 978 (vc-dir-fileinfo->name argdata)
1001 (setq data (ewoc-data crt)) 979 (vc-dir-fileinfo->name data)))))
1002 (setq dir 980 nil))
1003 (let ((crtdir (vc-dir-fileinfo->directory data)))
1004 (if crtdir
1005 crtdir
1006 (file-name-directory (expand-file-name
1007 (vc-dir-fileinfo->name data))))))
1008
1009 (when (and (vc-dir-fileinfo->directory data)
1010 (string-equal (substring argdir 0 (length dir)) dir))
1011 (when (vc-dir-fileinfo->marked data)
1012 (error "Cannot mark `%s', parent directory `%s' marked"
1013 (vc-dir-fileinfo->name argdata)
1014 (vc-dir-fileinfo->name data)))))
1015 nil)))
1016 981
1017(defun vc-dir-children-marked-p (arg) 982(defun vc-dir-children-marked-p (arg)
1018 ;; Return nil if none of the children of arg is marked. 983 ;; Return nil if none of the children of arg is marked.
1019 (when vc-dir-insert-directories 984 (let* ((argdata (ewoc-data arg))
1020 (let* ((argdata (ewoc-data arg)) 985 (argdir (vc-dir-fileinfo->directory argdata))
1021 (argdir (vc-dir-fileinfo->directory argdata)) 986 (arglen (length argdir))
1022 (arglen (length argdir)) 987 (is-child t)
1023 (is-child t) 988 (crt arg)
1024 (crt arg) 989 data dir)
1025 data dir) 990 (while (and is-child (setq crt (ewoc-next vc-ewoc crt)))
1026 (while (and is-child (setq crt (ewoc-next vc-ewoc crt))) 991 (setq data (ewoc-data crt))
1027 (setq data (ewoc-data crt)) 992 (setq dir
1028 (setq dir 993 (let ((crtdir (vc-dir-fileinfo->directory data)))
1029 (let ((crtdir (vc-dir-fileinfo->directory data))) 994 (if crtdir
1030 (if crtdir 995 crtdir
1031 crtdir 996 (file-name-directory (expand-file-name
1032 (file-name-directory (expand-file-name 997 (vc-dir-fileinfo->name data))))))
1033 (vc-dir-fileinfo->name data)))))) 998 (if (string-equal argdir (substring dir 0 arglen))
1034 (if (string-equal argdir (substring dir 0 arglen)) 999 (when (vc-dir-fileinfo->marked data)
1035 (when (vc-dir-fileinfo->marked data) 1000 (error "Cannot mark `%s', child `%s' marked"
1036 (error "Cannot mark `%s', child `%s' marked" 1001 (vc-dir-fileinfo->name argdata)
1037 (vc-dir-fileinfo->name argdata) 1002 (vc-dir-fileinfo->name data)))
1038 (vc-dir-fileinfo->name data))) 1003 ;; We are done, we got to an entry that is not a child of `arg'.
1039 ;; We are done, we got to an entry that is not a child of `arg'. 1004 (setq is-child nil)))
1040 (setq is-child nil))) 1005 nil))
1041 nil)))
1042 1006
1043(defun vc-dir-mark-file (&optional arg) 1007(defun vc-dir-mark-file (&optional arg)
1044 ;; Mark ARG or the current file and move to the next line. 1008 ;; Mark ARG or the current file and move to the next line.