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

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

bug#39902: 28.0.50; Marking in dired with active region


From: Juri Linkov
Subject: bug#39902: 28.0.50; Marking in dired with active region
Date: Wed, 11 Mar 2020 02:18:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> OTOH, if point is at the end of the region (in contrast to your
>> screenshot), one could be surprised that the file line where the cursor
>> is displayed doesn't get marked.
>
> Right, here is a complete patch that should do the right thing
> depending on the new defcustom:

Sorry, this patch was a response to another your comment:

>> This is a strange corner case.  I never used a region like that, I guess
>> because I felt that this case is dubious.

This means that the patch doesn't handle this strange corner case,
but it handles more usual case where point is on the file name:

diff --git a/lisp/dired.el b/lisp/dired.el
index a4de51f609..420938ef2e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3578,6 +3578,12 @@ dired-mark-files-in-region
            (insert dired-marker-char)))
       (forward-line 1))))
 
+(defcustom dired-mark-inclusive nil
+  "Non-nil means `dired-mark' marks file on the region end."
+  :type 'boolean
+  :version "28.1"
+  :group 'dired)
+
 (defun dired-mark (arg &optional interactive)
   "Mark the file at point in the Dired buffer.
 If the region is active, mark all files in the region.
@@ -3597,7 +3603,11 @@ dired-mark
            (end (region-end)))
        (dired-mark-files-in-region
         (progn (goto-char beg) (line-beginning-position))
-        (progn (goto-char end) (line-beginning-position))))))
+        (progn (goto-char end)
+                (if (and dired-mark-inclusive
+                         (or (eolp) (get-text-property (point) 
'dired-filename)))
+                    (line-end-position)
+                  (line-beginning-position)))))))
    ;; Mark subdir files from the subdir headerline.
    ((dired-get-subdir)
     (save-excursion (dired-mark-subdir-files)))





reply via email to

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