emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/dired.el


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/dired.el
Date: Sun, 15 May 2005 17:33:25 -0400

Index: emacs/lisp/dired.el
diff -c emacs/lisp/dired.el:1.309 emacs/lisp/dired.el:1.310
*** emacs/lisp/dired.el:1.309   Fri May 13 17:03:30 2005
--- emacs/lisp/dired.el Sun May 15 21:33:25 2005
***************
*** 450,456 ****
                              "flagged" "marked"))))
      (and (> count 0) count)))
  
! (defmacro dired-map-over-marks (body arg &optional show-progress)
    "Eval BODY with point on each marked line.  Return a list of BODY's results.
  If no marked file could be found, execute BODY on the current line.
    If ARG is an integer, use the next ARG (or previous -ARG, if ARG<0)
--- 450,457 ----
                              "flagged" "marked"))))
      (and (> count 0) count)))
  
! (defmacro dired-map-over-marks (body arg &optional show-progress
!                                    distinguish-one-marked)
    "Eval BODY with point on each marked line.  Return a list of BODY's results.
  If no marked file could be found, execute BODY on the current line.
    If ARG is an integer, use the next ARG (or previous -ARG, if ARG<0)
***************
*** 465,471 ****
  Search starts at the beginning of the buffer, thus the car of the list
    corresponds to the line nearest to the buffer's bottom.  This
    is also true for (positive and negative) integer values of ARG.
! BODY should not be too long as it is expanded four times."
    ;;
    ;;Warning: BODY must not add new lines before point - this may cause an
    ;;endless loop.
--- 466,475 ----
  Search starts at the beginning of the buffer, thus the car of the list
    corresponds to the line nearest to the buffer's bottom.  This
    is also true for (positive and negative) integer values of ARG.
! BODY should not be too long as it is expanded four times.
! 
! If DISTINGUISH-ONE-MARKED is non-nil, then if we find just one marked file,
! return (t FILENAME) instead of (FILENAME)."
    ;;
    ;;Warning: BODY must not add new lines before point - this may cause an
    ;;endless loop.
***************
*** 505,517 ****
                 (set-marker next-position nil)
                 (setq next-position (and (re-search-forward regexp nil t)
                                          (point-marker)))))
             (if found
                 results
               (list ,body)))))
       ;; save-excursion loses, again
       (dired-move-to-filename)))
  
! (defun dired-get-marked-files (&optional localp arg filter)
    "Return the marked files' names as list of strings.
  The list is in the same order as the buffer, that is, the car is the
    first marked file.
--- 509,523 ----
                 (set-marker next-position nil)
                 (setq next-position (and (re-search-forward regexp nil t)
                                          (point-marker)))))
+            (if (and ,distinguish-one-marked (= (length results) 1))
+                (setq results (cons t results)))
             (if found
                 results
               (list ,body)))))
       ;; save-excursion loses, again
       (dired-move-to-filename)))
  
! (defun dired-get-marked-files (&optional localp arg filter 
distinguish-one-marked)
    "Return the marked files' names as list of strings.
  The list is in the same order as the buffer, that is, the car is the
    first marked file.
***************
*** 522,534 ****
    If ARG is otherwise non-nil, use file.  Usually ARG comes from
    the command's prefix arg.
  Optional third argument FILTER, if non-nil, is a function to select
!   some of the files--those for which (funcall FILTER FILENAME) is non-nil."
!   (let ((all-of-them
!        (save-excursion
!          (dired-map-over-marks (dired-get-filename localp) arg)))
!       result)
      (if (not filter)
!       (nreverse all-of-them)
        (dolist (file all-of-them)
        (if (funcall filter file)
            (push file result)))
--- 528,548 ----
    If ARG is otherwise non-nil, use file.  Usually ARG comes from
    the command's prefix arg.
  Optional third argument FILTER, if non-nil, is a function to select
!   some of the files--those for which (funcall FILTER FILENAME) is non-nil.
! 
! If DISTINGUISH-ONE-MARKED is non-nil, then if we find just one marked file,
! return (t FILENAME) instead of (FILENAME).
! Don't use that together with FILTER."
!   (let* ((all-of-them
!         (save-excursion
!           (dired-map-over-marks
!            (dired-get-filename localp)
!            arg nil distinguish-one-marked)))
!        result)
      (if (not filter)
!       (if (and distinguish-one-marked (eq (car all-of-them) t))
!           all-of-them
!         (nreverse all-of-them))
        (dolist (file all-of-them)
        (if (funcall filter file)
            (push file result)))
***************
*** 2537,2551 ****
   (an argument or confirmation).
  The window is not shown if there is just one file or
   OP-SYMBOL is a member of the list in `dired-no-confirm'.
! FILES is the list of marked files."
    (or bufname (setq bufname  " *Marked Files*"))
    (if (or (eq dired-no-confirm t)
          (memq op-symbol dired-no-confirm)
          (= (length files) 1))
        (apply function args)
      (with-current-buffer (get-buffer-create bufname)
        (erase-buffer)
!       (dired-format-columns-of-files files)
        (remove-text-properties (point-min) (point-max)
                              '(mouse-face nil help-echo nil)))
      (save-window-excursion
--- 2551,2571 ----
   (an argument or confirmation).
  The window is not shown if there is just one file or
   OP-SYMBOL is a member of the list in `dired-no-confirm'.
! FILES is the list of marked files.  It can also be (t FILENAME)
! in the case of one marked file, to distinguish that from using
! just the current file."
    (or bufname (setq bufname  " *Marked Files*"))
    (if (or (eq dired-no-confirm t)
          (memq op-symbol dired-no-confirm)
+         ;; If FILES defaulted to the current line's file.
          (= (length files) 1))
        (apply function args)
      (with-current-buffer (get-buffer-create bufname)
        (erase-buffer)
!       ;; Handle (t FILE) just like (FILE), here.
!       ;; That value is used (only in some cases), to mean
!       ;; just one file that was marked, rather than the current line file.
!       (dired-format-columns-of-files (if (eq (car files) t) (cdr files) 
files))
        (remove-text-properties (point-min) (point-max)
                              '(mouse-face nil help-echo nil)))
      (save-window-excursion




reply via email to

[Prev in Thread] Current Thread [Next in Thread]