unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
@ 2010-08-05 14:20 Drew Adams
  2011-01-28 23:08 ` Drew Adams
  0 siblings, 1 reply; 30+ messages in thread
From: Drew Adams @ 2010-08-05 14:20 UTC (permalink / raw)
  To: 6799; +Cc: 'Rob Giardina'

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-08-02 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags -Ic:/xpm/include'

---

Per Juanma's request, this is a another reminder to please add
`dired-details.el', with links to the threads that reference Rob Giardino's
patches.

--------------------------------------
> From: Juanma Barranquero   Sent: Thursday, August 05, 2010 3:19 AM
> To: help-gnu-emacs@gnu.org Subject: Re: A "smaller" dired
> 
> On Wed, Aug 4, 2010 at 17:50, Drew Adams wrote
>
> > [FWIW - This feature was OK'd for addition to vanilla Emacs 
> >  a few years ago, but no one has bothered to add it.
> >  The author of dired-details.el and myself tried
> >  several times to get past the inertia, but to no avail so far.]
> 
> A patch, or at least a reminder, to the bug list with a wishlist tag
> would help IMO.

--------------------------------------
> From: Drew Adams        Sent: Sunday, July 19, 2009 7:34 AM
> To: emacs-devel@gnu.org Subject: RE: dired-details[+].el
> 
> > 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] 30+ messages in thread

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2010-08-05 14:20 bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch] Drew Adams
@ 2011-01-28 23:08 ` Drew Adams
  2011-03-13  3:28   ` Juanma Barranquero
  0 siblings, 1 reply; 30+ messages in thread
From: Drew Adams @ 2011-01-28 23:08 UTC (permalink / raw)
  To: 6799

PING

This code has been agreed to since RMS was in charge, and it was made available
(integrated) by Rob Giardina - years ago.  What's the story?

> Per Juanma's request, this is a another reminder to please add
> `dired-details.el', with links to the threads that reference 
> Rob Giardino's patches.
> 
> > From: Juanma Barranquero   Sent: Thursday, August 05, 2010 3:19 AM
> > To: help-gnu-emacs@gnu.org Subject: Re: A "smaller" dired
> > 
> > > [FWIW - This feature was OK'd for addition to vanilla Emacs 
> > >  a few years ago, but no one has bothered to add it.
> > >  The author of dired-details.el and myself tried
> > >  several times to get past the inertia, but to no avail so far.]
> > 
> > A patch, or at least a reminder, to the bug list with a wishlist tag
> > would help IMO.






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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2011-01-28 23:08 ` Drew Adams
@ 2011-03-13  3:28   ` Juanma Barranquero
  2011-03-13 16:58     ` Drew Adams
  0 siblings, 1 reply; 30+ messages in thread
From: Juanma Barranquero @ 2011-03-13  3:28 UTC (permalink / raw)
  To: Drew Adams; +Cc: 6799

On Sat, Jan 29, 2011 at 00:08, Drew Adams <drew.adams@oracle.com> wrote:
> PING
>
> This code has been agreed to since RMS was in charge, and it was made available
> (integrated) by Rob Giardina - years ago.  What's the story?

Let's move this forward.

Which was the intention, adding dired-details.el, or patching dired.el
to add the functionality?

    Juanma





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2011-03-13  3:28   ` Juanma Barranquero
@ 2011-03-13 16:58     ` Drew Adams
  2012-04-12 19:10       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 30+ messages in thread
From: Drew Adams @ 2011-03-13 16:58 UTC (permalink / raw)
  To: 'Juanma Barranquero'; +Cc: 6799

> <drew.adams@oracle.com> wrote:
> > PING
> >
> > This code has been agreed to since RMS was in charge, and 
> > it was made available (integrated) by Rob Giardina - years ago.
> > What's the story?
> 
> Let's move this forward.
> 
> Which was the intention, adding dired-details.el, or patching dired.el
> to add the functionality?

Please contact Rob Giardina.  I believe that he patched the existing Dired code
(and some C code? and some other Lisp code?), doing everything that was needed.

Dunno what his current address is.  Here are some that have worked in the past:

rob <AT> razoo <DOT> com
rob <DOT> giardina <AT> gmail <DOT> com
rob <AT> giardina <DOT> us






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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2011-03-13 16:58     ` Drew Adams
@ 2012-04-12 19:10       ` Lars Magne Ingebrigtsen
  2012-04-12 20:05         ` Drew Adams
  0 siblings, 1 reply; 30+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-04-12 19:10 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Juanma Barranquero', 6799

"Drew Adams" <drew.adams@oracle.com> writes:

> Please contact Rob Giardina.  I believe that he patched the existing
> Dired code (and some C code? and some other Lisp code?), doing
> everything that was needed.
>
> Dunno what his current address is.  Here are some that have worked in
> the past:
>
> rob <AT> razoo <DOT> com
> rob <DOT> giardina <AT> gmail <DOT> com
> rob <AT> giardina <DOT> us

If you want this code included in Emacs, please assemble the patch and
post it here.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-04-12 19:10       ` Lars Magne Ingebrigtsen
@ 2012-04-12 20:05         ` Drew Adams
  2012-04-25 15:46           ` Rob Giardina
  0 siblings, 1 reply; 30+ messages in thread
From: Drew Adams @ 2012-04-12 20:05 UTC (permalink / raw)
  To: 'Lars Magne Ingebrigtsen'; +Cc: 'Juanma Barranquero', 6799, rob

As I have said several times now, ask Rob Giardina.  He made a whole set of
changes to various Emacs files, including perhaps C code.  I am not aware of
what changes he made. 

Rob has sent mail as recently as 2011/11/29 to emacs-orgmode@gnu.org.  His
address for that was rob@giardina.us.  (No, I do not subscribe to that mailing
list.  But I know how to use Google.)  Please contact Rob.

> > Please contact Rob Giardina.  I believe that he patched the existing
> > Dired code (and some C code? and some other Lisp code?), doing
> > everything that was needed.
> 
> If you want this code included in Emacs, please assemble the patch and
> post it here.

It is not a question of "if I want".  It was decided by RMS that this should be
included in Emacs.  Long, long ago.  Rob did the work required for this to
happen, but no one ever committed it, AFAIK.

What I use, personally, is dired-details.el plus dired-details+.el, and they
suffice.  But Rob went to the trouble of patching Emacs in various places,
integrating the features cleanly at a more basic level etc.

I have no idea what Rob's changes were, but if you search the mailing list
perhaps you can find references to them.  Rob refers to a patch for 2005-07-07
CVS, here:
http://comments.gmane.org/gmane.emacs.devel/74172

Here is the last mail from Rob on the subject, AFAIK:
http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00215.html

Here is my last mail on the subject, with relevant links: 

