GNU bug report logs - #48071
28.0.50: dired-guess-default: comply with docstring options [PATCH]

Previous Next

Package: emacs;

Reported by: Boruch Baum <boruch_baum <at> gmx.com>

Date: Tue, 27 Apr 2021 18:54:02 UTC

Severity: minor

Found in version 28.0.50

Done: Michael Heerdegen <michael_heerdegen <at> web.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48071 in the body.
You can then email your comments to 48071 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Tue, 27 Apr 2021 18:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Boruch Baum <boruch_baum <at> gmx.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 27 Apr 2021 18:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Boruch Baum <boruch_baum <at> gmx.com>
To: Emacs Bug Reporting <bug-gnu-emacs <at> gnu.org>
Subject: 28.0.50: dired-guess-default: comply with docstring options [PATCH]
Date: Tue, 27 Apr 2021 14:53:40 -0400
[Message part 1 (text/plain, inline)]
The docstring for dired-guess-default claims it should handle multiple
instances of COMMAND each of which could be a STRING or a FUNCTION which
evaluates to a STRING ...

The attached patch does that. It also weeds out strings that don't represent
valid programs on the host machine.

It turned out that function dired-guess-shell-command wasn't ready for
the multiple responses, so the patch corrects that as well.

My package diredc has an additional feature of an option for a universal
fall-back. My memory is that the emacs developers rejected the idea when
I originally proposed it, so it's not in this patch.

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
[dired-guess-default.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Tue, 20 Jul 2021 14:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Boruch Baum <boruch_baum <at> gmx.com>
Cc: 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Tue, 20 Jul 2021 16:17:39 +0200
Boruch Baum <boruch_baum <at> gmx.com> writes:

> The docstring for dired-guess-default claims it should handle multiple
> instances of COMMAND each of which could be a STRING or a FUNCTION which
> evaluates to a STRING ...
>
> The attached patch does that. It also weeds out strings that don't represent
> valid programs on the host machine.

I don't think we want to do the latter because of Tramp considerations.

I've now changed dired-guess-default in a somewhat different way than
your patch suggested, but it's functionally similar.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 48071 <at> debbugs.gnu.org and Boruch Baum <boruch_baum <at> gmx.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 20 Jul 2021 14:18:02 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 28.1 and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 Jul 2021 01:46:01 GMT) Full text and rfc822 format available.

Removed tag(s) patch. Request was from Michael Heerdegen <michael_heerdegen <at> web.de> to control <at> debbugs.gnu.org. (Wed, 21 Jul 2021 01:46:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Wed, 21 Jul 2021 01:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Boruch Baum <boruch_baum <at> gmx.com>, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Wed, 21 Jul 2021 03:53:28 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I've now changed dired-guess-default in a somewhat different way than
> your patch suggested, but it's functionally similar.

What happened to the expression case?  Have you maybe removed it by
accident (at least it's broken for me now)?  See the `eval' calls in the
original code.

These were valid `eval' calls, they allowed to construct commands on the
fly at run time, even specific to the currently given FILE, by
specifying an expression that calculated the command string.

TIA,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Wed, 21 Jul 2021 02:18:01 GMT) Full text and rfc822 format available.

Message #20 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Boruch Baum <boruch_baum <at> gmx.com>, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Wed, 21 Jul 2021 04:16:57 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> What happened to the expression case?  Have you maybe removed it by
> accident (at least it's broken for me now)?  See the `eval' calls in the
> original code.

Other things changed, too: AFAIU now only one file has to match,
originally all had to - correct?  That means if I mark 10 files and one
of them is an image, I will get (all) image viewers as guesses.

If this is intended: Should we not at least provide an option to get the
old behavior or sort those matches that match all files first?

TIA,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Wed, 21 Jul 2021 11:05:02 GMT) Full text and rfc822 format available.

Message #23 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Boruch Baum <boruch_baum <at> gmx.com>, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Wed, 21 Jul 2021 13:04:22 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Other things changed, too: AFAIU now only one file has to match,
> originally all had to - correct?  That means if I mark 10 files and one
> of them is an image, I will get (all) image viewers as guesses.

Fixed now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Wed, 21 Jul 2021 11:13:02 GMT) Full text and rfc822 format available.

Message #26 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: Boruch Baum <boruch_baum <at> gmx.com>, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Wed, 21 Jul 2021 13:12:31 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> What happened to the expression case?  Have you maybe removed it by
> accident (at least it's broken for me now)?  See the `eval' calls in the
> original code.

Yup; removed by accident.  Put back in now, I think.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Wed, 21 Jul 2021 23:23:02 GMT) Full text and rfc822 format available.

Message #29 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Boruch Baum <boruch_baum <at> gmx.com>, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Thu, 22 Jul 2021 01:22:18 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Yup; removed by accident.  Put back in now, I think.

Yes, looks good, thanks -

Michael.




Reply sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
You have taken responsibility. (Wed, 21 Jul 2021 23:29:01 GMT) Full text and rfc822 format available.

Notification sent to Boruch Baum <boruch_baum <at> gmx.com>:
bug acknowledged by developer. (Wed, 21 Jul 2021 23:29:02 GMT) Full text and rfc822 format available.

Message #34 received at 48071-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 48071-done <at> debbugs.gnu.org, Boruch Baum <boruch_baum <at> gmx.com>
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Thu, 22 Jul 2021 01:28:36 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>
> > Other things changed, too: AFAIU now only one file has to match,
> > originally all had to - correct?
>
> Fixed now.

Yes - thanks.

So the (only) remaining user visible change is that now all matching
entries are considered instead of only the first one, which is actually
a fix: the docstring of `dired-guess-shell-alist-user' describes it
should work like that.

Ok, I hope we are done then ;-) and: closing again.

Thanks,

Michael.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Thu, 22 Jul 2021 03:29:01 GMT) Full text and rfc822 format available.

Message #37 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 48071 <at> debbugs.gnu.org
Cc: boruch_baum <at> gmx.com
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Thu, 22 Jul 2021 05:28:05 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Ok, I hope we are done then ;-) and: closing again.

BTW, one more thought: quite a few people might want to configure this
beyond the "adding entries to dired-guess-shell-alist-user" level -
the suggested filtering of not installed executables mentioned in the
original report is one example.

If we bound #'dired-guess-default to a new variable
`dired-guess-default-function' and used the binding of that variable in
the code, it would be easier to do such things, and it would be a tiny
change.

What do you think?

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Thu, 22 Jul 2021 12:11:02 GMT) Full text and rfc822 format available.

