Subject: 25.3; dired-hide-details-mode does not persist in desktop session

From: Yuen Ho Wong <[email-masked]>
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.

>From 49b10c2f4b17809d0b34354699e6a1a35d7be785 Mon Sep 17 00:00:00 2001
From: Jimmy Yuen Ho Wong <[email-masked]>
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

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