* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
@ 2018-01-04 1:11 Yuen Ho Wong
2018-01-04 16:42 ` Eli Zaretskii
2022-04-17 18:22 ` Lars Ingebrigtsen
0 siblings, 2 replies; 18+ messages in thread
From: Yuen Ho Wong @ 2018-01-04 1:11 UTC (permalink / raw)
To: 29972
[-- Attachment #1: Type: text/plain, Size: 686 bytes --]
How to reproduce:
1. Turn on `desktop-save-mode`
2. dired some directory
3. Press `(` to turn on `dired-hide-details-mode`
4. C-x C-c, when asked to save desktop, choose yes
5. Launch emacs again, desktop restored the dired buffer but not
`dired-hide-details-mode`
What went wrong:
`dired-hide-details-mode`'s definition does not declare a lighter or a
keymap, thus it is not added to `minor-mode-alist` by
`define-minor-mode`. So when `desktop` tries to get the buffer's info to
save to `.emacs.desktop` via `desktop-buffer-info`,
`dired-hide-details-mode` does not exist, and thus not saved to the
session file.
Fix:
Just declare an empty lighter. I've attached a patch for this.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add dired-hide-details-mode to minor-mode-alist --]
[-- Type: text/x-patch, Size: 728 bytes --]
From 49b10c2f4b17809d0b34354699e6a1a35d7be785 Mon Sep 17 00:00:00 2001
From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Date: Wed, 3 Jan 2018 23:43:27 +0000
Subject: [PATCH] Add dired-hide-details-mode to minor-mode-alist
---
lisp/dired.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/lisp/dired.el b/lisp/dired.el
index b853d64c56..97f41400f8 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -2433,6 +2433,7 @@ permissions are hidden from view.
See options: `dired-hide-details-hide-symlink-targets' and
`dired-hide-details-hide-information-lines'."
:group 'dired
+ :lighter: ""
(unless (derived-mode-p 'dired-mode)
(error "Not a Dired buffer"))
(dired-hide-details-update-invisibility-spec)
--
2.15.1
[-- Attachment #3: Type: text/plain, Size: 7912 bytes --]
Jimmy Yuen Ho Wong
In GNU Emacs 25.3.3 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21)
of 2017-09-28 built on Atago.local
Repository revision: 67b78428be670691c240a20bb7af9248b884d583
Windowing system distributor 'Apple Inc.', version 10.13.2
Configured using:
'configure --with-mac --enable-mac-app=/Users/build/emacs-mac-build
--prefix=/Users/build/emacs-mac-build'
Configured features:
NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
Important settings:
value of $LANG: en_GB.UTF-8
locale-coding-system: utf-8-unix
Major mode: Fundamental
Minor modes in effect:
company-flx-mode: t
company-quickhelp-mode: t
company-quickhelp-local-mode: t
company-statistics-mode: t
imenu-list-minor-mode: t
projectile-mode: t
flx-ido-mode: t
override-global-mode: t
winner-mode: t
which-key-mode: t
which-function-mode: t
smooth-scrolling-mode: t
show-smartparens-global-mode: t
smartparens-global-mode: t
show-paren-mode: t
savehist-mode: t
save-place-mode: t
recentf-mode: t
pyenv-mode: t
purpose-mode: t
ido-vertical-mode: t
ido-ubiquitous-mode: t
ido-everywhere: t
global-whitespace-cleanup-mode: t
global-undo-tree-mode: t
global-origami-mode: t
global-move-dup-mode: t
global-magit-file-mode: t
diff-auto-refine-mode: t
magit-auto-revert-mode: t
global-git-commit-mode: t
async-bytecomp-package-mode: t
shell-dirtrack-mode: t
server-mode: t
global-hl-line-mode: t
global-flycheck-mode: t
global-company-mode: t
display-time-mode: t
desktop-save-mode: t
delete-selection-mode: t
auto-compile-on-save-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mac-mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
temp-buffer-resize-mode: t
size-indication-mode: t
column-number-mode: t
line-number-mode: t
global-visual-line-mode: t
transient-mark-mode: t
Recent messages:
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
imenu-list: couldn’t create index because of error: (imenu-unavailable "This buffer cannot use ‘imenu-default-create-index-function’")
Loading /Users/wyuenho/.emacs.d/company-statistics-cache.el (source)...done
Warning: symbolic link to Git-controlled source file
ls does not support --dired; see ‘dired-use-ls-dired’ for more details.
Wrote /Users/wyuenho/.emacs.d/.emacs.desktop.lock
Desktop: 1 frame, 2 buffers restored.
Turning on magit-auto-revert-mode...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Load-path shadows:
/Users/wyuenho/.emacs.d/elpa/seq-2.20/seq hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/seq
/Users/wyuenho/.emacs.d/elpa/let-alist-1.0.5/let-alist hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/let-alist
Features:
(shadow sort mail-extr emacsbug sendmail jka-compr company-flx
company-quickhelp pos-tip company-statistics company-oddmuse
company-keywords company-etags company-gtags company-dabbrev-code
company-dabbrev company-files company-capf company-cmake company-xcode
company-clang company-semantic company-eclim company-template
company-css company-nxml company-bbdb linum cap-words superword subword
solarized-theme hideshow window-purpose-x imenu-list monky bindat rg
wgrep-ag wgrep ag vc-svn find-dired go-projectile vc-git go-rename
go-guru go-eldoc projectile grep ibuf-ext ibuffer go-mode find-file ffap
tide tide-lv ts-comint typescript-mode compile js2-mode-expansions
js2-mode etags xref project smartparens-javascript js-mode-expansions js
smartparens-html html-mode-expansions sgml-mode cc-mode-expansions
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs yaml-mode multi-term term disp-table ehelp
bash-completion restclient yasnippet-snippets mocha-snippets yasnippet
evil-numbers cycle-quotes string-inflection smartparens-config
smartparens-python expand-region text-mode-expansions
python-el-fgallina-expansions er-basic-expansions expand-region-core
expand-region-custom visual-regexp-steroids visual-regexp
multiple-cursors mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core rect idomenu smex flx-isearch
flx-ido flx zoom-frm frame-cmds frame-fns avoid delight dired-collapse
dired-single dired-hide-dotfiles all-the-icons-dired all-the-icons
all-the-icons-faces data-material data-weathericons data-octicons
data-fileicons data-faicons data-alltheicons font-lock+
exec-path-from-shell pager-default-keybindings pager windmove bind-key
solarized-dark-theme solarized color winner which-key which-func imenu
smooth-scrolling smartparens thingatpt paren savehist saveplace recentf
tree-widget pyenv-mode pythonic f python tramp-sh docker-tramp
tramp-cache tramp tramp-compat tramp-loaddefs trampver ucs-normalize
window-purpose window-purpose-fixes window-purpose-prefix-overload
window-purpose-switch window-purpose-layout window-purpose-core
window-purpose-configuration window-purpose-utils ido-vertical-mode
ido-completing-read+ memoize cus-edit wid-edit minibuf-eldef ido
whitespace-cleanup-mode whitespace undo-tree diff origami
origami-parsers cl move-dup magit-obsolete magit-blame magit-stash
magit-bisect magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-branch magit-collab ghub url-auth url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap let-alist magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
diff-mode magit-core magit-autorevert autorevert filenotify
magit-process magit-margin magit-mode git-commit magit-git magit-section
magit-utils crm magit-popup log-edit easy-mmode message dired
format-spec rfc822 mml mml-sec epg mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log with-editor async-bytecomp async
shell pcomplete comint ansi-color ring server hl-line flycheck json map
find-func subr-x company time desktop frameset delsel auto-compile
advice packed cus-start cus-load finder-inf edmacro kmacro gh-common
gh-profile url-parse auth-source gnus-util mm-util help-fns mail-prsvr
password-cache url-vars rx s marshal eieio-compat cl-seq dash eieio
eieio-core cl-macs info package epg-config seq byte-opt gv bytecomp
byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib
mule-util time-date tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel mac-win term/common-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote kqueue mac multi-tty
make-network-process emacs)
Memory information:
((conses 16 704475 147100)
(symbols 48 52021 0)
(miscs 40 917 1384)
(strings 32 148362 131289)
(string-bytes 1 4953797)
(vectors 16 109995)
(vector-slots 8 2591740 314018)
(floats 8 12505 8339)
(intervals 56 1918 1624)
(buffers 976 26))
^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-04 1:11 bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session Yuen Ho Wong
@ 2018-01-04 16:42 ` Eli Zaretskii
2018-01-05 13:08 ` Jimmy Yuen Ho Wong
2022-04-17 18:22 ` Lars Ingebrigtsen
1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-04 16:42 UTC (permalink / raw)
To: Yuen Ho Wong; +Cc: 29972
> From: Yuen Ho Wong <wyuenho@gmail.com>
> Date: Thu, 04 Jan 2018 01:11:13 +0000
>
> How to reproduce:
> 1. Turn on `desktop-save-mode`
> 2. dired some directory
> 3. Press `(` to turn on `dired-hide-details-mode`
> 4. C-x C-c, when asked to save desktop, choose yes
> 5. Launch emacs again, desktop restored the dired buffer but not
> `dired-hide-details-mode`
>
> What went wrong:
> `dired-hide-details-mode`'s definition does not declare a lighter or a
> keymap, thus it is not added to `minor-mode-alist` by
> `define-minor-mode`. So when `desktop` tries to get the buffer's info to
> save to `.emacs.desktop` via `desktop-buffer-info`,
> `dired-hide-details-mode` does not exist, and thus not saved to the
> session file.
>
> Fix:
> Just declare an empty lighter. I've attached a patch for this.
Can't you instead customize desktop-locals-to-save?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-04 16:42 ` Eli Zaretskii
@ 2018-01-05 13:08 ` Jimmy Yuen Ho Wong
2018-01-05 14:25 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Jimmy Yuen Ho Wong @ 2018-01-05 13:08 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29972
[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]
I don't believe so. I've looked at a number of approaches.
1. `desktop-minor-mode-handlers` on desktop-read
Not going to be consulted unless `dired-hide-details-mode` is saved as
a buffer minor mode.
2. `desktop-minor-mode-table` on desktop-save
If `dired-hide-details-mode` is not in `minor-mode-alist`,
`desktop-minor-mode-table` will not even be consulted.
3. `desktop-locals-to-save`
This does save the minor mode local variable to the desktop file, but
desktop won't be able to restore the minor mode because minor modes are
activated before buffer local variables are restored, not after.
So the only choices left to me are:
- :lighter ""
- (add-minor-mode 'dired-hide-details-mode "")
Either way adds an empty string as a lighter, and the second option makes
you ask why you are declaring *and* adding a minor mode, so I picked the
first option. It's more concise.
Jimmy Wong
On Thu, Jan 4, 2018 at 4:42 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Yuen Ho Wong <wyuenho@gmail.com>
> > Date: Thu, 04 Jan 2018 01:11:13 +0000
> >
> > How to reproduce:
> > 1. Turn on `desktop-save-mode`
> > 2. dired some directory
> > 3. Press `(` to turn on `dired-hide-details-mode`
> > 4. C-x C-c, when asked to save desktop, choose yes
> > 5. Launch emacs again, desktop restored the dired buffer but not
> > `dired-hide-details-mode`
> >
> > What went wrong:
> > `dired-hide-details-mode`'s definition does not declare a lighter or a
> > keymap, thus it is not added to `minor-mode-alist` by
> > `define-minor-mode`. So when `desktop` tries to get the buffer's info to
> > save to `.emacs.desktop` via `desktop-buffer-info`,
> > `dired-hide-details-mode` does not exist, and thus not saved to the
> > session file.
> >
> > Fix:
> > Just declare an empty lighter. I've attached a patch for this.
>
> Can't you instead customize desktop-locals-to-save?
>
[-- Attachment #2: Type: text/html, Size: 2561 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 13:08 ` Jimmy Yuen Ho Wong
@ 2018-01-05 14:25 ` Eli Zaretskii
2018-01-05 15:02 ` Jimmy Yuen Ho Wong
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-05 14:25 UTC (permalink / raw)
To: Jimmy Yuen Ho Wong; +Cc: 29972
> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Fri, 5 Jan 2018 13:08:35 +0000
> Cc: 29972@debbugs.gnu.org
>
> I don't believe so. I've looked at a number of approaches.
>
> 1. `desktop-minor-mode-handlers` on desktop-read
> Not going to be consulted unless `dired-hide-details-mode` is saved as a buffer minor mode.
> 2. `desktop-minor-mode-table` on desktop-save
> If `dired-hide-details-mode` is not in `minor-mode-alist`, `desktop-minor-mode-table` will not even be
> consulted.
> 3. `desktop-locals-to-save`
> This does save the minor mode local variable to the desktop file, but desktop won't be able to restore the
> minor mode because minor modes are activated before buffer local variables are restored, not after.
>
> So the only choices left to me are:
> - :lighter ""
> - (add-minor-mode 'dired-hide-details-mode "")
>
> Either way adds an empty string as a lighter, and the second option makes you ask why you are declaring
> *and* adding a minor mode, so I picked the first option. It's more concise.
Then maybe we need a new, more thorough customization facility for
desktop.el, or a change in the facilities you tried to make them
handle this case as well. It doesn't sound right to me to make tricky
changes in a minor mode just so it could be restored by desktop.el.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 14:25 ` Eli Zaretskii
@ 2018-01-05 15:02 ` Jimmy Yuen Ho Wong
2018-01-05 15:16 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Jimmy Yuen Ho Wong @ 2018-01-05 15:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29972
[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]
Actually I would question why we have minor modes not added to
minor-mode-alist at all just because both lighter and keymap are missing.
What do you think about changing define-minor-mode?
On Fri, 5 Jan 2018 at 2:26 pm, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> > Date: Fri, 5 Jan 2018 13:08:35 +0000
> > Cc: 29972@debbugs.gnu.org
> >
> > I don't believe so. I've looked at a number of approaches.
> >
> > 1. `desktop-minor-mode-handlers` on desktop-read
> > Not going to be consulted unless `dired-hide-details-mode` is saved
> as a buffer minor mode.
> > 2. `desktop-minor-mode-table` on desktop-save
> > If `dired-hide-details-mode` is not in `minor-mode-alist`,
> `desktop-minor-mode-table` will not even be
> > consulted.
> > 3. `desktop-locals-to-save`
> > This does save the minor mode local variable to the desktop file,
> but desktop won't be able to restore the
> > minor mode because minor modes are activated before buffer local
> variables are restored, not after.
> >
> > So the only choices left to me are:
> > - :lighter ""
> > - (add-minor-mode 'dired-hide-details-mode "")
> >
> > Either way adds an empty string as a lighter, and the second option
> makes you ask why you are declaring
> > *and* adding a minor mode, so I picked the first option. It's more
> concise.
>
> Then maybe we need a new, more thorough customization facility for
> desktop.el, or a change in the facilities you tried to make them
> handle this case as well. It doesn't sound right to me to make tricky
> changes in a minor mode just so it could be restored by desktop.el.
>
[-- Attachment #2: Type: text/html, Size: 2151 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 15:02 ` Jimmy Yuen Ho Wong
@ 2018-01-05 15:16 ` Eli Zaretskii
2018-01-05 17:42 ` Jimmy Yuen Ho Wong
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-05 15:16 UTC (permalink / raw)
To: Jimmy Yuen Ho Wong; +Cc: 29972
> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Fri, 05 Jan 2018 15:02:21 +0000
> Cc: 29972@debbugs.gnu.org
>
> Actually I would question why we have minor modes not added to minor-mode-alist at all just because both
> lighter and keymap are missing.
Because minor-mode-alist is for displaying an indication of a minor
mode in the mode line?
> What do you think about changing define-minor-mode?
IMO, a better idea is to find out why desktop.el requires a minor mode
to be in minor-mode-alist before it saves it. Is there really a
justification for that?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 15:16 ` Eli Zaretskii
@ 2018-01-05 17:42 ` Jimmy Yuen Ho Wong
2018-01-05 18:20 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Jimmy Yuen Ho Wong @ 2018-01-05 17:42 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29972
[-- Attachment #1: Type: text/plain, Size: 1814 bytes --]
> Because minor-mode-alist is for displaying an indication of a minor
mode in the mode line?
Right, but there doesn't appear to be any other more reliable way to know
what minor mode is active in a buffer. An alternative I can think of is see
if there's buffer local variable that also exists in `minor-mode-list`, but
that's still not reliable, hence we have these `desktop-minor-mode-*` vars.
The fundamental reason appears to be desktop.el needs an efficient and
reliable way to know what buffer local variables are minor modes, since
`minor-mode-list` is just a global list of loaded minor-modes,
`minor-mode-alist` is as close as you get.
If my patch make it in, it will not be the first minor mode in emacs that
defines an empty string lighter. `xref`, `linum`, `erc-track` and `rcirc`
all do this. There are even more examples in the wild. I have at least 8
other packages in my ~/.emacs.d/elpa that do the same thing.
I agree, however, that this is an abuse. There should be perhaps some
buffer local variable called `buffer-minor-modes`, but I think this should
be a separate issue and a new feature, so perhaps wait til after 26.1?
On Fri, Jan 5, 2018 at 3:16 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> > Date: Fri, 05 Jan 2018 15:02:21 +0000
> > Cc: 29972@debbugs.gnu.org
> >
> > Actually I would question why we have minor modes not added to
> minor-mode-alist at all just because both
> > lighter and keymap are missing.
>
> Because minor-mode-alist is for displaying an indication of a minor
> mode in the mode line?
>
> > What do you think about changing define-minor-mode?
>
> IMO, a better idea is to find out why desktop.el requires a minor mode
> to be in minor-mode-alist before it saves it. Is there really a
> justification for that?
>
[-- Attachment #2: Type: text/html, Size: 3041 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 17:42 ` Jimmy Yuen Ho Wong
@ 2018-01-05 18:20 ` Eli Zaretskii
2018-01-05 18:29 ` Noam Postavsky
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-05 18:20 UTC (permalink / raw)
To: Jimmy Yuen Ho Wong; +Cc: 29972
> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Fri, 5 Jan 2018 17:42:49 +0000
> Cc: 29972@debbugs.gnu.org
>
> The fundamental reason appears to be desktop.el needs an efficient and reliable way to know what buffer
> local variables are minor modes, since `minor-mode-list` is just a global list of loaded minor-modes,
> `minor-mode-alist` is as close as you get.
So maybe desktop.el should have defcustom with the list of minor
modes, whose default value is computed from minor-mode-alist, but
which users could customize to add any additional minor modes?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 18:20 ` Eli Zaretskii
@ 2018-01-05 18:29 ` Noam Postavsky
2018-01-05 18:37 ` Drew Adams
2018-01-05 19:41 ` Eli Zaretskii
0 siblings, 2 replies; 18+ messages in thread
From: Noam Postavsky @ 2018-01-05 18:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29972, Jimmy Yuen Ho Wong
On Fri, Jan 5, 2018 at 1:20 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
>> Date: Fri, 5 Jan 2018 17:42:49 +0000
>> Cc: 29972@debbugs.gnu.org
>>
>> The fundamental reason appears to be desktop.el needs an efficient and reliable way to know what buffer
>> local variables are minor modes, since `minor-mode-list` is just a global list of loaded minor-modes,
>> `minor-mode-alist` is as close as you get.
>
> So maybe desktop.el should have defcustom with the list of minor
> modes, whose default value is computed from minor-mode-alist, but
> which users could customize to add any additional minor modes?
Would it help if define-minor-mode recorded what the
variable/expression is (e.g., by putting a property on the function
symbol)?
This could also be useful for define-globalized-minor-mode (see
Bug#29081 - for which the current suggestion is to do without that,
but if such a thing has two uses, it will likely be helpful in even
more situations).
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 18:29 ` Noam Postavsky
@ 2018-01-05 18:37 ` Drew Adams
2018-01-05 19:41 ` Eli Zaretskii
1 sibling, 0 replies; 18+ messages in thread
From: Drew Adams @ 2018-01-05 18:37 UTC (permalink / raw)
To: Noam Postavsky, Eli Zaretskii; +Cc: 29972, Jimmy Yuen Ho Wong
`describe-mode' uses `minor-mode-list' (`list', not
`alist') to determine which minor modes are active
in the current buffer.
It also uses `minor-mode-alist', because of what
this comment says:
;; Older packages do not register in minor-mode-list
;; but only in `minor-mode-alist'.
The code that determines which minor modes are
active in the current buffer could be factored
out into a separate funtion, and that could be
used, for example, by desktop.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 18:29 ` Noam Postavsky
2018-01-05 18:37 ` Drew Adams
@ 2018-01-05 19:41 ` Eli Zaretskii
2018-01-05 19:54 ` Noam Postavsky
1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-05 19:41 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 29972, wyuenho
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Fri, 5 Jan 2018 13:29:49 -0500
> Cc: Jimmy Yuen Ho Wong <wyuenho@gmail.com>, 29972@debbugs.gnu.org
>
> Would it help if define-minor-mode recorded what the
> variable/expression is (e.g., by putting a property on the function
> symbol)?
Not sure what should desktop.el do with that. Loop on all symbols in
obarray looking for those with that property?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 19:41 ` Eli Zaretskii
@ 2018-01-05 19:54 ` Noam Postavsky
2018-01-05 19:56 ` Eli Zaretskii
0 siblings, 1 reply; 18+ messages in thread
From: Noam Postavsky @ 2018-01-05 19:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29972, Jimmy Yuen Ho Wong
On Fri, Jan 5, 2018 at 2:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Noam Postavsky <npostavs@users.sourceforge.net>
>> Date: Fri, 5 Jan 2018 13:29:49 -0500
>> Cc: Jimmy Yuen Ho Wong <wyuenho@gmail.com>, 29972@debbugs.gnu.org
>>
>> Would it help if define-minor-mode recorded what the
>> variable/expression is (e.g., by putting a property on the function
>> symbol)?
>
> Not sure what should desktop.el do with that. Loop on all symbols in
> obarray looking for those with that property?
I thought looping over symbols in minor-mode-list would make sense.
(I see describe-mode only takes minor modes which have function and
variable using the same symbol)
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 19:54 ` Noam Postavsky
@ 2018-01-05 19:56 ` Eli Zaretskii
2018-01-05 19:59 ` Noam Postavsky
0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-05 19:56 UTC (permalink / raw)
To: Noam Postavsky; +Cc: 29972, wyuenho
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Fri, 5 Jan 2018 14:54:01 -0500
> Cc: Jimmy Yuen Ho Wong <wyuenho@gmail.com>, 29972@debbugs.gnu.org
>
> >> Would it help if define-minor-mode recorded what the
> >> variable/expression is (e.g., by putting a property on the function
> >> symbol)?
> >
> > Not sure what should desktop.el do with that. Loop on all symbols in
> > obarray looking for those with that property?
>
> I thought looping over symbols in minor-mode-list would make sense.
Yes, but your suggestion never mentioned minor-mode-list, so I
probably missed the point.
> (I see describe-mode only takes minor modes which have function and
> variable using the same symbol)
That happens automagically if one uses define-minor-mode, right?
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 19:56 ` Eli Zaretskii
@ 2018-01-05 19:59 ` Noam Postavsky
2018-01-08 12:43 ` Jimmy Yuen Ho Wong
0 siblings, 1 reply; 18+ messages in thread
From: Noam Postavsky @ 2018-01-05 19:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29972, Jimmy Yuen Ho Wong
On Fri, Jan 5, 2018 at 2:56 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> (I see describe-mode only takes minor modes which have function and
>> variable using the same symbol)
>
> That happens automagically if one uses define-minor-mode, right?
Except if you use its :variable option.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-05 19:59 ` Noam Postavsky
@ 2018-01-08 12:43 ` Jimmy Yuen Ho Wong
2018-01-08 18:54 ` Eli Zaretskii
[not found] ` <<83r2r06v1y.fsf@gnu.org>
0 siblings, 2 replies; 18+ messages in thread
From: Jimmy Yuen Ho Wong @ 2018-01-08 12:43 UTC (permalink / raw)
To: 29972
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
Does that mean this patch can't be merged until we've figured a way out by
changing `define-minor-mode` to introduce a new `buffer-minor-modes` buffer
local variable?
On Fri, Jan 5, 2018 at 7:59 PM, Noam Postavsky <
npostavs@users.sourceforge.net> wrote:
> On Fri, Jan 5, 2018 at 2:56 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> >> (I see describe-mode only takes minor modes which have function and
> >> variable using the same symbol)
> >
> > That happens automagically if one uses define-minor-mode, right?
>
> Except if you use its :variable option.
>
[-- Attachment #2: Type: text/html, Size: 974 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-08 12:43 ` Jimmy Yuen Ho Wong
@ 2018-01-08 18:54 ` Eli Zaretskii
[not found] ` <<83r2r06v1y.fsf@gnu.org>
1 sibling, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2018-01-08 18:54 UTC (permalink / raw)
To: Jimmy Yuen Ho Wong; +Cc: 29972
> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Mon, 8 Jan 2018 12:43:38 +0000
>
> Does that mean this patch can't be merged until we've figured a way out by changing `define-minor-mode` to
> introduce a new `buffer-minor-modes` buffer local variable?
We need to figure out some way for desktop.el to record
dired-hide-details-mode, either automatically or given user
customizations.
It's possible that looking at minor-mode-list (not minor-mode-alist!)
is such a way.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
[not found] ` <<83r2r06v1y.fsf@gnu.org>
@ 2018-01-08 19:08 ` Drew Adams
0 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2018-01-08 19:08 UTC (permalink / raw)
To: Eli Zaretskii, Jimmy Yuen Ho Wong; +Cc: 29972
> We need to figure out some way for desktop.el to record
> dired-hide-details-mode, either automatically or given user
> customizations.
>
> It's possible that looking at minor-mode-list (not minor-mode-alist!)
> is such a way.
Yes, that's no doubt possible. Perhaps it's also possible
to make changes to variable `dired-hide-details-mode' change
the mode. If so then you could just add that variable to
the default value of `desktop-locals-to-save'. And since
that's a user option, users could then control whether that's
the behavior they want, i.e., whether desktop should restore
whether details were shown/hidden.
^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session
2018-01-04 1:11 bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session Yuen Ho Wong
2018-01-04 16:42 ` Eli Zaretskii
@ 2022-04-17 18:22 ` Lars Ingebrigtsen
1 sibling, 0 replies; 18+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-17 18:22 UTC (permalink / raw)
To: Yuen Ho Wong; +Cc: 29972
Yuen Ho Wong <wyuenho@gmail.com> writes:
> How to reproduce:
> 1. Turn on `desktop-save-mode`
> 2. dired some directory
> 3. Press `(` to turn on `dired-hide-details-mode`
> 4. C-x C-c, when asked to save desktop, choose yes
> 5. Launch emacs again, desktop restored the dired buffer but not
> `dired-hide-details-mode`
>
> What went wrong:
> `dired-hide-details-mode`'s definition does not declare a lighter or a
> keymap, thus it is not added to `minor-mode-alist` by
> `define-minor-mode`. So when `desktop` tries to get the buffer's info to
> save to `.emacs.desktop` via `desktop-buffer-info`,
> `dired-hide-details-mode` does not exist, and thus not saved to the
> session file.
>
> Fix:
> Just declare an empty lighter. I've attached a patch for this.
I've fixed this in a differently way in Emacs 29 -- I'm using the
local-minor-modes variable instead, which does not depend on lighters
and keymaps.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2022-04-17 18:22 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04 1:11 bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session Yuen Ho Wong
2018-01-04 16:42 ` Eli Zaretskii
2018-01-05 13:08 ` Jimmy Yuen Ho Wong
2018-01-05 14:25 ` Eli Zaretskii
2018-01-05 15:02 ` Jimmy Yuen Ho Wong
2018-01-05 15:16 ` Eli Zaretskii
2018-01-05 17:42 ` Jimmy Yuen Ho Wong
2018-01-05 18:20 ` Eli Zaretskii
2018-01-05 18:29 ` Noam Postavsky
2018-01-05 18:37 ` Drew Adams
2018-01-05 19:41 ` Eli Zaretskii
2018-01-05 19:54 ` Noam Postavsky
2018-01-05 19:56 ` Eli Zaretskii
2018-01-05 19:59 ` Noam Postavsky
2018-01-08 12:43 ` Jimmy Yuen Ho Wong
2018-01-08 18:54 ` Eli Zaretskii
[not found] ` <<83r2r06v1y.fsf@gnu.org>
2018-01-08 19:08 ` Drew Adams
2022-04-17 18:22 ` Lars Ingebrigtsen
[not found] <<m28tdezavi.fsf@mobilecat.lan>
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).