2

I use desktop-save and desktop-change-dir a lot. Recently, I upgraded my hardware and now have a screen with way more DPI. This forced me to increase the font size in emacs.

Unfortunately, all my desktop files contain a font definition:

(setq desktop-saved-frameset [frameset 1 (22300 50983 182648 566000) (desktop . "206") "horazont@sinistra.sotecware.net" nil nil ((((font-backend xft x) (font . "-unknown-DejaVu Sans Mono-normal-normal-normal-*-11-*-*-*-m-0-iso10646-1") (font-parameter) […]

Is there a way to make emacs ignore the font from desktop files, and ideally, not store it there at all?

I could hack up a sed-call to fix my desktop files, but I really would prefer emacs not to save the font at all.

0

One way to do it is to hook desktop-after-read-hook in ~/.emacs to set the desired face after loading a desktop file.

(defun fix-face ()
  "fix the face after desktop-change-dir"
  (custom-set-faces
   '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 100 :width normal :foundry "unknown" :family "Hack")))))
  )
(add-hook 'desktop-after-read-hook 'fix-face)

This duplicates setting the face and is not found by customize-variable, so unfortunately it requires manual fiddling with the .emacs file whenever the default face has to be changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.