Commit bfe81e78 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

*** empty log message ***

parent c3554e95
......@@ -166,21 +166,48 @@ With prefix arg, prompt for diff switches."
(message "Comparing files %s %s..." new old)
(setq new (expand-file-name new)
old (expand-file-name old))
(let ((buf (compile-internal (mapconcat 'identity
(append '("diff")
(if (consp diff-switches)
(list diff-switches))
(list old)
(list new))
" ")
"No more differences" "Diff"
(set-buffer buf)
(set (make-local-variable 'diff-old-file) old)
(set (make-local-variable 'diff-new-file) new))
(let ((old-alt (diff-prepare old new))
(new-alt (diff-prepare new old))
(let ((command
(mapconcat 'identity
(append '("diff")
(if (consp diff-switches)
(list diff-switches))
(if (or old-alt new-alt)
(list "-L" old "-L" new))
(list (or old-alt old))
(list (or new-alt new)))
" ")))
(setq buf
(compile-internal command
"No more differences" "Diff"
(set-buffer buf)
(set (make-local-variable 'diff-old-file) old)
(set (make-local-variable 'diff-new-file) new))
(if old-alt (delete-file old-alt))
(if new-alt (delete-file new-alt)))))
;; Copy the file FILE into a temporary file if that is necessary
;; for comparison. (This is only necessary if the file name has a handler.)
;; OTHER is the other file to be compared.
(defun diff-prepare (file other)
(let (handler handlers)
(setq handlers file-name-handler-alist)
(while (and (consp handlers) (null handler))
(if (and (consp (car handlers))
(stringp (car (car handlers)))
(string-match (car (car handlers)) file))
(setq handler (cdr (car handlers))))
(setq handlers (cdr handlers)))
(if handler
(funcall handler 'diff-prepare file other)
(defun diff-backup (file &optional switches)
......@@ -466,24 +466,36 @@ and use this command with a prefix argument (the value does not matter)."
;; Compress or uncompress the current file.
;; Return nil for success, offending filename else.
(let* (buffer-read-only
(from-file (dired-get-filename)))
(cond ((save-excursion (beginning-of-line)
(looking-at dired-re-sym))
(dired-log (concat "Attempt to compress a symbolic link:\n"
(dired-make-relative from-file))
((string-match "\\.Z$" from-file)
(from-file (dired-get-filename))
(new-file (dired-compress-file from-file)))
(if new-file
(progn (dired-update-file-line new-file) nil)
(dired-log (concat "Failed to compress" from-file))
(defun dired-compress-file (file)
;; Compress or uncompress FILE.
;; Return the name of the compressed or uncompressed file.
;; Rerurn nil if no change in files.
(let (handler (handlers file-name-handler-alist))
(while (and (consp handlers) (null handler))
(if (and (consp (car handlers))
(stringp (car (car handlers)))
(string-match (car (car handlers)) file))
(setq handler (cdr (car handlers))))
(setq handlers (cdr handlers)))
(cond (handler
(funcall handler 'dired-compress-file file))
((file-symlink-p file)
((string-match "\\.Z$" file)
(if (dired-check-process (concat "Uncompressing " from-file)
"uncompress" from-file)
(dired-make-relative from-file)
(dired-update-file-line (substring from-file 0 -2))))
(substring file 0 -2)))
(if (dired-check-process (concat "Compressing " from-file)
"compress" "-f" from-file)
;; Errors from the process are already logged.
(dired-make-relative from-file)
(dired-update-file-line (concat from-file ".Z")))))
(concat name ".Z"))))))
(defun dired-mark-confirm (op-symbol arg)
;; Request confirmation from the user that the operation described
......@@ -720,8 +732,9 @@ a prefix arg lets you edit the `ls' switches used for the new listing."
(let (buffer-read-only)
(dired-add-entry-do-indentation marker-char)
(dired-ls (dired-make-absolute filename directory);; don't expand `.' !
(concat dired-actual-switches "d"))
;; don't expand `.' !
(insert-directory (dired-make-absolute filename directory)
(concat dired-actual-switches "d"))
(forward-line -1)
;; We want to have the non-directory part, only:
(let* ((beg (dired-move-to-filename t)) ; error for strange output
......@@ -1536,7 +1549,7 @@ This function takes some pains to conform to `ls -lR' output."
(if (equal dirname (car (car (reverse dired-subdir-alist))))
;; top level directory may contain wildcards:
(dired-readin-insert dired-directory)
(dired-ls dirname dired-actual-switches nil t)))
(insert-directory dirname dired-actual-switches nil t)))
(message "Reading directory %s...done" dirname)
(setq end (point-marker))
(indent-rigidly begin end 2)
......@@ -1635,38 +1648,6 @@ is always equal to STRING."
;;; moving by subdirectories
(defun dired-subdir-index (dir)
;; Return an index into alist for use with nth
;; for the sake of subdir moving commands.
(let (found (index 0) (alist dired-subdir-alist))
(while alist
(if (string= dir (car (car alist)))
(setq alist nil found t)
(setq alist (cdr alist) index (1+ index))))
(if found index nil)))
(defun dired-next-subdir (arg &optional no-error-if-not-found no-skip)
"Go to next subdirectory, regardless of level."
;; Use 0 arg to go to this directory's header line.
;; NO-SKIP prevents moving to end of header line, returning whatever
;; position was found in dired-subdir-alist.
(interactive "p")
(let ((this-dir (dired-current-directory))
pos index)
;; nth with negative arg does not return nil but the first element
(setq index (- (dired-subdir-index this-dir) arg))
(setq pos (if (>= index 0)
(dired-get-subdir-min (nth index dired-subdir-alist))))
(if pos
(goto-char pos)
(or no-skip (skip-chars-forward "^\n\r"))
(if no-error-if-not-found
nil ; return nil if not found
(error "%s directory" (if (> arg 0) "Last" "First"))))))
(defun dired-prev-subdir (arg &optional no-error-if-not-found no-skip)
"Go to previous subdirectory, regardless of level.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment