unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 63744@debbugs.gnu.org, sdl.web@gmail.com
Subject: bug#63744: 28.2; fix dired-guess-default
Date: Mon, 29 May 2023 15:07:36 +0300	[thread overview]
Message-ID: <83sfbfgx2v.fsf@gnu.org> (raw)
In-Reply-To: <87fs7g53rx.fsf@web.de> (message from Michael Heerdegen on Mon, 29 May 2023 03:23:46 +0200)

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Cc: Leo Liu <sdl.web@gmail.com>,  63744@debbugs.gnu.org
> Date: Mon, 29 May 2023 03:23:46 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > > There is no alternative at the moment other than redefining
> > > dired-guess-default.
> >
> > But your suggestion is also a change in that function, so what's the
> > difference?
> 
> I think he means: the user should not have to do this.

If there's only one user who wants that, there's no difference...

> > >    (RE ("STR1" "STR2" ...))
> >
> > Can't you generate the entire value of dired-guess-shell-alist-user
> > dynamically, including the RE part?
> 
> It's a real difference, actually a real win.  Please don't only have
> constant lists in mind.

Does this answer my question above?  If so, I don't think I understand
the answer, please elaborate.  I asked why not generate the whole
value, including the REGEXP part, dynamically.

> "Dynamically" means that dired can inspect the matched file (the file
> name is provided via the variable 'file' bound when evaluating the
> expression).  This means the EXPR can look at the properties of the
> file, it's type and modes etc, which allows a more fine grained user
> customization.  With such a change one can have entries looking like
> 
>   (RE (if COND (GET-DEFAULTS-FOR-COND) (GET-OTHER-DEFAULTS)))
> 
> which would currently be have to be specified as several entries like
> 
>   (RE (when COND DEFAULT-FOR-COND-1))
>   (RE (when COND DEFAULT-FOR-COND-2))
>     ...
>   (RE (when COND DEFAULT-FOR-COND-n))
>   (RE (when (not COND) OTHER-DEFAULT-1))
>   ...
>   (RE (when (not COND) OTHER-DEFAULT-m))
> 
> and, much worse, testing the CONDITION would have to be performed many
> times.

Sorry, I don't see why it has to be so complicated.  RE can be
generated just once, and then consed into a list with whatever should
follow it, and those other elements could be generated dynamically.

Anyway, I don't see why we should keep arguing.  I already said that I
won't object to such an extension of the forms in
dired-guess-shell-alist-user, I just think we should document them,
and I'm quite sure such a change in the code is not for the released
branch.





  parent reply	other threads:[~2023-05-29 12:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-27  4:10 bug#63744: 28.2; fix dired-guess-default Leo Liu
2023-05-27  6:49 ` Eli Zaretskii
2023-05-28  2:40   ` Leo Liu
2023-05-28  6:27     ` Eli Zaretskii
2023-05-29  1:23       ` Michael Heerdegen
2023-05-29  3:49         ` Leo Liu
2023-05-29 12:38           ` Eli Zaretskii
2023-05-30  0:04             ` Michael Heerdegen
2023-05-29 12:07         ` Eli Zaretskii [this message]
2023-05-29 18:20           ` Leo Liu
2023-05-29 18:27             ` Eli Zaretskii
2023-05-30  0:24               ` Michael Heerdegen
2023-05-30  2:36                 ` Eli Zaretskii
2023-06-02  0:14       ` Michael Heerdegen
2023-06-02  4:28         ` Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sfbfgx2v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=63744@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).