GNU bug report logs - #43961
read carefully: dired-file-name-at-point vs dired-filename-at-point

Previous Next

Package: emacs;

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

Date: Mon, 12 Oct 2020 14:28:02 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


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

From: Arthur Miller <arthur.miller <at> live.com>
To: Boruch Baum <boruch_baum <at> gmx.com>
Cc: 43961 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 Richard Stallman <rms <at> gnu.org>
Subject: Re: bug#43961: read carefully: dired-file-name-at-point vs
 dired-filename-at-point
Date: Tue, 13 Oct 2020 12:58:10 +0200
Boruch Baum <boruch_baum <at> gmx.com> writes:

> On 2020-10-13 06:54, Lars Ingebrigtsen wrote:
>> Boruch Baum <boruch_baum <at> gmx.com> writes:
>>
>> > They return different values. One returns an expanded (canonical)
>> > path-name, and the other an abbreviated one.
>>
>> Why not just have one call the other, and wrap the results in
>> abbreviate-file-name?
>
> You could, but you wouldn't be saving anything since the inner function
> would still need to perform the expansion, so for the abbreviated
> function you end up in effect with an inefficient (abbrev (expand file))
> instead of a choice between (abbrev file) or (expand file).
>
> Also, much of the change ends up being defaliases, docstrings and
> deprecation notices, so its more clearly presented without nesting
> functions.
>
> --
> hkp://keys.gnupg.net
> CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
Boruch you are mind reader! At least I thought so when I saw your mail
yesterday.

I was playing with Dired myself on Monday and I actually wrote a mail
about those two functions + file-name-directory and directory-file-name,
I just never send it.

dired-filename-at-point is supposed to return a filename closest to the
point, according to docs. For me it didn't work at all.

But I mostly disliked the name. Why are there two almost identical name
for different functionality? I like self-documented names for variables
but if there are names like directory-file-name and file-name-directory
or something like dired-file-name-at-point and dired-filename-at-point;
then I have to remember and actively think about which one was that I
want? Usually ends up with unnecessary look-up into docs, because I
don't remember which one was that I want. Not that I hate so much to
think :-), but it does interrupt the flow of thoughts.

I understand that logic was 'objectoworkon-followed-by-operation' but I
still find it unnecessary convoluted. It is just so much more
straightforward if each function has unique descriptive name, and yes I
am aware that such names are sometimes hard to get by.

I have seen also discussion about string-replace and replace-string, can
we plase not? For the reason above. And for the new APIs added, please
don't use naming patterns like word1-word2 and word2-word1 or similar
where same words are used just with some slight variation.




This bug report was last modified 4 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.