> From: Drew Adams Sent: Sunday, July 19, 2009 7:34 AM
> > 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] 30+ messages in thread

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-04-12 20:05         ` Drew Adams
@ 2012-04-25 15:46           ` Rob Giardina
  2012-07-21 20:12             ` Drew Adams
  0 siblings, 1 reply; 30+ messages in thread
From: Rob Giardina @ 2012-04-25 15:46 UTC (permalink / raw)
  To: Drew Adams; +Cc: Juanma Barranquero, Lars Magne Ingebrigtsen, 6799

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

Thanks for remembering this patch Drew. I did work with RMS a long way
back but it fell by the wayside in the last phases.

The patch is just elisp and doc, no C. The changes are pretty simple
and contain all the community enhancements added later
(dired-details+).

Basically, it adds some bindings to a few functions that will loop
over the dired file listing lines to add invisibile overlays to the
messiest parts of the lines. Pretty self-contained.

It would have to be re-tested at this point. I've attached the old
ones if it will help decide if you want the feature. I can test some
fresh patches on HEAD in the next few weeks when my biz/personal life
calms a bit.

Regards,
Rob

On Thu, Apr 12, 2012 at 4:05 PM, Drew Adams <drew.adams@oracle.com> wrote:
>
> As I have said several times now, ask Rob Giardina.  He made a whole set of
> changes to various Emacs files, including perhaps C code.  I am not aware of
> what changes he made.
>
> Rob has sent mail as recently as 2011/11/29 to emacs-orgmode@gnu.org.  His
> address for that was rob@giardina.us.  (No, I do not subscribe to that mailing
> list.  But I know how to use Google.)  Please contact Rob.
>
> > > Please contact Rob Giardina.  I believe that he patched the existing
> > > Dired code (and some C code? and some other Lisp code?), doing
> > > everything that was needed.
> >
> > If you want this code included in Emacs, please assemble the patch and
> > post it here.
>
> It is not a question of "if I want".  It was decided by RMS that this should be
> included in Emacs.  Long, long ago.  Rob did the work required for this to
> happen, but no one ever committed it, AFAIK.
>
> What I use, personally, is dired-details.el plus dired-details+.el, and they
> suffice.  But Rob went to the trouble of patching Emacs in various places,
> integrating the features cleanly at a more basic level etc.
>
> I have no idea what Rob's changes were, but if you search the mailing list
> perhaps you can find references to them.  Rob refers to a patch for 2005-07-07
> CVS, here:
> http://comments.gmane.org/gmane.emacs.devel/74172
>
> Here is the last mail from Rob on the subject, AFAIK:
> http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00215.html
>
> Here is my last mail on the subject, with relevant links:
>
> > From: Drew Adams Sent: Sunday, July 19, 2009 7:34 AM
> > > 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
>

[-- Attachment #2: dired-x.el.patch --]
[-- Type: application/octet-stream, Size: 699 bytes --]

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

[-- Attachment #3: dired.el.patch --]
[-- Type: application/octet-stream, Size: 8133 bytes --]

*** old/dired.el	Sun Jul 15 15:42:33 2007
--- new/dired.el	Sun Jul 15 21:19:44 2007
***************
*** 1042,1047 ****
--- 1042,1048 ----
      (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,1247 ****
--- 1243,1251 ----
      (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,3339 ****
--- 3338,3508 ----
  	     '(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"))
  

[-- Attachment #4: dired.texi.patch --]
[-- Type: application/octet-stream, Size: 2171 bytes --]

*** old/dired.texi	Sun Jul 15 18:00:22 2007
--- new/dired.texi	Sun Jul 15 18:00:10 2007
***************
*** 41,46 ****
--- 41,47 ----
  @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,1016 ****
--- 1012,1056 ----
  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] 30+ messages in thread

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-04-25 15:46           ` Rob Giardina
@ 2012-07-21 20:12             ` Drew Adams
  2012-12-15 21:15               ` Christopher Schmidt
  0 siblings, 1 reply; 30+ messages in thread
From: Drew Adams @ 2012-07-21 20:12 UTC (permalink / raw)
  To: 'Rob Giardina'
  Cc: 'Juanma Barranquero', 'Lars Magne Ingebrigtsen',
	6799

ping.

Still hoping, after all these years...

The replies from Emacs Dev have varied from gee-we-don't-know-how-to-find-Rob
(even though he has replied to this bug list and his email address works) to
gee-we-don't-know-whether-he-has-signed-papers (even though he has replied here
indicating that he has).

What's the problem?

(Again, this is for Emacs, not for me.  I am content with loading
dired-details(+).el for my own use.  But it's a shame that Emacs users do not
have this great feature as part of Emacs.)


