Subject: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length'

From: Eli Zaretskii <[email-masked]>
Date: Sat, 18 Nov 2023 12:55:16 +0200

> From: Liu Hui <[email-masked]>
> Date: Sat, 18 Nov 2023 17:23:26 +0800
> Cc: [email-masked], [email-masked], [email-masked]
> 
> > > +(defun dired--get-filename-display-length ()
> > > +  "Return maximum display length of filename."
> >
> > This doc string is inaccurate.  The function actually returns the
> > number of columns available for displaying the file names in a Dired
> > buffer, and it should be called with point at the first character of
> > the file name.
> 
> Why is it inaccurate? When `dired-filename-display-length' is window,
> the function does return the number of columns available, and it is
> used as the maximum display length. Moreover, it could be an integer,
> which also means the maximum display length.

If there are two different modes of using this function, the doc
string could describe them both.  Currently, it only describes the use
case where dired-filename-display-length is an integer, in which case
it is a simple accessor.  The other use case is more subtle, and the
doc string is completely silent about that, in particular it doesn't
mention that point should be at the first character of the file name
in that case.

> BTW, I just find isearch doesn't handle hidden filenames based on
> 'invisible' text property, which needs to be fixed. So maybe an
> overlay-based approach is better? though I don't know if there is any
> possible problem with using overlays for this feature. WDYT?

Doesn't "M-x i" during isearch handle this?

> --- a/lisp/wdired.el
> +++ b/lisp/wdired.el
> @@ -261,6 +261,9 @@ wdired-change-to-wdired-mode
>    (add-function :override (local 'revert-buffer-function) #'wdired-revert)
>    (set-buffer-modified-p nil)
>    (setq buffer-undo-list nil)
> +  ;; remove filename invisibility spec to ensure filenames are visible
> +  ;; for editing

Comments should be complete sentences: begin with a capital letter and
end with a period.  Also, please mention here the new defcustom you
add to Dired, so that the comment could better explain itself.

Thanks.