all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#37182: 24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories
@ 2019-08-25 17:54 Wolfgang Scherer
       [not found] ` <handler.37182.B.156675851429203.ack@debbugs.gnu.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Scherer @ 2019-08-25 17:54 UTC (permalink / raw)
  To: 37182

In a *vc-dir* buffer of a mercurial or git repository, it appears to be
the intention, that marking both a directory and files inside the
directory is invalid.

1. When a directory is marked,

   - trying to mark a file in the directory raises the error:

       vc-dir-mark-file: Parent directory `./' is already marked

   - trying to mark all files with `C-u M' raises the error:

       Cannot mark all files, directory `./' marked

2. When a file is marked,

   - trying to mark the parent directory raises the error:

       vc-dir-mark-file: File `xx' in this directory is already marked

3. However, when no directories are marked,

   - marking all files with the key sequence `C-u M', results in all
     directories and all files to be marked

   - trying to mark all files again with `C-u M' raises the error:

       Cannot mark all files, directory `./' marked

This behavior is inconsistent.

The following patch against the savannah repository fixes it:

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 9a6f6bb..567da65 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -667,7 +667,8 @@ share the same state."
      vc-ewoc)
     (ewoc-map
      (lambda (filearg)
-       (unless (vc-dir-fileinfo->marked filearg)
+       (unless (or (vc-dir-fileinfo->directory filearg)
+               (vc-dir-fileinfo->marked filearg))
          (setf (vc-dir-fileinfo->marked filearg) t)
          t))
      vc-ewoc))






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#37182: Acknowledgement (24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories)
       [not found] ` <handler.37182.B.156675851429203.ack@debbugs.gnu.org>
@ 2019-08-26 23:06   ` Wolfgang Scherer
  2020-02-05  0:28     ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Scherer @ 2019-08-26 23:06 UTC (permalink / raw)
  To: 37182

[-- Attachment #1: Type: text/plain, Size: 36 bytes --]

Patch with commit message attached.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Do-not-mark-directories-in-vc-dir-mark-all-files.patch --]
[-- Type: text/x-patch; name="0001-Do-not-mark-directories-in-vc-dir-mark-all-files.patch", Size: 885 bytes --]

From c1a53afb0c3f8101a0bdb50490c304f0d2996696 Mon Sep 17 00:00:00 2001
From: Wolfgang Scherer <wolfgang.scherer@gmx.de>
Date: Tue, 27 Aug 2019 01:03:59 +0200
Subject: [PATCH] Do not mark directories in vc-dir-mark-all-files

* lisp/vc/vc-dir.el: (vc-dir-mark-all-files) Do not mark directories
when marking all files (Bug#37182).
---
 lisp/vc/vc-dir.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 9a6f6bb..567da65 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -667,7 +667,8 @@ share the same state."
 	 vc-ewoc)
 	(ewoc-map
 	 (lambda (filearg)
-	   (unless (vc-dir-fileinfo->marked filearg)
+	   (unless (or (vc-dir-fileinfo->directory filearg)
+		       (vc-dir-fileinfo->marked filearg))
 	     (setf (vc-dir-fileinfo->marked filearg) t)
 	     t))
 	 vc-ewoc))
--
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#37182: Acknowledgement (24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories)
  2019-08-26 23:06   ` bug#37182: Acknowledgement (24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories) Wolfgang Scherer
@ 2020-02-05  0:28     ` Dmitry Gutov
  2020-02-05 14:24       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2020-02-05  0:28 UTC (permalink / raw)
  To: Wolfgang Scherer, 37182

On 27.08.2019 2:06, Wolfgang Scherer wrote:
>   	(ewoc-map
>   	 (lambda (filearg)
> -	   (unless (vc-dir-fileinfo->marked filearg)
> +	   (unless (or (vc-dir-fileinfo->directory filearg)
> +		       (vc-dir-fileinfo->marked filearg))
>   	     (setf (vc-dir-fileinfo->marked filearg) t)
>   	     t))
>   	 vc-ewoc))

LGTM (works, too).

Eli, this okay for emacs-27?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#37182: Acknowledgement (24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories)
  2020-02-05  0:28     ` Dmitry Gutov
@ 2020-02-05 14:24       ` Eli Zaretskii
  2020-02-11 22:31         ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2020-02-05 14:24 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 37182, Wolfgang.Scherer

> From: Dmitry Gutov <dgutov@yandex.ru>
> Date: Wed, 5 Feb 2020 03:28:24 +0300
> 
> On 27.08.2019 2:06, Wolfgang Scherer wrote:
> >   	(ewoc-map
> >   	 (lambda (filearg)
> > -	   (unless (vc-dir-fileinfo->marked filearg)
> > +	   (unless (or (vc-dir-fileinfo->directory filearg)
> > +		       (vc-dir-fileinfo->marked filearg))
> >   	     (setf (vc-dir-fileinfo->marked filearg) t)
> >   	     t))
> >   	 vc-ewoc))
> 
> LGTM (works, too).
> 
> Eli, this okay for emacs-27?

Yes, but please also fix the doc string to clearly say what happens
with directories.

Thanks.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#37182: Acknowledgement (24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories)
  2020-02-05 14:24       ` Eli Zaretskii
@ 2020-02-11 22:31         ` Dmitry Gutov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2020-02-11 22:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 37182-done, Wolfgang.Scherer

Version: 27.1

On 05.02.2020 16:24, Eli Zaretskii wrote:
> Yes, but please also fix the doc string to clearly say what happens
> with directories.

Done, I think.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-11 22:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-25 17:54 bug#37182: 24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories Wolfgang Scherer
     [not found] ` <handler.37182.B.156675851429203.ack@debbugs.gnu.org>
2019-08-26 23:06   ` bug#37182: Acknowledgement (24.5; 24.5.1: C-u vc-dir-mark-all-files should not mark directories) Wolfgang Scherer
2020-02-05  0:28     ` Dmitry Gutov
2020-02-05 14:24       ` Eli Zaretskii
2020-02-11 22:31         ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.