all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* dired-details[+].el
@ 2009-07-19  9:55 joakim
  2009-07-19 14:34 ` dired-details[+].el Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: joakim @ 2009-07-19  9:55 UTC (permalink / raw)
  To: Emacs Development

I discovered dired-details and dired-details+ and found them useful.
Could they be added to emacs?

http://www.emacswiki.org/emacs/DiredDetails

-- 
Joakim Verona




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

* RE: dired-details[+].el
  2009-07-19  9:55 dired-details[+].el joakim
@ 2009-07-19 14:34 ` Drew Adams
  2012-05-16 15:24   ` dired-details[+].el Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2009-07-19 14:34 UTC (permalink / raw)
  To: joakim, 'Emacs Development'

> I discovered dired-details and dired-details+ and found them useful.
> Could they be added to emacs?
> 
> http://www.emacswiki.org/emacs/DiredDetails

They were supposed to be added. Rob Giardina submitted an Emacs 23 patch two
years ago that integrates the functionality of both in a better way even than
the separate libraries dired-details[+].el. 

I don't think any reason was ever given for why the patch wasn't incorporated
(committed). RMS asked for comment on the merged code, but no one ever answered
his request (on emacs-devel, at least). The last time I ping'ed the list about
this was 2008-07 - I never got an answer either.

Last ping:
http://lists.gnu.org/archive/html/emacs-devel/2008-07/msg01152.html

Rob's change log and RMS's call for comment:
http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg01187.html

Original thread:
http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00226.html





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

* Re: dired-details[+].el
  2009-07-19 14:34 ` dired-details[+].el Drew Adams
@ 2012-05-16 15:24   ` Stefan Monnier
  2012-05-16 16:10     ` dired-details[+].el Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-05-16 15:24 UTC (permalink / raw)
  To: Drew Adams; +Cc: rob, joakim, 'Emacs Development'

>> I discovered dired-details and dired-details+ and found them useful.
>> Could they be added to emacs?
>> http://www.emacswiki.org/emacs/DiredDetails
> They were supposed to be added.  Rob Giardina submitted an Emacs 23 patch two
> years ago that integrates the functionality of both in a better way even than
> the separate libraries dired-details[+].el.

Thanks.

> I don't think any reason was ever given for why the patch wasn't
> incorporated (committed).

A technical reason is lack of copyright paperwork.  I'm not sure if the
email I used in the Cc is valid.  If so, Rob, could you contact me to
get this copyright business out of the way?

> Rob's change log and RMS's call for comment:
> http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg01187.html

This was mangled by the non-MIME forwarding, but I think I managed to
unmangle it (see after my sig).  Some of the hunks don't apply any more,
but they're trivial to fix.  There are a few minor details to make
before we can install the code:

>         * dired.el: new functions to support hiding file details in dired.

Please capitalize all the phrases in your changelog.

>         (dired-revert): delete cached overlay lists

And please punctuate them properly.

>         (dired-details): new customize group
>         New customizable vars.
>         (dired-details-hidden-string)
>         (dired-details-hide-link-targets)
>         (dired-details-initially-hide)
>         New buffer local vars.

There's some ":" missing somewhere.

