bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#13152: 24.2.90; [REGRESSION] dired-get-marked-files changed


From: Leo Liu
Subject: bug#13152: 24.2.90; [REGRESSION] dired-get-marked-files changed
Date: Wed, 09 Jan 2013 19:07:57 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (OS X 10.8.2)

On 2013-01-09 06:35 +0800, Glenn Morris wrote:
> Maybe you can just make dired-get-marked-files throw an explicit error
> "Not in Dired mode" unless (derived-mode-p 'dired-mode), though I still
> don't see what the big deal is here. You would need to check ever caller
> to make sure this did not break anything.

After looking at this function more closely, I am reluctant to put in a
(derived-mode-p 'dired-mode) check since all the related functions work
more generally (using regexps) and do not depend on mode checking.

So I propose the following patch instead which avoids returning values
such as (nil) or (t nil). What do you think? - Leo


diff --git a/lisp/dired.el b/lisp/dired.el
index b62b4d1a..2f7d5b37 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -620,12 +620,14 @@ (defun dired-get-marked-files (&optional localp arg 
filter distinguish-one-marke
 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 'no-error-if-not-filep)
-            arg nil distinguish-one-marked)))
-        result)
+  (let ((all-of-them
+        (save-excursion
+          (delq nil (dired-map-over-marks
+                     (dired-get-filename localp 'no-error-if-not-filep)
+                     arg nil distinguish-one-marked))))
+       result)
+    (when (equal all-of-them '(t))
+      (setq all-of-them nil))
     (if (not filter)
        (if (and distinguish-one-marked (eq (car all-of-them) t))
            all-of-them





reply via email to

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