From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jimmy Yuen Ho Wong Newsgroups: gmane.emacs.bugs Subject: bug#29972: 25.3; dired-hide-details-mode does not persist in desktop session Date: Fri, 5 Jan 2018 13:08:35 +0000 Message-ID: References: <83d12pbmol.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a114984fca55dda0562072630" X-Trace: blaine.gmane.org 1515157701 1878 195.159.176.226 (5 Jan 2018 13:08:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 5 Jan 2018 13:08:21 +0000 (UTC) Cc: 29972@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 05 14:08:17 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXRjH-0008F2-SG for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Jan 2018 14:08:12 +0100 Original-Received: from localhost ([::1]:39217 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXRlH-0004Qc-0s for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Jan 2018 08:10:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXRl8-0004No-38 for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2018 08:10:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXRl4-0001S9-2w for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2018 08:10:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXRl3-0001S3-Va for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2018 08:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eXRl3-0008DY-Pc for bug-gnu-emacs@gnu.org; Fri, 05 Jan 2018 08:10:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jimmy Yuen Ho Wong Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jan 2018 13:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29972 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29972-submit@debbugs.gnu.org id=B29972.151515774331515 (code B ref 29972); Fri, 05 Jan 2018 13:10:01 +0000 Original-Received: (at 29972) by debbugs.gnu.org; 5 Jan 2018 13:09:03 +0000 Original-Received: from localhost ([127.0.0.1]:36392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXRk7-0008CF-K6 for submit@debbugs.gnu.org; Fri, 05 Jan 2018 08:09:03 -0500 Original-Received: from mail-wm0-f51.google.com ([74.125.82.51]:39275) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXRk6-0008Bj-5L for 29972@debbugs.gnu.org; Fri, 05 Jan 2018 08:09:02 -0500 Original-Received: by mail-wm0-f51.google.com with SMTP id i11so2378974wmf.4 for <29972@debbugs.gnu.org>; Fri, 05 Jan 2018 05:09:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+dosd5imfcLzG2gj5CkLMeUdwIshVY2nD81xaNBudSw=; b=PBD74zNe4UXT4mf8Kv4Nh30xNT4ckhQrOMJxoUpWgyo7qePeA0YFh9NgXowrCa/45p 9IFGmtCIlpfKRbrp/zhBL0ZdVTQJcnwb0jwyt+Svc9QxqeA05Sa/GcieOJcef+iNBaVP OzNkgqfJHORPA7qVcXdfJr7zCnrBwpykkZlvNjC4V3sQsnLn9K23Oh0fwiyheB8r6Pyj rcBBjK0nGuRoO2osYIjOnkYBizZ6pSNoSx63r6q741ZQKsLBprlNZsyOLrxGGJL5exVQ P1wai26+eQE8dkuhH5acfZ3npnRY0YS6lV33T3ffepfZscE9EvdEpMDeLy4nWJKloiVX /dyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+dosd5imfcLzG2gj5CkLMeUdwIshVY2nD81xaNBudSw=; b=grEubS7F80t2INkOvYaCiEVcc6PTEeL/6aVTT2WxDYx/aFS2Md63j49y38ZP6Kx7KE eEiQO1aNJeDYqJCloCoHShop/yYwA9cps8nLhmw0BRqWEchjpX2m72h53IIR9MkV5JRg ojuGA5gESxc5auRc5VschMFMK9qw2bBQMW5JcUiBHT6Tdk/8dF7HQPEopK5POZ/dg1KZ ocBN+R2cIzXXJd+/ckStHEEsEB8NPhkD+phA0mb/rStWc5alR7ExjceZoGCyZu/h/pH2 RIMxSyKQqJGW7l/4PamDb/XCoa8VNsTZl4AYiPCUvJywFwsCOwa799myzAHgOFHEPyjG burg== X-Gm-Message-State: AKGB3mLv87IsOQmEy6/MJ4fTuyOlg+NyauI1puEq8gbi/h+B1f6ZxEAh 0A3Q52hNUlfLOTzzRa8M1ZkrgBDVjrRYuvSVQ0g= X-Google-Smtp-Source: ACJfBosOuhfstn7QmKKSEYM8edJ7rxLRCLnO5eXY+Di4NaV+FJxzGNk8dz5O1gelMRXW8mh9zqPD1Z7BpQOJDKVeotA= X-Received: by 10.28.142.2 with SMTP id q2mr2459079wmd.33.1515157736216; Fri, 05 Jan 2018 05:08:56 -0800 (PST) Original-Received: by 10.223.196.199 with HTTP; Fri, 5 Jan 2018 05:08:35 -0800 (PST) In-Reply-To: <83d12pbmol.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141794 Archived-At: --001a114984fca55dda0562072630 Content-Type: text/plain; charset="UTF-8" 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 wrote: > > From: Yuen Ho Wong > > 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? > --001a114984fca55dda0562072630 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I don't believe so. I've looked at a number of app= roaches.

1. `desktop-minor-mode-handlers` on desktop-rea= d
=C2=A0 =C2=A0 Not going to be consulted unless `dired-hide-deta= ils-mode` is saved as a buffer minor mode.
2. `desktop-minor-mode= -table` on desktop-save
=C2=A0 =C2=A0 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`
=C2=A0 =C2=A0 T= his does save the minor mode local variable to the desktop file, but deskto= p won't be able to restore the minor mode because minor modes are activ= ated before buffer local variables are restored, not after.

<= /div>
So the only choices left to me are:
- :lighter "&q= uot;
- (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.

<= /div>
Jimmy Wong

On Thu, Jan 4, 2018 at 4:42 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> From: Yuen Ho Wo= ng <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 i= nfo 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?

--001a114984fca55dda0562072630--