all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alvaro Ramirez <alvaro@xenodium.com>
To: kickingvegas@gmail.com
Cc: emacs-devel@gnu.org
Subject: Re: Keen on a dired-hide-details-mode patch?
Date: Fri, 02 Aug 2024 11:40:11 +0100	[thread overview]
Message-ID: <m2bk2bi4xg.fsf@xenodium.com> (raw)
In-Reply-To: <E99DD6CB-18D5-44E1-86DF-4455F06D81AB@gmail.com>

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



  reply	other threads:[~2024-08-02 10:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-07-22 11:20     ` Eli Zaretskii
2024-07-22  6:29 ` Charles Choi

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

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

  git send-email \
    --in-reply-to=m2bk2bi4xg.fsf@xenodium.com \
    --to=alvaro@xenodium.com \
    --cc=emacs-devel@gnu.org \
    --cc=kickingvegas@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.