comparison lisp/dired-aux.el @ 4478:f25a821aefb0

(dired-diff): Read options right here; don't try to use diff-read-switches. Always call diff with 3 args. (dired-backup-diff): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Sat, 07 Aug 1993 19:25:43 +0000
parents 6e13c3b03b67
children c40febdb9967
comparison
equal deleted inserted replaced
4477:7101a887f80d 4478:f25a821aefb0
41 41
42 ;;;###autoload 42 ;;;###autoload
43 (defun dired-diff (file &optional switches) 43 (defun dired-diff (file &optional switches)
44 "Compare file at point with file FILE using `diff'. 44 "Compare file at point with file FILE using `diff'.
45 FILE defaults to the file at the mark. 45 FILE defaults to the file at the mark.
46 The prompted-for file is the first file given to `diff'." 46 The prompted-for file is the first file given to `diff'.
47 With prefix arg, prompt for second argument SWITCHES,
48 which is options for `diff'."
47 (interactive 49 (interactive
48 (let ((default (if (mark t) 50 (let ((default (if (mark t)
49 (save-excursion (goto-char (mark t)) 51 (save-excursion (goto-char (mark t))
50 (dired-get-filename t t))))) 52 (dired-get-filename t t)))))
51 (list (read-file-name (format "Diff %s with: %s" 53 (list (read-file-name (format "Diff %s with: %s"
52 (dired-get-filename t) 54 (dired-get-filename t)
53 (if default 55 (if default
54 (concat "(default " default ") ") 56 (concat "(default " default ") ")
55 "")) 57 ""))
56 (dired-current-directory) default t) 58 (dired-current-directory) default t)
57 (if (fboundp 'diff-read-switches) 59 (if current-prefix-arg
58 (diff-read-switches "Options for diff: "))))) 60 (read-string "Options for diff: "
59 (if switches ; Emacs 19's diff has but two 61 (if (stringp diff-switches)
60 (diff file (dired-get-filename t) switches) ; args (yet ;-) 62 diff-switches
61 (diff file (dired-get-filename t)))) 63 (mapconcat 'identity diff-switches " ")))))))
64 (diff file (dired-get-filename t) switches))
62 65
63 ;;;###autoload 66 ;;;###autoload
64 (defun dired-backup-diff (&optional switches) 67 (defun dired-backup-diff (&optional switches)
65 "Diff this file with its backup file or vice versa. 68 "Diff this file with its backup file or vice versa.
66 Uses the latest backup, if there are several numerical backups. 69 Uses the latest backup, if there are several numerical backups.
67 If this file is a backup, diff it with its original. 70 If this file is a backup, diff it with its original.
68 The backup file is the first file given to `diff'." 71 The backup file is the first file given to `diff'.
69 (interactive (list (if (fboundp 'diff-read-switches) 72 With prefix arg, prompt for argument SWITCHES which is options for `diff'."
70 (diff-read-switches "Diff with switches: ")))) 73 (interactive
71 (if switches 74 (if current-prefix-arg
72 (diff-backup (dired-get-filename) switches) 75 (list (read-string "Options for diff: "
73 (diff-backup (dired-get-filename)))) 76 (if (stringp diff-switches)
77 diff-switches
78 (mapconcat 'identity diff-switches " "))))
79 nil))
80 (diff-backup (dired-get-filename) switches))
74 81
75 (defun dired-do-chxxx (attribute-name program op-symbol arg) 82 (defun dired-do-chxxx (attribute-name program op-symbol arg)
76 ;; Change file attributes (mode, group, owner) of marked files and 83 ;; Change file attributes (mode, group, owner) of marked files and
77 ;; refresh their file lines. 84 ;; refresh their file lines.
78 ;; ATTRIBUTE-NAME is a string describing the attribute to the user. 85 ;; ATTRIBUTE-NAME is a string describing the attribute to the user.