unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Keen on a dired-hide-details-mode patch?
@ 2024-07-21 16:07 Alvaro Ramirez
  2024-07-21 16:23 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Alvaro Ramirez @ 2024-07-21 16:07 UTC (permalink / raw)
  To: emacs-devel

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

Hi folks,

I have rough changes to enable hiding Dired’s absolute path via 
dired-hide-details-mode.

Given a Dired header path like:

/long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:

dired-hide-details-mode would display it as:

eshell:

I’ve attached a couple of gifs demonstrating the toggle via "(" 
Dired binding (before and after mod).

Is there interest in receiving a patch? I’m happy to propose one, 
but wanted to check before investing further (it would be my first 
Emacs submission).

Alvaro


[-- Attachment #2: before_patch.gif --]
[-- Type: image/gif, Size: 0 bytes --]

[-- Attachment #3: after_patch.gif --]
[-- Type: image/gif, Size: 0 bytes --]

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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 16:07 Keen on a dired-hide-details-mode patch? Alvaro Ramirez
@ 2024-07-21 16:23 ` Eli Zaretskii
       [not found]   ` <m27cdehavc.fsf@xenodium.com>
  2024-07-21 19:50 ` Yuri Khan
  2024-07-22  6:29 ` Charles Choi
  2 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2024-07-21 16:23 UTC (permalink / raw)
  To: Alvaro Ramirez; +Cc: emacs-devel

> From: Alvaro Ramirez <alvaro@xenodium.com>
> Date: Sun, 21 Jul 2024 17:07:07 +0100
> 
> I have rough changes to enable hiding Dired’s absolute path via 
> dired-hide-details-mode.
> 
> Given a Dired header path like:
> 
> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
> 
> dired-hide-details-mode would display it as:
> 
> eshell:
> 
> I’ve attached a couple of gifs demonstrating the toggle via "(" 
> Dired binding (before and after mod).
> 
> Is there interest in receiving a patch? I’m happy to propose one, 
> but wanted to check before investing further (it would be my first 
> Emacs submission).

Please use "M-x submit-emacs-patch" to submit your patch, and let's
take it from there.

Thank you for your interest in Emacs.

P.S. Your GIF images, as posted, appear to be empty.



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

* Re: Keen on a dired-hide-details-mode patch?
       [not found]   ` <m27cdehavc.fsf@xenodium.com>
@ 2024-07-21 18:38     ` Alvaro Ramirez
  2024-07-28 18:00       ` Alvaro Ramirez
  0 siblings, 1 reply; 14+ messages in thread
From: Alvaro Ramirez @ 2024-07-21 18:38 UTC (permalink / raw)
  To: emacs-devel

+emacs-devel

Alvaro Ramirez <alvaro@xenodium.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Alvaro Ramirez <alvaro@xenodium.com>
>>> Date: Sun, 21 Jul 2024 17:07:07 +0100
>>> I have rough changes to enable hiding Dired’s absolute path 
>>> via
>>> dired-hide-details-mode.
>>> Given a Dired header path like:
>>> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
>>> dired-hide-details-mode would display it as:
>>> eshell:
>>> I’ve attached a couple of gifs demonstrating the toggle via 
>>> "("
>>> Dired binding (before and after mod).
>>> Is there interest in receiving a patch? I’m happy to propose 
>>> one,
>>> but wanted to check before investing further (it would be my 
>>> first
>>> Emacs submission).
>>
>> Please use "M-x submit-emacs-patch" to submit your patch, and 
>> let's
>> take it from there.
>
> Sounds good. Will do.
>
>>
>> Thank you for your interest in Emacs.
>
> Thanks Eli!
>
>>
>> P.S. Your GIF images, as posted, appear to be empty.
>
> Try these...
>
> Before patch: https://0x0.st/s/fsFsYyLFchgeEqP7LtDtGQ/Xpqy.gif
> After patch: https://0x0.st/s/cw4fZsFX65OJxD_ueAb-TQ/XpqJ.gif



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 16:07 Keen on a dired-hide-details-mode patch? Alvaro Ramirez
  2024-07-21 16:23 ` Eli Zaretskii
@ 2024-07-21 19:50 ` Yuri Khan
  2024-07-21 20:13   ` Alvaro Ramirez
  2024-07-22  6:29 ` Charles Choi
  2 siblings, 1 reply; 14+ messages in thread
From: Yuri Khan @ 2024-07-21 19:50 UTC (permalink / raw)
  To: Alvaro Ramirez; +Cc: emacs-devel

On Sun, 21 Jul 2024 at 23:14, Alvaro Ramirez <alvaro@xenodium.com> wrote:

> I have rough changes to enable hiding Dired’s absolute path via
> dired-hide-details-mode.
>
> Given a Dired header path like:
>
> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
>
> dired-hide-details-mode would display it as:
>
> eshell:

Will that be gated behind a separate setting? Because some of the
projects I work on consist of multiple components with an …/include
and a …/src in each so it’s vital to see the full path.

(Well, maybe stripping the project root to just its basename would be nice.)



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 19:50 ` Yuri Khan
@ 2024-07-21 20:13   ` Alvaro Ramirez
  2024-07-21 20:19     ` Yuri Khan
  2024-07-22 11:20     ` Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Alvaro Ramirez @ 2024-07-21 20:13 UTC (permalink / raw)
  To: Yuri Khan, emacs-devel

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Sun, 21 Jul 2024 at 23:14, Alvaro Ramirez 
> <alvaro@xenodium.com> wrote:
>
>> I have rough changes to enable hiding Dired’s absolute path via
>> dired-hide-details-mode.
>>
>> Given a Dired header path like:
>>
>> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
>>
>> dired-hide-details-mode would display it as:
>>
>> eshell:
>
> Will that be gated behind a separate setting?

Sure. Can do.

>  Because some of the
> projects I work on consist of multiple components with an 
> …/include
> and a …/src in each so it’s vital to see the full path.

Curious, in addition to dired header, wouldn't you also have 
de-duping details in the buffer name (and thus mode line)? I'm 
guessing I'm relying on the uniquify built-in package for this.

>
> (Well, maybe stripping the project root to just its basename 
> would be nice.)



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 20:13   ` Alvaro Ramirez
@ 2024-07-21 20:19     ` Yuri Khan
  2024-07-31 16:27       ` Alvaro Ramirez
  2024-07-22 11:20     ` Eli Zaretskii
  1 sibling, 1 reply; 14+ messages in thread
From: Yuri Khan @ 2024-07-21 20:19 UTC (permalink / raw)
  To: Alvaro Ramirez; +Cc: emacs-devel

On Mon, 22 Jul 2024 at 03:13, Alvaro Ramirez <alvaro@xenodium.com> wrote:

> >  Because some of the
> > projects I work on consist of multiple components with an
> > …/include
> > and a …/src in each so it’s vital to see the full path.
>
> Curious, in addition to dired header, wouldn't you also have
> de-duping details in the buffer name (and thus mode line)? I'm
> guessing I'm relying on the uniquify built-in package for this.

Ah, that’s okay then.



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 16:07 Keen on a dired-hide-details-mode patch? Alvaro Ramirez
  2024-07-21 16:23 ` Eli Zaretskii
  2024-07-21 19:50 ` Yuri Khan
@ 2024-07-22  6:29 ` Charles Choi
  2 siblings, 0 replies; 14+ messages in thread
From: Charles Choi @ 2024-07-22  6:29 UTC (permalink / raw)
  To: emacs-devel

Alvaro - 

Hello! Does this patch also work with Dired subdirs?

Charles

—
Charles Y. Choi
kickingvegas@gmail.com





> On Jul 21, 2024, at 9:07 AM, Alvaro Ramirez <alvaro@xenodium.com> wrote:
> 
> 
> I have rough changes to enable hiding Dired’s absolute path via dired-hide-details-mode.
> 
> Given a Dired header path like:
> 
> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
> 
> dired-hide-details-mode would display it as:




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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 20:13   ` Alvaro Ramirez
  2024-07-21 20:19     ` Yuri Khan
@ 2024-07-22 11:20     ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2024-07-22 11:20 UTC (permalink / raw)
  To: Alvaro Ramirez; +Cc: yuri.v.khan, emacs-devel

> From: Alvaro Ramirez <alvaro@xenodium.com>
> Date: Sun, 21 Jul 2024 21:13:24 +0100
> 
> Yuri Khan <yuri.v.khan@gmail.com> writes:
> 
> >> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
> >>
> >> dired-hide-details-mode would display it as:
> >>
> >> eshell:
> >
> > Will that be gated behind a separate setting?
> 
> Sure. Can do.

I think we indeed need a new option, so that users could control
whether they see the full directory name or just its last component.



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 18:38     ` Alvaro Ramirez
@ 2024-07-28 18:00       ` Alvaro Ramirez
  0 siblings, 0 replies; 14+ messages in thread
From: Alvaro Ramirez @ 2024-07-28 18:00 UTC (permalink / raw)
  To: emacs-devel

Alvaro Ramirez <alvaro@xenodium.com> writes:

> +emacs-devel
>
> Alvaro Ramirez <alvaro@xenodium.com> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> From: Alvaro Ramirez <alvaro@xenodium.com>
>>>> Date: Sun, 21 Jul 2024 17:07:07 +0100
>>>> I have rough changes to enable hiding Dired’s absolute path 
>>>> via
>>>> dired-hide-details-mode.
>>>> Given a Dired header path like:
>>>> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
>>>> dired-hide-details-mode would display it as:
>>>> eshell:
>>>> I’ve attached a couple of gifs demonstrating the toggle via 
>>>> "("
>>>> Dired binding (before and after mod).
>>>> Is there interest in receiving a patch? I’m happy to propose 
>>>> one,
>>>> but wanted to check before investing further (it would be my 
>>>> first
>>>> Emacs submission).
>>>
>>> Please use "M-x submit-emacs-patch" to submit your patch, and 
>>> let's
>>> take it from there.

Initial patch at 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72272

>>
>> Sounds good. Will do.
>>
>>>
>>> Thank you for your interest in Emacs.
>>
>> Thanks Eli!
>>
>>>
>>> P.S. Your GIF images, as posted, appear to be empty.
>>
>> Try these...
>>
>> Before patch: https://0x0.st/s/fsFsYyLFchgeEqP7LtDtGQ/Xpqy.gif
>> After patch: https://0x0.st/s/cw4fZsFX65OJxD_ueAb-TQ/XpqJ.gif



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-21 20:19     ` Yuri Khan
@ 2024-07-31 16:27       ` Alvaro Ramirez
  2024-07-31 19:40         ` Charles Choi
  0 siblings, 1 reply; 14+ messages in thread
From: Alvaro Ramirez @ 2024-07-31 16:27 UTC (permalink / raw)
  To: kickingvegas; +Cc: emacs-devel

Hi Charles!

Charles Choi <kickingvegas@gmail.com> writes:

> Alvaro - 
> 
> Hello! Does this patch also work with Dired subdirs?

Got more details? I'm guessing yes, as it applies to all dired 
buffer headers, but maybe I'm not considering something else? You 
can see the difference at:

Before patch: https://0x0.st/s/fsFsYyLFchgeEqP7LtDtGQ/Xpqy.gif
After patch: https://0x0.st/s/cw4fZsFX65OJxD_ueAb-TQ/XpqJ.gif

The initial patch is available if you'd like to try it out for 
your use-case 
https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-07/msg00976.html

> 
> Charles
> 
> —
> Charles Y. Choi
> kickingvegas@gmail.com
> 
>> On Jul 21, 2024, at 9:07 AM, Alvaro Ramirez 
>> <alvaro@xenodium.com> wrote:
>> 
>> 
>> I have rough changes to enable hiding Dired’s absolute path via 
>> dired-hide-details-mode.
>> 
>> Given a Dired header path like:
>> 
>> /long/path/to/some/location/that/goes/deep/into/emacs/lisp/eshell:
>> 
>> dired-hide-details-mode would display it as:



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-31 16:27       ` Alvaro Ramirez
@ 2024-07-31 19:40         ` Charles Choi
  2024-08-01 16:31           ` Alvaro Ramirez
  0 siblings, 1 reply; 14+ messages in thread
From: Charles Choi @ 2024-07-31 19:40 UTC (permalink / raw)
  To: emacs-devel

Alvaro - 

Here’s an example directory with subdirs and hiding turned on. If your patch deals with the subdirs then I’d be thrilled.

http://yummymelon.com/images/pastes/dired-hiding-on.png

All my best - 

Charles

—
Charles Y. Choi, Ph.D.
kickingvegas@gmail.com



> On Jul 31, 2024, at 9:27 AM, Alvaro Ramirez <alvaro@xenodium.com> wrote:
> 
> Got more details? I'm guessing yes, as it applies to all dired buffer headers, but maybe I'm not considering something else? You can see the difference at:




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

* Re: Keen on a dired-hide-details-mode patch?
  2024-07-31 19:40         ` Charles Choi
@ 2024-08-01 16:31           ` Alvaro Ramirez
  2024-08-01 19:39             ` Charles Choi
  0 siblings, 1 reply; 14+ messages in thread
From: Alvaro Ramirez @ 2024-08-01 16:31 UTC (permalink / raw)
  To: kickingvegas; +Cc: emacs-devel

> Alvaro -
>
> Here’s an example directory with subdirs and hiding turned 
> on. If your patch
> deals with the subdirs then I’d be thrilled.
>
> http://yummymelon.com/images/pastes/dired-hiding-on.png

Oooh, thanks Charles. TIL about this dired view/feature ;) I've 
been using the dired-subtree package myself since 2015 it seems 
https://lmno.lol/alvaro/drill-down-emacs-dired-with-dired-subtree

For the subdirs view in the screenshot you sent, I triggered it 
using `M-x dired-maybe-insert-subdir`. Lemme know if you're using 
a different mechanism.

I kinda have something working locally, which looks like this: 
https://0x0.st/s/1UqYa811zfdRYdMdDWdE-Q/XO2D.gif

The patch from 
https://lists.gnu.org/archive/html/bug-gnu-emacs/2024-07/msg00976.html 
doesn't yet handle this case. I'll wait a little to hear if 
there's interest in including this patch/functionality upstream 
before investing further.

>
> All my best -
>
> Charles
>
> —
> Charles Y. Choi, Ph.D.
> kickingvegas@gmail.com
>
>
>
> > On Jul 31, 2024, at 9:27 AM, Alvaro Ramirez 
> > <alvaro@xenodium.com> wrote:
> >
> > Got more details? I'm guessing yes, as it applies to all dired 
> > buffer
> > headers, but maybe I'm not considering something else? You can 
> > see the
> > difference at:



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

* Re: Keen on a dired-hide-details-mode patch?
  2024-08-01 16:31           ` Alvaro Ramirez
@ 2024-08-01 19:39             ` Charles Choi
  2024-08-02 10:40               ` Alvaro Ramirez
  0 siblings, 1 reply; 14+ messages in thread
From: Charles Choi @ 2024-08-01 19:39 UTC (permalink / raw)
  To: emacs-devel

Alvaro - 

Yes, `dired-maybe-insert-subdir` is the command that inserts a subdir provided it is issued when the point is over a directory. For reference, I invoke it from Casual Dired from here https://github.com/kickingvegas/casual-dired/blob/4be72b52f91700cdb529a185b8f6f21bd0a86542/lisp/casual-dired.el#L76

Ideally your hiding code would show the relative pathname of a subdir when hiding is turned on, otherwise the fullpath.

Note that my current understanding of subdir behavior with default Dired is that it only supports subdirectories within the current parent directory. I vaguely recall there are other 3rd party packages that try to let you insert out-of-hierarchy subdirs. I don’t think it’s something you need to support, but this patch could potentially break such packages if pushed into core.

All my best -

Charles

—
Charles Y. Choi, Ph.D.
kickingvegas@gmail.com





> On Aug 1, 2024, at 9:31 AM, Alvaro Ramirez <alvaro@xenodium.com> wrote:
> 
> For the subdirs view in the screenshot you sent, I triggered it using `M-x dired-maybe-insert-subdir`. Lemme know if you're using a different mechanism.




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

* Re: Keen on a dired-hide-details-mode patch?
  2024-08-01 19:39             ` Charles Choi
@ 2024-08-02 10:40               ` Alvaro Ramirez
  0 siblings, 0 replies; 14+ messages in thread
From: Alvaro Ramirez @ 2024-08-02 10:40 UTC (permalink / raw)
  To: kickingvegas; +Cc: emacs-devel

> Alvaro -
>
> Yes, `dired-maybe-insert-subdir` is the command that inserts a 
> subdir provided
> it is issued when the point is over a directory. For reference, 
> I invoke it
> from Casual Dired from here
> https://github.com/kickingvegas/casual-dired/blob/4be72b52f91700cdb529a185b8f6f21bd0a86542/lisp/casual-dired.el#L76
>
> Ideally your hiding code would show the relative pathname of a 
> subdir when
> hiding is turned on, otherwise the fullpath.

I think https://0x0.st/s/1UqYa811zfdRYdMdDWdE-Q/XO2D.gif shows 
that? or do we mean something else?

Without patching your core dired.el, try the following and see if 
that does what you expect:

(use-package dired
  :hook ((dired-mode . dired-hide-details-mode)
         (dired-after-readin 
         . ar/hide-dired-details-include-all-subdir-paths))
  :config
  (defun ar/hide-dired-details-include-all-subdir-paths ()
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward dired-subdir-regexp nil t)
        (let* ((match-bounds (cons (match-beginning 1) (match-end 
        1)))
               (path (file-name-directory (buffer-substring (car 
               match-bounds) (cdr match-bounds))))
               (path-start (car match-bounds))
               (path-end (+ (car match-bounds) (length path)))
               (inhibit-read-only t))
          (put-text-property path-start path-end 'invisible 
          'dired-hide-details-information)))))) 

> Note that my current understanding of subdir behavior with 
> default Dired is
> that it only supports subdirectories within the current parent 
> directory. I
> vaguely recall there are other 3rd party packages that try to 
> let you insert
> out-of-hierarchy subdirs. I don’t think it’s something you need 
> to support, but
> this patch could potentially break such packages if pushed into 
> core.

I use one of them (dired-subtree). No breakage so far.



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

end of thread, other threads:[~2024-08-02 10:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-21 16:07 Keen on a dired-hide-details-mode patch? Alvaro Ramirez
2024-07-21 16:23 ` Eli Zaretskii
     [not found]   ` <m27cdehavc.fsf@xenodium.com>
2024-07-21 18:38     ` Alvaro Ramirez
2024-07-28 18:00       ` Alvaro Ramirez
2024-07-21 19:50 ` Yuri Khan
2024-07-21 20:13   ` Alvaro Ramirez
2024-07-21 20:19     ` Yuri Khan
2024-07-31 16:27       ` Alvaro Ramirez
2024-07-31 19:40         ` Charles Choi
2024-08-01 16:31           ` Alvaro Ramirez
2024-08-01 19:39             ` Charles Choi
2024-08-02 10:40               ` Alvaro Ramirez
2024-07-22 11:20     ` Eli Zaretskii
2024-07-22  6:29 ` Charles Choi

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).