GNU bug report logs - #76596
30.1; dired-movement-style does not honor subdir operations

Previous Next

Package: emacs;

Reported by: Charles Choi <kickingvegas <at> gmail.com>

Date: Wed, 26 Feb 2025 20:07:01 UTC

Severity: minor

Found in version 30.1

Fixed in version 30.1.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: kickingvegas <at> gmail.com, 76596 <at> debbugs.gnu.org
Subject: bug#76596: 30.1; dired-movement-style does not honor subdir operations
Date: Wed, 19 Mar 2025 20:30:10 +0200
[Message part 1 (text/plain, inline)]
>> I'd like to add the new values under this bug report.
>> 
>> Current values are
>> 
>>   (const :tag "Cycle through non-empty lines" cycle)
>>   (const :tag "Stop on last/first non-empty line" bounded))
>> 
>> New values could be
>> 
>>   (const :tag "Cycle through file lines" cycle-files)
>>   (const :tag "Stop on last/first file line" bounded-files))
>
> Feel free.

So here is the patch:

[dired-movement-style-cycle-files.patch (text/x-diff, inline)]
diff --git a/lisp/dired.el b/lisp/dired.el
index c00ae0fde7d..f735747e991 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -518,10 +518,14 @@ dired-movement-style
               to the first/last visible line.
  * `bounded': don't move up/down if the current line is the
               first/last visible line.
+ * `cycle-files': like `cycle' but moves only over file lines.
+ * `bounded-files': like `bounded' but moves only over file lines.
 Any other non-nil value is treated as `bounded'."
   :type '(choice (const :tag "Move to any line" nil)
                  (const :tag "Cycle through non-empty lines" cycle)
-                 (const :tag "Stop on last/first non-empty line" bounded))
+                 (const :tag "Cycle through file lines" cycle-files)
+                 (const :tag "Stop on last/first non-empty line" bounded)
+                 (const :tag "Stop on last/first file line" bounded-files)))
   :group 'dired
   :version "30.1")
 
@@ -2925,7 +2929,7 @@ dired--move-to-next-line
         ;; but it still wants to move farther.
         (cond
          ;; `cycle': go to the other end.
-         ((eq dired-movement-style 'cycle)
+         ((memq dired-movement-style '(cycle cycle-files))
           ;; Argument not changing on the second wrap
           ;; means infinite loop with no files found.
           (if (and wrapped (eq old-arg arg))
@@ -2937,7 +2941,8 @@ dired--move-to-next-line
          ;; `bounded': go back to the last non-empty line.
          (dired-movement-style ; Either 'bounded or anything else non-nil.
           (while (and (dired-between-files)
-                      (not (dired-get-subdir))
+                      (or (eq dired-movement-style 'bounded-files)
+                          (not (dired-get-subdir)))
                       (not (zerop arg)))
             (funcall jumpfun (- moving-down))
             ;; Point not moving means infinite loop.
@@ -2946,9 +2951,12 @@ dired--move-to-next-line
               (setq old-position (point))))
           ;; Encountered a boundary, so let's stop movement.
           (setq arg (if (and (dired-between-files)
-                             (not (dired-get-subdir)))
+                             (or (eq dired-movement-style 'bounded-files)
+                                 (not (dired-get-subdir))))
                         0 moving-down)))))
-      (unless (and (dired-between-files) (not (dired-get-subdir)))
+      (unless (and (dired-between-files)
+                   (or (memq dired-movement-style '(cycle-files bounded-files))
+                       (not (dired-get-subdir))))
         ;; Has moved to a non-empty line.  This movement does
         ;; make sense.
         (decf arg moving-down))

This bug report was last modified 59 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.