unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* global dired-hide-details-mode
@ 2016-11-07  8:17 Alexander Klimov
  2016-11-07 13:45 ` Michael Heerdegen
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Klimov @ 2016-11-07  8:17 UTC (permalink / raw)
  To: emacs-devel

Hi.

Looks like there is no way to customize Emacs so that every 
new dired buffer starts with dired-hide-details-mode, but g 
(that is revert-buffer) keeps the details state.

My current approach is to add 
 dired-hide-details-unless-reverting-in-progress
into
 dired-before-readin-hook

(defvar dired-reverting-in-progress nil)
(defun dired-reverting-in-progress-advice (orig-fun &rest args)
  (let ((dired-reverting-in-progress t))
    (apply orig-fun args)))
(advice-add 'dired-revert :around #'dired-reverting-in-progress-advice)

(defun dired-hide-details-unless-reverting-in-progress ()
  (unless dired-reverting-in-progress
    (dired-hide-details-mode)))

It would be nice to create a more direct way to achieve this 
functionality.

-- 
Regards,
ASK



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

* Re: global dired-hide-details-mode
  2016-11-07  8:17 global dired-hide-details-mode Alexander Klimov
@ 2016-11-07 13:45 ` Michael Heerdegen
  2016-11-07 14:11   ` Alexander Klimov
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Heerdegen @ 2016-11-07 13:45 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

Alexander Klimov <alserkli@inbox.ru> writes:

> Looks like there is no way to customize Emacs so that every 
> new dired buffer starts with dired-hide-details-mode, but g 
> (that is revert-buffer) keeps the details state.

Doesn't

(add-hook 'dired-mode-hook
	  (lambda () (dired-hide-details-mode +1)))

behave like that?


Michael.



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

* Re: global dired-hide-details-mode
  2016-11-07 13:45 ` Michael Heerdegen
@ 2016-11-07 14:11   ` Alexander Klimov
  2016-11-07 15:22     ` Michael Heerdegen
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Klimov @ 2016-11-07 14:11 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

On Mon, 7 Nov 2016, Michael Heerdegen wrote:
> > Looks like there is no way to customize Emacs so that every 
> > new dired buffer starts with dired-hide-details-mode, but g 
> > (that is revert-buffer) keeps the details state.
> 
> Doesn't
> 
> (add-hook 'dired-mode-hook
> 	  (lambda () (dired-hide-details-mode +1)))
> 
> behave like that?

Yes, thanks!

Somehow I missed dired-mode-hook, probably I was under impression that 
using it instead of dired-before-readin-hook will force reading 
the directory twice.

Btw, the following also works:

 (add-hook 'dired-mode-hook 'dired-hide-details-mode)

-- 
Regards,
ASK



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

* Re: global dired-hide-details-mode
  2016-11-07 14:11   ` Alexander Klimov
@ 2016-11-07 15:22     ` Michael Heerdegen
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2016-11-07 15:22 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

Alexander Klimov <alserkli@inbox.ru> writes:

> Somehow I missed dired-mode-hook, probably I was under impression that
> using it instead of dired-before-readin-hook will force reading the
> directory twice.

AFAIR, `dired-hide-details-mode' is anchored deeper in dired than you
probably had expected: the invisible text property is applied already
after reading in the contents, unconditionally and independently from
the value of `dired-hide-details-mode'.  `dired-hide-details-mode' only
toggles the according invisibility spec.  That's why `dired-mode-hook'
is the right place to enable that mode.

Enabling `dired-hide-details-mode' directly after filling the buffer
might work too because it sets the invisibility spec, but I think when
entering `dired-mode', the details mode gets effectively turned off (via
unsetting buffer local variables when changing the major mode).


Michael.



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

end of thread, other threads:[~2016-11-07 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-07  8:17 global dired-hide-details-mode Alexander Klimov
2016-11-07 13:45 ` Michael Heerdegen
2016-11-07 14:11   ` Alexander Klimov
2016-11-07 15:22     ` Michael Heerdegen

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