Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!sunpitt.east.sun.com!wpmstr!fpb From: wpmstr!fpb@sunpitt.east.sun.com (Frank P. Bresz) Newsgroups: gnu.emacs Subject: Dired mode and the unix -F switch (repost) Message-ID: <9001242115.AA02196@wpmstr.wp> Date: 24 Jan 90 21:15:42 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: wpmstr!fbresz@sunpitt.east.sun.com Distribution: gnu Organization: Westinghouse, ITTC, Pgh, PA. Lines: 203 Hi All, Last patch was backwards. Here is the real one. Thanks to tale@turing.cs.rpi.edu (David C Lawrence) for catching it. Any comments back to: InterNet : wpmstr!fbresz@sunpitt.east.sun.com Voice : (412)733-6749 Fax : (412)733-6444 Snail : Westinghouse Electric Corp ITTC Mail Stop 7 1740 Golden Mile Highway Monroeille, PA 15146 enjoy. Frank P. Bresz }*{ Here is the patch ... diff -c dist-18.52/dired.el dired.el *** dist-18.52/dired.el Mon Aug 8 08:14:09 1988 --- dired.el Wed Jan 17 11:32:55 1990 *************** *** 21,28 **** ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. - ;In loaddefs.el ;(defvar dired-listing-switches "-al" ; "Switches passed to ls for dired. MUST contain the 'l' option. --- 21,36 ---- ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. + ;; + ;;----------------------------------------------------------------------- + ;; Mon Jan 8, 1990 + ;; Kludged (dired-get-filename) wpmstr!fbresz@sunpitt.east.sun.com + ;; This is to allow 'F' as a valid switch in the + ;; dired-listing-switches variable + ;; Should probably change the doc string for dired-listing-switches variable + ;; but since it is inside loaddefs.el it will have to wait until a release from + ;; FSF. ;In loaddefs.el ;(defvar dired-listing-switches "-al" ; "Switches passed to ls for dired. MUST contain the 'l' option. *************** *** 271,295 **** Value returned normally includes the directory name. A non-nil 1st argument means do not include it. A non-nil 2nd argument says return nil if no filename on this line, otherwise an error occurs." ! (let (eol) ! (save-excursion ! (end-of-line) ! (setq eol (point)) ! (beginning-of-line) ! (if (re-search-forward ! "\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\)[ ]+[0-9]+" ! eol t) ! (progn (skip-chars-forward " ") ! (skip-chars-forward "^ " eol) ! (skip-chars-forward " " eol) ! (let ((beg (point))) ! (skip-chars-forward "^ \n") ! (if localp ! (buffer-substring beg (point)) ! ;; >> uses default-directory, could lose on cd, multiple. ! (concat default-directory (buffer-substring beg (point)))))) ! (if no-error-if-not-filep nil ! (error "No file on this line")))))) (defun dired-move-to-filename () "In dired, move to first char of filename on this line. --- 279,309 ---- Value returned normally includes the directory name. A non-nil 1st argument means do not include it. A non-nil 2nd argument says return nil if no filename on this line, otherwise an error occurs." ! (let (eol fname) ! (setq fname ! (save-excursion ! (end-of-line) ! (setq eol (point)) ! (beginning-of-line) ! (if (re-search-forward ! "\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\)[ ]+[0-9]+" ! eol t) ! (progn (skip-chars-forward " ") ! (skip-chars-forward "^ " eol) ! (skip-chars-forward " " eol) ! (let ((beg (point))) ! (skip-chars-forward "^ \n") ! (if localp ! (buffer-substring beg (point)) ! ;; >> uses default-directory, could lose on cd, multiple. ! (concat default-directory (buffer-substring beg (point)))))) ! (if no-error-if-not-filep nil ! (error "No file on this line"))))) ! (if fname ! (if (file-exists-p fname) ! fname ! (if (file-exists-p (substring fname 0 -1)) ! (substring fname 0 -1)))))) (defun dired-move-to-filename () "In dired, move to first char of filename on this line. *************** *** 432,443 **** (defun dired-rename-file (to-file) "Rename this file to TO-FILE." ! (interactive ! (list (read-file-name (format "Rename %s to: " ! (file-name-nondirectory (dired-get-filename))) ! nil (dired-get-filename)))) (setq to-file (expand-file-name to-file)) ! (rename-file (dired-get-filename) to-file) (let ((buffer-read-only nil)) (beginning-of-line) (delete-region (point) (progn (forward-line 1) (point))) --- 446,459 ---- (defun dired-rename-file (to-file) "Rename this file to TO-FILE." ! (interactive "FRename to: ") (setq to-file (expand-file-name to-file)) ! (and (file-directory-p to-file) ! (setq to-file ! (concat (file-name-as-directory to-file) ! (file-name-nondirectory ! (dired-get-filename))))) ! (rename-file (dired-get-filename) to-file 0) (let ((buffer-read-only nil)) (beginning-of-line) (delete-region (point) (progn (forward-line 1) (point))) *************** *** 448,455 **** (defun dired-copy-file (to-file) "Copy this file to TO-FILE." (interactive "FCopy to: ") - (copy-file (dired-get-filename) to-file) (setq to-file (expand-file-name to-file)) (dired-add-entry (file-name-directory to-file) (file-name-nondirectory to-file))) --- 464,476 ---- (defun dired-copy-file (to-file) "Copy this file to TO-FILE." (interactive "FCopy to: ") (setq to-file (expand-file-name to-file)) + (and (file-directory-p to-file) + (setq to-file + (concat (file-name-as-directory to-file) + (file-name-nondirectory + (dired-get-filename))))) + (copy-file (dired-get-filename) to-file 0) (dired-add-entry (file-name-directory to-file) (file-name-nondirectory to-file))) *************** *** 542,550 **** (file-name-nondirectory file))) (dired-move-to-filename)) ! (defun dired-do-deletions () "In dired, delete the files flagged for deletion." ! (interactive) (let (delete-list answer) (save-excursion (goto-char 1) --- 563,571 ---- (file-name-nondirectory file))) (dired-move-to-filename)) ! (defun dired-do-deletions (arg) "In dired, delete the files flagged for deletion." ! (interactive "P") (let (delete-list answer) (save-excursion (goto-char 1) *************** *** 568,574 **** (insert (car (car l))) (setq l (cdr l)))) (goto-char (point-min)) ! (setq answer (yes-or-no-p "Delete these files? "))) (if answer (let ((l delete-list) failures) --- 589,595 ---- (insert (car (car l))) (setq l (cdr l)))) (goto-char (point-min)) ! (setq answer (or arg (yes-or-no-p "Delete these files? ")))) (if answer (let ((l delete-list) failures)