diff options
| author | Glenn Morris | 2011-02-16 00:32:30 -0800 |
|---|---|---|
| committer | Glenn Morris | 2011-02-16 00:32:30 -0800 |
| commit | da5e0ce4d6e000b1bc493cb20ce0cc9ecb1ba244 (patch) | |
| tree | c7c8ffc0f78212cf0cda1676fd9d54e5d7a034b1 | |
| parent | 1f5d53eb532df40b6c41d25a8b1eaf4ccf69d518 (diff) | |
| download | emacs-da5e0ce4d6e000b1bc493cb20ce0cc9ecb1ba244.tar.gz emacs-da5e0ce4d6e000b1bc493cb20ce0cc9ecb1ba244.zip | |
More dired-x cleanup.
* lisp/dired-x.el (dired-bind-jump, dired-bind-man, dired-bind-info):
Doc fixes. Add :set property, replacing top-level calls.
(dired-vm-read-only-folders, dired-vm): Doc fix (drop v. old VM 4).
(dired-guess-shell-gnutar): Test tar version rather than system-type.
(dired-extra-startup, dired-man, dired-info): Doc fixes.
(dired-clean-up-after-deletion): Use when and dolist.
(dired-jump): Use unless and when.
(dired-virtual): Use line-end-position.
(dired-default-directory-alist): Rename from default-directory-alist.
(dired-default-directory): Update for above name change.
(dired-vm): Drop VM < 5 and simplify.
(dired-buffer-more-recently-used-p): Rewrite.
(dired-filename-at-point): Use when and or.
(dired-x-read-filename-at-point): Rename from read-filename-at-point.
Update callers.
* doc/misc/dired-x.texi (Multiple Dired Directories): Update for rename of
default-directory-alist.
(Miscellaneous Commands): No longer mention very old VM version 4.
| -rw-r--r-- | doc/misc/ChangeLog | 9 | ||||
| -rw-r--r-- | doc/misc/dired-x.texi | 15 | ||||
| -rw-r--r-- | lisp/ChangeLog | 18 | ||||
| -rw-r--r-- | lisp/dired-x.el | 204 |
4 files changed, 130 insertions, 116 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 34096144066..fe589bb6fdd 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-02-16 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * dired-x.texi (Multiple Dired Directories): Update for rename of | ||
| 4 | default-directory-alist. | ||
| 5 | (Miscellaneous Commands): No longer mention very old VM version 4. | ||
| 6 | |||
| 1 | 2011-02-15 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2011-02-15 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Merge from gnulib. | 9 | Merge from gnulib. |
| @@ -5,7 +11,8 @@ | |||
| 5 | 11 | ||
| 6 | 2011-02-14 Teodor Zlatanov <tzz@lifelogs.com> | 12 | 2011-02-14 Teodor Zlatanov <tzz@lifelogs.com> |
| 7 | 13 | ||
| 8 | * auth.texi (Help for users): Login collection is "Login" and not "login". | 14 | * auth.texi (Help for users): |
| 15 | Login collection is "Login" and not "login". | ||
| 9 | 16 | ||
| 10 | 2011-02-13 Michael Albinus <michael.albinus@gmx.de> | 17 | 2011-02-13 Michael Albinus <michael.albinus@gmx.de> |
| 11 | 18 | ||
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index 9ae569c151c..a1e7e0ae9fc 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi | |||
| @@ -978,8 +978,8 @@ A general mechanism is provided for special handling of the working | |||
| 978 | directory in special major modes: | 978 | directory in special major modes: |
| 979 | 979 | ||
| 980 | @table @code | 980 | @table @code |
| 981 | @item default-directory-alist | 981 | @item dired-default-directory-alist |
| 982 | @vindex default-directory-alist | 982 | @vindex dired-default-directory-alist |
| 983 | Default: @code{((dired-mode . (dired-current-directory)))} | 983 | Default: @code{((dired-mode . (dired-current-directory)))} |
| 984 | 984 | ||
| 985 | Alist of major modes and their notion of @code{default-directory}, as a | 985 | Alist of major modes and their notion of @code{default-directory}, as a |
| @@ -990,7 +990,7 @@ in favor of @code{default-directory}. | |||
| 990 | @findex dired-default-directory | 990 | @findex dired-default-directory |
| 991 | Use this function like you would use the variable | 991 | Use this function like you would use the variable |
| 992 | @code{default-directory}, except that @code{dired-default-directory} | 992 | @code{default-directory}, except that @code{dired-default-directory} |
| 993 | also consults the variable @code{default-directory-alist}. | 993 | also consults the variable @code{dired-default-directory-alist}. |
| 994 | @end table | 994 | @end table |
| 995 | 995 | ||
| 996 | @node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top | 996 | @node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top |
| @@ -1141,13 +1141,12 @@ file (assumed to be a UNIX mail folder). | |||
| 1141 | 1141 | ||
| 1142 | @vindex dired-vm-read-only-folders | 1142 | @vindex dired-vm-read-only-folders |
| 1143 | If you give this command a prefix argument, it will visit the folder | 1143 | If you give this command a prefix argument, it will visit the folder |
| 1144 | read-only. This only works in VM 5, not VM 4. | 1144 | read-only. |
| 1145 | 1145 | ||
| 1146 | If the variable @code{dired-vm-read-only-folders} is @code{t}, | 1146 | If the variable @code{dired-vm-read-only-folders} is @code{t}, |
| 1147 | @code{dired-vm} will | 1147 | @code{dired-vm} will visit all folders read-only. If it is neither |
| 1148 | visit all folders read-only. If it is neither @code{nil} nor @code{t}, e.g., | 1148 | @code{nil} nor @code{t}, e.g., the symbol @code{if-file-read-only}, only |
| 1149 | the symbol @code{if-file-read-only}, only files not writable by you are | 1149 | files not writable by you are visited read-only. |
| 1150 | visited read-only. This is the recommended value if you run VM 5. | ||
| 1151 | 1150 | ||
| 1152 | @vindex dired-bind-vm | 1151 | @vindex dired-bind-vm |
| 1153 | If the variable @code{dired-bind-vm} is @code{t}, @code{dired-vm} will be bound | 1152 | If the variable @code{dired-bind-vm} is @code{t}, @code{dired-vm} will be bound |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a9adce5a3f5..10ca65a55a9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2011-02-16 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * dired-x.el (dired-bind-jump, dired-bind-man, dired-bind-info): | ||
| 4 | Doc fixes. Add :set property, replacing top-level calls. | ||
| 5 | (dired-vm-read-only-folders, dired-vm): Doc fix (drop v. old VM 4). | ||
| 6 | (dired-guess-shell-gnutar): Test tar version rather than system-type. | ||
| 7 | (dired-extra-startup, dired-man, dired-info): Doc fixes. | ||
| 8 | (dired-clean-up-after-deletion): Use when and dolist. | ||
| 9 | (dired-jump): Use unless and when. | ||
| 10 | (dired-virtual): Use line-end-position. | ||
| 11 | (dired-default-directory-alist): Rename from default-directory-alist. | ||
| 12 | (dired-default-directory): Update for above name change. | ||
| 13 | (dired-vm): Drop VM < 5 and simplify. | ||
| 14 | (dired-buffer-more-recently-used-p): Rewrite. | ||
| 15 | (dired-filename-at-point): Use when and or. | ||
| 16 | (dired-x-read-filename-at-point): Rename from read-filename-at-point. | ||
| 17 | Update callers. | ||
| 18 | |||
| 1 | 2011-02-15 Glenn Morris <rgm@gnu.org> | 19 | 2011-02-15 Glenn Morris <rgm@gnu.org> |
| 2 | 20 | ||
| 3 | * dired-x.el: Use easymenu for menu items. Fix item capitalization. | 21 | * dired-x.el: Use easymenu for menu items. Fix item capitalization. |
diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 95381ccdc0c..fa064898ed4 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | ;; | 32 | ;; |
| 33 | ;; (add-hook 'dired-load-hook | 33 | ;; (add-hook 'dired-load-hook |
| 34 | ;; (lambda () | 34 | ;; (lambda () |
| 35 | ;; (require 'dired-x) | 35 | ;; (load "dired-x") |
| 36 | ;; ;; Set global variables here. For example: | 36 | ;; ;; Set global variables here. For example: |
| 37 | ;; ;; (setq dired-guess-shell-gnutar "gtar") | 37 | ;; ;; (setq dired-guess-shell-gnutar "gtar") |
| 38 | ;; )) | 38 | ;; )) |
| @@ -79,7 +79,6 @@ | |||
| 79 | 79 | ||
| 80 | (defcustom dired-bind-vm nil | 80 | (defcustom dired-bind-vm nil |
| 81 | "Non-nil means \"V\" runs `dired-vm', otherwise \"V\" runs `dired-rmail'. | 81 | "Non-nil means \"V\" runs `dired-vm', otherwise \"V\" runs `dired-rmail'. |
| 82 | |||
| 83 | RMAIL files in the old Babyl format (used before before Emacs 23.1) | 82 | RMAIL files in the old Babyl format (used before before Emacs 23.1) |
| 84 | contain \"-*- rmail -*-\" at the top, so `dired-find-file' | 83 | contain \"-*- rmail -*-\" at the top, so `dired-find-file' |
| 85 | will run `rmail' on these files. New RMAIL files use the standard | 84 | will run `rmail' on these files. New RMAIL files use the standard |
| @@ -88,26 +87,49 @@ mbox format, and so cannot be distinguished in this way." | |||
| 88 | :group 'dired-keys) | 87 | :group 'dired-keys) |
| 89 | 88 | ||
| 90 | (defcustom dired-bind-jump t | 89 | (defcustom dired-bind-jump t |
| 91 | "Non-nil means bind `dired-jump' to C-x C-j, otherwise do not." | 90 | "Non-nil means bind `dired-jump' to C-x C-j, otherwise do not. |
| 91 | Setting this variable directly after dired-x is loaded has no effect - | ||
| 92 | use \\[customize]." | ||
| 92 | :type 'boolean | 93 | :type 'boolean |
| 94 | :set (lambda (sym val) | ||
| 95 | (if (set sym val) | ||
| 96 | (progn | ||
| 97 | (define-key global-map "\C-x\C-j" 'dired-jump) | ||
| 98 | (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)) | ||
| 99 | (if (eq 'dired-jump (lookup-key global-map "\C-x\C-j")) | ||
| 100 | (define-key global-map "\C-x\C-j" nil)) | ||
| 101 | (if (eq 'dired-jump-other-window (lookup-key global-map "\C-x4\C-j")) | ||
| 102 | (define-key global-map "\C-x4\C-j" nil)))) | ||
| 93 | :group 'dired-keys) | 103 | :group 'dired-keys) |
| 94 | 104 | ||
| 95 | (defcustom dired-bind-man t | 105 | (defcustom dired-bind-man t |
| 96 | "Non-nil means bind `dired-man' to \"N\" in dired-mode, otherwise do not." | 106 | "Non-nil means bind `dired-man' to \"N\" in dired-mode, otherwise do not. |
| 107 | Setting this variable directly after dired-x is loaded has no effect - | ||
| 108 | use \\[customize]." | ||
| 97 | :type 'boolean | 109 | :type 'boolean |
| 110 | :set (lambda (sym val) | ||
| 111 | (if (set sym val) | ||
| 112 | (define-key dired-mode-map "N" 'dired-man) | ||
| 113 | (if (eq 'dired-man (lookup-key dired-mode-map "N")) | ||
| 114 | (define-key dired-mode-map "N" nil)))) | ||
| 98 | :group 'dired-keys) | 115 | :group 'dired-keys) |
| 99 | 116 | ||
| 100 | (defcustom dired-bind-info t | 117 | (defcustom dired-bind-info t |
| 101 | "Non-nil means bind `dired-info' to \"I\" in dired-mode, otherwise do not." | 118 | "Non-nil means bind `dired-info' to \"I\" in dired-mode, otherwise do not. |
| 119 | Setting this variable directly after dired-x is loaded has no effect - | ||
| 120 | use \\[customize]." | ||
| 102 | :type 'boolean | 121 | :type 'boolean |
| 122 | :set (lambda (sym val) | ||
| 123 | (if (set sym val) | ||
| 124 | (define-key dired-mode-map "I" 'dired-info) | ||
| 125 | (if (eq 'dired-info (lookup-key dired-mode-map "I")) | ||
| 126 | (define-key dired-mode-map "I" nil)))) | ||
| 103 | :group 'dired-keys) | 127 | :group 'dired-keys) |
| 104 | 128 | ||
| 105 | (defcustom dired-vm-read-only-folders nil | 129 | (defcustom dired-vm-read-only-folders nil |
| 106 | "If non-nil, \\[dired-vm] will visit all folders read-only. | 130 | "If non-nil, \\[dired-vm] will visit all folders read-only. |
| 107 | If neither nil nor t, e.g. the symbol `if-file-read-only', only | 131 | If neither nil nor t, e.g. the symbol `if-file-read-only', only |
| 108 | files not writable by you are visited read-only. | 132 | files not writable by you are visited read-only." |
| 109 | |||
| 110 | Read-only folders only work in VM 5, not in VM 4." | ||
| 111 | :type '(choice (const :tag "off" nil) | 133 | :type '(choice (const :tag "off" nil) |
| 112 | (const :tag "on" t) | 134 | (const :tag "on" t) |
| 113 | (other :tag "non-writable only" if-file-read-only)) | 135 | (other :tag "non-writable only" if-file-read-only)) |
| @@ -181,13 +203,20 @@ listing a directory. See also `dired-local-variables-file'." | |||
| 181 | :type 'boolean | 203 | :type 'boolean |
| 182 | :group 'dired-x) | 204 | :group 'dired-x) |
| 183 | 205 | ||
| 184 | (defcustom dired-guess-shell-gnutar (when (or (eq system-type 'gnu) | 206 | (defcustom dired-guess-shell-gnutar |
| 185 | (eq system-type 'gnu/linux)) | 207 | (catch 'found |
| 186 | "tar") | 208 | (dolist (exe '("tar" "gtar")) |
| 209 | (if (with-temp-buffer | ||
| 210 | (ignore-errors (call-process exe nil t nil "--version")) | ||
| 211 | (and (re-search-backward "GNU tar" nil t) t)) | ||
| 212 | (throw 'found exe)))) | ||
| 187 | "If non-nil, name of GNU tar executable. | 213 | "If non-nil, name of GNU tar executable. |
| 188 | \(E.g., \"tar\" or \"gtar\"). The `z' switch will be used with it for | 214 | \(E.g., \"tar\" or \"gtar\"). The `z' switch will be used with it for |
| 189 | compressed or gzip'ed tar files. If you don't have GNU tar, set this | 215 | compressed or gzip'ed tar files. If you don't have GNU tar, set this |
| 190 | to nil: a pipe using `zcat' or `gunzip -c' will be used." | 216 | to nil: a pipe using `zcat' or `gunzip -c' will be used." |
| 217 | ;; Changed from system-type test to testing --version output. | ||
| 218 | ;; Maybe test --help for -z instead? | ||
| 219 | :version "24.1" | ||
| 191 | :type '(choice (const :tag "Not GNU tar" nil) | 220 | :type '(choice (const :tag "Not GNU tar" nil) |
| 192 | (string :tag "Command name")) | 221 | (string :tag "Command name")) |
| 193 | :group 'dired-x) | 222 | :group 'dired-x) |
| @@ -223,12 +252,6 @@ to nil: a pipe using `zcat' or `gunzip -c' will be used." | |||
| 223 | (define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp) | 252 | (define-key dired-mode-map "%Y" 'dired-do-relsymlink-regexp) |
| 224 | (define-key dired-mode-map "V" 'dired-do-run-mail) | 253 | (define-key dired-mode-map "V" 'dired-do-run-mail) |
| 225 | 254 | ||
| 226 | (if dired-bind-man | ||
| 227 | (define-key dired-mode-map "N" 'dired-man)) | ||
| 228 | |||
| 229 | (if dired-bind-info | ||
| 230 | (define-key dired-mode-map "I" 'dired-info)) | ||
| 231 | |||
| 232 | ;;; MENU BINDINGS | 255 | ;;; MENU BINDINGS |
| 233 | 256 | ||
| 234 | (require 'easymenu) | 257 | (require 'easymenu) |
| @@ -270,11 +293,6 @@ matching regexp"] | |||
| 270 | files"] | 293 | files"] |
| 271 | "Refresh")) | 294 | "Refresh")) |
| 272 | 295 | ||
| 273 | ;;; GLOBAL BINDING. | ||
| 274 | (when dired-bind-jump | ||
| 275 | (define-key global-map "\C-x\C-j" 'dired-jump) | ||
| 276 | (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)) | ||
| 277 | |||
| 278 | 296 | ||
| 279 | ;; Install into appropriate hooks. | 297 | ;; Install into appropriate hooks. |
| 280 | 298 | ||
| @@ -293,28 +311,8 @@ files"] | |||
| 293 | \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring; | 311 | \\[dired-copy-filename-as-kill]\t-- copy the file or subdir names into the kill ring; |
| 294 | \t you can feed it to other commands using \\[yank] | 312 | \t you can feed it to other commands using \\[yank] |
| 295 | 313 | ||
| 296 | For more features, see variables | 314 | To see the options you can set, use M-x customize-group RET dired-x RET. |
| 297 | 315 | See also the functions: | |
| 298 | `dired-bind-vm' | ||
| 299 | `dired-bind-jump' | ||
| 300 | `dired-bind-info' | ||
| 301 | `dired-bind-man' | ||
| 302 | `dired-vm-read-only-folders' | ||
| 303 | `dired-omit-mode' | ||
| 304 | `dired-omit-files' | ||
| 305 | `dired-omit-extensions' | ||
| 306 | `dired-omit-size-limit' | ||
| 307 | `dired-find-subdir' | ||
| 308 | `dired-enable-local-variables' | ||
| 309 | `dired-local-variables-file' | ||
| 310 | `dired-guess-shell-gnutar' | ||
| 311 | `dired-guess-shell-gzip-quiet' | ||
| 312 | `dired-guess-shell-znew-switches' | ||
| 313 | `dired-guess-shell-alist-user' | ||
| 314 | `dired-clean-up-buffers-too' | ||
| 315 | |||
| 316 | See also functions | ||
| 317 | |||
| 318 | `dired-flag-extension' | 316 | `dired-flag-extension' |
| 319 | `dired-virtual' | 317 | `dired-virtual' |
| 320 | `dired-jump' | 318 | `dired-jump' |
| @@ -339,26 +337,22 @@ Remove expanded subdir of deleted dir, if any." | |||
| 339 | (save-excursion (and (cdr dired-subdir-alist) | 337 | (save-excursion (and (cdr dired-subdir-alist) |
| 340 | (dired-goto-subdir fn) | 338 | (dired-goto-subdir fn) |
| 341 | (dired-kill-subdir))) | 339 | (dired-kill-subdir))) |
| 342 | |||
| 343 | ;; Offer to kill buffer of deleted file FN. | 340 | ;; Offer to kill buffer of deleted file FN. |
| 344 | (if dired-clean-up-buffers-too | 341 | (when dired-clean-up-buffers-too |
| 345 | (progn | 342 | (let ((buf (get-file-buffer fn))) |
| 346 | (let ((buf (get-file-buffer fn))) | 343 | (and buf |
| 347 | (and buf | 344 | (funcall (function y-or-n-p) |
| 348 | (funcall (function y-or-n-p) | 345 | (format "Kill buffer of %s, too? " |
| 349 | (format "Kill buffer of %s, too? " | 346 | (file-name-nondirectory fn))) |
| 350 | (file-name-nondirectory fn))) | 347 | (save-excursion ; you never know where kill-buffer leaves you |
| 351 | (save-excursion ; you never know where kill-buffer leaves you | 348 | (kill-buffer buf)))) |
| 352 | (kill-buffer buf)))) | 349 | (let ((buf-list (dired-buffers-for-dir (expand-file-name fn)))) |
| 353 | (let ((buf-list (dired-buffers-for-dir (expand-file-name fn))) | 350 | (and buf-list |
| 354 | (buf nil)) | 351 | (y-or-n-p (format "Kill dired buffer%s of %s, too? " |
| 355 | (and buf-list | 352 | (dired-plural-s (length buf-list)) |
| 356 | (y-or-n-p (format "Kill dired buffer%s of %s, too? " | 353 | (file-name-nondirectory fn))) |
| 357 | (dired-plural-s (length buf-list)) | 354 | (dolist (buf buf-list) |
| 358 | (file-name-nondirectory fn))) | 355 | (save-excursion (kill-buffer buf)))))) |
| 359 | (while buf-list | ||
| 360 | (save-excursion (kill-buffer (car buf-list))) | ||
| 361 | (setq buf-list (cdr buf-list))))))) | ||
| 362 | ;; Anything else? | 356 | ;; Anything else? |
| 363 | ) | 357 | ) |
| 364 | 358 | ||
| @@ -460,11 +454,10 @@ move to its line in dired." | |||
| 460 | (progn | 454 | (progn |
| 461 | (setq dir (dired-current-directory)) | 455 | (setq dir (dired-current-directory)) |
| 462 | (dired-up-directory other-window) | 456 | (dired-up-directory other-window) |
| 463 | (or (dired-goto-file dir) | 457 | (unless (dired-goto-file dir) |
| 464 | ;; refresh and try again | 458 | ;; refresh and try again |
| 465 | (progn | 459 | (dired-insert-subdir (file-name-directory dir)) |
| 466 | (dired-insert-subdir (file-name-directory dir)) | 460 | (dired-goto-file dir))) |
| 467 | (dired-goto-file dir)))) | ||
| 468 | (if other-window | 461 | (if other-window |
| 469 | (dired-other-window dir) | 462 | (dired-other-window dir) |
| 470 | (dired dir)) | 463 | (dired dir)) |
| @@ -475,10 +468,9 @@ move to its line in dired." | |||
| 475 | (dired-insert-subdir (file-name-directory file)) | 468 | (dired-insert-subdir (file-name-directory file)) |
| 476 | (dired-goto-file file)) | 469 | (dired-goto-file file)) |
| 477 | ;; Toggle omitting, if it is on, and try again. | 470 | ;; Toggle omitting, if it is on, and try again. |
| 478 | (if dired-omit-mode | 471 | (when dired-omit-mode |
| 479 | (progn | 472 | (dired-omit-mode) |
| 480 | (dired-omit-mode) | 473 | (dired-goto-file file))))))) |
| 481 | (dired-goto-file file)))))))) | ||
| 482 | 474 | ||
| 483 | (defun dired-jump-other-window (&optional file-name) | 475 | (defun dired-jump-other-window (&optional file-name) |
| 484 | "Like \\[dired-jump] (`dired-jump') but in other window." | 476 | "Like \\[dired-jump] (`dired-jump') but in other window." |
| @@ -695,7 +687,7 @@ you can relist single subdirs using \\[dired-do-redisplay]." | |||
| 695 | (forward-line 1) | 687 | (forward-line 1) |
| 696 | (and (looking-at "^ wildcard ") | 688 | (and (looking-at "^ wildcard ") |
| 697 | (buffer-substring (match-end 0) | 689 | (buffer-substring (match-end 0) |
| 698 | (progn (end-of-line) (point))))))) | 690 | (line-end-position)))))) |
| 699 | (if wildcard | 691 | (if wildcard |
| 700 | (setq dirname (expand-file-name wildcard default-directory)))) | 692 | (setq dirname (expand-file-name wildcard default-directory)))) |
| 701 | ;; If raw ls listing (not a saved old dired buffer), give it a | 693 | ;; If raw ls listing (not a saved old dired buffer), give it a |
| @@ -777,9 +769,12 @@ Also useful for `auto-mode-alist' like this: | |||
| 777 | ;; mechanism is provided for special handling of the working directory in | 769 | ;; mechanism is provided for special handling of the working directory in |
| 778 | ;; special major modes. | 770 | ;; special major modes. |
| 779 | 771 | ||
| 772 | (define-obsolete-variable-alias 'default-directory-alist | ||
| 773 | 'dired-default-directory-alist "24.1") | ||
| 774 | |||
| 780 | ;; It's easier to add to this alist than redefine function | 775 | ;; It's easier to add to this alist than redefine function |
| 781 | ;; default-directory while keeping the old information. | 776 | ;; default-directory while keeping the old information. |
| 782 | (defconst default-directory-alist | 777 | (defconst dired-default-directory-alist |
| 783 | '((dired-mode . (if (fboundp 'dired-current-directory) | 778 | '((dired-mode . (if (fboundp 'dired-current-directory) |
| 784 | (dired-current-directory) | 779 | (dired-current-directory) |
| 785 | default-directory))) | 780 | default-directory))) |
| @@ -789,8 +784,8 @@ nil is ignored in favor of `default-directory'.") | |||
| 789 | 784 | ||
| 790 | (defun dired-default-directory () | 785 | (defun dired-default-directory () |
| 791 | "Usage like variable `default-directory'. | 786 | "Usage like variable `default-directory'. |
| 792 | Knows about the special cases in variable `default-directory-alist'." | 787 | Knows about the special cases in variable `dired-default-directory-alist'." |
| 793 | (or (eval (cdr (assq major-mode default-directory-alist))) | 788 | (or (eval (cdr (assq major-mode dired-default-directory-alist))) |
| 794 | default-directory)) | 789 | default-directory)) |
| 795 | 790 | ||
| 796 | (defun dired-smart-shell-command (command &optional output-buffer error-buffer) | 791 | (defun dired-smart-shell-command (command &optional output-buffer error-buffer) |
| @@ -1369,8 +1364,9 @@ NOSELECT the files are merely found but not selected." | |||
| 1369 | (declare-function Man-getpage-in-background "man" (topic)) | 1364 | (declare-function Man-getpage-in-background "man" (topic)) |
| 1370 | 1365 | ||
| 1371 | (defun dired-man () | 1366 | (defun dired-man () |
| 1372 | "Run man on this file. Display old buffer if buffer name matches filename. | 1367 | "Run `man' on this file." |
| 1373 | Uses `man.el' of \\[manual-entry] fame." | 1368 | ;; Used also to say: "Display old buffer if buffer name matches filename." |
| 1369 | ;; but I have no idea what that means. | ||
| 1374 | (interactive) | 1370 | (interactive) |
| 1375 | (require 'man) | 1371 | (require 'man) |
| 1376 | (let* ((file (dired-get-filename)) | 1372 | (let* ((file (dired-get-filename)) |
| @@ -1382,7 +1378,7 @@ Uses `man.el' of \\[manual-entry] fame." | |||
| 1382 | ;; Run Info on files. | 1378 | ;; Run Info on files. |
| 1383 | 1379 | ||
| 1384 | (defun dired-info () | 1380 | (defun dired-info () |
| 1385 | "Run info on this file." | 1381 | "Run `info' on this file." |
| 1386 | (interactive) | 1382 | (interactive) |
| 1387 | (info (dired-get-filename))) | 1383 | (info (dired-get-filename))) |
| 1388 | 1384 | ||
| @@ -1393,17 +1389,16 @@ Uses `man.el' of \\[manual-entry] fame." | |||
| 1393 | 1389 | ||
| 1394 | (defun dired-vm (&optional read-only) | 1390 | (defun dired-vm (&optional read-only) |
| 1395 | "Run VM on this file. | 1391 | "Run VM on this file. |
| 1396 | With prefix arg, visit folder read-only (this requires at least VM 5). | 1392 | With optional prefix argument, visits the folder read-only. |
| 1397 | See also variable `dired-vm-read-only-folders'." | 1393 | Otherwise obeys the value of `dired-vm-read-only-folders'." |
| 1398 | (interactive "P") | 1394 | (interactive "P") |
| 1399 | (let ((dir (dired-current-directory)) | 1395 | (let ((dir (dired-current-directory)) |
| 1400 | (fil (dired-get-filename))) | 1396 | (fil (dired-get-filename))) |
| 1401 | ;; take care to supply 2nd arg only if requested - may still run VM 4! | 1397 | (vm-visit-folder fil (or read-only |
| 1402 | (cond (read-only (vm-visit-folder fil t)) | 1398 | (eq t dired-vm-read-only-folders) |
| 1403 | ((eq t dired-vm-read-only-folders) (vm-visit-folder fil t)) | 1399 | (and dired-vm-read-only-folders |
| 1404 | ((null dired-vm-read-only-folders) (vm-visit-folder fil)) | 1400 | (not (file-writable-p fil))))) |
| 1405 | (t (vm-visit-folder fil (not (file-writable-p fil))))) | 1401 | ;; So that pressing `v' inside VM does prompt within current directory: |
| 1406 | ;; so that pressing `v' inside VM does prompt within current directory: | ||
| 1407 | (set (make-local-variable 'vm-folder-directory) dir))) | 1402 | (set (make-local-variable 'vm-folder-directory) dir))) |
| 1408 | 1403 | ||
| 1409 | (defun dired-rmail () | 1404 | (defun dired-rmail () |
| @@ -1450,16 +1445,11 @@ See also variable `dired-vm-read-only-folders'." | |||
| 1450 | 1445 | ||
| 1451 | ;; This should be a builtin | 1446 | ;; This should be a builtin |
| 1452 | (defun dired-buffer-more-recently-used-p (buffer1 buffer2) | 1447 | (defun dired-buffer-more-recently-used-p (buffer1 buffer2) |
| 1453 | "Return t if BUFFER1 is more recently used than BUFFER2." | 1448 | "Return t if BUFFER1 is more recently used than BUFFER2. |
| 1454 | (if (equal buffer1 buffer2) | 1449 | Considers buffers closer to the car of `buffer-list' to be more recent." |
| 1455 | nil | 1450 | (and (not (equal buffer1 buffer2)) |
| 1456 | (let ((more-recent nil) | 1451 | (memq buffer1 (buffer-list)) |
| 1457 | (list (buffer-list))) | 1452 | (not (memq buffer1 (memq buffer2 (buffer-list)))))) |
| 1458 | (while (and list | ||
| 1459 | (not (setq more-recent (equal buffer1 (car list)))) | ||
| 1460 | (not (equal buffer2 (car list)))) | ||
| 1461 | (setq list (cdr list))) | ||
| 1462 | more-recent))) | ||
| 1463 | 1453 | ||
| 1464 | ;; Same thing as `dired-buffers-for-dir' of dired.el? - lrd 11/23/93 | 1454 | ;; Same thing as `dired-buffers-for-dir' of dired.el? - lrd 11/23/93 |
| 1465 | ;; (defun dired-buffers-for-dir-exact (dir) | 1455 | ;; (defun dired-buffers-for-dir-exact (dir) |
| @@ -1559,7 +1549,7 @@ to mark all zero length files." | |||
| 1559 | (forward-char mode-len) | 1549 | (forward-char mode-len) |
| 1560 | (setq nlink (read (current-buffer))) | 1550 | (setq nlink (read (current-buffer))) |
| 1561 | ;; Karsten Wenger <kw@cis.uni-muenchen.de> fixed uid. | 1551 | ;; Karsten Wenger <kw@cis.uni-muenchen.de> fixed uid. |
| 1562 | (setq uid (buffer-substring (+ (point) 1) | 1552 | (setq uid (buffer-substring (1+ (point)) |
| 1563 | (progn (forward-word 1) (point)))) | 1553 | (progn (forward-word 1) (point)))) |
| 1564 | (re-search-forward directory-listing-before-filename-regexp) | 1554 | (re-search-forward directory-listing-before-filename-regexp) |
| 1565 | (goto-char (match-beginning 1)) | 1555 | (goto-char (match-beginning 1)) |
| @@ -1649,7 +1639,7 @@ Identical to `find-file' except when called interactively, with a prefix arg | |||
| 1649 | \(e.g., \\[universal-argument]\), in which case it guesses filename near point. | 1639 | \(e.g., \\[universal-argument]\), in which case it guesses filename near point. |
| 1650 | Useful for editing file mentioned in buffer you are viewing, | 1640 | Useful for editing file mentioned in buffer you are viewing, |
| 1651 | or to test if that file exists. Use minibuffer after snatching filename." | 1641 | or to test if that file exists. Use minibuffer after snatching filename." |
| 1652 | (interactive (list (read-filename-at-point "Find file: "))) | 1642 | (interactive (list (dired-x-read-filename-at-point "Find file: "))) |
| 1653 | (find-file (expand-file-name filename))) | 1643 | (find-file (expand-file-name filename))) |
| 1654 | 1644 | ||
| 1655 | (defun dired-x-find-file-other-window (filename) | 1645 | (defun dired-x-find-file-other-window (filename) |
| @@ -1661,7 +1651,7 @@ Identical to `find-file-other-window' except when called interactively, with | |||
| 1661 | a prefix arg \(e.g., \\[universal-argument]\), in which case it guesses filename near point. | 1651 | a prefix arg \(e.g., \\[universal-argument]\), in which case it guesses filename near point. |
| 1662 | Useful for editing file mentioned in buffer you are viewing, | 1652 | Useful for editing file mentioned in buffer you are viewing, |
| 1663 | or to test if that file exists. Use minibuffer after snatching filename." | 1653 | or to test if that file exists. Use minibuffer after snatching filename." |
| 1664 | (interactive (list (read-filename-at-point "Find file: "))) | 1654 | (interactive (list (dired-x-read-filename-at-point "Find file: "))) |
| 1665 | (find-file-other-window (expand-file-name filename))) | 1655 | (find-file-other-window (expand-file-name filename))) |
| 1666 | 1656 | ||
| 1667 | ;;; Internal functions. | 1657 | ;;; Internal functions. |
| @@ -1677,13 +1667,10 @@ Not perfect - point must be in middle of or end of filename." | |||
| 1677 | 1667 | ||
| 1678 | (save-excursion | 1668 | (save-excursion |
| 1679 | ;; First see if just past a filename. | 1669 | ;; First see if just past a filename. |
| 1680 | (if (not (eobp)) | 1670 | (or (eobp) |
| 1681 | (if (looking-at "[] \t\n[{}()]") ; whitespace or some parens | 1671 | (when (looking-at "[] \t\n[{}()]") ; whitespace or some parens |
| 1682 | (progn | 1672 | (skip-chars-backward " \n\t\r({[]})") |
| 1683 | (skip-chars-backward " \n\t\r({[]})") | 1673 | (or (bobp) (backward-char 1)))) |
| 1684 | (if (not (bobp)) | ||
| 1685 | (backward-char 1))))) | ||
| 1686 | |||
| 1687 | (if (string-match (concat "[" filename-chars "]") | 1674 | (if (string-match (concat "[" filename-chars "]") |
| 1688 | (char-to-string (following-char))) | 1675 | (char-to-string (following-char))) |
| 1689 | (progn | 1676 | (progn |
| @@ -1706,7 +1693,7 @@ Not perfect - point must be in middle of or end of filename." | |||
| 1706 | ;; Return string. | 1693 | ;; Return string. |
| 1707 | (expand-file-name (concat prefix (buffer-substring start (point))))))) | 1694 | (expand-file-name (concat prefix (buffer-substring start (point))))))) |
| 1708 | 1695 | ||
| 1709 | (defun read-filename-at-point (prompt) | 1696 | (defun dired-x-read-filename-at-point (prompt) |
| 1710 | "Return filename prompting with PROMPT with completion. | 1697 | "Return filename prompting with PROMPT with completion. |
| 1711 | If `current-prefix-arg' is non-nil, uses name at point as guess." | 1698 | If `current-prefix-arg' is non-nil, uses name at point as guess." |
| 1712 | (if current-prefix-arg | 1699 | (if current-prefix-arg |
| @@ -1716,6 +1703,9 @@ If `current-prefix-arg' is non-nil, uses name at point as guess." | |||
| 1716 | guess | 1703 | guess |
| 1717 | nil (file-name-nondirectory guess))) | 1704 | nil (file-name-nondirectory guess))) |
| 1718 | (read-file-name prompt default-directory))) | 1705 | (read-file-name prompt default-directory))) |
| 1706 | |||
| 1707 | (define-obsolete-function-alias 'read-filename-at-point | ||
| 1708 | 'dired-x-read-filename-at-point "24.1") ; is this even needed? | ||
| 1719 | 1709 | ||
| 1720 | ;;; BUG REPORTS | 1710 | ;;; BUG REPORTS |
| 1721 | 1711 | ||