Message #40 received at 48071-done <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 48071-done <at> debbugs.gnu.org, Boruch Baum <boruch_baum <at> gmx.com>
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Thu, 22 Jul 2021 14:10:08 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> So the (only) remaining user visible change is that now all matching
> entries are considered instead of only the first one, which is actually
> a fix: the docstring of `dired-guess-shell-alist-user' describes it
> should work like that.

Well...  does it?  It's pretty vague on the issue.  And the comments
seem to contradict that:

;; * Parse `dired-guess-shell-alist-user' and
;;   `dired-guess-shell-alist-default' (in that order) for the first REGEXP
;;   that matches the first file in the file list.
;;
;; * If the REGEXP matches all the entries of the file list then evaluate
;;   COMMAND, which is either a string or a Lisp expression returning a
;;   string.  COMMAND may be a list of commands.
;;
;; * Return this command to `dired-guess-shell-command' which prompts user
;;   with it.  The list of commands is put into the list of default values.
;;   If a command is used successfully then it is stored permanently in
;;   `dired-shell-command-history'.

But this is pretty nonsensical -- it describes how the function what
implemented, but not really what to do when the rest of the files don't
match, or when more of them match "the first file".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Thu, 22 Jul 2021 12:19:01 GMT) Full text and rfc822 format available.

Message #43 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: boruch_baum <at> gmx.com, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Thu, 22 Jul 2021 14:18:28 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> If we bound #'dired-guess-default to a new variable
> `dired-guess-default-function' and used the binding of that variable in
> the code, it would be easier to do such things, and it would be a tiny
> change.
>
> What do you think?

Sure, if you want to...  but do people really want to customise the
defaults in Dired to this extent?  I haven't really seen much clamouring
for this stuff.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Thu, 22 Jul 2021 23:22:02 GMT) Full text and rfc822 format available.

Message #46 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: boruch_baum <at> gmx.com, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Fri, 23 Jul 2021 01:21:50 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> > What do you think?
>
> Sure, if you want to...  but do people really want to customise the
> defaults in Dired to this extent?  I haven't really seen much
> clamouring for this stuff.

I think this is partly because doing this is such an unpleasant and
byzantine thing to do.  But I also have package developers in mind.

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48071; Package emacs. (Fri, 23 Jul 2021 13:05:01 GMT) Full text and rfc822 format available.

Message #49 received at 48071 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: boruch_baum <at> gmx.com, 48071 <at> debbugs.gnu.org
Subject: Re: bug#48071: 28.0.50: dired-guess-default: comply with docstring
 options [PATCH]
Date: Fri, 23 Jul 2021 15:04:25 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

>> Sure, if you want to...  but do people really want to customise the
>> defaults in Dired to this extent?  I haven't really seen much
>> clamouring for this stuff.
>
> I think this is partly because doing this is such an unpleasant and
> byzantine thing to do.  But I also have package developers in mind.

Sure; I'm not against adding it if you feel it would be useful.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 21 Aug 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 220 days ago.

Previous Next


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