> From: rob.giardina@gmail.com [mailto:rob.giardina@gmail.com] 
> Sent: Wednesday, April 25, 2012 8:47 AM
> 
> Thanks for remembering this patch Drew. I did work with RMS a long way
> back but it fell by the wayside in the last phases.
> 
> The patch is just elisp and doc, no C. The changes are pretty simple
> and contain all the community enhancements added later
> (dired-details+).
> 
> Basically, it adds some bindings to a few functions that will loop
> over the dired file listing lines to add invisibile overlays to the
> messiest parts of the lines. Pretty self-contained.
> 
> It would have to be re-tested at this point. I've attached the old
> ones if it will help decide if you want the feature. I can test some
> fresh patches on HEAD in the next few weeks when my biz/personal life
> calms a bit.
> 
> Regards,
> Rob
> 
> On Thu, Apr 12, 2012 at 4:05 PM, Drew Adams 
> <drew.adams@oracle.com> wrote:
> >
> > As I have said several times now, ask Rob Giardina.  He 
> > made a whole set of changes to various Emacs files,
> > including perhaps C code.  I am not aware of
> > what changes he made.
> >
> > Rob has sent mail as recently as 2011/11/29 to 
> > emacs-orgmode@gnu.org.  His address for that was
> > rob@giardina.us.  (No, I do not subscribe to that mailing
> > list.  But I know how to use Google.)  Please contact Rob.
> >
> > > > Please contact Rob Giardina.  I believe that he patched 
> > > > the existing
> > > > Dired code (and some C code? and some other Lisp code?), doing
> > > > everything that was needed.
> > >
> > > If you want this code included in Emacs, please assemble 
> > > the patch and post it here.
> >
> > It is not a question of "if I want".  It was decided by RMS 
> > that this should be included in Emacs.  Long, long ago.
> > Rob did the work required for this to
> > happen, but no one ever committed it, AFAIK.
> >
> > What I use, personally, is dired-details.el plus 
> > dired-details+.el, and they
> > suffice.  But Rob went to the trouble of patching Emacs in 
> > various places,
> > integrating the features cleanly at a more basic level etc.
> >
> > I have no idea what Rob's changes were, but if you search 
> > the mailing list
> > perhaps you can find references to them.  Rob refers to a 
> > patch for 2005-07-07
> > CVS, here:
> > http://comments.gmane.org/gmane.emacs.devel/74172
> >
> > Here is the last mail from Rob on the subject, AFAIK:
> > http://lists.gnu.org/archive/html/emacs-devel/2007-07/msg00215.html
> >
> > Here is my last mail on the subject, with relevant links:
> >
> > > From: Drew Adams Sent: Sunday, July 19, 2009 7:34 AM
> > > > 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] 30+ messages in thread

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-07-21 20:12             ` Drew Adams
@ 2012-12-15 21:15               ` Christopher Schmidt
  2012-12-15 22:17                 ` Christopher Schmidt
  0 siblings, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2012-12-15 21:15 UTC (permalink / raw)
  To: 6799; +Cc: Michael Heerdegen

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

"Drew Adams" <drew.adams@oracle.com> writes:
> ping.
>
> Still hoping, after all these years...
>
> The replies from Emacs Dev have varied from
> gee-we-don't-know-how-to-find-Rob (even though he has replied to this
> bug list and his email address works) to
> gee-we-don't-know-whether-he-has-signed-papers (even though he has
> replied here indicating that he has).
>
> What's the problem?
>
> (Again, this is for Emacs, not for me.  I am content with loading
> dired-details(+).el for my own use.  But it's a shame that Emacs users
> do not have this great feature as part of Emacs.)

Here is my attempt.

[-- Attachment #2: my-dired-hide-details-mode.el --]
[-- Type: application/emacs-lisp, Size: 2706 bytes --]

[-- Attachment #3: Type: text/plain, Size: 908 bytes --]


Usage:

    (progn
      (require 'cl-lib)
      (require 'dired)
      (require 'my-dired-hide-details-mode))

Press `(' in any dired buffer to toggle details.

Other than dired-details by Rob this implementation does not use
overlays but text properties which is a lot faster.

I just wrote this a few minutes ago but the code seems to work fine with
dired, wdired and find-dired.

If there is interest, I can polish the code, add documentation and
customisation options and come up with a full patch for the trunk.  I
think, due to the way my-dired-hide-details-mode is designed, it would
be best to add the code directly to dired.el - that is

    add new code to dired-insert-set-properties
    add new minor mode dired-hide-details-mode
    bind dired-hide-details-mode in dired-mode-map

It would be necessary to fix a few bugs find-dired as well.  Nothing
fancy, though.

WDYT?

        Christopher

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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-12-15 21:15               ` Christopher Schmidt
@ 2012-12-15 22:17                 ` Christopher Schmidt
  2012-12-16 22:31                   ` Stefan Monnier
  0 siblings, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2012-12-15 22:17 UTC (permalink / raw)
  To: 6799; +Cc: Michael Heerdegen

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

Christopher Schmidt <christopher@ch.ristopher.com> writes:
> Here is my attempt.

Here is a better one.

[-- Attachment #2: my-dired-hide-details-mode.el --]
[-- Type: application/emacs-lisp, Size: 2636 bytes --]

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


        Christopher

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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-12-15 22:17                 ` Christopher Schmidt
@ 2012-12-16 22:31                   ` Stefan Monnier
  2012-12-17 13:24                     ` Christopher Schmidt
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Monnier @ 2012-12-16 22:31 UTC (permalink / raw)
  To: 6799; +Cc: Michael Heerdegen

>   (save-restriction
>     (widen)

Please add a comment explaining why widening should be used here.

> 		 do (let ((buffer-read-only))
> 		      (put-text-property (point) end
> 					 'invisible my-dired-hide-details-mode))

Better bind inhibit-read-only to t.  Or better yet, use
with-silent-modifications (but move it outside the loop).

Also, rather than set the invisible property to nil or t, better set it
to another symbol (e.g. `dired-details'), whose meaning is then
controlled by add-to-invisibility-spec.

> (defadvice dired-insert-set-properties
>   (after my-add-hide-props (beg end) activate)

Obviously, this would have to be turned into a patch, and since it's not
small, it would need to be moved to its own function (which would be
called from dired-insert-set-properties).

> (defadvice find-dired (after my-fix-move-process-mark-to-arg activate)
>   (move-marker (process-mark (get-buffer-process (current-buffer)))
> 	       (save-excursion
> 		 (goto-char (point-min))
> 		 (forward-line 1)
> 		 (point))))

How is that related to dired-details?


        Stefan





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-12-16 22:31                   ` Stefan Monnier
@ 2012-12-17 13:24                     ` Christopher Schmidt
  2013-02-10 15:02                       ` Christopher Schmidt
  0 siblings, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2012-12-17 13:24 UTC (permalink / raw)
  To: 6799; +Cc: Michael Heerdegen

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

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

thanks for your input.  Here is a preliminary patch for the trunk.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dired-dired-hide-details-mode.diff --]
[-- Type: text/x-diff, Size: 3479 bytes --]

--- lisp/dired.el
+++ lisp/dired.el
@@ -230,6 +230,12 @@
   :version "22.1"
   :group 'dired)
 
+(defcustom dired-hide-details-hide-symlink-targets t
+  "If non-nil, `dired-hide-details-mode' hides symbolic link targets."
+  :type 'boolean
+  :version "24.4"
+  :group 'dired)
+
 ;; Internal variables
 
 (defvar dired-marker-char ?*		; the answer is 42
@@ -1222,15 +1228,22 @@
     (goto-char beg)
     (while (< (point) end)
       (condition-case nil
-	  (if (dired-move-to-filename)
-	      (add-text-properties
-	       (point)
-	       (save-excursion
-		 (dired-move-to-end-of-filename)
-		 (point))
-	       '(mouse-face highlight
-		 dired-filename t
-		 help-echo "mouse-2: visit this file in other window")))
+	  (when (dired-move-to-filename)
+	    (put-text-property (+ (line-beginning-position) 2) (point)
+			       'invisible 'dired-detail)
+	    (add-text-properties
+	     (point)
+	     (progn
+	       (dired-move-to-end-of-filename)
+	       (point))
+	     '(mouse-face
+	       highlight
+	       dired-filename t
+	       help-echo "mouse-2: visit this file in other window"))
+	    (when (and dired-hide-details-hide-symlink-targets
+		       (< (+ (point) 4) (line-end-position)))
+	      (put-text-property (+ (point) 4) (line-end-position)
+				 'invisible 'dired-detail)))
 	(error nil))
       (forward-line 1))))
 \f
@@ -1494,6 +1507,7 @@
     ;; hiding
     (define-key map "$" 'dired-hide-subdir)
     (define-key map "\M-$" 'dired-hide-all)
+    (define-key map "(" 'dired-hide-details-mode)
     ;; isearch
     (define-key map (kbd "M-s a C-s")   'dired-do-isearch)
     (define-key map (kbd "M-s a M-C-s") 'dired-do-isearch-regexp)
@@ -1584,6 +1598,14 @@
       '(menu-item "Toggle Image Thumbnails in This Buffer" image-dired-dired-toggle-marked-thumbs
                   :help "Add or remove image thumbnails in front of marked file names"))
 
+    (define-key map [menu-bar immediate unhide-details]
+      '(menu-item "UnHide Details" dired-hide-details-mode
+		  :help "Unhide details in buffer"
+		  :visible dired-hide-details-mode))
+    (define-key map [menu-bar immediate hide-details]
+      '(menu-item "Hide Details" dired-hide-details-mode
+		  :help "Hide details in buffer"
+		  :visible (not dired-hide-details-mode)))
     (define-key map [menu-bar immediate revert-buffer]
       '(menu-item "Refresh" revert-buffer
 		  :help "Update contents of shown directories"))
@@ -1912,6 +1934,9 @@
 	selective-display t		; for subdirectory hiding
 	mode-line-buffer-identification
 	(propertized-buffer-identification "%17b"))
+  ;; ignore dired-detail value of invisible text property by default
+  (when (eq buffer-invisibility-spec t)
+    (setq buffer-invisibility-spec (list t)))
   (set (make-local-variable 'revert-buffer-function)
        (function dired-revert))
   (set (make-local-variable 'buffer-stale-function)
@@ -2228,6 +2253,20 @@
       (substring file (match-end 0))
     file))
 \f
+;;; Minor mode for hiding details
+;;;###autoload
+(define-minor-mode dired-hide-details-mode
+  "Hide details in `dired-mode'."
+  :group 'dired
+  (unless (derived-mode-p 'dired-mode)
+    (error "Not a Dired buffer"))
+  (funcall (if dired-hide-details-mode
+	       'add-to-invisibility-spec
+	     'remove-from-invisibility-spec)
+	   'dired-detail))
+
+(put 'dired-hide-details-mode 'safe-local-variable 'booleanp)
+\f
 ;;; Functions for finding the file name in a dired buffer line.
 
 (defvar dired-permission-flags-regexp

[-- Attachment #3: Type: text/plain, Size: 2680 bytes --]


I would love to hear your feedback.

>>   (save-restriction
>>     (widen)
>
> Please add a comment explaining why widening should be used here.

Widening is not necessary any more.

>>               do (let ((buffer-read-only))
>>                    (put-text-property (point) end
>>                                       'invisible my-dired-hide-details-mode))
>
> Better bind inhibit-read-only to t.  Or better yet, use
> with-silent-modifications (but move it outside the loop).
>
> Also, rather than set the invisible property to nil or t, better set
> it to another symbol (e.g. `dired-details'), whose meaning is then
> controlled by add-to-invisibility-spec.

Right.  Obviously this simplifies the implementation.

>> (defadvice dired-insert-set-properties
>>   (after my-add-hide-props (beg end) activate)
>
> Obviously, this would have to be turned into a patch, and since it's
> not small, it would need to be moved to its own function (which would
> be called from dired-insert-set-properties).

Check the new patch.  Altogether 7 new lines are added to
dired-insert-set-properties.

>> (defadvice find-dired (after my-fix-move-process-mark-to-arg activate)
>>   (move-marker (process-mark (get-buffer-process (current-buffer)))
>>             (save-excursion
>>               (goto-char (point-min))
>>               (forward-line 1)
>>               (point))))
>
> How is that related to dired-details?

This is not necessary any more.

My former implementation hid every non-file line that
dired-insert-set-properties is called upon.  Vanilla dired calls
dired-insert-set-properties on every line except the directory
headerline so my-dired-hide-details-mode hid the information line.

    total used in directory RMS available VI

Initially find-dired inserts the directory headerline, newline and the
find arguments and set the process mark is set to 1.

In the process filter of find find-dired evals

    (dired-insert-set-properties (process-mark proc)
                                 (1+ (point)))
    (move-marker (process-mark proc) (1+ (point)))

with (point) being right before the end of the last complete line added
by find.

That is dired-insert-set-properties is called on the first and second
line so my former code added the invisible property to the directory
headerline as well.  This is why I added that advice - just move the
process mark to the second line so dired-insert-set-properties is not
called on the directory headerline.

I removed the hiding of non-file lines.  Hiding full lines via text
properties might cause confusion when it comes to interactive line
movement.  There are no changed to find-dired.el now.

        Christopher

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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2012-12-17 13:24                     ` Christopher Schmidt
@ 2013-02-10 15:02                       ` Christopher Schmidt
  2013-02-10 15:08                         ` Christopher Schmidt
  2013-02-11  3:37                         ` Stefan Monnier
  0 siblings, 2 replies; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-10 15:02 UTC (permalink / raw)
  To: 6799

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

Christopher Schmidt <christopher@ch.ristopher.com> writes:
> Here is a preliminary patch for the trunk.

Here is the final patch.  Drew Adams and Michael Heerdegen tested it and
did not find any problems.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 10351 bytes --]

--- lisp/ChangeLog
+++ lisp/ChangeLog
@@ -1,5 +1,25 @@
 2013-02-10  Christopher Schmidt  <christopher@ch.ristopher.com>
 
+	* locate.el (locate-mode-map): Disable dired-hide-details-mode.
+
+	* find-dired.el (find-dired): Call dired-insert-set-properties on
+	initial information line.  Set process mark on end of buffer.
+	(find-dired-sentinel): Call dired-insert-set-properties on
+	summary.
+
+	* dired.el (dired-hide-details-hide-symlink-targets)
+	(dired-hide-details-hide-information-lines): New options.
+	(dired-insert-directory): Set properties after final treatment of
+	output.
+	(dired-insert-set-properties): Set dired-hide-details-*
+	properties.
+	(dired-mode-map): Bind dired-hide-details-mode.
+	(dired-mode): Set buffer-invisibility-spec to a list.
+	(dired-next-line): Skip hidden lines.
+	(dired-previous-line): Use dired-next-line.
+	(dired-hide-details-mode): New minor mode.
+	(dired-hide-details-update-invisibility-spec): New function.
+
 	* minibuf-eldef.el (minibuffer-default--in-prompt-regexps): Handle
 	"foo (bar, default: xxx): " prompts.
 
--- lisp/dired.el
+++ lisp/dired.el
@@ -230,6 +230,18 @@
   :version "22.1"
   :group 'dired)
 
+(defcustom dired-hide-details-hide-symlink-targets t
+  "If non-nil, `dired-hide-details-mode' hides symbolic link targets."
+  :type 'boolean
+  :version "24.4"
+  :group 'dired)
+
+(defcustom dired-hide-details-hide-information-lines t
+  "Non-nil means hide lines other than header and file/dir lines."
+  :type 'boolean
+  :version "24.4"
+  :group 'dired)
+
 ;; Internal variables
 
 (defvar dired-marker-char ?*		; the answer is 42
@@ -1196,7 +1208,6 @@
       ;; Note: adjust dired-build-subdir-alist if you change this.
       (setq dir (replace-regexp-in-string "\\\\" "\\\\" dir nil t)
             dir (replace-regexp-in-string "\n" "\\n" dir nil t)))
-    (dired-insert-set-properties opoint (point))
     ;; If we used --dired and it worked, the lines are already indented.
     ;; Otherwise, indent them.
     (unless (save-excursion
@@ -1205,18 +1216,21 @@
       (let ((indent-tabs-mode nil))
 	(indent-rigidly opoint (point) 2)))
     ;; Insert text at the beginning to standardize things.
-    (save-excursion
-      (goto-char opoint)
-      (if (and (or hdr wildcard)
-               (not (and (looking-at "^  \\(.*\\):$")
-                         (file-name-absolute-p (match-string 1)))))
+    (let ((content-point opoint))
+      (save-excursion
+	(goto-char opoint)
+	(when (and (or hdr wildcard)
+		   (not (and (looking-at "^  \\(.*\\):$")
+			     (file-name-absolute-p (match-string 1)))))
 	  ;; Note that dired-build-subdir-alist will replace the name
 	  ;; by its expansion, so it does not matter whether what we insert
 	  ;; here is fully expanded, but it should be absolute.
-	  (insert "  " (directory-file-name (file-name-directory dir)) ":\n"))
-      (when wildcard
-	;; Insert "wildcard" line where "total" line would be for a full dir.
-	(insert "  wildcard " (file-name-nondirectory dir) "\n")))))
+	  (insert "  " (directory-file-name (file-name-directory dir)) ":\n")
+	  (setq content-point (point)))
+	(when wildcard
+	  ;; Insert "wildcard" line where "total" line would be for a full dir.
+	  (insert "  wildcard " (file-name-nondirectory dir) "\n")))
+      (dired-insert-set-properties content-point (point)))))
 
 (defun dired-insert-set-properties (beg end)
   "Add various text properties to the lines in the region."
@@ -1224,15 +1238,24 @@
     (goto-char beg)
     (while (< (point) end)
       (condition-case nil
-	  (if (dired-move-to-filename)
-	      (add-text-properties
-	       (point)
-	       (save-excursion
-		 (dired-move-to-end-of-filename)
-		 (point))
-	       '(mouse-face highlight
-		 dired-filename t
-		 help-echo "mouse-2: visit this file in other window")))
+	  (if (not (dired-move-to-filename))
+	      (put-text-property (line-beginning-position)
+				 (1+ (line-end-position))
+				 'invisible 'dired-hide-details-information)
+	    (put-text-property (+ (line-beginning-position) 1) (1- (point))
+			       'invisible 'dired-hide-details-detail)
+	    (add-text-properties
+	     (point)
+	     (progn
+	       (dired-move-to-end-of-filename)
+	       (point))
+	     '(mouse-face
+	       highlight
+	       dired-filename t
+	       help-echo "mouse-2: visit this file in other window"))
+	    (when (< (+ (point) 4) (line-end-position))
+	      (put-text-property (+ (point) 4) (line-end-position)
+				 'invisible 'dired-hide-details-link)))
 	(error nil))
       (forward-line 1))))
 \f
@@ -1496,6 +1519,7 @@
     ;; hiding
     (define-key map "$" 'dired-hide-subdir)
     (define-key map "\M-$" 'dired-hide-all)
+    (define-key map "(" 'dired-hide-details-mode)
     ;; isearch
     (define-key map (kbd "M-s a C-s")   'dired-do-isearch)
     (define-key map (kbd "M-s a M-C-s") 'dired-do-isearch-regexp)
@@ -1586,6 +1610,14 @@
       '(menu-item "Toggle Image Thumbnails in This Buffer" image-dired-dired-toggle-marked-thumbs
                   :help "Add or remove image thumbnails in front of marked file names"))
 
+    (define-key map [menu-bar immediate unhide-details]
+      '(menu-item "UnHide Details" dired-hide-details-mode
+		  :help "Unhide details in buffer"
+		  :visible dired-hide-details-mode))
+    (define-key map [menu-bar immediate hide-details]
+      '(menu-item "Hide Details" dired-hide-details-mode
+		  :help "Hide details in buffer"
+		  :visible (not dired-hide-details-mode)))
     (define-key map [menu-bar immediate revert-buffer]
       '(menu-item "Refresh" revert-buffer
 		  :help "Update contents of shown directories"))
@@ -1914,6 +1946,9 @@
 	selective-display t		; for subdirectory hiding
 	mode-line-buffer-identification
 	(propertized-buffer-identification "%17b"))
+  ;; ignore dired-hide-details-* value of invisible text property by default
+  (when (eq buffer-invisibility-spec t)
+    (setq buffer-invisibility-spec (list t)))
   (set (make-local-variable 'revert-buffer-function)
        (function dired-revert))
   (set (make-local-variable 'buffer-stale-function)
@@ -1978,15 +2013,32 @@
   "Move down lines then position at filename.
 Optional prefix ARG says how many lines to move; default is one line."
   (interactive "p")
+  (unless arg
+    (setq arg 1))
   (forward-line arg)
+  (while (and (progn
+		(while (and (< arg 0)
+			    (bolp)
+			    (/= (1+ (point)) (point-max))
+			    (eq (get-text-property (1+ (point)) 'invisible)
+				'dired-hide-details-information))
+		  (forward-char -1))
+		(invisible-p (point)))
+	      (let ((p (funcall (if (> arg 0)
+				    'next-single-property-change
+				  'previous-single-property-change)
+				(point)
+				'invisible)))
+		(when p
+		  (goto-char p)
+		  t))))
   (dired-move-to-filename))
 
-(defun dired-previous-line (arg)
+(defun dired-previous-linel (arg)
   "Move up lines then position at filename.
 Optional prefix ARG says how many lines to move; default is one line."
   (interactive "p")
-  (forward-line (- arg))
-  (dired-move-to-filename))
+  (dired-next-line (- (or arg 1))))
 
 (defun dired-next-dirline (arg &optional opoint)
   "Goto ARG'th next directory file line."
@@ -2230,6 +2282,42 @@
       (substring file (match-end 0))
     file))
 \f
+;;; Minor mode for hiding details
+;;;###autoload
+(define-minor-mode dired-hide-details-mode
+  "Hide details in `dired-mode'."
+  :group 'dired
+  (if (derived-mode-p 'locate-mode)
+      (setq dired-hide-details-mode nil)
+    (unless (derived-mode-p 'dired-mode)
+      (error "Not a Dired buffer"))
+    (dired-hide-details-update-invisibility-spec)
+    (if dired-hide-details-mode
+	(add-hook 'wdired-mode-hook
+		  'dired-hide-details-update-invisibility-spec
+		  nil
+		  t)
+      (remove-hook 'wdired-mode-hook
+		   'dired-hide-details-update-invisibility-spec
+		   t))))
+
+(defun dired-hide-details-update-invisibility-spec ()
+  (funcall (if dired-hide-details-mode
+	       'add-to-invisibility-spec
+	     'remove-from-invisibility-spec)
+	   'dired-hide-details-detail)
+  (funcall (if (and dired-hide-details-mode
+		    dired-hide-details-hide-information-lines)
+	       'add-to-invisibility-spec
+	     'remove-from-invisibility-spec)
+	   'dired-hide-details-information)
+  (funcall (if (and dired-hide-details-mode
+		    dired-hide-details-hide-symlink-targets
+		    (not (derived-mode-p 'wdired-mode)))
+	       'add-to-invisibility-spec
+	     'remove-from-invisibility-spec)
+	   'dired-hide-details-link))
+\f
 ;;; Functions for finding the file name in a dired buffer line.
 
 (defvar dired-permission-flags-regexp
--- lisp/find-dired.el
+++ lisp/find-dired.el
@@ -210,13 +210,15 @@
     (insert "  " dir ":\n")
     ;; Make second line a ``find'' line in analogy to the ``total'' or
     ;; ``wildcard'' line.
-    (insert "  " args "\n")
+    (let ((point (point)))
+      (insert "  " args "\n")
+      (dired-insert-set-properties point (point)))
     (setq buffer-read-only t)
     (let ((proc (get-buffer-process (current-buffer))))
       (set-process-filter proc (function find-dired-filter))
       (set-process-sentinel proc (function find-dired-sentinel))
       ;; Initialize the process marker; it is used by the filter.
-      (move-marker (process-mark proc) 1 (current-buffer)))
+      (move-marker (process-mark proc) (point) (current-buffer)))
     (setq mode-line-process '(":%s"))))
 
 (defun kill-find ()
@@ -337,10 +339,11 @@
 	  (let ((buffer-read-only nil))
 	    (save-excursion
 	      (goto-char (point-max))
-	      (insert "\n  find " state)
-	      (forward-char -1)		;Back up before \n at end of STATE.
-	      (insert " at " (substring (current-time-string) 0 19))
-	      (forward-char 1)
+	      (let ((point (point)))
+		(insert "\n  find " state)
+		(forward-char -1)		;Back up before \n at end of STATE.
+		(insert " at " (substring (current-time-string) 0 19))
+		(dired-insert-set-properties point (point)))
 	      (setq mode-line-process
 		    (concat ":"
 			    (symbol-name (process-status proc))))
--- lisp/locate.el
+++ lisp/locate.el
@@ -382,6 +382,7 @@
     (define-key map "l"       'locate-do-redisplay)
     (define-key map "U"       'dired-unmark-all-files)
     (define-key map "V"       'locate-find-directory)
+    (define-key map [remap dired-hide-details-mode] nil)
     map)
   "Local keymap for Locate mode buffers.")
 

[-- Attachment #3: Type: text/plain, Size: 108 bytes --]


Should the key bindings and definition of dired-hide-details-mode go
into dired-x.el?

        Christopher

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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-10 15:02                       ` Christopher Schmidt
@ 2013-02-10 15:08                         ` Christopher Schmidt
  2013-02-11  3:37                         ` Stefan Monnier
  1 sibling, 0 replies; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-10 15:08 UTC (permalink / raw)
  To: 6799

Christopher Schmidt <christopher@ch.ristopher.com> writes:
> -(defun dired-previous-line (arg)
> +(defun dired-previous-linel (arg)

That's a typo.

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-10 15:02                       ` Christopher Schmidt
  2013-02-10 15:08                         ` Christopher Schmidt
@ 2013-02-11  3:37                         ` Stefan Monnier
  2013-02-11  8:19                           ` Christopher Schmidt
  1 sibling, 1 reply; 30+ messages in thread
From: Stefan Monnier @ 2013-02-11  3:37 UTC (permalink / raw)
  To: 6799

> Here is the final patch.  Drew Adams and Michael Heerdegen tested it and
> did not find any problems.

Thanks.  A few nitpicks and comments below.

> +  ;; ignore dired-hide-details-* value of invisible text property by default
> +  (when (eq buffer-invisibility-spec t)
> +    (setq buffer-invisibility-spec (list t)))

Please capitalize and punctuate your comments.

>    (forward-line arg)
> +  (while (and (progn
> +		(while (and (< arg 0)
> +			    (bolp)
> +			    (/= (1+ (point)) (point-max))
> +			    (eq (get-text-property (1+ (point)) 'invisible)
> +				'dired-hide-details-information))
> +		  (forward-char -1))
> +		(invisible-p (point)))
> +	      (let ((p (funcall (if (> arg 0)
> +				    'next-single-property-change
> +				  'previous-single-property-change)
> +				(point)
> +				'invisible)))
> +		(when p
> +		  (goto-char p)
> +		  t))))
>    (dired-move-to-filename))

What is this for?

> +  (if (derived-mode-p 'locate-mode)
> +      (setq dired-hide-details-mode nil)

Could you explain why locate-mode needs such special treatment (here and
in locate-mode-map)?  I'm mostly worried here that maybe some other mode
might require similar treatment.


        Stefan





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11  3:37                         ` Stefan Monnier
@ 2013-02-11  8:19                           ` Christopher Schmidt
  2013-02-11 14:25                             ` Stefan Monnier
  0 siblings, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-11  8:19 UTC (permalink / raw)
  To: 6799

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>    (forward-line arg)
>> +  (while (and (progn
>> +		(while (and (< arg 0)
>> +			    (bolp)
>> +			    (/= (1+ (point)) (point-max))
>> +			    (eq (get-text-property (1+ (point)) 'invisible)
>> +				'dired-hide-details-information))
>> +		  (forward-char -1))
>> +		(invisible-p (point)))
>> +	      (let ((p (funcall (if (> arg 0)
>> +				    'next-single-property-change
>> +				  'previous-single-property-change)
>> +				(point)
>> +				'invisible)))
>> +		(when p
>> +		  (goto-char p)
>> +		  t))))
>>    (dired-move-to-filename))
>
> What is this for?

dired-(next|previous)-line use (forward|backward)-line for point
movement.  These functions ignore hidden lines and subsequent point
movement by the editing loop does not do the right thing when point
moves backwards over a hidden line.

    (defvar use-case 0)

    (with-selected-window
        (or (get-buffer-window "*moose*")
            (progn
              (split-window-below)))
      (switch-to-buffer (get-buffer-create "*moose*"))
      (erase-buffer)

      (insert "Header\n"
              (propertize "Hidden\n" 'invisible t)
              "Stuff")

      (cl-ecase use-case
        (0
         (goto-char (point-min))
         (forward-line 1))
        (1
         (goto-char (point-max))
         (forward-line -1))
        (2
         (goto-char (point-min))
         (next-line 1))
        (3
         (goto-char (point-max))
         (next-line -1)))
      (prog1 use-case
        (setq use-case (% (1+ use-case) 4))))

Put that in scratch, eval the first form, eval the second form four
times in a row.  Use case 1 does not work.  The change you cited tries
to work around this problem in dired.

I do not know whether dired-(next|previous)-line should use
(next|previous)-line with nil-bound line-move-visual.  AFAICT
(next|previous)-line do not do the right thing either.

>> +  (if (derived-mode-p 'locate-mode)
>> +      (setq dired-hide-details-mode nil)
>
> Could you explain why locate-mode needs such special treatment (here
> and in locate-mode-map)?  I'm mostly worried here that maybe some
> other mode might require similar treatment.

The buffer generated by M-x locate RET does not contain any "details" to
hide.  dired-hide-details-mode would be a no-op there.

Locate buffers are not real dired buffer.  locate-mode is an independent
major mode whose keymap derives from dired-mode-map.  locate runs
dired-mode-hook despite the current buffer not being derived from
dired-mode.

I think ignoring locate is better than complaining that
dired-hide-details-mode is enabled in a buffer that is not derived from
dired-mode.

I am not aware of any other mode that behaves that way.

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11  8:19                           ` Christopher Schmidt
@ 2013-02-11 14:25                             ` Stefan Monnier
  2013-02-11 16:08                               ` Christopher Schmidt
  0 siblings, 1 reply; 30+ messages in thread
From: Stefan Monnier @ 2013-02-11 14:25 UTC (permalink / raw)
  To: 6799

> dired-(next|previous)-line use (forward|backward)-line for point
> movement.  These functions ignore hidden lines and subsequent point
> movement by the editing loop does not do the right thing when point
> moves backwards over a hidden line.

Thanks.  Then the code needs a clear comment about it, citing the
specific concrete case that it's trying to fix.

>     (defvar use-case 0)

>     (with-selected-window
>         (or (get-buffer-window "*moose*")
>             (progn
>               (split-window-below)))
>       (switch-to-buffer (get-buffer-create "*moose*"))
>       (erase-buffer)

>       (insert "Header\n"
>               (propertize "Hidden\n" 'invisible t)
>               "Stuff")

>       (cl-ecase use-case
>         (0
>          (goto-char (point-min))
>          (forward-line 1))
>         (1
>          (goto-char (point-max))
>          (forward-line -1))
>         (2
>          (goto-char (point-min))
>          (next-line 1))
>         (3
>          (goto-char (point-max))
>          (next-line -1)))
>       (prog1 use-case
>         (setq use-case (% (1+ use-case) 4))))

> Put that in scratch, eval the first form, eval the second form four
> times in a row.  Use case 1 does not work.  The change you cited tries
> to work around this problem in dired.

I'm not sure what this shows: I get a buffer with two visible lines
("Header" and "Stuff"); case 0 moves point to just before "Stuff" and so
does case 1, and both seem right to my understanding of the code
you provided.

> I do not know whether dired-(next|previous)-line should use
> (next|previous)-line with nil-bound line-move-visual.  AFAICT
> (next|previous)-line do not do the right thing either.
>>> +  (if (derived-mode-p 'locate-mode)
>>> +      (setq dired-hide-details-mode nil)
>> Could you explain why locate-mode needs such special treatment (here
>> and in locate-mode-map)?  I'm mostly worried here that maybe some
>> other mode might require similar treatment.
> The buffer generated by M-x locate RET does not contain any "details" to
> hide.  dired-hide-details-mode would be a no-op there.

A no-op doesn't sound like a bad thing.

> Locate buffers are not real dired buffer.  locate-mode is an independent
> major mode whose keymap derives from dired-mode-map.  locate runs
> dired-mode-hook despite the current buffer not being derived from
> dired-mode.

Indeed, it looks messy: it runs dired-mode-hook but not from
locate-mode.  Of course, part of it is because dired-mode is still not
written as a proper mode function (e.g. it requires a `dir' argument),
so locate can't use it to derive from it.

> I think ignoring locate is better than complaining that
> dired-hide-details-mode is enabled in a buffer that is not derived
> from dired-mode.

If, as you say, dired-details would simply be a no-op in locate, then
I think the better option is to simply ignore locate, in the sense of
not doing anything special about, rather than write code that tries to
actively avoid running dired-details code in locate.

> I am not aware of any other mode that behaves that way.

I was thinking of virtual-dired (in dired-x), vc-dired (which doesn't
exist any more in Emacs, but there might still be similar thingies out
there), ...


        Stefan





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11 14:25                             ` Stefan Monnier
@ 2013-02-11 16:08                               ` Christopher Schmidt
  2013-02-11 17:58                                 ` Stefan Monnier
  0 siblings, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-11 16:08 UTC (permalink / raw)
  To: 6799

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

thank you very much for your feedback.

>> dired-(next|previous)-line use (forward|backward)-line for point
>> movement.  These functions ignore hidden lines and subsequent point
>> movement by the editing loop does not do the right thing when point
>> moves backwards over a hidden line.
>
> Thanks.  Then the code needs a clear comment about it, citing the
> specific concrete case that it's trying to fix.
[...]
>> Put that in scratch, eval the first form, eval the second form four
>> times in a row.  Use case 1 does not work.  The change you cited
>> tries to work around this problem in dired.
>
> I'm not sure what this shows: I get a buffer with two visible lines
> ("Header" and "Stuff"); case 0 moves point to just before "Stuff" and
> so does case 1, and both seem right to my understanding of the code
> you provided.

Emacs behaves correctly.  (forward-line -1) is executed but the point
does not move across one visible line.  (dired-next-line -1) should skip
hidden lines, though.  (next-line -1) does the right thing.

Unfortunately next-line has some quirks, such as goal-column,
next-line-add-newlines, etc.  What about using line-move directly?  The
workaround is less cumbersome.

    (defun dired-next-line (arg)
      "Move down lines then position at filename.
    Optional prefix ARG says how many lines to move; default is one line."
      (interactive "p")
      (let ((line-move-visual)
            (goal-column))
        (line-move arg t))
      ;; We never want to move point into an invisible line.
      (while (and (invisible-p (point))
                  (not (if (and arg (< arg 0)) (bobp) (eobp))))
        (forward-char (if (and arg (< arg 0)) -1 1)))
      (dired-move-to-filename))

>>>> +  (if (derived-mode-p 'locate-mode)
>>>> +      (setq dired-hide-details-mode nil)
>>> Could you explain why locate-mode needs such special treatment (here
>>> and in locate-mode-map)?  I'm mostly worried here that maybe some
>>> other mode might require similar treatment.
>> The buffer generated by M-x locate RET does not contain any "details"
>> to hide.  dired-hide-details-mode would be a no-op there.
>
> A no-op doesn't sound like a bad thing.

There is the message "Dired-Hide-Details mode (disabled|enabled)".

Is there any reason for locate-filename-indentation to be 4 rather than
2 by default?

Dired-hide-details-mode considers everything from the third character to
the file name to be a detail.  That is dired-hide-details-mode hides
these two spaces if enabled.  This is either a bug or a feature.  I do
not know.

Other than that, dired-hide-details-mode it is a no-op in locate-mode
buffers.

>> Locate buffers are not real dired buffer.  locate-mode is an
>> independent major mode whose keymap derives from dired-mode-map.
>> locate runs dired-mode-hook despite the current buffer not being
>> derived from dired-mode.
>
> Indeed, it looks messy: it runs dired-mode-hook but not from
> locate-mode.  Of course, part of it is because dired-mode is still not
> written as a proper mode function (e.g. it requires a `dir' argument),
> so locate can't use it to derive from it.

Could we set the derived-mode-parent property of locate-mode to
dired-mode?  One way or another, (derived-mode-p 'dired-mode) should
return non-nil in locate-mode buffers.

>> I think ignoring locate is better than complaining that
>> dired-hide-details-mode is enabled in a buffer that is not derived
>> from dired-mode.
>
> If, as you say, dired-details would simply be a no-op in locate, then
> I think the better option is to simply ignore locate, in the sense of
> not doing anything special about, rather than write code that tries to
> actively avoid running dired-details code in locate.

Ok.

>> I am not aware of any other mode that behaves that way.
>
> I was thinking of virtual-dired (in dired-x), vc-dired (which doesn't
> exist any more in Emacs, but there might still be similar thingies out
> there), ...

As long as these modes use dired-insert-set-properties in the way it is
meant to be there should not be a problem.

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11 16:08                               ` Christopher Schmidt
@ 2013-02-11 17:58                                 ` Stefan Monnier
  2013-02-11 18:07                                   ` Drew Adams
  2013-02-11 19:52                                   ` Christopher Schmidt
  0 siblings, 2 replies; 30+ messages in thread
From: Stefan Monnier @ 2013-02-11 17:58 UTC (permalink / raw)
  To: 6799

>> I'm not sure what this shows: I get a buffer with two visible lines
>> ("Header" and "Stuff"); case 0 moves point to just before "Stuff" and
>> so does case 1, and both seem right to my understanding of the code
>> you provided.
> Emacs behaves correctly.  (forward-line -1) is executed but the point
> does not move across one visible line.

I'm sorry if I'm maybe a bit dense, but I don't understand what
you're saying.  Please be more specific (and feel free to use
a concrete example from dired-details rather than from your test case).

I especially don't understand because IIUC dired-details only ever hides
parts of a line (i.e. it never hides an LF) and it never hides the
filename itself, so it neither affects what (forward-char arg) should
do nor what (dired-move-to-filename) should do and after those two, the
cursor should be placed in a visible spot, so there's no need to move
the cursor.

> Is there any reason for locate-filename-indentation to be 4 rather than
> 2 by default?

I have no idea, sorry.

> Other than that, dired-hide-details-mode it is a no-op in locate-mode
> buffers.

Then let's not do anything special for locate-mode.

BTW, I saw another detail in your code that should be improved:

+    (define-key map [menu-bar immediate unhide-details]
+      '(menu-item "UnHide Details" dired-hide-details-mode
+		  :help "Unhide details in buffer"
+		  :visible dired-hide-details-mode))
+    (define-key map [menu-bar immediate hide-details]
+      '(menu-item "Hide Details" dired-hide-details-mode
+		  :help "Hide details in buffer"
+		  :visible (not dired-hide-details-mode)))

this should use a single entry with a toggle box.  Example from the
elisp manual:

          (menu-item "Debug on Error" toggle-debug-on-error
                     :button (:toggle
                              . (and (boundp 'debug-on-error)
                                     debug-on-error)))

>>> Locate buffers are not real dired buffer.  locate-mode is an
>>> independent major mode whose keymap derives from dired-mode-map.
>>> locate runs dired-mode-hook despite the current buffer not being
>>> derived from dired-mode.
>> Indeed, it looks messy: it runs dired-mode-hook but not from
>> locate-mode.  Of course, part of it is because dired-mode is still not
>> written as a proper mode function (e.g. it requires a `dir' argument),
>> so locate can't use it to derive from it.
> Could we set the derived-mode-parent property of locate-mode to
> dired-mode?  One way or another, (derived-mode-p 'dired-mode) should
> return non-nil in locate-mode buffers.

That sounds right, yes.

>> I was thinking of virtual-dired (in dired-x), vc-dired (which doesn't
>> exist any more in Emacs, but there might still be similar thingies out
>> there), ...
> As long as these modes use dired-insert-set-properties in the way it is
> meant to be there should not be a problem.

OK, great.  Then feel free to install at your convenience (with a note
in etc/NEWS as well),


        Stefan






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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11 17:58                                 ` Stefan Monnier
@ 2013-02-11 18:07                                   ` Drew Adams
  2013-02-11 19:52                                   ` Christopher Schmidt
  1 sibling, 0 replies; 30+ messages in thread
From: Drew Adams @ 2013-02-11 18:07 UTC (permalink / raw)
  To: 'Stefan Monnier', 6799

> Please be more specific (and feel free to use
> a concrete example from dired-details rather than from your 
> test case).

Just a nit.  To be fair and to avoid confusion, let's please not refer to these
enhancements using the name `dired-details'.  That name was taken by Rob
Giardina for his library dired-details.el (see the Subject line).

If this enhancement implements `dired-hide-details-mode', then please call it
that, or speak of "dired-hide-details".






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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11 17:58                                 ` Stefan Monnier
  2013-02-11 18:07                                   ` Drew Adams
@ 2013-02-11 19:52                                   ` Christopher Schmidt
  2013-02-13  9:54                                     ` Christopher Schmidt
  2013-02-15 15:25                                     ` Stefan Monnier
  1 sibling, 2 replies; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-11 19:52 UTC (permalink / raw)
  To: 6799

Stefan Monnier <monnier@iro.umontreal.ca> writes:
> I'm sorry if I'm maybe a bit dense, but I don't understand what you're
> saying.  Please be more specific (and feel free to use a concrete
> example from dired-details rather than from your test case).

I am sorry for not being on point and specific.

> I especially don't understand because IIUC dired-details only ever
> hides parts of a line (i.e. it never hides an LF) and it never hides
> the filename itself, so it neither affects what (forward-char arg)
> nshould do nor what (dired-move-to-filename) should do and after those
> two, the cursor should be placed in a visible spot, so there's no need
> to move the cursor.

dired-hide-details-mode also hides full lines other than header and
file/directory lines.  This includes the informational line right after
the header line.

    /my/directory:
    total used in directory 1M available 1.0G  <--
    drwx------  2 me me 4.0K Feb 11 17:35 file

Apply the patch, revert all hunks to dired-(next|previous)-line and move
point around the first lines of a dired buffer with hidden details.  Use
C-n and C-p for point movement.

> OK, great.  Then feel free to install at your convenience (with a note
> in etc/NEWS as well),

Thank you very much.  I am going to do that after I incorporate your
feedback and give the code another round of testing.  Thank you so much
for your feedback and your help.

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11 19:52                                   ` Christopher Schmidt
@ 2013-02-13  9:54                                     ` Christopher Schmidt
  2013-02-15 15:25                                     ` Stefan Monnier
  1 sibling, 0 replies; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-13  9:54 UTC (permalink / raw)
  To: 6799-done

Christopher Schmidt <christopher@ch.ristopher.com> writes:
> Thank you very much.  I am going to do that after I incorporate your
> feedback and give the code another round of testing.  Thank you so
> much for your feedback and your help.

I applied the patch (r111768).

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-11 19:52                                   ` Christopher Schmidt
  2013-02-13  9:54                                     ` Christopher Schmidt
@ 2013-02-15 15:25                                     ` Stefan Monnier
  2013-02-15 18:44                                       ` Christopher Schmidt
  1 sibling, 1 reply; 30+ messages in thread
From: Stefan Monnier @ 2013-02-15 15:25 UTC (permalink / raw)
  To: 6799

> dired-hide-details-mode also hides full lines other than header and
> file/directory lines.  This includes the informational line right after
> the header line.
>     /my/directory:
>     total used in directory 1M available 1.0G  <--
>     drwx------  2 me me 4.0K Feb 11 17:35 file

Is that the only full line that it hides, or are there others?

> Apply the patch, revert all hunks to dired-(next|previous)-line and move
> point around the first lines of a dired buffer with hidden details.  Use
> C-n and C-p for point movement.

AFAICT, the resulting behavior (when replacing dired-next-line's body
with forward-line plus dired-move-to-filename) is slightly suboptimal,
but only for that one "hidden usage line" at the top, and even then it's
nothing too terrible.

Thinking of how to "fix it right", I think we'd need to introduce
something like a point-adjustment-function which dired-next-line could
set, and would take a "direction" argument.  So keyboard.c's
adjust_point_for_property would call this function after
adjusting point.  But it seems difficult to introduce such a thing in
a robust way:
- We could have it as a variable, which gets cleared before running the
  next command, but then dired-next-line should only set it when called
  interactively (otherwise if the caller calls dired-next-line within,
  say, a save-excursion, you'd get surprising side-effects).
- We could have it as a property on the `dired-next-line' symbol, but
  then we get the reverse problem, that a wrapper command that just
  calls dired-next-line and not much else would fail to get this part of
  dired-next-line's behavior.

Maybe a cleaner solution is to export keyboard.c's
adjust_point_for_property to Elisp so that dired-next-line can call
it explicitly (to replace your "(while (and (invisible-p (point))) ...)"
loop).


        Stefan





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-15 15:25                                     ` Stefan Monnier
@ 2013-02-15 18:44                                       ` Christopher Schmidt
  2013-02-16 21:52                                         ` Juri Linkov
  0 siblings, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-15 18:44 UTC (permalink / raw)
  To: 6799

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> dired-hide-details-mode also hides full lines other than header and
>> file/directory lines.  This includes the informational line right
>> after
>> the header line.
>>     /my/directory:
>>     total used in directory 1M available 1.0G  <--
>>     drwx------  2 me me 4.0K Feb 11 17:35 file
>
> Is that the only full line that it hides, or are there others?

Each and every line that is not a file line and that
dired-insert-set-properties is called upon.

In dired it is only this informational line.  In find-dired the
footer is hidden as well.

    find finished at Fri Feb 15 20:00:00

> Thinking of how to "fix it right", I think we'd need to introduce
> something like a point-adjustment-function which dired-next-line could
> set, and would take a "direction" argument.  So keyboard.c's
> adjust_point_for_property would call this function after adjusting
> point.  But it seems difficult to introduce such a thing in
> a robust way:
> - We could have it as a variable, which gets cleared before running
>   the next command, but then dired-next-line should only set it when
>   called interactively (otherwise if the caller calls dired-next-line
>   within, say, a save-excursion, you'd get surprising side-effects).
> - We could have it as a property on the `dired-next-line' symbol, but
>   then we get the reverse problem, that a wrapper command that just
>   calls dired-next-line and not much else would fail to get this part
>   of dired-next-line's behavior.
>
> Maybe a cleaner solution is to export keyboard.c's
> adjust_point_for_property to Elisp so that dired-next-line can call
> it explicitly (to replace your "(while (and (invisible-p (point))) ...)"
> loop).

Yes, that would be great.

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-15 18:44                                       ` Christopher Schmidt
@ 2013-02-16 21:52                                         ` Juri Linkov
  2013-02-16 22:58                                           ` Drew Adams
  2013-02-17 14:57                                           ` Christopher Schmidt
  0 siblings, 2 replies; 30+ messages in thread
From: Juri Linkov @ 2013-02-16 21:52 UTC (permalink / raw)
  To: 6799

Usually I don't do this but when I called in a dired buffer
`M-x text-mode RET' it unexpectedly removed from display all text
except filenames (i.e. made other text invisible).

I wonder should such cases be handled e.g. by disabling
`dired-hide-details-mode' in the hook `after-change-major-mode-hook'?





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-16 21:52                                         ` Juri Linkov
@ 2013-02-16 22:58                                           ` Drew Adams
  2013-02-17 10:05                                             ` Juri Linkov
  2013-02-17 14:57                                           ` Christopher Schmidt
  1 sibling, 1 reply; 30+ messages in thread
From: Drew Adams @ 2013-02-16 22:58 UTC (permalink / raw)
  To: 'Juri Linkov', 6799

> Usually I don't do this but when I called in a dired buffer
> `M-x text-mode RET' it unexpectedly removed from display all text
> except filenames (i.e. made other text invisible).
> 
> I wonder should such cases be handled e.g. by disabling
> `dired-hide-details-mode' in the hook `after-change-major-mode-hook'?

They should definitely be handled, one way or another.

`dired-hide-details-mode' makes sense only in a mode derived from Dired mode.

Your suggested fix sounds like the right approach in general, but I think
turning off `dired-hide-details-mode' should somehow be done BEFORE changing to
a mode that is not dired-derived, not afterward.

Can you use `change-major-mode-hook' instead, to do this before changing the
mode?  Is it possible at that point to test whether the target mode is
(derived-mode-p dired-mode)?






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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-16 22:58                                           ` Drew Adams
@ 2013-02-17 10:05                                             ` Juri Linkov
  0 siblings, 0 replies; 30+ messages in thread
From: Juri Linkov @ 2013-02-17 10:05 UTC (permalink / raw)
  To: Drew Adams; +Cc: 6799

> Can you use `change-major-mode-hook' instead, to do this before
> changing the mode?  Is it possible at that point to test whether
> the target mode is (derived-mode-p dired-mode)?

Yes, it seems `change-major-mode-hook' is more suitable.
This is what `outline-mode' does to remove invisibility by using:

  (add-hook 'change-major-mode-hook 'show-all nil t)





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-16 21:52                                         ` Juri Linkov
  2013-02-16 22:58                                           ` Drew Adams
@ 2013-02-17 14:57                                           ` Christopher Schmidt
  2013-02-18  9:49                                             ` Juri Linkov
  1 sibling, 1 reply; 30+ messages in thread
From: Christopher Schmidt @ 2013-02-17 14:57 UTC (permalink / raw)
  To: 6799

Juri Linkov <juri@jurta.org> writes:
> Usually I don't do this but when I called in a dired buffer `M-x
> text-mode RET' it unexpectedly removed from display all text except
> filenames (i.e. made other text invisible).

buffer-invisibility-spec is being set back to t.  I.e. all text with a
non-nil invisible text property is hidden.

> I wonder should such cases be handled e.g. by disabling
> `dired-hide-details-mode' in the hook `after-change-major-mode-hook'?

Disabling dired-hide-details-mode just modifies
buffer-invisibility-spec.  This will not change anything.

I guess the invisible text property should be set back to nil.
dired-hide-details-mode will not work from thereon in this buffer.

Is this a real issue?

        Christopher





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-17 14:57                                           ` Christopher Schmidt
@ 2013-02-18  9:49                                             ` Juri Linkov
  2013-02-18 14:38                                               ` Drew Adams
  0 siblings, 1 reply; 30+ messages in thread
From: Juri Linkov @ 2013-02-18  9:49 UTC (permalink / raw)
  To: 6799

> I guess the invisible text property should be set back to nil.
> dired-hide-details-mode will not work from thereon in this buffer.
>
> Is this a real issue?

It's not an issue to me, I just accidentally noticed that effect.
I don't know how likely is that someone does this routinely
that requires adding a function to remove invisible text property
to be called from `change-major-mode-hook'.





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

* bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch]
  2013-02-18  9:49                                             ` Juri Linkov
@ 2013-02-18 14:38                                               ` Drew Adams
  0 siblings, 0 replies; 30+ messages in thread
From: Drew Adams @ 2013-02-18 14:38 UTC (permalink / raw)
  To: 'Juri Linkov', 6799

> > I guess the invisible text property should be set back to nil.
> > dired-hide-details-mode will not work from thereon in this buffer.
> >
> > Is this a real issue?
> 
> It's not an issue to me, I just accidentally noticed that effect.
> I don't know how likely is that someone does this routinely
> that requires adding a function to remove invisible text property
> to be called from `change-major-mode-hook'.

IMO, it is a real issue, of course.  We are breaking a reasonable use of our
editor: to change the mode and do something different with the same text.

Users should be able to change the mode and then act on the text in various ways
- e.g., treating it as just a file listing.

Yes, there is also `list-directory' that could be used for that, but that's not
a reason not to fix this, at least if the fix is straightforward.  Is the fix
onerous or something?






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

end of thread, other threads:[~2013-02-18 14:38 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 14:20 bug#6799: 24.0.50; Please add dired-details.el to Emacs [patch] Drew Adams
2011-01-28 23:08 ` Drew Adams
2011-03-13  3:28   ` Juanma Barranquero
2011-03-13 16:58     ` Drew Adams
2012-04-12 19:10       ` Lars Magne Ingebrigtsen
2012-04-12 20:05         ` Drew Adams
2012-04-25 15:46           ` Rob Giardina
2012-07-21 20:12             ` Drew Adams
2012-12-15 21:15               ` Christopher Schmidt
2012-12-15 22:17                 ` Christopher Schmidt
2012-12-16 22:31                   ` Stefan Monnier
2012-12-17 13:24                     ` Christopher Schmidt
2013-02-10 15:02                       ` Christopher Schmidt
2013-02-10 15:08                         ` Christopher Schmidt
2013-02-11  3:37                         ` Stefan Monnier
2013-02-11  8:19                           ` Christopher Schmidt
2013-02-11 14:25                             ` Stefan Monnier
2013-02-11 16:08                               ` Christopher Schmidt
2013-02-11 17:58                                 ` Stefan Monnier
2013-02-11 18:07                                   ` Drew Adams
2013-02-11 19:52                                   ` Christopher Schmidt
2013-02-13  9:54                                     ` Christopher Schmidt
2013-02-15 15:25                                     ` Stefan Monnier
2013-02-15 18:44                                       ` Christopher Schmidt
2013-02-16 21:52                                         ` Juri Linkov
2013-02-16 22:58                                           ` Drew Adams
2013-02-17 10:05                                             ` Juri Linkov
2013-02-17 14:57                                           ` Christopher Schmidt
2013-02-18  9:49                                             ` Juri Linkov
2013-02-18 14:38                                               ` Drew Adams

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