> --- old/lisp/dired-x.el      Sun Jul 15 21:25:37 2007
> +++ new/lisp/dired-x.el    Sun Jul 15 22:00:23 2007
> @@ -755,7 +755,8 @@
>    (set (make-local-variable 'dired-subdir-alist) nil)
>    (dired-build-subdir-alist)
>    (goto-char (point-min))
> -  (dired-initial-position dirname))
> +  (dired-initial-position dirname)
> +  (run-hooks 'dired-after-readin-hook))

I'm not sure if this is appropriate.  But I think it's OK to just try it
and fix it later if someone reports a problem.

> +    (dired-details-delete-overlays) ;;ditch the entire overlay cache

Please capitalize and punctuate your comments.

> +    (define-key map "(" 'dired-details-hide)
> +    (define-key map ")" 'dired-details-show)
> +    (define-key map ";" 'dired-details-toggle)

I'd rather place the bindings on a "dired-details" prefix.

> +(defcustom dired-details-hidden-string "[...]"
> +  "*This string will be shown in place of file details and symbolic links."
> +  :group 'dired-details
> +  :type 'string)

No need for "*" in defcustoms.

> +(defcustom dired-details-hide-link-targets t
> +  "*Hide symbolic link target paths."
> +  :group 'dired-details
> +  :type 'boolean)

FWIW I find something like (setq truncate-lines t) to be better.
Since line truncation is the default in tabulated-list-mode, maybe we
should also make it the default in dired.

> +(defvar dired-details-state nil
> +  "Three possible values: nil (has not been set), 'hidden (details are
> +hidden), 'shown (details are visible).")
> +(make-variable-buffer-local 'dired-details-state)

The first line of a docstring should stand on its own.

> +(add-hook 'dired-after-readin-hook 'dired-details-activate)

Rather than unconditionally adding to dired-after-readin-hook, I think
we should add/remove from this hook when toggling.

> +    (dolist (overlay (cdr dir-and-overlays))
> +      (delete-overlay overlay)))

Aka (mapc #'delete-overlay (cdr dir-and-overlays)).

> +(defun dired-details-toggle (&optional arg default-too)
> +  "Toggle visibility of dired details.
> +With positive prefix argument ARG hide the details, with negative
> +show them."
> +  (interactive "P")
> +  (let ((hide (if (null arg)
> +                  (not (eq 'hidden dired-details-state))
> +                (> (prefix-numeric-value arg) 0))))
> +    (if default-too
> +        (setq dired-details-initially-hide hide))
> +    (if hide (dired-details-hide)
> +      (dired-details-show))))

Use define-minor-mode.

> +(defun dired-details-hide()

Add a space before open parentheses.

> +  "Make an invisible, evaporable overlay for each visible file
> +details in this dired buffer. This is called from

Again, the first line of a docstring should stand on its own.

> +  (unless (memq major-mode '(dired-mode vc-dired-mode))

Use derived-mode-p.

> +    (error "dired-details-hide can only be called in dired mode"))

Actually, why bother signaling an error here?

> +                 (cached-overlays
> +                  (assoc dir dired-details-internal-overlay-cache)))

BTW, why do we bother with this business of caching overlays?

> +(defun dired-details-hide-overlay (o)
> +  (overlay-put o 'invisible t)
> +  (overlay-put o 'before-string dired-details-hidden-string))

Why use dired-details-hidden-string rather than just using the
traditional ellipsis with buffer-invisibility-spec?


        Stefan


2007-07-15  Rob Giardina  <address@hidden>

        * dired.el: new functions to support hiding file details in dired.
        (dired-revert): delete cached overlay lists
        (dired-details): new customize group
        New customizable vars.
        (dired-details-hidden-string)
        (dired-details-hide-link-targets)
        (dired-details-initially-hide)
        New buffer local vars.
        (dired-details-internal-overlay-cache)
        (dired-details-state)
        New functions.
        (dired-details-activate)
        (dired-details-delete-overlays)
        (dired-details-toggle)
        (dired-details-hide)
        (dired-details-show)
        (dired-details-make-current-line-overlay)
        (dired-details-hide-overlay)
        (dired-details-show-overlay)
        (dired-details-frob-overlays)

        * dired-x.el (dired-virtual): run `dired-after-readin-hook' after
        restoring a saved dired buffer

--- old/lisp/dired-x.el      Sun Jul 15 21:25:37 2007
+++ new/lisp/dired-x.el    Sun Jul 15 22:00:23 2007
@@ -755,7 +755,8 @@
   (set (make-local-variable 'dired-subdir-alist) nil)
   (dired-build-subdir-alist)
   (goto-char (point-min))
-  (dired-initial-position dirname))
+  (dired-initial-position dirname)
+  (run-hooks 'dired-after-readin-hook))
 
 (defun dired-virtual-guess-dir ()
   "Guess and return appropriate working directory of this buffer.

--- old/lisp/dired.el	Sun Jul 15 15:42:33 2007
+++ new/lisp/dired.el	Sun Jul 15 21:19:44 2007
@@ -1042,6 +1042,7 @@
     (goto-char (point-min))
     (setq mark-alist;; only after dired-remember-hidden since this unhides:
 	  (dired-remember-marks (point-min) (point-max)))
+    (dired-details-delete-overlays) ;;ditch the entire overlay cache
     ;; treat top level dir extra (it may contain wildcards)
     (dired-uncache
      (if (consp dired-directory) (car dired-directory) dired-directory))
@@ -1242,6 +1243,9 @@
     (define-key map "\C-n" 'dired-next-line)
     (define-key map "\C-p" 'dired-previous-line)
     (define-key map [down] 'dired-next-line)
+    (define-key map "(" 'dired-details-hide)
+    (define-key map ")" 'dired-details-show)
+    (define-key map ";" 'dired-details-toggle)
     (define-key map [up] 'dired-previous-line)
     ;; hiding
     (define-key map "$" 'dired-hide-subdir)
@@ -3334,6 +3338,171 @@
 	     '(dired-mode . dired-restore-desktop-buffer))
 
 \f
+;;; optionally hide file details and link targets
+
+(defgroup dired-details nil
+  "Settings for to hide file details and symbolic link targets."
+  :group 'dired
+  :prefix "dired-details-")
+
+(defcustom dired-details-hidden-string "[...]"
+  "*This string will be shown in place of file details and symbolic links."
+  :group 'dired-details
+  :type 'string)
+
+(defcustom dired-details-hide-link-targets t
+  "*Hide symbolic link target paths."
+  :group 'dired-details
+  :type 'boolean)
+
+(defcustom dired-details-initially-hide nil
+  "*Hide dired details on entry to dired buffers."
+  :group 'dired-details
+  :type 'boolean)
+
+(defvar dired-details-internal-overlay-cache nil)
+(make-variable-buffer-local 'dired-details-internal-overlay-cache)
+
+(defvar dired-details-state nil
+  "Three possible values: nil (has not been set), 'hidden (details are
+hidden), 'shown (details are visible).")
+(make-variable-buffer-local 'dired-details-state)
+
+(defun dired-details-activate()
+  "Set up dired-details in the current dired buffer. Called by
+dired-after-readin-hook on initial display and when a dired
+buffer is modified. If the state of detail display has been set
+in this buffer then use that state, otherwise use the value of
+`dired-details-initially-hide'."
+  (if (eq 'hidden dired-details-state)
+      (dired-details-hide)
+      (when dired-details-initially-hide
+        (dired-details-hide))))
+(add-hook 'dired-after-readin-hook 'dired-details-activate)
+
+(defun dired-details-delete-overlays()
+  (dolist (dir-and-overlays dired-details-internal-overlay-cache)
+    (dolist (overlay (cdr dir-and-overlays))
+      (delete-overlay overlay)))
+  (setq dired-details-internal-overlay-cache nil))
+
+(defun dired-details-toggle (&optional arg default-too)
+  "Toggle visibility of dired details.
+With positive prefix argument ARG hide the details, with negative
+show them."
+  (interactive "P")
+  (let ((hide (if (null arg)
+                  (not (eq 'hidden dired-details-state))
+                (> (prefix-numeric-value arg) 0))))
+    (if default-too
+        (setq dired-details-initially-hide hide))
+    (if hide (dired-details-hide)
+      (dired-details-show))))
+
+(defun dired-details-hide()
+  "Make an invisible, evaporable overlay for each visible file
+details in this dired buffer. This is called from
+dired-after-readin-hook in different contexts: (1) narrowed to a
+single file (after copy, move, symlink etc.)  (2) narrowed to a
+single subdir (e.g. after dired-insert-subdir) (3) with multiple
+visible subdirs and not narrowed (e.g. after dired-revert)"
+  (interactive)
+  (unless (memq major-mode '(dired-mode vc-dired-mode))
+    (error "dired-details-hide can only be called in dired mode"))
+
+  (save-excursion
+    (goto-char (point-min))
+    (if (not (looking-at dired-subdir-regexp))
+        ;;a single file or files -- just make an overlay for each
+        (let* ((parent (dired-current-directory))
+               (cached-parent-overlays
+                (assoc parent dired-details-internal-overlay-cache)))
+          (unless cached-parent-overlays
+            (error "dired-details overlays not found for directory %s" parent))
+          (dired-goto-next-file)
+          (while (< (point) (point-max))
+            (dired-details-make-current-line-overlay cached-parent-overlays)
+            (dired-next-line 1)))
+
+        ;;hide each visible subdirectory (either of cases (2) or (3)
+        ;;mentioned above)
+        (dolist (dir-and-pos dired-subdir-alist)
+          (let* ((dir (car dir-and-pos))
+                 (pos (cdr dir-and-pos))
+                 (cached-overlays
+                  (assoc dir dired-details-internal-overlay-cache)))
+            ;;skip this directory if it's outside of a narrowed region
+            (when (and (>= pos (point-min)) (<= pos (point-max)))
+              (if cached-overlays
+                  (dired-details-frob-overlays t) ;;reuse existing
+                  (let ((cache (list dir)) ;;make new overlays
+                        (subdir-start (let ((rest pos))
+                                        ;;xemacs compat: in xemacs, this is a list
+                                        (if (atom rest) rest (car rest))))
+                        (subdir-end (1- (dired-get-subdir-max dir-and-pos))))
+                    (goto-char subdir-start)
+                    (dired-goto-next-file)
+                    (while (< (point) subdir-end)
+                      ;;nb: uses setcdr to update cache
+                      (dired-details-make-current-line-overlay cache)
+                      (dired-next-line 1))
+                    (setq dired-details-internal-overlay-cache
+                          (cons cache dired-details-internal-overlay-cache)))))))
+        (setq dired-details-state 'hidden))))
+
+(defun dired-details-show()
+  "Show whatever details a call to `dired-details-hide' may have
+hidden in this buffer."
+  (interactive)
+  (dired-details-frob-overlays nil)
+  (setq dired-details-state 'shown))
+
+(defun dired-details-make-current-line-overlay (cache)
+  (let ((detail-overlay ;hide the flags, size, owner, date, etc.
+         (make-overlay
+          (+ 2 (progn (beginning-of-line) (point)))
+          (progn (dired-move-to-filename)(point))))
+
+        (ln-target ;hide the destination of a symbolic when
+         (when dired-details-hide-link-targets
+           (if (progn (beginning-of-line)
+                      (search-forward-regexp
+                       "-> \\(.*\\)"
+                       (save-excursion (end-of-line)(point)) t))
+               (make-overlay (match-beginning 1) (match-end 1))))))
+
+    ;;delete the overlay when the dired line goes away
+    (overlay-put detail-overlay 'evaporate t)
+    (dired-details-hide-overlay detail-overlay)
+
+    (when ln-target
+      (overlay-put ln-target 'evaporate t)
+      (dired-details-hide-overlay ln-target))
+
+    (setcdr cache (append (if ln-target
+                              (list ln-target detail-overlay)
+                            (list detail-overlay))
+                          (cdr cache)))
+    detail-overlay))
+
+(defun dired-details-hide-overlay (o)
+  (overlay-put o 'invisible t)
+  (overlay-put o 'before-string dired-details-hidden-string))
+
+(defun dired-details-show-overlay (o)
+  (overlay-put o 'invisible nil)
+  (overlay-put o 'before-string ""))
+
+(defun dired-details-frob-overlays (hide)
+  (when dired-details-internal-overlay-cache
+    (let ((frobber (if hide 'dired-details-hide-overlay
+                            'dired-details-show-overlay)))
+      (dolist (dir-and-overlays dired-details-internal-overlay-cache)
+        (dolist (overlay (cdr dir-and-overlays))
+          (funcall frobber overlay))))))
+
+\f
+
 (if (eq system-type 'vax-vms)
     (load "dired-vms"))
 

--- old/doc/emacs/dired.texi      Sun Jul 15 18:00:22 2007
+++ new/doc/emacs/dired.texi    Sun Jul 15 18:00:10 2007
@@ -41,6 +41,7 @@
  @end ifnottex
  * Subdirectory Motion::             Moving across subdirectories, and up and down.
  * Hiding Subdirectories::     Making subdirectories visible or invisible.
+ * Hiding File Details::       Making file attributes visible or invisible.
  * Updating: Dired Updating.   Discarding lines for files of no interest.
  * Find: Dired and Find.             Using `find' to choose the files for Dired.
  * Wdired::                    Operating on files by editing the Dired buffer.
@@ -1011,6 +1012,45 @@
 without having to remove the Dired marks on files in those
 subdirectories.
 
+@node Hiding File Details
+@section Hiding File Details
+
+@cindex hiding in Dired (Dired)
+  @dfn{Hiding} file details means making file attributes and symbolic
+link targets invisible using overlays (@pxref{Overlays,,, elisp, the
+Emacs Lisp Reference Manual}). This converts the dired display to a
+terse list of filenames while continuing to support all normal dired
+commands.
+
+@table @kbd
+@item @kbd{;}
+@findex dired-details-toggle
+@kindex @kbd{;} @r{(Dired)}
+Hide or reveal file details in the current Dired buffer.
+
+@item @kbd{(}
+@findex dired-details-hide
+@kindex @kbd{(} @r{(Dired)}
+Hide file details in the current Dired buffer.
+
+@item @kbd{)}
+@findex dired-details-hide
+@kindex @kbd{)} @r{(Dired)}
+Show file details in the current Dired buffer.
+@end table
+
+   You can customize @code{dired-details-hidden-string} to display any
+string in place of hidden details and link targets (the default is
+"[...]").
+
+   The option @code{dired-details-hide-link-targets} can be set to
+@code{nil} to show link targets when details are hidden. The default is to
+hide link targets.
+
+   Currently, the dired-sort-* family of functions do not call
+@code{dired-after-readin-hook} and thus will not hide details until
+the next call to @code{dired-revert} (@kbd{g}).
+
 @node Dired Updating
 @section Updating the Dired Buffer
 @cindex updating Dired buffer




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

* RE: dired-details[+].el
  2012-05-16 15:24   ` dired-details[+].el Stefan Monnier
@ 2012-05-16 16:10     ` Drew Adams
  2012-05-16 22:57       ` bug#6799: dired-details[+].el Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2012-05-16 16:10 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: rob, joakim, 'Emacs Development'

Thanks for looking into this again, Stefan. 

> A technical reason is lack of copyright paperwork.  I'm not 
> sure if the email I used in the Cc is valid.  If so, Rob,
> could you contact me to get this copyright business out of the way?

Hopefully Rob will answer, but I'm pretty sure he already took care of the
copyright stuff.  The most recent reply we have from Rob is from this address:
rob.giardina@gmail.com.

This is that reply:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6799#23. Note too that he included
the latest patches in that message.

> > Rob's change log and RMS's call for comment:
> > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg01187.html
> 
> This was mangled by the non-MIME forwarding, but I think I managed to
> unmangle it (see after my sig).  Some of the hunks don't 
> apply any more, but they're trivial to fix.  There are a few minor
> details to make before we can install the code:

Please check also the patches in his message a few weeks ago (see above), just
in case there is some difference that might be important.

> > +    (define-key map "(" 'dired-details-hide)
> > +    (define-key map ")" 'dired-details-show)
> > +    (define-key map ";" 'dired-details-toggle)
> 
> I'd rather place the bindings on a "dired-details" prefix.

FWIW, I think we need only one keybinding, for just `dired-details-toggle'.
It's good to have the other commands too, but I'm not sure they need key
bindings.  Just one opinion.  Personally, I use only the toggle, and I bind it
to `)' - and also to `(', for the heck of it.  I never use the other two
commands, but users are different.

So in particular I see no need for a prefix key - a single keystroke should be
sufficient for everything that one wants to do with `dired-details'.

Note that the toggle (at least as I defined it, and I think Rob's patches kept
this behavior) affects future Dired buffers - IOW the new setting persists after
toggling in the current Dired buffer, so that it is used thereafter
(everywhere).

> > +(defcustom dired-details-hide-link-targets t
> > +  "*Hide symbolic link target paths."
> > +  :group 'dired-details
> > +  :type 'boolean)
> 
> FWIW I find something like (setq truncate-lines t) to be better.

Not the same thing.  And not better, IMO - less specific.  Hiding symlink
targets should apply regardless of line length.  Truncating is only about
handling long lines.  (But I don't really care about this matter.)

> Since line truncation is the default in tabulated-list-mode, maybe we
> should also make it the default in dired.

Egads, no, please.

No, I won't fight over the default value, but I think truncated lines as the
default is nearly always a bad idea.  An extra reason is that some users will
have no clue what's going on and how to show the missing info.

Truncating lines is nearly a barbarism that should go the way of the dinosaurs.
No, just kidding.  It can be handy if you know how to toggle it, but truncation
should not be the default (anywhere), IMHO.

Again though, not very important.

> > +(defun dired-details-toggle (&optional arg default-too)
> > +  "Toggle visibility of dired details.
> > +With positive prefix argument ARG hide the details, with negative
> > +show them."
> > +  (interactive "P")
> > +  (let ((hide (if (null arg)
> > +                  (not (eq 'hidden dired-details-state))
> > +                (> (prefix-numeric-value arg) 0))))
> > +    (if default-too
> > +        (setq dired-details-initially-hide hide))
> > +    (if hide (dired-details-hide)
> > +      (dired-details-show))))
> 
> Use define-minor-mode.

I think I disagree, and I feel more strongly about this point.  The current
behavior is what I like, and I'm not sure how using a minor mode would provide
it.  This is the behavior:

 Toggling affects only the current Dired buffer and subsequently
 created Dired buffers.  It does not affect other existing Dired buffers.

A local minor mode would affect only the current Dired buffer and not
subsequently created ones.  A global minor mode would affect all Dired buffers
at the same time.  

The current toggle is very handy.  Toggling twice, just to show something for a
moment for example, does not show everything in all Dired buffers (as would a
global minor mode).  It has an effect only on the current buffer (since you did
it twice).

And the fact that toggling sets the "mode" for all new Dired buffers is very
handy, though it's hard for me to do justice as to why.  Just try it for a
while, to see.  Drill down the directory hierarchy, for instance.  But again, I
can't really characterize the value using a particular example - just try it.

I really suggest (ask that) you play with the existing feature a while, before
suggesting behavior changes.

> > +(defun dired-details-hide-overlay (o)
> > +  (overlay-put o 'invisible t)
> > +  (overlay-put o 'before-string dired-details-hidden-string))
> 
> Why use dired-details-hidden-string rather than just using the
> traditional ellipsis with buffer-invisibility-spec?

The first thing I did when getting dired-details.el was change the string to "",
and I've never looked back.  In my use of it, hiding the details means showing
nothing in their place.  And in the commentary of dired-details+.el I
recommended that others do the same.

FWIW, This is important to me.  When I hide details I get a _minimal_ Dired
display.  And I automatically fit its frame to the content, so the frame takes
up a minimum of screen real estate.  It's thus almost like a speedbar (narrow),
but the buffer still has the full functionality of Dired.

HTH.




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

* bug#6799: dired-details[+].el
  2012-05-16 16:10     ` dired-details[+].el Drew Adams
@ 2012-05-16 22:57       ` Stefan Monnier
  2012-05-16 23:52         ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-05-16 22:57 UTC (permalink / raw)
  To: Drew Adams; +Cc: rob, rob.giardina, 6799, joakim

>> A technical reason is lack of copyright paperwork.  I'm not 
>> sure if the email I used in the Cc is valid.  If so, Rob,
>> could you contact me to get this copyright business out of the way?
> Hopefully Rob will answer, but I'm pretty sure he already took care of
> the copyright stuff.

At least I can't find him in the FSF's copyright-list.
Sometimes some entries are missing, so if he says he did sign the
papers, I'll ask the copyright clerk to investigate.

> The most recent reply we have from Rob is from
> this address: rob.giardina@gmail.com.

Thanks, I added it to the Cc.

> This is that reply:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6799#23.  Note too that
> he included the latest patches in that message.

Thanks.  Moved this thread to the bug.  The patch there looks very
similar to the one I just reviewed.

>> > +    (define-key map "(" 'dired-details-hide)
>> > +    (define-key map ")" 'dired-details-show)
>> > +    (define-key map ";" 'dired-details-toggle)
>> I'd rather place the bindings on a "dired-details" prefix.
> FWIW, I think we need only one keybinding, for just `dired-details-toggle'.

Actually, I think you're right.

>> > +(defcustom dired-details-hide-link-targets t
>> > +  "*Hide symbolic link target paths."
>> > +  :group 'dired-details
>> > +  :type 'boolean)
>> FWIW I find something like (setq truncate-lines t) to be better.
> Not the same thing.  And not better, IMO - less specific.  Hiding symlink
> targets should apply regardless of line length.  Truncating is only about
> handling long lines.  (But I don't really care about this matter.)

Not the same thing indeed, but in many cases, truncation makes
hiding unnecessary.

>> Since line truncation is the default in tabulated-list-mode, maybe we
>> should also make it the default in dired.
> Egads, no, please.
> No, I won't fight over the default value, but I think truncated lines as the
> default is nearly always a bad idea.

I find truncated lines to be the only good choice for text displayed in
columns, where wrapping breaks the clean visual display.
I don't claim it's perfect, but I think it's a generally better default.

> An extra reason is that some users will have no clue what's going on
> and how to show the missing info.

If that's really a problem, it's a general one that needs to be fixed in
general (e.g. by adding horizontal scroll bars and/or supporting
horizontal scrolling via two-finger gestures or things like that).

> Truncating lines is nearly a barbarism that should go the way of the
> dinosaurs.  No, just kidding.  It can be handy if you know how to
> toggle it, but truncation should not be the default (anywhere), IMHO.

Obviously a matter of taste.

> Again though, not very important.

>> > +(defun dired-details-toggle (&optional arg default-too)
>> > +  "Toggle visibility of dired details.
>> > +With positive prefix argument ARG hide the details, with negative
>> > +show them."
>> > +  (interactive "P")
>> > +  (let ((hide (if (null arg)
>> > +                  (not (eq 'hidden dired-details-state))
>> > +                (> (prefix-numeric-value arg) 0))))
>> > +    (if default-too
>> > +        (setq dired-details-initially-hide hide))
>> > +    (if hide (dired-details-hide)
>> > +      (dired-details-show))))
>> Use define-minor-mode.
> I think I disagree, and I feel more strongly about this point.
> The current behavior is what I like, and I'm not sure how using
> a minor mode would provide it.  This is the behavior:
>  Toggling affects only the current Dired buffer and subsequently
>  created Dired buffers.  It does not affect other existing Dired buffers.

I don't see why using define-minor-mode would prevent this behavior.

> A local minor mode would affect only the current Dired buffer and not
> subsequently created ones.  A global minor mode would affect all Dired
> buffers at the same time.

A local minor mode can change global defaults as well.

>> > +(defun dired-details-hide-overlay (o)
>> > +  (overlay-put o 'invisible t)
>> > +  (overlay-put o 'before-string dired-details-hidden-string))
>> Why use dired-details-hidden-string rather than just using the
>> traditional ellipsis with buffer-invisibility-spec?
> The first thing I did when getting dired-details.el was change the
> string to "", and I've never looked back.  In my use of it, hiding the
> details means showing nothing in their place.  And in the commentary
> of dired-details+.el I recommended that others do the same.

You could still get this result by changing buffer-invisibility-spec, so
it's not an objection.


        Stefan





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

* bug#6799: dired-details[+].el
  2012-05-16 22:57       ` bug#6799: dired-details[+].el Stefan Monnier
@ 2012-05-16 23:52         ` Drew Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2012-05-16 23:52 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: rob, rob.giardina, 6799, joakim

> I don't see why using define-minor-mode would prevent this behavior.

How, for example?  Or I can wait and see. ;-)  My main point here was to get the
behavior, not how to get it.  My limited use of `define-minor-mode' didn't
suggest to me how to do it.

> > A local minor mode would affect only the current Dired 
> > buffer and not subsequently created ones.  A global minor mode would 
> > affect all Dired buffers at the same time.
> 
> A local minor mode can change global defaults as well.

Ah, yes.  So we can have the same behavior with `define-minor-mode' - great.

> >> Why use dired-details-hidden-string rather than just using the
> >> traditional ellipsis with buffer-invisibility-spec?
> >
> > The first thing I did when getting dired-details.el was change the
> > string to "", and I've never looked back.  In my use of it, 
> > hiding the details means showing nothing in their place.  And in
> > the commentary of dired-details+.el I recommended that others do the same.
> 
> You could still get this result by changing 
> buffer-invisibility-spec, so it's not an objection.

To me, it's a cop-out to tell users to go fiddle with
`buffer-invisibility-spec'.

To me, the most Lisp-averse Emacs newbie should be able to easily get rid of the
useless `...'.  S?he (including I) should not have to go look up
`buffer-invisibility-spec' in the Elisp manual.  Or even have to scan a Dired
mode doc string to find something about how to use `buffer-invisibility-spec' to
get rid of it...

But maybe I'm misunderstanding your suggestion.

I say "useless" because I see no good reason why we should _ever_ show `...' for
this feature.  `...' indicates a particular position where something is elided,
but the same columns are elided from each row.  The position indicates nothing -
the column of repeated ellipses just constitutes noise and wastes space.

To me, it's just as clear, and simpler, for the toggle to simply remove those
columns, without replacing them by `...'.

To me.

Try it - and see if it isn't clear enough, and cleaner & simpler for users.






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

end of thread, other threads:[~2012-05-16 23:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-19  9:55 dired-details[+].el joakim
2009-07-19 14:34 ` dired-details[+].el Drew Adams
2012-05-16 15:24   ` dired-details[+].el Stefan Monnier
2012-05-16 16:10     ` dired-details[+].el Drew Adams
2012-05-16 22:57       ` bug#6799: dired-details[+].el Stefan Monnier
2012-05-16 23:52         ` Drew Adams

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.