comparison lisp/efs/dired.el @ 183:e121b013d1f0 r20-3b18

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