emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About desktop file


From: Angelo Graziosi
Subject: Re: About desktop file
Date: Sun, 11 Sep 2016 22:13:25 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0



Il 11/09/2016 18:34, Eli Zaretskii ha scritto:
From: Angelo Graziosi <address@hidden>
Date: Sun, 11 Sep 2016 10:31:41 +0200

The 'desktop' file is very useful but sometimes it remembers too many
things..

Suppose I am using "foo" font in my init.el file:

(set-face-attribute 'default nil :font "foo 13" )
(set-frame-font "foo 13" nil t)

and that I am working with many buffers. Now suppose I change the font
to use 'bar' font:

(set-face-attribute 'default nil :font "bar13" )
(set-frame-font "bar 13" nil t)

When I restart Emacs, it loads the buffers with the old 'foo' font.

I don't think I can reproduce this.  But since you didn't show the
full recipe, I cannot be sure I did what you did.

Are you saying that the old font was recorded in the desktop file, but
the new one isn't?  How is that possible?  Why would the old font end
up being recorded in the desktop file, but not the new one?

Maybe you changed the font outside the Emacs session, just by editing
the init.el file?  In that case, you should change the font inside the
session, and then save the desktop, then the information in the
desktop file will be updated for the next restart.

No no no. I didn't change anything. This is a recipe:

Save you current ~/.emacs.d folder then create an empty one:

mkdir .emacs.d

and put there this init.el file

$ cat init.el

(set-face-attribute 'default nil :font "Source Code Pro 13" )
(set-frame-font "Source Code Pro 13" nil t)

;; Instead of saving on ~/.emacs.desktop
(setq desktop-base-file-name "~/.emacs.d/desktop")

;; Instead of saving on ~/.emacs.desktop.lock
(setq desktop-base-lock-name "~/.emacs.d/desktop.lock")

;; Save desktop
(desktop-save-mode 1)


Now start Emacs and visit, for example, init.el. Quit Emacs saving the desktop.

Restart Emacs. It reload init.el and the font used is right, Source Code Pro. This is confirmed in Options | Set default font.

Now, in the init.el file, change "Source Code Pro 13" with, for example, "Lucida Console 13". Quit Emacs. Restart Emacs. It reload init.el but displays it with "Source Code Pro" NOT with the font we have set in the init.el file, and Options | Set default font still shows it is using Source Code Pro. I would expect the buffer is rendered with the font we have set in the init.el file.

Now if you quit Emacs and rename the desktop file,

mv desktop desktop-save

the next time you start Emacs, it starts without desktop file and scratch buffer and all the other visited buffers, hereafter, are rendered with Lucida Console, i.e. the font we have set in init.el. Also Options | Set default font confirms the new font is used, now.

The desktop file stores the font even if init.el says to use another one,

$ grep Source desktop-save
(setq desktop-saved-frameset [frameset 1 (22485 45444 720000 0) (desktop . "208") [...] (font-backend uniscribe gdi) (font . "-outline-Source Code Pro-normal-normal-normal-mono-17-*-*-*-c-*-iso8859-1") (border-width . 2) (internal-border-width . 0)[...]

My opinion is that desktop file should not register this information, the font used should be always what is set in the initialization file.. otherwise why it is called "initialization" file?

But this is only my opinion..


Ciao,
Angelo.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]