Mercurial > hg > xemacs-beta
comparison lisp/efs/dired.el @ 50:ee648375d8d6 r19-16b91
Import from CVS: tag r19-16b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:56:41 +0200 |
parents | 56c54cf7c5b6 |
children |
comparison
equal
deleted
inserted
replaced
49:b46643e427ac | 50:ee648375d8d6 |
---|---|
381 (defvar dired-refresh-automatically t | 381 (defvar dired-refresh-automatically t |
382 "*If non-nil, refresh dired buffers automatically after file operations.") | 382 "*If non-nil, refresh dired buffers automatically after file operations.") |
383 | 383 |
384 ;;; File name regular expressions and extensions. | 384 ;;; File name regular expressions and extensions. |
385 | 385 |
386 (defvar dired-trivial-filenames "^\\.\\.?$\\|^#" | 386 (defvar dired-trivial-filenames "\\`\\.\\.?\\'\\|\\`#" |
387 "*Regexp of files to skip when finding first file of a directory listing. | 387 "*Regexp of files to skip when finding first file of a directory listing. |
388 A value of nil means move to the subdir line. | 388 A value of nil means move to the subdir line. |
389 A value of t means move to first file.") | 389 A value of t means move to first file.") |
390 | 390 |
391 (defvar dired-cleanup-alist | 391 (defvar dired-cleanup-alist |
416 This only has effect when the subdirectory is in omission mode. | 416 This only has effect when the subdirectory is in omission mode. |
417 To make omission mode the default, set `dired-omit-files' to t. | 417 To make omission mode the default, set `dired-omit-files' to t. |
418 See also `dired-omit-extensions'.") | 418 See also `dired-omit-extensions'.") |
419 (make-variable-buffer-local 'dired-omit-extensions) | 419 (make-variable-buffer-local 'dired-omit-extensions) |
420 | 420 |
421 (defvar dired-omit-regexps '("^#" "^\\.") | 421 (defvar dired-omit-regexps '("\\`#" "\\`\\.") |
422 "*File names matching these regexp may be omitted (buffer-local). | 422 "*File names matching these regexp may be omitted (buffer-local). |
423 This only has effect when the subdirectory is in omission mode. | 423 This only has effect when the subdirectory is in omission mode. |
424 To make omission mode the default, set `dired-omit-files' to t. | 424 To make omission mode the default, set `dired-omit-files' to t. |
425 This only has effect when `dired-omit-files' is t. | 425 This only has effect when `dired-omit-files' is t. |
426 See also `dired-omit-extensions'.") | 426 See also `dired-omit-extensions'.") |
427 (make-variable-buffer-local 'dired-omit-regexps) | 427 (make-variable-buffer-local 'dired-omit-regexps) |
428 | 428 |
429 (defvar dired-filename-re-ext "\\..+$" ; start from the first dot. last dot? | 429 (defvar dired-filename-re-ext "\\..+\\'" ; start from the first dot. last dot? |
430 "*Defines what is the extension of a file name. | 430 "*Defines what is the extension of a file name. |
431 \(match-beginning 0\) for this regexp in the file name without directory will | 431 \(match-beginning 0\) for this regexp in the file name without directory will |
432 be taken to be the start of the extension.") | 432 be taken to be the start of the extension.") |
433 | 433 |
434 ;;; Hook variables | 434 ;;; Hook variables |
2813 ;;;; -------------------------------------------------------- | 2813 ;;;; -------------------------------------------------------- |
2814 | 2814 |
2815 (defun dired-find-file () | 2815 (defun dired-find-file () |
2816 "In dired, visit the file or directory named on this line." | 2816 "In dired, visit the file or directory named on this line." |
2817 (interactive) | 2817 (interactive) |
2818 (find-file (dired-get-filename))) | 2818 (let ((find-file-run-dired t)) |
2819 (find-file (dired-get-filename)))) | |
2819 | 2820 |
2820 (defun dired-view-file () | 2821 (defun dired-view-file () |
2821 "In dired, examine a file in view mode, returning to dired when done. | 2822 "In dired, examine a file in view mode, returning to dired when done. |
2822 When file is a directory, show it in this buffer if it is inserted; | 2823 When file is a directory, show it in this buffer if it is inserted; |
2823 otherwise, display it in another buffer." | 2824 otherwise, display it in another buffer." |
2832 "In dired, visit this file or directory in another window. | 2833 "In dired, visit this file or directory in another window. |
2833 With a prefix, the file is displayed, but the window is not selected." | 2834 With a prefix, the file is displayed, but the window is not selected." |
2834 (interactive "P") | 2835 (interactive "P") |
2835 (if display | 2836 (if display |
2836 (dired-display-file) | 2837 (dired-display-file) |
2837 (find-file-other-window (dired-get-filename)))) | 2838 (let ((find-file-run-dired t)) |
2839 (find-file-other-window (dired-get-filename))))) | |
2838 | 2840 |
2839 ;; Only for Emacs 19 | 2841 ;; Only for Emacs 19 |
2840 (defun dired-find-file-other-frame () | 2842 (defun dired-find-file-other-frame () |
2841 "In dired, visit this file or directory in another frame." | 2843 "In dired, visit this file or directory in another frame." |
2842 (interactive) | 2844 (interactive) |
2843 (find-file-other-frame (dired-get-filename))) | 2845 (let ((find-file-run-dired t)) |
2846 (find-file-other-frame (dired-get-filename)))) | |
2844 | 2847 |
2845 (defun dired-display-file () | 2848 (defun dired-display-file () |
2846 "In dired, displays this file or directory in the other window." | 2849 "In dired, displays this file or directory in the other window." |
2847 (interactive) | 2850 (interactive) |
2848 (display-buffer (find-file-noselect (dired-get-filename)))) | 2851 (let ((find-file-run-dired t)) |
2852 (display-buffer (find-file-noselect (dired-get-filename))))) | |
2849 | 2853 |
2850 ;; After an idea by wurgler@zippysun.math.uakron.edu (Tom Wurgler). | 2854 ;; After an idea by wurgler@zippysun.math.uakron.edu (Tom Wurgler). |
2851 (defun dired-do-find-file (&optional arg) | 2855 (defun dired-do-find-file (&optional arg) |
2852 "Visit all marked files at once, and display them simultaneously. | 2856 "Visit all marked files at once, and display them simultaneously. |
2853 See also function `simultaneous-find-file'. | 2857 See also function `simultaneous-find-file'. |
2874 (while file-list | 2878 (while file-list |
2875 ;; Split off vertically a window of the desired size | 2879 ;; Split off vertically a window of the desired size |
2876 ;; The upper window will have SIZE lines. We select the lower | 2880 ;; The upper window will have SIZE lines. We select the lower |
2877 ;; (larger) window because we want to split that again. | 2881 ;; (larger) window because we want to split that again. |
2878 (select-window (split-window nil size)) | 2882 (select-window (split-window nil size)) |
2879 (find-file (car file-list)) | 2883 (let ((find-file-run-dired t)) |
2884 (find-file (car file-list))) | |
2880 (setq file-list (cdr file-list))))) | 2885 (setq file-list (cdr file-list))))) |
2881 | 2886 |
2882 (defun dired-create-directory (directory) | 2887 (defun dired-create-directory (directory) |
2883 "Create a directory called DIRECTORY." | 2888 "Create a directory called DIRECTORY." |
2884 (interactive | 2889 (interactive |
3043 "")) | 3048 "")) |
3044 | 3049 |
3045 (defun dired-file-name-sans-rcs-extension (fn) | 3050 (defun dired-file-name-sans-rcs-extension (fn) |
3046 "Returns the file name FN without its RCS extension \",v\"." | 3051 "Returns the file name FN without its RCS extension \",v\"." |
3047 (setq fn (file-name-nondirectory fn)) | 3052 (setq fn (file-name-nondirectory fn)) |
3048 (if (string-match ",v$" fn 1) | 3053 (if (string-match ",v\\'" fn 1) |
3049 (substring fn 0 (match-beginning 0)) | 3054 (substring fn 0 (match-beginning 0)) |
3050 fn)) | 3055 fn)) |
3051 | 3056 |
3052 (defun dired-file-name-sans-compress-extension (fn) | 3057 (defun dired-file-name-sans-compress-extension (fn) |
3053 "Returns the file name FN without the extension from compress or gzip." | 3058 "Returns the file name FN without the extension from compress or gzip." |
3054 (setq fn (file-name-nondirectory fn)) | 3059 (setq fn (file-name-nondirectory fn)) |
3055 (if (string-match "\\.\\([zZ]\\|gz\\)$" fn 1) | 3060 (if (string-match "\\.\\([zZ]\\|gz\\)\\'" fn 1) |
3056 (substring fn (match-beginning 0)) | 3061 (substring fn (match-beginning 0)) |
3057 fn)) | 3062 fn)) |
3058 | 3063 |
3059 | 3064 |
3060 ;;;; --------------------------------------------------------------------- | 3065 ;;;; --------------------------------------------------------------------- |
4212 (lambda (dir) | 4217 (lambda (dir) |
4213 (or (equal (file-name-nondirectory (directory-file-name dir)) | 4218 (or (equal (file-name-nondirectory (directory-file-name dir)) |
4214 "RCS") | 4219 "RCS") |
4215 ;; skip inserted RCS subdirs | 4220 ;; skip inserted RCS subdirs |
4216 (setq rcs-files | 4221 (setq rcs-files |
4217 (append (directory-files dir t ",v$") ; *,v and RCS/*,v | 4222 (append (directory-files dir t ",v\\'") ; *,v and RCS/*,v |
4218 (let ((rcs-dir (expand-file-name "RCS" dir))) | 4223 (let ((rcs-dir (expand-file-name "RCS" dir))) |
4219 (if (file-directory-p rcs-dir) | 4224 (if (file-directory-p rcs-dir) |
4220 (mapcar ; working files from ./RCS are in ./ | 4225 (mapcar ; working files from ./RCS are in ./ |
4221 (function | 4226 (function |
4222 (lambda (x) | 4227 (lambda (x) |
4223 (expand-file-name x dir))) | 4228 (expand-file-name x dir))) |
4224 (directory-files | 4229 (directory-files |
4225 (file-name-as-directory rcs-dir) | 4230 (file-name-as-directory rcs-dir) |
4226 nil ",v$")))) | 4231 nil ",v\\'")))) |
4227 rcs-files))))) | 4232 rcs-files))))) |
4228 (mapcar (function car) dired-subdir-alist)) | 4233 (mapcar (function car) dired-subdir-alist)) |
4229 (setq total (length rcs-files)) | 4234 (setq total (length rcs-files)) |
4230 (while rcs-files | 4235 (while rcs-files |
4231 (setq wf (substring (car rcs-files) 0 -2) | 4236 (setq wf (substring (car rcs-files) 0 -2) |
5427 (let (rgxp) | 5432 (let (rgxp) |
5428 (if dired-omit-extensions | 5433 (if dired-omit-extensions |
5429 (setq rgxp (concat | 5434 (setq rgxp (concat |
5430 ".\\(" | 5435 ".\\(" |
5431 (mapconcat 'regexp-quote dired-omit-extensions "\\|") | 5436 (mapconcat 'regexp-quote dired-omit-extensions "\\|") |
5432 "\\)$"))) | 5437 "\\)\\'"))) |
5433 (if dired-omit-regexps | 5438 (if dired-omit-regexps |
5434 (setq rgxp | 5439 (setq rgxp |
5435 (concat | 5440 (concat |
5436 rgxp | 5441 rgxp |
5437 (and rgxp "\\|") | 5442 (and rgxp "\\|") |