mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-04 11:40:22 +00:00
(menu-set-font): New function. Bind "Set Default
Font" menu item to it. Apply selected font to all frames, and make it savable. (menu-bar-options-save): Save `default' font if changed.
This commit is contained in:
parent
848767de39
commit
ba858bf98d
@ -627,6 +627,22 @@ by \"Save Options\" in Custom buffers.")
|
||||
:button (:toggle . (and (default-boundp ',variable)
|
||||
(default-value ',variable))))))
|
||||
|
||||
;; Function for setting/saving default font.
|
||||
|
||||
(defun menu-set-font ()
|
||||
"Interactively select a font and make it the default."
|
||||
(interactive)
|
||||
(let ((font (if (functionp 'x-font-dialog)
|
||||
(x-font-dialog)
|
||||
(mouse-select-font)))
|
||||
spec)
|
||||
(when font
|
||||
(set-face-attribute 'default nil :font font)
|
||||
(setq spec (list (list t (face-attr-construct 'default))))
|
||||
(put 'default 'customized-face spec)
|
||||
(custom-push-theme 'theme-face 'default 'user 'set spec)
|
||||
(put 'default 'face-modified nil))))
|
||||
|
||||
;;; Assemble all the top-level items of the "Options" menu
|
||||
(define-key menu-bar-options-menu [customize]
|
||||
(list 'menu-item "Customize Emacs" menu-bar-custom-menu))
|
||||
@ -660,6 +676,8 @@ by \"Save Options\" in Custom buffers.")
|
||||
(and (get elt 'customized-value)
|
||||
(customize-mark-to-save elt)
|
||||
(setq need-save t)))
|
||||
(and (get 'default 'customized-face)
|
||||
(put 'default 'saved-face (get 'default 'customized-face)))
|
||||
;; Save if we changed anything.
|
||||
(when need-save
|
||||
(custom-save-all))))
|
||||
@ -671,10 +689,10 @@ by \"Save Options\" in Custom buffers.")
|
||||
(define-key menu-bar-options-menu [custom-separator]
|
||||
'("--"))
|
||||
|
||||
(define-key menu-bar-options-menu [mouse-set-font]
|
||||
'(menu-item "Set Font/Fontset..." mouse-set-font
|
||||
:visible (display-multi-font-p)
|
||||
:help "Select a font from list of known fonts/fontsets"))
|
||||
(define-key menu-bar-options-menu [menu-set-font]
|
||||
'(menu-item "Set Default Font..." menu-set-font
|
||||
:visible (display-multi-font-p)
|
||||
:help "Select a default font"))
|
||||
|
||||
;; The "Show/Hide" submenu of menu "Options"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user