diff options
| author | Dave Love | 2001-01-26 13:14:11 +0000 |
|---|---|---|
| committer | Dave Love | 2001-01-26 13:14:11 +0000 |
| commit | 83fadedf5fa9f2cfa90e99dd109c20ed0e70052f (patch) | |
| tree | 700d20e062d3aa8ad1055c2b290ea89ff505f154 | |
| parent | 6c317bd2b45e7beaef9bd425e0ae65329b5c99d5 (diff) | |
| download | emacs-83fadedf5fa9f2cfa90e99dd109c20ed0e70052f.tar.gz emacs-83fadedf5fa9f2cfa90e99dd109c20ed0e70052f.zip | |
Revert last change.
| -rw-r--r-- | lisp/dired-aux.el | 62 | ||||
| -rw-r--r-- | lisp/dired.el | 86 |
2 files changed, 81 insertions, 67 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 05d998176f7..4b966711012 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -99,7 +99,7 @@ With prefix arg, prompt for argument SWITCHES which is options for `diff'." | |||
| 99 | (setq failures | 99 | (setq failures |
| 100 | (dired-bunch-files 10000 | 100 | (dired-bunch-files 10000 |
| 101 | (function dired-check-process) | 101 | (function dired-check-process) |
| 102 | (append | 102 | (append |
| 103 | (list operation program new-attribute) | 103 | (list operation program new-attribute) |
| 104 | (if (string-match "gnu" system-configuration) | 104 | (if (string-match "gnu" system-configuration) |
| 105 | '("--") nil)) | 105 | '("--") nil)) |
| @@ -198,7 +198,7 @@ Uses the shell command coming from variables `lpr-command' and | |||
| 198 | nil op-symbol files | 198 | nil op-symbol files |
| 199 | (function read-string) | 199 | (function read-string) |
| 200 | (format prompt (dired-mark-prompt arg files)) initial)) | 200 | (format prompt (dired-mark-prompt arg files)) initial)) |
| 201 | 201 | ||
| 202 | ;;; Cleaning a directory: flagging some backups for deletion. | 202 | ;;; Cleaning a directory: flagging some backups for deletion. |
| 203 | 203 | ||
| 204 | (defvar dired-file-version-alist) | 204 | (defvar dired-file-version-alist) |
| @@ -290,7 +290,7 @@ with a prefix argument." | |||
| 290 | (progn (beginning-of-line) | 290 | (progn (beginning-of-line) |
| 291 | (delete-char 1) | 291 | (delete-char 1) |
| 292 | (insert dired-del-marker))))) | 292 | (insert dired-del-marker))))) |
| 293 | 293 | ||
| 294 | ;;; Shell commands | 294 | ;;; Shell commands |
| 295 | 295 | ||
| 296 | (defun dired-read-shell-command (prompt arg files) | 296 | (defun dired-read-shell-command (prompt arg files) |
| @@ -379,10 +379,12 @@ the list of file names explicitly with the FILE-LIST argument." | |||
| 379 | ;; your cmd. | 379 | ;; your cmd. |
| 380 | (let ((stuff-it | 380 | (let ((stuff-it |
| 381 | (cond ((string-match "\\*" command) | 381 | (cond ((string-match "\\*" command) |
| 382 | (lambda (x) (replace-regexp-in-string "\\*" x command))) | 382 | (function (lambda (x) |
| 383 | (dired-replace-in-string "\\*" x command)))) | ||
| 383 | ((string-match "\\?" command) | 384 | ((string-match "\\?" command) |
| 384 | (lambda (x) (replace-regexp-in-string "\\?" x command))) | 385 | (function (lambda (x) |
| 385 | (t (lambda (x) (concat command " " x)))))) | 386 | (dired-replace-in-string "\\?" x command)))) |
| 387 | (t (function (lambda (x) (concat command " " x))))))) | ||
| 386 | (if on-each | 388 | (if on-each |
| 387 | (mapconcat stuff-it (mapcar 'shell-quote-argument file-list) ";") | 389 | (mapconcat stuff-it (mapcar 'shell-quote-argument file-list) ";") |
| 388 | (let ((fns (mapconcat 'shell-quote-argument | 390 | (let ((fns (mapconcat 'shell-quote-argument |
| @@ -400,7 +402,7 @@ the list of file names explicitly with the FILE-LIST argument." | |||
| 400 | (shell-command command))) | 402 | (shell-command command))) |
| 401 | ;; Return nil for sake of nconc in dired-bunch-files. | 403 | ;; Return nil for sake of nconc in dired-bunch-files. |
| 402 | nil) | 404 | nil) |
| 403 | 405 | ||
| 404 | ;; In Emacs 19 this will return program's exit status. | 406 | ;; In Emacs 19 this will return program's exit status. |
| 405 | ;; This is a separate function so that ange-ftp can redefine it. | 407 | ;; This is a separate function so that ange-ftp can redefine it. |
| 406 | (defun dired-call-process (program discard &rest arguments) | 408 | (defun dired-call-process (program discard &rest arguments) |
| @@ -439,7 +441,7 @@ the list of file names explicitly with the FILE-LIST argument." | |||
| 439 | (kill-buffer err-buffer) | 441 | (kill-buffer err-buffer) |
| 440 | (message "%s...done" msg) | 442 | (message "%s...done" msg) |
| 441 | nil)))) | 443 | nil)))) |
| 442 | 444 | ||
| 443 | ;; Commands that delete or redisplay part of the dired buffer. | 445 | ;; Commands that delete or redisplay part of the dired buffer. |
| 444 | 446 | ||
| 445 | (defun dired-kill-line (&optional arg) | 447 | (defun dired-kill-line (&optional arg) |
| @@ -498,7 +500,7 @@ and use this command with a prefix argument (the value does not matter)." | |||
| 498 | count)))) | 500 | count)))) |
| 499 | 501 | ||
| 500 | ;;;###end dired-cmd.el | 502 | ;;;###end dired-cmd.el |
| 501 | 503 | ||
| 502 | ;;; 30K | 504 | ;;; 30K |
| 503 | ;;;###begin dired-cp.el | 505 | ;;;###begin dired-cp.el |
| 504 | 506 | ||
| @@ -555,7 +557,7 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.") | |||
| 555 | (setq suffix (car suffixes) suffixes nil)) | 557 | (setq suffix (car suffixes) suffixes nil)) |
| 556 | (setq suffixes (cdr suffixes)))) | 558 | (setq suffixes (cdr suffixes)))) |
| 557 | ;; If so, compute desired new name. | 559 | ;; If so, compute desired new name. |
| 558 | (if suffix | 560 | (if suffix |
| 559 | (setq newname (concat (substring file 0 (match-beginning 0)) | 561 | (setq newname (concat (substring file 0 (match-beginning 0)) |
| 560 | (nth 1 suffix)))) | 562 | (nth 1 suffix)))) |
| 561 | (cond (handler | 563 | (cond (handler |
| @@ -589,7 +591,7 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.") | |||
| 589 | "compress" "-f" file)) | 591 | "compress" "-f" file)) |
| 590 | ;; Don't use NEWNAME with `compress'. | 592 | ;; Don't use NEWNAME with `compress'. |
| 591 | (concat file ".Z")))))))) | 593 | (concat file ".Z")))))))) |
| 592 | 594 | ||
| 593 | (defun dired-mark-confirm (op-symbol arg) | 595 | (defun dired-mark-confirm (op-symbol arg) |
| 594 | ;; Request confirmation from the user that the operation described | 596 | ;; Request confirmation from the user that the operation described |
| 595 | ;; by OP-SYMBOL is to be performed on the marked files. | 597 | ;; by OP-SYMBOL is to be performed on the marked files. |
| @@ -674,7 +676,7 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.") | |||
| 674 | (apply 'message qprompt qs-args) | 676 | (apply 'message qprompt qs-args) |
| 675 | (setq char (set qs-var (read-char)))) | 677 | (setq char (set qs-var (read-char)))) |
| 676 | (memq (cdr elt) '(t y yes))))))) | 678 | (memq (cdr elt) '(t y yes))))))) |
| 677 | 679 | ||
| 678 | ;;;###autoload | 680 | ;;;###autoload |
| 679 | (defun dired-do-compress (&optional arg) | 681 | (defun dired-do-compress (&optional arg) |
| 680 | "Compress or uncompress marked (or next ARG) files." | 682 | "Compress or uncompress marked (or next ARG) files." |
| @@ -747,7 +749,7 @@ a prefix arg lets you edit the `ls' switches used for the new listing." | |||
| 747 | arg) | 749 | arg) |
| 748 | (dired-move-to-filename) | 750 | (dired-move-to-filename) |
| 749 | (message "Redisplaying...done"))) | 751 | (message "Redisplaying...done"))) |
| 750 | 752 | ||
| 751 | (defun dired-update-file-line (file) | 753 | (defun dired-update-file-line (file) |
| 752 | ;; Delete the current line, and insert an entry for FILE. | 754 | ;; Delete the current line, and insert an entry for FILE. |
| 753 | ;; If FILE is nil, then just delete the current line. | 755 | ;; If FILE is nil, then just delete the current line. |
| @@ -847,7 +849,7 @@ a prefix arg lets you edit the `ls' switches used for the new listing." | |||
| 847 | ;; It inserts the file's absolute name, rather than | 849 | ;; It inserts the file's absolute name, rather than |
| 848 | ;; the relative one. That may be hard to fix since it | 850 | ;; the relative one. That may be hard to fix since it |
| 849 | ;; is probably controlled by something in ftp. | 851 | ;; is probably controlled by something in ftp. |
| 850 | (goto-char opoint) | 852 | (goto-char opoint) |
| 851 | (let ((inserted-name (dired-get-filename 'verbatim))) | 853 | (let ((inserted-name (dired-get-filename 'verbatim))) |
| 852 | (if (file-name-directory inserted-name) | 854 | (if (file-name-directory inserted-name) |
| 853 | (progn | 855 | (progn |
| @@ -929,7 +931,7 @@ a prefix arg lets you edit the `ls' switches used for the new listing." | |||
| 929 | (save-excursion (forward-line 1) (point)))) | 931 | (save-excursion (forward-line 1) (point)))) |
| 930 | (setq file (directory-file-name file)) | 932 | (setq file (directory-file-name file)) |
| 931 | (dired-add-entry file (if (eq ?\040 marker) nil marker))))) | 933 | (dired-add-entry file (if (eq ?\040 marker) nil marker))))) |
| 932 | 934 | ||
| 933 | ;;; Copy, move/rename, making hard and symbolic links | 935 | ;;; Copy, move/rename, making hard and symbolic links |
| 934 | 936 | ||
| 935 | (defcustom dired-recursive-copies nil | 937 | (defcustom dired-recursive-copies nil |
| @@ -1026,7 +1028,7 @@ Special value `always' suppresses confirmation." | |||
| 1026 | (if (and buffer-file-name | 1028 | (if (and buffer-file-name |
| 1027 | (dired-in-this-tree buffer-file-name expanded-from-dir)) | 1029 | (dired-in-this-tree buffer-file-name expanded-from-dir)) |
| 1028 | (let ((modflag (buffer-modified-p)) | 1030 | (let ((modflag (buffer-modified-p)) |
| 1029 | (to-file (replace-regexp-in-string | 1031 | (to-file (dired-replace-in-string |
| 1030 | (concat "^" (regexp-quote from-dir)) | 1032 | (concat "^" (regexp-quote from-dir)) |
| 1031 | to-dir | 1033 | to-dir |
| 1032 | buffer-file-name))) | 1034 | buffer-file-name))) |
| @@ -1085,8 +1087,8 @@ Special value `always' suppresses confirmation." | |||
| 1085 | ;; Update buffer-local dired-subdir-alist | 1087 | ;; Update buffer-local dired-subdir-alist |
| 1086 | (setcar elt | 1088 | (setcar elt |
| 1087 | (dired-normalize-subdir | 1089 | (dired-normalize-subdir |
| 1088 | (replace-regexp-in-string regexp newtext (car elt))))))) | 1090 | (dired-replace-in-string regexp newtext (car elt))))))) |
| 1089 | 1091 | ||
| 1090 | ;; The basic function for half a dozen variations on cp/mv/ln/ln -s. | 1092 | ;; The basic function for half a dozen variations on cp/mv/ln/ln -s. |
| 1091 | (defun dired-create-files (file-creator operation fn-list name-constructor | 1093 | (defun dired-create-files (file-creator operation fn-list name-constructor |
| 1092 | &optional marker-char) | 1094 | &optional marker-char) |
| @@ -1181,7 +1183,7 @@ ESC or `q' to not overwrite any of the remaining files, | |||
| 1181 | (message "%s: %s file%s" | 1183 | (message "%s: %s file%s" |
| 1182 | operation success-count (dired-plural-s success-count))))) | 1184 | operation success-count (dired-plural-s success-count))))) |
| 1183 | (dired-move-to-filename)) | 1185 | (dired-move-to-filename)) |
| 1184 | 1186 | ||
| 1185 | (defun dired-do-create-files (op-symbol file-creator operation arg | 1187 | (defun dired-do-create-files (op-symbol file-creator operation arg |
| 1186 | &optional marker-char op1 | 1188 | &optional marker-char op1 |
| 1187 | how-to) | 1189 | how-to) |
| @@ -1302,7 +1304,7 @@ Optional arg HOW-TO is used to set the value of the into-dir variable | |||
| 1302 | (dired-current-directory))))) | 1304 | (dired-current-directory))))) |
| 1303 | (or other-dir this-dir)) | 1305 | (or other-dir this-dir)) |
| 1304 | this-dir))) | 1306 | this-dir))) |
| 1305 | 1307 | ||
| 1306 | ;;;###autoload | 1308 | ;;;###autoload |
| 1307 | (defun dired-create-directory (directory) | 1309 | (defun dired-create-directory (directory) |
| 1308 | "Create a directory called DIRECTORY." | 1310 | "Create a directory called DIRECTORY." |
| @@ -1379,7 +1381,7 @@ When renaming multiple or marked files, you specify a directory." | |||
| 1379 | (dired-do-create-files 'move (function dired-rename-file) | 1381 | (dired-do-create-files 'move (function dired-rename-file) |
| 1380 | "Move" arg dired-keep-marker-rename "Rename")) | 1382 | "Move" arg dired-keep-marker-rename "Rename")) |
| 1381 | ;;;###end dired-cp.el | 1383 | ;;;###end dired-cp.el |
| 1382 | 1384 | ||
| 1383 | ;;; 5K | 1385 | ;;; 5K |
| 1384 | ;;;###begin dired-re.el | 1386 | ;;;###begin dired-re.el |
| 1385 | (defun dired-do-create-files-regexp | 1387 | (defun dired-do-create-files-regexp |
| @@ -1542,7 +1544,7 @@ Type SPC or `y' to %s one file, DEL or `n' to skip to next, | |||
| 1542 | (dired-rename-non-directory (function downcase) "Rename downcase" arg)) | 1544 | (dired-rename-non-directory (function downcase) "Rename downcase" arg)) |
| 1543 | 1545 | ||
| 1544 | ;;;###end dired-re.el | 1546 | ;;;###end dired-re.el |
| 1545 | 1547 | ||
| 1546 | ;;; 13K | 1548 | ;;; 13K |
| 1547 | ;;;###begin dired-ins.el | 1549 | ;;;###begin dired-ins.el |
| 1548 | 1550 | ||
| @@ -1695,7 +1697,7 @@ With optional arg REMEMBER-MARKS, return an alist of marked files." | |||
| 1695 | (message "Reading directory %s..." dirname) | 1697 | (message "Reading directory %s..." dirname) |
| 1696 | (let ((dired-actual-switches | 1698 | (let ((dired-actual-switches |
| 1697 | (or switches | 1699 | (or switches |
| 1698 | (replace-regexp-in-string "R" "" dired-actual-switches)))) | 1700 | (dired-replace-in-string "R" "" dired-actual-switches)))) |
| 1699 | (if (equal dirname (car (car (reverse dired-subdir-alist)))) | 1701 | (if (equal dirname (car (car (reverse dired-subdir-alist)))) |
| 1700 | ;; top level directory may contain wildcards: | 1702 | ;; top level directory may contain wildcards: |
| 1701 | (dired-readin-insert dired-directory) | 1703 | (dired-readin-insert dired-directory) |
| @@ -1798,7 +1800,7 @@ is always equal to STRING." | |||
| 1798 | (setq result | 1800 | (setq result |
| 1799 | (cons (substring str end) result))) | 1801 | (cons (substring str end) result))) |
| 1800 | (nreverse result))) | 1802 | (nreverse result))) |
| 1801 | 1803 | ||
| 1802 | ;;; moving by subdirectories | 1804 | ;;; moving by subdirectories |
| 1803 | 1805 | ||
| 1804 | ;;;###autoload | 1806 | ;;;###autoload |
| @@ -1841,7 +1843,7 @@ The next char is either \\n, or \\r if DIR is hidden." | |||
| 1841 | ;; at either \r or \n after this function succeeds. | 1843 | ;; at either \r or \n after this function succeeds. |
| 1842 | (progn (skip-chars-forward "^\r\n") | 1844 | (progn (skip-chars-forward "^\r\n") |
| 1843 | (point))))) | 1845 | (point))))) |
| 1844 | 1846 | ||
| 1845 | ;;;###autoload | 1847 | ;;;###autoload |
| 1846 | (defun dired-mark-subdir-files () | 1848 | (defun dired-mark-subdir-files () |
| 1847 | "Mark all files except `.' and `..' in current subdirectory. | 1849 | "Mark all files except `.' and `..' in current subdirectory. |
| @@ -1903,7 +1905,7 @@ Lower levels are unaffected." | |||
| 1903 | (if pos | 1905 | (if pos |
| 1904 | (goto-char pos) | 1906 | (goto-char pos) |
| 1905 | (error "At the bottom")))) | 1907 | (error "At the bottom")))) |
| 1906 | 1908 | ||
| 1907 | ;;; hiding | 1909 | ;;; hiding |
| 1908 | 1910 | ||
| 1909 | (defun dired-unhide-subdir () | 1911 | (defun dired-unhide-subdir () |
| @@ -1970,7 +1972,7 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory." | |||
| 1970 | 1972 | ||
| 1971 | ;;;###end dired-ins.el | 1973 | ;;;###end dired-ins.el |
| 1972 | 1974 | ||
| 1973 | 1975 | ||
| 1974 | ;; Functions for searching in tags style among marked files. | 1976 | ;; Functions for searching in tags style among marked files. |
| 1975 | 1977 | ||
| 1976 | ;;;###autoload | 1978 | ;;;###autoload |
| @@ -1990,14 +1992,14 @@ with the command \\[tags-loop-continue]." | |||
| 1990 | (interactive | 1992 | (interactive |
| 1991 | "sQuery replace in marked files (regexp): \nsQuery replace %s by: \nP") | 1993 | "sQuery replace in marked files (regexp): \nsQuery replace %s by: \nP") |
| 1992 | (tags-query-replace from to delimited '(dired-get-marked-files))) | 1994 | (tags-query-replace from to delimited '(dired-get-marked-files))) |
| 1993 | 1995 | ||
| 1994 | ;;;###autoload | 1996 | ;;;###autoload |
| 1995 | (defun dired-show-file-type (file &optional deref-symlinks) | 1997 | (defun dired-show-file-type (file &optional deref-symlinks) |
| 1996 | "Print the type of FILE, according to the `file' command. | 1998 | "Print the type of FILE, according to the `file' command. |
| 1997 | If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is | 1999 | If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is |
| 1998 | true then the type of the file linked to by FILE is printed instead." | 2000 | true then the type of the file linked to by FILE is printed instead." |
| 1999 | (interactive (list (dired-get-filename t) current-prefix-arg)) | 2001 | (interactive (list (dired-get-filename t) current-prefix-arg)) |
| 2000 | (with-temp-buffer | 2002 | (with-temp-buffer |
| 2001 | (if deref-symlinks | 2003 | (if deref-symlinks |
| 2002 | (call-process "file" nil t t "-L" file) | 2004 | (call-process "file" nil t t "-L" file) |
| 2003 | (call-process "file" nil t t file)) | 2005 | (call-process "file" nil t t file)) |
diff --git a/lisp/dired.el b/lisp/dired.el index 481fe3b6862..03d1cf405ee 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -292,7 +292,7 @@ Subexpression 2 must end right before the \\n or \\r.") | |||
| 292 | '(".+" (dired-move-to-filename) nil (0 font-lock-function-name-face))) | 292 | '(".+" (dired-move-to-filename) nil (0 font-lock-function-name-face))) |
| 293 | ;; | 293 | ;; |
| 294 | ;; Symbolic links. | 294 | ;; Symbolic links. |
| 295 | (list dired-re-sym | 295 | (list dired-re-sym |
| 296 | '(".+" (dired-move-to-filename) nil (0 font-lock-keyword-face))) | 296 | '(".+" (dired-move-to-filename) nil (0 font-lock-keyword-face))) |
| 297 | ;; | 297 | ;; |
| 298 | ;; Files suffixed with `completion-ignored-extensions'. | 298 | ;; Files suffixed with `completion-ignored-extensions'. |
| @@ -303,7 +303,7 @@ Subexpression 2 must end right before the \\n or \\r.") | |||
| 303 | (list (concat "\\(" (mapconcat 'identity extensions "\\|") "\\|#\\)$") | 303 | (list (concat "\\(" (mapconcat 'identity extensions "\\|") "\\|#\\)$") |
| 304 | '(".+" (dired-move-to-filename) nil (0 font-lock-string-face)))))) | 304 | '(".+" (dired-move-to-filename) nil (0 font-lock-string-face)))))) |
| 305 | "Additional expressions to highlight in Dired mode.") | 305 | "Additional expressions to highlight in Dired mode.") |
| 306 | 306 | ||
| 307 | ;;; Macros must be defined before they are used, for the byte compiler. | 307 | ;;; Macros must be defined before they are used, for the byte compiler. |
| 308 | 308 | ||
| 309 | ;; Mark all files for which CONDITION evals to non-nil. | 309 | ;; Mark all files for which CONDITION evals to non-nil. |
| @@ -406,10 +406,10 @@ Optional second argument ARG forces to use other files. If ARG is an | |||
| 406 | (save-excursion | 406 | (save-excursion |
| 407 | (nreverse (dired-map-over-marks (dired-get-filename localp) arg)))) | 407 | (nreverse (dired-map-over-marks (dired-get-filename localp) arg)))) |
| 408 | 408 | ||
| 409 | 409 | ||
| 410 | ;; Function dired-ls is redefinable for VMS, ange-ftp, Prospero or | 410 | ;; Function dired-ls is redefinable for VMS, ange-ftp, Prospero or |
| 411 | ;; other special applications. | 411 | ;; other special applications. |
| 412 | 412 | ||
| 413 | ;; The dired command | 413 | ;; The dired command |
| 414 | 414 | ||
| 415 | (defun dired-read-dir-and-switches (str) | 415 | (defun dired-read-dir-and-switches (str) |
| @@ -514,12 +514,12 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 514 | (setq buffer (create-file-buffer (directory-file-name dirname))))) | 514 | (setq buffer (create-file-buffer (directory-file-name dirname))))) |
| 515 | (set-buffer buffer) | 515 | (set-buffer buffer) |
| 516 | (if (not new-buffer-p) ; existing buffer ... | 516 | (if (not new-buffer-p) ; existing buffer ... |
| 517 | (cond (switches ; ... but new switches | 517 | (cond (switches ; ... but new switches |
| 518 | ;; file list may have changed | 518 | ;; file list may have changed |
| 519 | (if (consp dir-or-list) | 519 | (if (consp dir-or-list) |
| 520 | (setq dired-directory dir-or-list)) | 520 | (setq dired-directory dir-or-list)) |
| 521 | ;; this calls dired-revert | 521 | ;; this calls dired-revert |
| 522 | (dired-sort-other switches)) | 522 | (dired-sort-other switches)) |
| 523 | ;; If directory has changed on disk, offer to revert. | 523 | ;; If directory has changed on disk, offer to revert. |
| 524 | ((if (let ((attributes (file-attributes dirname)) | 524 | ((if (let ((attributes (file-attributes dirname)) |
| 525 | (modtime (visited-file-modtime))) | 525 | (modtime (visited-file-modtime))) |
| @@ -586,7 +586,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 586 | (setq blist (cdr blist)))))) | 586 | (setq blist (cdr blist)))))) |
| 587 | found)) | 587 | found)) |
| 588 | 588 | ||
| 589 | 589 | ||
| 590 | ;; Read in a new dired buffer | 590 | ;; Read in a new dired buffer |
| 591 | 591 | ||
| 592 | ;; dired-readin differs from dired-insert-subdir in that it accepts | 592 | ;; dired-readin differs from dired-insert-subdir in that it accepts |
| @@ -749,7 +749,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 749 | ;; boundaries. | 749 | ;; boundaries. |
| 750 | (save-excursion (insert " " (directory-file-name dir) ":\n"))) | 750 | (save-excursion (insert " " (directory-file-name dir) ":\n"))) |
| 751 | 751 | ||
| 752 | 752 | ||
| 753 | ;; Reverting a dired buffer | 753 | ;; Reverting a dired buffer |
| 754 | 754 | ||
| 755 | (defun dired-revert (&optional arg noconfirm) | 755 | (defun dired-revert (&optional arg noconfirm) |
| @@ -857,7 +857,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 857 | (let ((handler (find-file-name-handler dir 'dired-uncache))) | 857 | (let ((handler (find-file-name-handler dir 'dired-uncache))) |
| 858 | (if handler | 858 | (if handler |
| 859 | (funcall handler 'dired-uncache dir)))) | 859 | (funcall handler 'dired-uncache dir)))) |
| 860 | 860 | ||
| 861 | ;; dired mode key bindings and initialization | 861 | ;; dired mode key bindings and initialization |
| 862 | 862 | ||
| 863 | (defvar dired-mode-map nil "Local keymap for dired-mode buffers.") | 863 | (defvar dired-mode-map nil "Local keymap for dired-mode buffers.") |
| @@ -1188,7 +1188,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh." | |||
| 1188 | :help "Copy current file or all marked files")) | 1188 | :help "Copy current file or all marked files")) |
| 1189 | 1189 | ||
| 1190 | (setq dired-mode-map map))) | 1190 | (setq dired-mode-map map))) |
| 1191 | 1191 | ||
| 1192 | ;; Dired mode is suitable only for specially formatted data. | 1192 | ;; Dired mode is suitable only for specially formatted data. |
| 1193 | (put 'dired-mode 'mode-class 'special) | 1193 | (put 'dired-mode 'mode-class 'special) |
| 1194 | 1194 | ||
| @@ -1282,7 +1282,7 @@ Keybindings: | |||
| 1282 | (set (make-local-variable 'font-lock-defaults) '(dired-font-lock-keywords t)) | 1282 | (set (make-local-variable 'font-lock-defaults) '(dired-font-lock-keywords t)) |
| 1283 | (dired-sort-other dired-actual-switches t) | 1283 | (dired-sort-other dired-actual-switches t) |
| 1284 | (run-hooks 'dired-mode-hook)) | 1284 | (run-hooks 'dired-mode-hook)) |
| 1285 | 1285 | ||
| 1286 | ;; Idiosyncratic dired commands that don't deal with marks. | 1286 | ;; Idiosyncratic dired commands that don't deal with marks. |
| 1287 | 1287 | ||
| 1288 | (defun dired-summary () | 1288 | (defun dired-summary () |
| @@ -1402,7 +1402,7 @@ otherwise, display it in another buffer." | |||
| 1402 | (interactive) | 1402 | (interactive) |
| 1403 | (let ((file (file-name-sans-versions (dired-get-filename) t))) | 1403 | (let ((file (file-name-sans-versions (dired-get-filename) t))) |
| 1404 | (display-buffer (find-file-noselect file)))) | 1404 | (display-buffer (find-file-noselect file)))) |
| 1405 | 1405 | ||
| 1406 | ;;; Functions for extracting and manipulating file names in dired buffers. | 1406 | ;;; Functions for extracting and manipulating file names in dired buffers. |
| 1407 | 1407 | ||
| 1408 | (defun dired-get-filename (&optional localp no-error-if-not-filep) | 1408 | (defun dired-get-filename (&optional localp no-error-if-not-filep) |
| @@ -1492,7 +1492,7 @@ DIR must be a directory name, not a file name." | |||
| 1492 | ;;; (or no-error | 1492 | ;;; (or no-error |
| 1493 | ;;; (error "%s: not in directory tree growing at %s" file dir)) | 1493 | ;;; (error "%s: not in directory tree growing at %s" file dir)) |
| 1494 | file)) | 1494 | file)) |
| 1495 | 1495 | ||
| 1496 | ;;; Functions for finding the file name in a dired buffer line. | 1496 | ;;; Functions for finding the file name in a dired buffer line. |
| 1497 | 1497 | ||
| 1498 | (defvar dired-move-to-filename-regexp | 1498 | (defvar dired-move-to-filename-regexp |
| @@ -1502,7 +1502,7 @@ DIR must be a directory name, not a file name." | |||
| 1502 | ;; weiand: changed: month ends potentially with . or , or ., | 1502 | ;; weiand: changed: month ends potentially with . or , or ., |
| 1503 | ;;old (month (concat l l "+ *")) | 1503 | ;;old (month (concat l l "+ *")) |
| 1504 | (month (concat l l "+[.]?,? *")) | 1504 | (month (concat l l "+[.]?,? *")) |
| 1505 | ;; Recognize any non-ASCII character. | 1505 | ;; Recognize any non-ASCII character. |
| 1506 | ;; The purpose is to match a Kanji character. | 1506 | ;; The purpose is to match a Kanji character. |
| 1507 | (k "[^\0-\177]") | 1507 | (k "[^\0-\177]") |
| 1508 | ;; (k "[^\x00-\x7f\x80-\xff]") | 1508 | ;; (k "[^\x00-\x7f\x80-\xff]") |
| @@ -1515,7 +1515,7 @@ DIR must be a directory name, not a file name." | |||
| 1515 | (western (concat "\\(" month s dd "\\|" dd s month "\\)" | 1515 | (western (concat "\\(" month s dd "\\|" dd s month "\\)" |
| 1516 | ;; weiand: changed: year potentially unaligned | 1516 | ;; weiand: changed: year potentially unaligned |
| 1517 | ;;old s "\\(" HH:MM "\\|" s yyyy "\\|" yyyy s "\\)")) | 1517 | ;;old s "\\(" HH:MM "\\|" s yyyy "\\|" yyyy s "\\)")) |
| 1518 | s "\\(" HH:MM | 1518 | s "\\(" HH:MM |
| 1519 | "\\|" yyyy s s "?" | 1519 | "\\|" yyyy s s "?" |
| 1520 | "\\|" s "?" yyyy | 1520 | "\\|" s "?" yyyy |
| 1521 | "\\)")) | 1521 | "\\)")) |
| @@ -1612,7 +1612,7 @@ regardless of the language.") | |||
| 1612 | nil | 1612 | nil |
| 1613 | (point)))) | 1613 | (point)))) |
| 1614 | 1614 | ||
| 1615 | 1615 | ||
| 1616 | ;; Keeping Dired buffers in sync with the filesystem and with each other | 1616 | ;; Keeping Dired buffers in sync with the filesystem and with each other |
| 1617 | 1617 | ||
| 1618 | (defun dired-buffers-for-dir (dir &optional file) | 1618 | (defun dired-buffers-for-dir (dir &optional file) |
| @@ -1677,7 +1677,7 @@ regardless of the language.") | |||
| 1677 | (substring pattern matched-in-pattern)) | 1677 | (substring pattern matched-in-pattern)) |
| 1678 | "\\'"))) | 1678 | "\\'"))) |
| 1679 | 1679 | ||
| 1680 | 1680 | ||
| 1681 | 1681 | ||
| 1682 | (defun dired-advertise () | 1682 | (defun dired-advertise () |
| 1683 | ;;"Advertise in variable `dired-buffers' that we dired `default-directory'." | 1683 | ;;"Advertise in variable `dired-buffers' that we dired `default-directory'." |
| @@ -1696,7 +1696,7 @@ regardless of the language.") | |||
| 1696 | ;; Removing is also done as a side-effect in dired-buffer-for-dir. | 1696 | ;; Removing is also done as a side-effect in dired-buffer-for-dir. |
| 1697 | (setq dired-buffers | 1697 | (setq dired-buffers |
| 1698 | (delq (assoc (expand-file-name dir) dired-buffers) dired-buffers))) | 1698 | (delq (assoc (expand-file-name dir) dired-buffers) dired-buffers))) |
| 1699 | 1699 | ||
| 1700 | ;; Tree Dired | 1700 | ;; Tree Dired |
| 1701 | 1701 | ||
| 1702 | ;;; utility functions | 1702 | ;;; utility functions |
| @@ -1898,7 +1898,7 @@ Returns the new value of the alist." | |||
| 1898 | ;; You may redefine this function as you wish, e.g. like in dired-x.el. | 1898 | ;; You may redefine this function as you wish, e.g. like in dired-x.el. |
| 1899 | (end-of-line) | 1899 | (end-of-line) |
| 1900 | (if dired-trivial-filenames (dired-goto-next-nontrivial-file))) | 1900 | (if dired-trivial-filenames (dired-goto-next-nontrivial-file))) |
| 1901 | 1901 | ||
| 1902 | ;; These are hooks which make tree dired work. | 1902 | ;; These are hooks which make tree dired work. |
| 1903 | ;; They are in this file because other parts of dired need to call them. | 1903 | ;; They are in this file because other parts of dired need to call them. |
| 1904 | ;; But they don't call the rest of tree dired unless there are subdirs loaded. | 1904 | ;; But they don't call the rest of tree dired unless there are subdirs loaded. |
| @@ -1935,7 +1935,7 @@ Optional argument means return a file name relative to `default-directory'." | |||
| 1935 | (if (or (null (cdr dired-subdir-alist)) (not (dired-next-subdir 1 t t))) | 1935 | (if (or (null (cdr dired-subdir-alist)) (not (dired-next-subdir 1 t t))) |
| 1936 | (point-max) | 1936 | (point-max) |
| 1937 | (point)))) | 1937 | (point)))) |
| 1938 | 1938 | ||
| 1939 | ;; Deleting files | 1939 | ;; Deleting files |
| 1940 | 1940 | ||
| 1941 | (defcustom dired-recursive-deletes nil ; Default only delete empty directories. | 1941 | (defcustom dired-recursive-deletes nil ; Default only delete empty directories. |
| @@ -1951,7 +1951,7 @@ Anything else means ask for each directory." | |||
| 1951 | (const :tag "Ask for each top directory only" top)) | 1951 | (const :tag "Ask for each top directory only" top)) |
| 1952 | :group 'dired) | 1952 | :group 'dired) |
| 1953 | 1953 | ||
| 1954 | ;; Match anything but `.' and `..'. | 1954 | ;; Match anything but `.' and `..'. |
| 1955 | (defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*") | 1955 | (defvar dired-re-no-dot "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*") |
| 1956 | 1956 | ||
| 1957 | ;; Delete file, possibly delete a directory and all its files. | 1957 | ;; Delete file, possibly delete a directory and all its files. |
| @@ -2064,7 +2064,7 @@ if there are no flagged files." | |||
| 2064 | (save-excursion (and (cdr dired-subdir-alist) | 2064 | (save-excursion (and (cdr dired-subdir-alist) |
| 2065 | (dired-goto-subdir fn) | 2065 | (dired-goto-subdir fn) |
| 2066 | (dired-kill-subdir)))) | 2066 | (dired-kill-subdir)))) |
| 2067 | 2067 | ||
| 2068 | ;; Confirmation | 2068 | ;; Confirmation |
| 2069 | 2069 | ||
| 2070 | (defun dired-marker-regexp () | 2070 | (defun dired-marker-regexp () |
| @@ -2184,7 +2184,7 @@ FILES is the list of marked files." | |||
| 2184 | j (1+ j) | 2184 | j (1+ j) |
| 2185 | files (cdr files))) | 2185 | files (cdr files))) |
| 2186 | rows)) | 2186 | rows)) |
| 2187 | 2187 | ||
| 2188 | ;; Commands to mark or flag file(s) at or near current line. | 2188 | ;; Commands to mark or flag file(s) at or near current line. |
| 2189 | 2189 | ||
| 2190 | (defun dired-repeat-over-lines (arg function) | 2190 | (defun dired-repeat-over-lines (arg function) |
| @@ -2325,7 +2325,7 @@ As always, hidden subdirs are not affected." | |||
| 2325 | (list ?\040 dired-marker-char) | 2325 | (list ?\040 dired-marker-char) |
| 2326 | (list dired-marker-char ?\040)))) | 2326 | (list dired-marker-char ?\040)))) |
| 2327 | (forward-line 1))))) | 2327 | (forward-line 1))))) |
| 2328 | 2328 | ||
| 2329 | ;;; Commands to mark or flag files based on their characteristics or names. | 2329 | ;;; Commands to mark or flag files based on their characteristics or names. |
| 2330 | 2330 | ||
| 2331 | (defvar dired-regexp-history nil | 2331 | (defvar dired-regexp-history nil |
| @@ -2444,7 +2444,7 @@ A prefix argument says to unflag those files instead." | |||
| 2444 | "auto save file"))) | 2444 | "auto save file"))) |
| 2445 | 2445 | ||
| 2446 | (defvar dired-garbage-files-regexp | 2446 | (defvar dired-garbage-files-regexp |
| 2447 | "\\.log$\\|\\.toc$\\|\\.dvi$\\|\\.bak$\\|\\.orig$\\|\\.rej$" | 2447 | "\\.log$\\|\\.toc$\\|\\.dvi$\\|\\.bak$\\|\\.orig$\\|\\.rej$" |
| 2448 | "*Regular expression to match \"garbage\" files for `dired-flag-garbage-files'.") | 2448 | "*Regular expression to match \"garbage\" files for `dired-flag-garbage-files'.") |
| 2449 | 2449 | ||
| 2450 | (defun dired-flag-garbage-files () | 2450 | (defun dired-flag-garbage-files () |
| @@ -2504,7 +2504,7 @@ OLD and NEW are both characters used to mark files." | |||
| 2504 | 2504 | ||
| 2505 | (defun dired-unmark-all-files (mark &optional arg) | 2505 | (defun dired-unmark-all-files (mark &optional arg) |
| 2506 | "Remove a specific mark (or any mark) from every file. | 2506 | "Remove a specific mark (or any mark) from every file. |
| 2507 | After this command, type the mark character to remove, | 2507 | After this command, type the mark character to remove, |
| 2508 | or type RET to remove all marks. | 2508 | or type RET to remove all marks. |
| 2509 | With prefix arg, query for each marked file. | 2509 | With prefix arg, query for each marked file. |
| 2510 | Type \\[help-command] at that time for help." | 2510 | Type \\[help-command] at that time for help." |
| @@ -2529,7 +2529,7 @@ Type SPC or `y' to unmark one file, DEL or `n' to skip to next, | |||
| 2529 | (message (if (= count 1) "1 mark removed" | 2529 | (message (if (= count 1) "1 mark removed" |
| 2530 | "%d marks removed") | 2530 | "%d marks removed") |
| 2531 | count)))) | 2531 | count)))) |
| 2532 | 2532 | ||
| 2533 | ;; Logging failures operating on files, and showing the results. | 2533 | ;; Logging failures operating on files, and showing the results. |
| 2534 | 2534 | ||
| 2535 | (defvar dired-log-buffer "*Dired log*") | 2535 | (defvar dired-log-buffer "*Dired log*") |
| @@ -2579,7 +2579,7 @@ Thus, use \\[backward-page] to find the beginning of a group of errors." | |||
| 2579 | ;; Log a summary describing a bunch of errors. | 2579 | ;; Log a summary describing a bunch of errors. |
| 2580 | (dired-log (concat "\n" string)) | 2580 | (dired-log (concat "\n" string)) |
| 2581 | (dired-log t)) | 2581 | (dired-log t)) |
| 2582 | 2582 | ||
| 2583 | ;;; Sorting | 2583 | ;;; Sorting |
| 2584 | 2584 | ||
| 2585 | ;; Most ls can only sort by name or by date (with -t), nothing else. | 2585 | ;; Most ls can only sort by name or by date (with -t), nothing else. |
| @@ -2629,15 +2629,15 @@ With a prefix argument you can edit the current listing switches instead." | |||
| 2629 | (if (string-match " " dired-actual-switches) | 2629 | (if (string-match " " dired-actual-switches) |
| 2630 | ;; New toggle scheme: add/remove a trailing " -t" | 2630 | ;; New toggle scheme: add/remove a trailing " -t" |
| 2631 | (if (string-match " -t\\'" dired-actual-switches) | 2631 | (if (string-match " -t\\'" dired-actual-switches) |
| 2632 | (replace-regexp-in-string " -t\\'" "" dired-actual-switches) | 2632 | (dired-replace-in-string " -t\\'" "" dired-actual-switches) |
| 2633 | (concat dired-actual-switches " -t")) | 2633 | (concat dired-actual-switches " -t")) |
| 2634 | ;; old toggle scheme: look for some 't' switch and add/remove it | 2634 | ;; old toggle scheme: look for some 't' switch and add/remove it |
| 2635 | (concat | 2635 | (concat |
| 2636 | "-l" | 2636 | "-l" |
| 2637 | (replace-regexp-in-string (concat "[-lt" | 2637 | (dired-replace-in-string (concat "[-lt" |
| 2638 | dired-ls-sorting-switches "]") | 2638 | dired-ls-sorting-switches "]") |
| 2639 | "" | 2639 | "" |
| 2640 | dired-actual-switches) | 2640 | dired-actual-switches) |
| 2641 | (if (string-match (concat "[t" dired-ls-sorting-switches "]") | 2641 | (if (string-match (concat "[t" dired-ls-sorting-switches "]") |
| 2642 | dired-actual-switches) | 2642 | dired-actual-switches) |
| 2643 | "" | 2643 | "" |
| @@ -2645,6 +2645,18 @@ With a prefix argument you can edit the current listing switches instead." | |||
| 2645 | (dired-sort-set-modeline) | 2645 | (dired-sort-set-modeline) |
| 2646 | (revert-buffer)) | 2646 | (revert-buffer)) |
| 2647 | 2647 | ||
| 2648 | ;; Some user code loads dired especially for this. | ||
| 2649 | (defun dired-replace-in-string (regexp newtext string) | ||
| 2650 | ;; Replace REGEXP with NEWTEXT everywhere in STRING and return result. | ||
| 2651 | ;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized. | ||
| 2652 | (let ((result "") (start 0) mb me) | ||
| 2653 | (while (string-match regexp string start) | ||
| 2654 | (setq mb (match-beginning 0) | ||
| 2655 | me (match-end 0) | ||
| 2656 | result (concat result (substring string start mb) newtext) | ||
| 2657 | start me)) | ||
| 2658 | (concat result (substring string start)))) | ||
| 2659 | |||
| 2648 | (defun dired-sort-other (switches &optional no-revert) | 2660 | (defun dired-sort-other (switches &optional no-revert) |
| 2649 | ;; Specify new ls SWITCHES for current dired buffer. Values matching | 2661 | ;; Specify new ls SWITCHES for current dired buffer. Values matching |
| 2650 | ;; `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp' set the | 2662 | ;; `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp' set the |
| @@ -2689,7 +2701,7 @@ To be called first in body of `dired-sort-other', etc." | |||
| 2689 | ;; No pre-R subdir alist, so revert to main directory | 2701 | ;; No pre-R subdir alist, so revert to main directory |
| 2690 | ;; listing: | 2702 | ;; listing: |
| 2691 | (list (car (reverse dired-subdir-alist)))))))) | 2703 | (list (car (reverse dired-subdir-alist)))))))) |
| 2692 | 2704 | ||
| 2693 | ;; To make this file smaller, the less common commands | 2705 | ;; To make this file smaller, the less common commands |
| 2694 | ;; go in a separate file. But autoload them here | 2706 | ;; go in a separate file. But autoload them here |
| 2695 | ;; to make the separation invisible. | 2707 | ;; to make the separation invisible. |
| @@ -2902,9 +2914,9 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory." | |||
| 2902 | (autoload 'dired-show-file-type "dired-aux" | 2914 | (autoload 'dired-show-file-type "dired-aux" |
| 2903 | "Print the type of FILE, according to the `file' command. | 2915 | "Print the type of FILE, according to the `file' command. |
| 2904 | If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is | 2916 | If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is |
| 2905 | true then the type of the file linked to by FILE is printed instead." | 2917 | true then the type of the file linked to by FILE is printed instead." |
| 2906 | t) | 2918 | t) |
| 2907 | 2919 | ||
| 2908 | (if (eq system-type 'vax-vms) | 2920 | (if (eq system-type 'vax-vms) |
| 2909 | (load "dired-vms")) | 2921 | (load "dired-vms")) |
| 2910 | 2922 | ||