Commit d7aed37c authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(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.
parent e5d31f9f
2004-03-23 Dave Love <fx@gnu.org>
* dired.el (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.
2004-03-23 Stefan Monnier <monnier@iro.umontreal.ca>
* vc-arch.el (vc-arch-diff): Handle the special case where `newvers'
is equivalent to nil.
(vc-arch-diff3-rej-p): Be a bit more flexible in what we accept.
(vc-arch-mode-line-string): Accept `added' state.
(vc-arch-state): Use inode-sigs if available.
(vc-arch-add-tagline): Rename from vc-arch-add-tag.
Copy&delete existing id file if any. Fallback if uuidgen is absent.
(vc-arch-tagline-re): New var.
(vc-arch-file-source-p, vc-arch-file-id, vc-arch-tagging-method):
New functions.
(vc-arch-find-file-not-found-hook, vc-arch-register): New backend ops.
(vc-arch-registered): Try our best guess using vc-arch-file-source-p.
* vc-hooks.el (vc-default-find-file-not-found-hook): New fun.
(vc-file-not-found-hook): Use it.
* diff-mode.el (diff-default-read-only): Change default.
(diff-mode-hook): Make it a defcustom. Add some options.
(diff-mode-map): Bind diff-refine-hook.
(diff-yank-handler): New var.
(diff-yank-function): New fun.
(diff-font-lock-keywords): Use them.
(diff-end-of-file): Handle case where file-header looks like diff text.
(diff-hunk-kill): Adjust to "new" hunk-next behavior.
(diff-file-kill): Delete a subsequent empty line, if applicable.
(diff-hunk-file-names): New fun, extracted from diff-tell-file-name.
(diff-find-file-name): Use it.
(diff-tell-file-name): New command.
(diff-mode): Be careful with view-mode.
(diff-delete-if-empty, diff-delete-empty-files, diff-make-unified):
New functions, for use in diff-mode-hook.
(diff-find-source-location): Catch "regex too large" errors.
(diff-apply-hunk, diff-test-hunk): Go to old or new file.
(diff-refine-hunk): New command.
* smerge-mode.el (smerge-mode-menu): Fix activate pred for resolve.
(smerge-context-menu-map): Remove unused var.
(smerge-keep-all): Preserve markers.
(smerge-keep-n): New fun.
(smerge-keep-base, smerge-keep-other, smerge-keep-mine)
(smerge-keep-current, smerge-ediff): Use it.
(smerge-kill-current): Use it. Make it work on some 3-part conflicts.
(smerge-popup-context-menu): Also use context-menu on 3-part conflicts.
(smerge-resolve): Resolve trivial 3-part conflicts.
2004-03-23 Juri Linkov <juri@jurta.org>
* man.el (Man-width): New var.
......@@ -11,24 +67,16 @@
* woman.el (woman-fill-frame): Doc fix.
(woman-decode-region): Use window-width instead of frame-width.
* abbrevlist.el (list-one-abbrev-table): Use window-width instead
of frame-width.
* descr-text.el (describe-char): Use window-width instead of
frame-width.
* international/mule-diag.el (describe-current-coding-system): Use
window-width instead of frame-width.
* international/quail.el (quail-insert-decode-map): Use
window-width instead of frame-width.
* abbrevlist.el (list-one-abbrev-table):
* descr-text.el (describe-char):
* international/mule-diag.el (describe-current-coding-system):
* international/quail.el (quail-insert-decode-map):
Use window-width instead of frame-width.
* jka-compr.el (jka-compr-compression-info-list): Add tbz and dz.
(jka-compr-mode-alist-additions): Add tbz.
(jka-compr-write-region): Add error message for undefined
compress-program.
(jka-compr-insert-file-contents): Add message for undefined
compress-program.
(jka-compr-write-region, jka-compr-insert-file-contents):
Add message for undefined compress-program.
(jka-compr-write-region): Remove redundant var bindings.
* dired-x.el (dired-guess-shell-alist-default): Add choices for
......@@ -47,8 +95,7 @@
2004-03-22 Luc Teirlinck <teirllm@auburn.edu>
* autorevert.el (global-auto-revert-non-file-buffers): Expand doc
string.
* autorevert.el (global-auto-revert-non-file-buffers): Expand docstring.
(buffer-stale-function): New variable.
(auto-revert-list-diff, auto-revert-dired-file-list)
(auto-revert-dired-changed-p, auto-revert-buffer-p): Delete.
......@@ -56,8 +103,7 @@
functions.
(auto-revert-buffers): Delete call to auto-revert-buffer-p.
* dired.el (dired-directory-changed-p, dired-buffer-stale-p): New
functions.
* dired.el (dired-directory-changed-p, dired-buffer-stale-p): New funs.
(dired-internal-noselect): Use dired-directory-changed-p.
Eliminate revert messages.
(dired-mode): Set buffer-stale-function to dired-buffer-stale-p.
......@@ -67,8 +113,8 @@
* international/characters.el: Setup syntaxes for more parentheses
Unicode characters.
* international/mule-cmds.el (select-safe-coding-system): Merge
coding-system and auto-cs before comparing them.
* international/mule-cmds.el (select-safe-coding-system):
Merge coding-system and auto-cs before comparing them.
2004-03-22 Stefan Monnier <monnier@iro.umontreal.ca>
......
;;; dired.el --- directory-browsing commands
;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001, 2003
;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 1997, 2000, 2001, 03, 2004
;; Free Software Foundation, Inc.
;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
......@@ -39,6 +39,7 @@
(defgroup dired nil
"Directory editing."
:link '(custom-manual "(emacs)Dired")
:group 'files)
(defgroup dired-mark nil
......@@ -192,6 +193,7 @@ with the buffer narrowed to the listing."
;; Note this can't simply be run inside function `dired-ls' as the hook
;; functions probably depend on the dired-subdir-alist to be OK.
;; Fixme: This should use mailcap.
(defcustom dired-view-command-alist
'(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s")
("[.]pdf\\'" . "xpdf %s")
......@@ -308,6 +310,16 @@ Subexpression 2 must end right before the \\n or \\r.")
;;; "\\([-d]\\(....w....\\|.......w.\\)\\)")
;;; '(1 font-lock-comment-face)
;;; '(".+" (dired-move-to-filename) nil (0 font-lock-comment-face)))
;; However, we don't need to highlight the file name, only the
;; permissions, to win generally. -- fx.
;; Fixme: we could also put text properties on the permission
;; fields with keymaps to frob the permissions, somewhat a la XEmacs.
(list (concat dired-re-maybe-mark dired-re-inode-size
"[-d]....\\(w\\)..\\(w\\).") ; group writable
'(1 font-lock-warning-face))
(list (concat dired-re-maybe-mark dired-re-inode-size
"[-d]....\\(w\\)....") ; world writable
'(1 font-lock-comment-face))
;;
;; Subdirectories.
(list dired-re-dir
......@@ -327,12 +339,12 @@ Subexpression 2 must end right before the \\n or \\r.")
;;; Macros must be defined before they are used, for the byte compiler.
;; Mark all files for which CONDITION evals to non-nil.
;; CONDITION is evaluated on each line, with point at beginning of line.
;; MSG is a noun phrase for the type of files being marked.
;; It should end with a noun that can be pluralized by adding `s'.
;; Return value is the number of files marked, or nil if none were marked.
(defmacro dired-mark-if (predicate msg)
"Mark all files for which PREDICATE evals to non-nil.
PREDICATE is evaluated on each line, with point at beginning of line.
MSG is a noun phrase for the type of files being marked.
It should end with a noun that can be pluralized by adding `s'.
Return value is the number of files marked, or nil if none were marked."
`(let (buffer-read-only count)
(save-excursion
(setq count 0)
......@@ -634,10 +646,12 @@ for a remote directory. This feature is used by Auto Revert Mode."
;; Read in a new dired buffer
;; dired-readin differs from dired-insert-subdir in that it accepts
;; wildcards, erases the buffer, and builds the subdir-alist anew
;; (including making it buffer-local and clearing it first).
(defun dired-readin ()
"Read in a new dired buffer.
Differs from dired-insert-subdir in that it accepts
wildcards, erases the buffer, and builds the subdir-alist anew
\(including making it buffer-local and clearing it first)."
;; default-directory and dired-actual-switches must be buffer-local
;; and initialized by now.
(let (dirname)
......@@ -756,6 +770,7 @@ If HDR is non-nil, insert a header line with the directory name."
;; Make the file names highlight when the mouse is on them.
(defun dired-insert-set-properties (beg end)
"Make the file names highlight when the mouse is on them."
(save-excursion
(goto-char beg)
(while (< (point) end)
......@@ -774,10 +789,10 @@ If HDR is non-nil, insert a header line with the directory name."
;; Reverting a dired buffer
(defun dired-revert (&optional arg noconfirm)
;; Reread the dired buffer. Must also be called after
;; dired-actual-switches have changed.
;; Should not fail even on completely garbaged buffers.
;; Preserves old cursor, marks/flags, hidden-p.
"Reread the dired buffer.
Must also be called after dired-actual-switches have changed.
Should not fail even on completely garbaged buffers.
Preserves old cursor, marks/flags, hidden-p."
(widen) ; just in case user narrowed
(let ((opoint (point))
(ofile (dired-get-filename nil t))
......@@ -804,10 +819,9 @@ If HDR is non-nil, insert a header line with the directory name."
(goto-char opoint)) ; was before
(dired-move-to-filename)
(save-excursion ; hide subdirs that were hidden
(mapcar (function (lambda (dir)
(if (dired-goto-subdir dir)
(dired-hide-subdir 1))))
hidden-subdirs)))
(dolist (dir hidden-subdirs)
(if (dired-goto-subdir dir)
(dired-hide-subdir 1)))))
;; outside of the let scope
;;; Might as well not override the user if the user changed this.
;;; (setq buffer-read-only t)
......@@ -817,7 +831,7 @@ If HDR is non-nil, insert a header line with the directory name."
;; Some of these are also used when inserting subdirs.
(defun dired-remember-marks (beg end)
;; Return alist of files and their marks, from BEG to END.
"Return alist of files and their marks, from BEG to END."
(if selective-display ; must unhide to make this work.
(let (buffer-read-only)
(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."
alist (cons (cons fil chr) alist)))))
alist))
;; Mark all files remembered in ALIST.
;; Each element of ALIST looks like (FILE . MARKERCHAR).
(defun dired-mark-remembered (alist)
"Mark all files remembered in ALIST.
Each element of ALIST looks like (FILE . MARKERCHAR)."
(let (elt fil chr)
(while alist
(setq elt (car alist)
......@@ -845,8 +859,8 @@ If HDR is non-nil, insert a header line with the directory name."
(delete-char 1)
(insert chr))))))
;; Return a list of names of subdirs currently hidden.
(defun dired-remember-hidden ()
"Return a list of names of subdirs currently hidden."
(let ((l dired-subdir-alist) dir pos result)
(while l
(setq dir (car (car l))
......@@ -858,9 +872,9 @@ If HDR is non-nil, insert a header line with the directory name."
(setq result (cons dir result))))
result))
;; Try to insert all subdirs that were displayed before,
;; according to the former subdir alist OLD-SUBDIR-ALIST.
(defun dired-insert-old-subdirs (old-subdir-alist)
"Try to insert all subdirs that were displayed before.
Do so according to the former subdir alist OLD-SUBDIR-ALIST."
(or (string-match "R" dired-actual-switches)
(let (elt dir)
(while old-subdir-alist
......@@ -873,20 +887,17 @@ If HDR is non-nil, insert a header line with the directory name."
(dired-insert-subdir dir))
(error nil))))))
;; Remove directory DIR from any directory cache.
(defun dired-uncache (dir)
"Remove directory DIR from any directory cache."
(let ((handler (find-file-name-handler dir 'dired-uncache)))
(if handler
(funcall handler 'dired-uncache dir))))
;; dired mode key bindings and initialization
(defvar dired-mode-map nil "Local keymap for dired-mode buffers.")
(if dired-mode-map
nil
(defvar dired-mode-map
;; This looks ugly when substitute-command-keys uses C-d instead d:
;; (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
(let ((map (make-keymap)))
(suppress-keymap map)
(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."
(define-key map "*u" 'dired-unmark)
(define-key map "*?" 'dired-unmark-all-files)
(define-key map "*!" 'dired-unmark-all-marks)
(define-key map "U" 'dired-unmark-all-marks)
(define-key map "*\177" 'dired-unmark-backward)
(define-key map "*\C-n" 'dired-next-marked-file)
(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."
'(menu-item "Copy to..." dired-do-copy
:help "Copy current file or all marked files"))
(setq dired-mode-map map)))
map)
"Local keymap for `dired-mode' buffers.")
;; Dired mode is suitable only for specially formatted data.
(put 'dired-mode 'mode-class 'special)
......@@ -1308,7 +1321,8 @@ Keybindings:
dired-directory)))
(set (make-local-variable 'dired-actual-switches)
(or switches dired-listing-switches))
(set (make-local-variable 'font-lock-defaults) '(dired-font-lock-keywords t))
(set (make-local-variable 'font-lock-defaults)
'(dired-font-lock-keywords t nil nil beginning-of-line))
(dired-sort-other dired-actual-switches t)
(run-hooks 'dired-mode-hook)
(when (featurep 'x-dnd)
......@@ -2635,11 +2649,15 @@ A prefix argument says to unflag those files instead."
(file-name-nondirectory fn)))))
"auto save file")))
(defvar dired-garbage-files-regexp
(defcustom dired-garbage-files-regexp
;; `log' here is dubious, ssince it's typically used for useful log
;; files, not just TeX stuff. -- fx
(concat (regexp-opt
'(".log" ".toc" ".dvi" ".bak" ".orig" ".rej" ".aux"))
"\\'")
"*Regular expression to match \"garbage\" files for `dired-flag-garbage-files'.")
"Regular expression to match \"garbage\" files for `dired-flag-garbage-files'."
:type 'regexp
:group 'dired)
(defun dired-flag-garbage-files ()
"Flag for deletion all files that match `dired-garbage-files-regexp'."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment