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

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

bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeli


From: Arthur Miller
Subject: bug#41250: 28.0.50; Dired displays unconditionally ls-switches on modeline
Date: Sun, 17 May 2020 05:01:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Cc: Drew Adams <drew.adams@oracle.com>,  41250@debbugs.gnu.org,
>>   juri@linkov.net
>> Date: Fri, 15 May 2020 23:08:46 +0200
>> 
>> After I saw Drews mail and patch, and answered, I was thinking
>> additionally, and I am actually now wondering, why is it assumed that
>> Dired will show sorting order on modeline by default? I mean other modes
>> does not do similar. Say, cc-mode does not show which current identation
>> scheme I use, or something similar.
>
> Yes, it does: the CC Mode shows the comment style in use and the minor
> mode.
>
>> Why is it assumed for Dired? I don't have historical insight so I
>> don't know why original author(s) decided to make it so?
>
> The sorting order was just one letter originally, so it sounds like a
> good idea to have an indication of why the order is this and not
> another.
>
>> If Dired show just, word "Dired" as it's lighter only, as other modes do,
>> then maybe Drews idea to have a format string is maybe the most flexible
>> one?
>
> Not IMO.  Using format strings and functions is "advanced usage",
> which is normally barred for newbies and relatively inexperienced
> Emacs users.  Popular options should IMO be exposed though easier
> customization values.

Ok, what about this strategy:

I have introduced dired-mode-line-hook, which is a usual thing in Emacs,
which is ment as a list of hooks that user can set. Each hook should
return a string that will be concatenated to the lighter. So users can
print whatever they want to that string (number of files, dirs etc).

I have introduced also another function that will just iterate through
hooks concat stuff and update the modeline and refactored some code to
call this function instead of old dired-sort-set-modeline. Also
dired-sort-set-modeline is changed to work as a mentioned hook and is
used as default value for dired-mode-line-hook.

If user does not prefer to see any aditional info on modeline then it is
just to set dired-mode-line-hook to nil. Obs, that can probably be coded
more elegantly, me & elisp are maybe not best friends (yet :-)). I have
built and tested emacs with the patch, but I might have missed
something.

While I was looking through the code to set myself into dired, I have
also noticed lots of '^L' chars, I took the freedom to clean it up where
I saw them, there are probably more.

Attachment: dired.patch
Description: Text Data


reply via email to

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