aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2004-03-23 21:44:31 +0000
committerStefan Monnier2004-03-23 21:44:31 +0000
commitd7aed37c2efb2b5332ff02cb448265c0c4365631 (patch)
tree20970f80c2ad374e6edd7f4e60972a118c48aae5 /lisp
parente5d31f9f638de02e9dfd7efa9bc674fc3196e228 (diff)
downloademacs-d7aed37c2efb2b5332ff02cb448265c0c4365631.tar.gz
emacs-d7aed37c2efb2b5332ff02cb448265c0c4365631.zip
(dired) <defgroup>: Add link to manual.
(dired-font-lock-keywords): Ad highlighting on unusual permissions. (dired-revert): Use dolist. (dired-mode-map): Add U binding. (dired-mode): Add font-lock-beginning-of-syntax-function. (dired-garbage-files-regexp): Make it a defcustom.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog88
-rw-r--r--lisp/dired.el82
2 files changed, 117 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 10a28d27c1d..dea317099bd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,59 @@
12004-03-23 Dave Love <fx@gnu.org>
2
3 * dired.el (dired) <defgroup>: Add link to manual.
4 (dired-font-lock-keywords): Ad highlighting on unusual permissions.
5 (dired-revert): Use dolist.
6 (dired-mode-map): Add U binding.
7 (dired-mode): Add font-lock-beginning-of-syntax-function.
8 (dired-garbage-files-regexp): Make it a defcustom.
9
102004-03-23 Stefan Monnier <monnier@iro.umontreal.ca>
11
12 * vc-arch.el (vc-arch-diff): Handle the special case where `newvers'
13 is equivalent to nil.
14 (vc-arch-diff3-rej-p): Be a bit more flexible in what we accept.
15 (vc-arch-mode-line-string): Accept `added' state.
16 (vc-arch-state): Use inode-sigs if available.
17 (vc-arch-add-tagline): Rename from vc-arch-add-tag.
18 Copy&delete existing id file if any. Fallback if uuidgen is absent.
19 (vc-arch-tagline-re): New var.
20 (vc-arch-file-source-p, vc-arch-file-id, vc-arch-tagging-method):
21 New functions.
22 (vc-arch-find-file-not-found-hook, vc-arch-register): New backend ops.
23 (vc-arch-registered): Try our best guess using vc-arch-file-source-p.
24
25 * vc-hooks.el (vc-default-find-file-not-found-hook): New fun.
26 (vc-file-not-found-hook): Use it.
27
28 * diff-mode.el (diff-default-read-only): Change default.
29 (diff-mode-hook): Make it a defcustom. Add some options.
30 (diff-mode-map): Bind diff-refine-hook.
31 (diff-yank-handler): New var.
32 (diff-yank-function): New fun.
33 (diff-font-lock-keywords): Use them.
34 (diff-end-of-file): Handle case where file-header looks like diff text.
35 (diff-hunk-kill): Adjust to "new" hunk-next behavior.
36 (diff-file-kill): Delete a subsequent empty line, if applicable.
37 (diff-hunk-file-names): New fun, extracted from diff-tell-file-name.
38 (diff-find-file-name): Use it.
39 (diff-tell-file-name): New command.
40 (diff-mode): Be careful with view-mode.
41 (diff-delete-if-empty, diff-delete-empty-files, diff-make-unified):
42 New functions, for use in diff-mode-hook.
43 (diff-find-source-location): Catch "regex too large" errors.
44 (diff-apply-hunk, diff-test-hunk): Go to old or new file.
45 (diff-refine-hunk): New command.
46
47 * smerge-mode.el (smerge-mode-menu): Fix activate pred for resolve.
48 (smerge-context-menu-map): Remove unused var.
49 (smerge-keep-all): Preserve markers.
50 (smerge-keep-n): New fun.
51 (smerge-keep-base, smerge-keep-other, smerge-keep-mine)
52 (smerge-keep-current, smerge-ediff): Use it.
53 (smerge-kill-current): Use it. Make it work on some 3-part conflicts.
54 (smerge-popup-context-menu): Also use context-menu on 3-part conflicts.
55 (smerge-resolve): Resolve trivial 3-part conflicts.
56
12004-03-23 Juri Linkov <juri@jurta.org> 572004-03-23 Juri Linkov <juri@jurta.org>
2 58
3 * man.el (Man-width): New var. 59 * man.el (Man-width): New var.
@@ -11,24 +67,16 @@
11 * woman.el (woman-fill-frame): Doc fix. 67 * woman.el (woman-fill-frame): Doc fix.
12 (woman-decode-region): Use window-width instead of frame-width. 68 (woman-decode-region): Use window-width instead of frame-width.
13 69
14 * abbrevlist.el (list-one-abbrev-table): Use window-width instead 70 * abbrevlist.el (list-one-abbrev-table):
15 of frame-width. 71 * descr-text.el (describe-char):
16 72 * international/mule-diag.el (describe-current-coding-system):
17 * descr-text.el (describe-char): Use window-width instead of 73 * international/quail.el (quail-insert-decode-map):
18 frame-width. 74 Use window-width instead of frame-width.
19
20 * international/mule-diag.el (describe-current-coding-system): Use
21 window-width instead of frame-width.
22
23 * international/quail.el (quail-insert-decode-map): Use
24 window-width instead of frame-width.
25 75
26 * jka-compr.el (jka-compr-compression-info-list): Add tbz and dz. 76 * jka-compr.el (jka-compr-compression-info-list): Add tbz and dz.
27 (jka-compr-mode-alist-additions): Add tbz. 77 (jka-compr-mode-alist-additions): Add tbz.
28 (jka-compr-write-region): Add error message for undefined 78 (jka-compr-write-region, jka-compr-insert-file-contents):
29 compress-program. 79 Add message for undefined compress-program.
30 (jka-compr-insert-file-contents): Add message for undefined
31 compress-program.
32 (jka-compr-write-region): Remove redundant var bindings. 80 (jka-compr-write-region): Remove redundant var bindings.
33 81
34 * dired-x.el (dired-guess-shell-alist-default): Add choices for 82 * dired-x.el (dired-guess-shell-alist-default): Add choices for
@@ -47,8 +95,7 @@
47 95
482004-03-22 Luc Teirlinck <teirllm@auburn.edu> 962004-03-22 Luc Teirlinck <teirllm@auburn.edu>
49 97
50 * autorevert.el (global-auto-revert-non-file-buffers): Expand doc 98 * autorevert.el (global-auto-revert-non-file-buffers): Expand docstring.
51 string.
52 (buffer-stale-function): New variable. 99 (buffer-stale-function): New variable.
53 (auto-revert-list-diff, auto-revert-dired-file-list) 100 (auto-revert-list-diff, auto-revert-dired-file-list)
54 (auto-revert-dired-changed-p, auto-revert-buffer-p): Delete. 101 (auto-revert-dired-changed-p, auto-revert-buffer-p): Delete.
@@ -56,8 +103,7 @@
56 functions. 103 functions.
57 (auto-revert-buffers): Delete call to auto-revert-buffer-p. 104 (auto-revert-buffers): Delete call to auto-revert-buffer-p.
58 105
59 * dired.el (dired-directory-changed-p, dired-buffer-stale-p): New 106 * dired.el (dired-directory-changed-p, dired-buffer-stale-p): New funs.
60 functions.
61 (dired-internal-noselect): Use dired-directory-changed-p. 107 (dired-internal-noselect): Use dired-directory-changed-p.
62 Eliminate revert messages. 108 Eliminate revert messages.
63 (dired-mode): Set buffer-stale-function to dired-buffer-stale-p. 109 (dired-mode): Set buffer-stale-function to dired-buffer-stale-p.
@@ -67,8 +113,8 @@
67 * international/characters.el: Setup syntaxes for more parentheses 113 * international/characters.el: Setup syntaxes for more parentheses
68 Unicode characters. 114 Unicode characters.
69 115
70 * international/mule-cmds.el (select-safe-coding-system): Merge 116 * international/mule-cmds.el (select-safe-coding-system):
71 coding-system and auto-cs before comparing them. 117 Merge coding-system and auto-cs before comparing them.
72 118
732004-03-22 Stefan Monnier <monnier@iro.umontreal.ca> 1192004-03-22 Stefan Monnier <monnier@iro.umontreal.ca>
74 120
diff --git a/lisp/dired.el b/lisp/dired.el
index 7b4b6974845..6e061dabeb7 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1,6 +1,6 @@
1;;; dired.el --- directory-browsing commands 1;;; dired.el --- directory-browsing commands
2 2
3;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001, 2003 3;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001, 03, 2004
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Sebastian Kremer <sk@thp.uni-koeln.de> 6;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
@@ -39,6 +39,7 @@
39 39
40(defgroup dired nil 40(defgroup dired nil
41 "Directory editing." 41 "Directory editing."
42 :link '(custom-manual "(emacs)Dired")
42 :group 'files) 43 :group 'files)
43 44
44(defgroup dired-mark nil 45(defgroup dired-mark nil
@@ -192,6 +193,7 @@ with the buffer narrowed to the listing."
192;; Note this can't simply be run inside function `dired-ls' as the hook 193;; Note this can't simply be run inside function `dired-ls' as the hook
193;; functions probably depend on the dired-subdir-alist to be OK. 194;; functions probably depend on the dired-subdir-alist to be OK.
194 195
196;; Fixme: This should use mailcap.
195(defcustom dired-view-command-alist 197(defcustom dired-view-command-alist
196 '(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s") 198 '(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s")
197 ("[.]pdf\\'" . "xpdf %s") 199 ("[.]pdf\\'" . "xpdf %s")
@@ -308,6 +310,16 @@ Subexpression 2 must end right before the \\n or \\r.")
308;;; "\\([-d]\\(....w....\\|.......w.\\)\\)") 310;;; "\\([-d]\\(....w....\\|.......w.\\)\\)")
309;;; '(1 font-lock-comment-face) 311;;; '(1 font-lock-comment-face)
310;;; '(".+" (dired-move-to-filename) nil (0 font-lock-comment-face))) 312;;; '(".+" (dired-move-to-filename) nil (0 font-lock-comment-face)))
313 ;; However, we don't need to highlight the file name, only the
314 ;; permissions, to win generally. -- fx.
315 ;; Fixme: we could also put text properties on the permission
316 ;; fields with keymaps to frob the permissions, somewhat a la XEmacs.
317 (list (concat dired-re-maybe-mark dired-re-inode-size
318 "[-d]....\\(w\\)..\\(w\\).") ; group writable
319 '(1 font-lock-warning-face))
320 (list (concat dired-re-maybe-mark dired-re-inode-size
321 "[-d]....\\(w\\)....") ; world writable
322 '(1 font-lock-comment-face))
311 ;; 323 ;;
312 ;; Subdirectories. 324 ;; Subdirectories.
313 (list dired-re-dir 325 (list dired-re-dir
@@ -327,12 +339,12 @@ Subexpression 2 must end right before the \\n or \\r.")
327 339
328;;; Macros must be defined before they are used, for the byte compiler. 340;;; Macros must be defined before they are used, for the byte compiler.
329 341
330;; Mark all files for which CONDITION evals to non-nil.
331;; CONDITION is evaluated on each line, with point at beginning of line.
332;; MSG is a noun phrase for the type of files being marked.
333;; It should end with a noun that can be pluralized by adding `s'.
334;; Return value is the number of files marked, or nil if none were marked.
335(defmacro dired-mark-if (predicate msg) 342(defmacro dired-mark-if (predicate msg)
343 "Mark all files for which PREDICATE evals to non-nil.
344PREDICATE is evaluated on each line, with point at beginning of line.
345MSG is a noun phrase for the type of files being marked.
346It should end with a noun that can be pluralized by adding `s'.
347Return value is the number of files marked, or nil if none were marked."
336 `(let (buffer-read-only count) 348 `(let (buffer-read-only count)
337 (save-excursion 349 (save-excursion
338 (setq count 0) 350 (setq count 0)
@@ -634,10 +646,12 @@ for a remote directory. This feature is used by Auto Revert Mode."
634 646
635;; Read in a new dired buffer 647;; Read in a new dired buffer
636 648
637;; dired-readin differs from dired-insert-subdir in that it accepts
638;; wildcards, erases the buffer, and builds the subdir-alist anew
639;; (including making it buffer-local and clearing it first).
640(defun dired-readin () 649(defun dired-readin ()
650 "Read in a new dired buffer.
651Differs from dired-insert-subdir in that it accepts
652wildcards, erases the buffer, and builds the subdir-alist anew
653\(including making it buffer-local and clearing it first)."
654
641 ;; default-directory and dired-actual-switches must be buffer-local 655 ;; default-directory and dired-actual-switches must be buffer-local
642 ;; and initialized by now. 656 ;; and initialized by now.
643 (let (dirname) 657 (let (dirname)
@@ -756,6 +770,7 @@ If HDR is non-nil, insert a header line with the directory name."
756 770
757;; Make the file names highlight when the mouse is on them. 771;; Make the file names highlight when the mouse is on them.
758(defun dired-insert-set-properties (beg end) 772(defun dired-insert-set-properties (beg end)
773 "Make the file names highlight when the mouse is on them."
759 (save-excursion 774 (save-excursion
760 (goto-char beg) 775 (goto-char beg)
761 (while (< (point) end) 776 (while (< (point) end)
@@ -774,10 +789,10 @@ If HDR is non-nil, insert a header line with the directory name."
774;; Reverting a dired buffer 789;; Reverting a dired buffer
775 790
776(defun dired-revert (&optional arg noconfirm) 791(defun dired-revert (&optional arg noconfirm)
777 ;; Reread the dired buffer. Must also be called after 792 "Reread the dired buffer.
778 ;; dired-actual-switches have changed. 793Must also be called after dired-actual-switches have changed.
779 ;; Should not fail even on completely garbaged buffers. 794Should not fail even on completely garbaged buffers.
780 ;; Preserves old cursor, marks/flags, hidden-p. 795Preserves old cursor, marks/flags, hidden-p."
781 (widen) ; just in case user narrowed 796 (widen) ; just in case user narrowed
782 (let ((opoint (point)) 797 (let ((opoint (point))
783 (ofile (dired-get-filename nil t)) 798 (ofile (dired-get-filename nil t))
@@ -804,10 +819,9 @@ If HDR is non-nil, insert a header line with the directory name."
804 (goto-char opoint)) ; was before 819 (goto-char opoint)) ; was before
805 (dired-move-to-filename) 820 (dired-move-to-filename)
806 (save-excursion ; hide subdirs that were hidden 821 (save-excursion ; hide subdirs that were hidden
807 (mapcar (function (lambda (dir) 822 (dolist (dir hidden-subdirs)
808 (if (dired-goto-subdir dir) 823 (if (dired-goto-subdir dir)
809 (dired-hide-subdir 1)))) 824 (dired-hide-subdir 1)))))
810 hidden-subdirs)))
811 ;; outside of the let scope 825 ;; outside of the let scope
812;;; Might as well not override the user if the user changed this. 826;;; Might as well not override the user if the user changed this.
813;;; (setq buffer-read-only t) 827;;; (setq buffer-read-only t)
@@ -817,7 +831,7 @@ If HDR is non-nil, insert a header line with the directory name."
817;; Some of these are also used when inserting subdirs. 831;; Some of these are also used when inserting subdirs.
818 832
819(defun dired-remember-marks (beg end) 833(defun dired-remember-marks (beg end)
820 ;; Return alist of files and their marks, from BEG to END. 834 "Return alist of files and their marks, from BEG to END."
821 (if selective-display ; must unhide to make this work. 835 (if selective-display ; must unhide to make this work.
822 (let (buffer-read-only) 836 (let (buffer-read-only)
823 (subst-char-in-region beg end ?\r ?\n))) 837 (subst-char-in-region beg end ?\r ?\n)))
@@ -830,9 +844,9 @@ If HDR is non-nil, insert a header line with the directory name."
830 alist (cons (cons fil chr) alist))))) 844 alist (cons (cons fil chr) alist)))))
831 alist)) 845 alist))
832 846
833;; Mark all files remembered in ALIST.
834;; Each element of ALIST looks like (FILE . MARKERCHAR).
835(defun dired-mark-remembered (alist) 847(defun dired-mark-remembered (alist)
848 "Mark all files remembered in ALIST.
849Each element of ALIST looks like (FILE . MARKERCHAR)."
836 (let (elt fil chr) 850 (let (elt fil chr)
837 (while alist 851 (while alist
838 (setq elt (car alist) 852 (setq elt (car alist)
@@ -845,8 +859,8 @@ If HDR is non-nil, insert a header line with the directory name."
845 (delete-char 1) 859 (delete-char 1)
846 (insert chr)))))) 860 (insert chr))))))
847 861
848;; Return a list of names of subdirs currently hidden.
849(defun dired-remember-hidden () 862(defun dired-remember-hidden ()
863 "Return a list of names of subdirs currently hidden."
850 (let ((l dired-subdir-alist) dir pos result) 864 (let ((l dired-subdir-alist) dir pos result)
851 (while l 865 (while l
852 (setq dir (car (car l)) 866 (setq dir (car (car l))
@@ -858,9 +872,9 @@ If HDR is non-nil, insert a header line with the directory name."
858 (setq result (cons dir result)))) 872 (setq result (cons dir result))))
859 result)) 873 result))
860 874
861;; Try to insert all subdirs that were displayed before,
862;; according to the former subdir alist OLD-SUBDIR-ALIST.
863(defun dired-insert-old-subdirs (old-subdir-alist) 875(defun dired-insert-old-subdirs (old-subdir-alist)
876 "Try to insert all subdirs that were displayed before.
877Do so according to the former subdir alist OLD-SUBDIR-ALIST."
864 (or (string-match "R" dired-actual-switches) 878 (or (string-match "R" dired-actual-switches)
865 (let (elt dir) 879 (let (elt dir)
866 (while old-subdir-alist 880 (while old-subdir-alist
@@ -873,20 +887,17 @@ If HDR is non-nil, insert a header line with the directory name."
873 (dired-insert-subdir dir)) 887 (dired-insert-subdir dir))
874 (error nil)))))) 888 (error nil))))))
875 889
876;; Remove directory DIR from any directory cache.
877(defun dired-uncache (dir) 890(defun dired-uncache (dir)
891 "Remove directory DIR from any directory cache."
878 (let ((handler (find-file-name-handler dir 'dired-uncache))) 892 (let ((handler (find-file-name-handler dir 'dired-uncache)))
879 (if handler 893 (if handler
880 (funcall handler 'dired-uncache dir)))) 894 (funcall handler 'dired-uncache dir))))
881 895
882;; dired mode key bindings and initialization 896;; dired mode key bindings and initialization
883 897
884(defvar dired-mode-map nil "Local keymap for dired-mode buffers.") 898(defvar dired-mode-map
885(if dired-mode-map
886 nil
887 ;; This looks ugly when substitute-command-keys uses C-d instead d: 899 ;; This looks ugly when substitute-command-keys uses C-d instead d:
888 ;; (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion) 900 ;; (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
889
890 (let ((map (make-keymap))) 901 (let ((map (make-keymap)))
891 (suppress-keymap map) 902 (suppress-keymap map)
892 (define-key map [mouse-2] 'dired-mouse-find-file-other-window) 903 (define-key map [mouse-2] 'dired-mouse-find-file-other-window)
@@ -951,6 +962,7 @@ If HDR is non-nil, insert a header line with the directory name."
951 (define-key map "*u" 'dired-unmark) 962 (define-key map "*u" 'dired-unmark)
952 (define-key map "*?" 'dired-unmark-all-files) 963 (define-key map "*?" 'dired-unmark-all-files)
953 (define-key map "*!" 'dired-unmark-all-marks) 964 (define-key map "*!" 'dired-unmark-all-marks)
965 (define-key map "U" 'dired-unmark-all-marks)
954 (define-key map "*\177" 'dired-unmark-backward) 966 (define-key map "*\177" 'dired-unmark-backward)
955 (define-key map "*\C-n" 'dired-next-marked-file) 967 (define-key map "*\C-n" 'dired-next-marked-file)
956 (define-key map "*\C-p" 'dired-prev-marked-file) 968 (define-key map "*\C-p" 'dired-prev-marked-file)
@@ -1210,7 +1222,8 @@ If HDR is non-nil, insert a header line with the directory name."
1210 '(menu-item "Copy to..." dired-do-copy 1222 '(menu-item "Copy to..." dired-do-copy
1211 :help "Copy current file or all marked files")) 1223 :help "Copy current file or all marked files"))
1212 1224
1213 (setq dired-mode-map map))) 1225 map)
1226 "Local keymap for `dired-mode' buffers.")
1214 1227
1215;; Dired mode is suitable only for specially formatted data. 1228;; Dired mode is suitable only for specially formatted data.
1216(put 'dired-mode 'mode-class 'special) 1229(put 'dired-mode 'mode-class 'special)
@@ -1308,7 +1321,8 @@ Keybindings:
1308 dired-directory))) 1321 dired-directory)))
1309 (set (make-local-variable 'dired-actual-switches) 1322 (set (make-local-variable 'dired-actual-switches)
1310 (or switches dired-listing-switches)) 1323 (or switches dired-listing-switches))
1311 (set (make-local-variable 'font-lock-defaults) '(dired-font-lock-keywords t)) 1324 (set (make-local-variable 'font-lock-defaults)
1325 '(dired-font-lock-keywords t nil nil beginning-of-line))
1312 (dired-sort-other dired-actual-switches t) 1326 (dired-sort-other dired-actual-switches t)
1313 (run-hooks 'dired-mode-hook) 1327 (run-hooks 'dired-mode-hook)
1314 (when (featurep 'x-dnd) 1328 (when (featurep 'x-dnd)
@@ -2635,11 +2649,15 @@ A prefix argument says to unflag those files instead."
2635 (file-name-nondirectory fn))))) 2649 (file-name-nondirectory fn)))))
2636 "auto save file"))) 2650 "auto save file")))
2637 2651
2638(defvar dired-garbage-files-regexp 2652(defcustom dired-garbage-files-regexp
2653 ;; `log' here is dubious, ssince it's typically used for useful log
2654 ;; files, not just TeX stuff. -- fx
2639 (concat (regexp-opt 2655 (concat (regexp-opt
2640 '(".log" ".toc" ".dvi" ".bak" ".orig" ".rej" ".aux")) 2656 '(".log" ".toc" ".dvi" ".bak" ".orig" ".rej" ".aux"))
2641 "\\'") 2657 "\\'")
2642 "*Regular expression to match \"garbage\" files for `dired-flag-garbage-files'.") 2658 "Regular expression to match \"garbage\" files for `dired-flag-garbage-files'."
2659 :type 'regexp
2660 :group 'dired)
2643 2661
2644(defun dired-flag-garbage-files () 2662(defun dired-flag-garbage-files ()
2645 "Flag for deletion all files that match `dired-garbage-files-regexp'." 2663 "Flag for deletion all files that match `dired-garbage-files-regexp'."