1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Prefer 'frame-parameter' where it is expected to be a bit faster

* lisp/international/mule-diag.el (mule-diag):
* lisp/menu-bar.el (menu-bar-showhide-scroll-bar-menu):
* lisp/mouse.el (mouse-drag-line, font-menu-add-default):
* lisp/scroll-bar.el (toggle-scroll-bar, toggle-horizontal-scroll-bar):
* lisp/faces.el (x-resolve-font-name): Use 'frame-parameter'.
This commit is contained in:
Dmitry Antipov 2016-07-05 08:33:29 +03:00
parent b1a64dba04
commit a7e302dc1d
5 changed files with 15 additions and 27 deletions

View file

@ -2881,7 +2881,7 @@ also the same size as FACE on FRAME, or fail."
pattern face)))
(error "No fonts match `%s'" pattern)))
(car fonts))
(cdr (assq 'font (frame-parameters (selected-frame))))))
(frame-parameter nil 'font)))
(defcustom font-list-limit 100
"This variable is obsolete and has no effect."

View file

@ -1114,7 +1114,7 @@ system which uses fontsets)."
(insert "\n\n")
(if window-system
(let ((font (cdr (assq 'font (frame-parameters)))))
(let ((font (frame-parameter nil 'font)))
(insert "The font and fontset of the selected frame are:\n"
" font: " font "\n"
" fontset: " (face-attribute 'default :fontset) "\n"))

View file

@ -989,49 +989,43 @@ The selected font will be the default on both the existing and future frames."
(customize-set-variable 'horizontal-scroll-bar-mode nil))
(defvar menu-bar-showhide-scroll-bar-menu
(let ((menu (make-sparse-keymap "Scroll-bar")))
(let ((menu (make-sparse-keymap "Scroll-bar"))
(vsb (frame-parameter nil 'vertical-scroll-bars))
(hsb (frame-parameter nil 'horizontal-scroll-bars)))
(bindings--define-key menu [horizontal]
'(menu-item "Horizontal"
menu-bar-horizontal-scroll-bar
:help "Horizontal scroll bar"
:visible (horizontal-scroll-bars-available-p)
:button (:radio . (cdr (assq 'horizontal-scroll-bars
(frame-parameters))))))
:button (:radio . hsb)))
(bindings--define-key menu [none-horizontal]
'(menu-item "None-horizontal"
menu-bar-no-horizontal-scroll-bar
:help "Turn off horizontal scroll bars"
:visible (horizontal-scroll-bars-available-p)
:button (:radio . (not (cdr (assq 'horizontal-scroll-bars
(frame-parameters)))))))
:button (:radio . (not hsb))))
(bindings--define-key menu [right]
'(menu-item "On the Right"
menu-bar-right-scroll-bar
:help "Scroll-bar on the right side"
:visible (display-graphic-p)
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars
(frame-parameters)))
'right))))
:button (:radio . (eq vsb 'right))))
(bindings--define-key menu [left]
'(menu-item "On the Left"
menu-bar-left-scroll-bar
:help "Scroll-bar on the left side"
:visible (display-graphic-p)
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars
(frame-parameters)))
'left))))
:button (:radio . (eq vsb 'left))))
(bindings--define-key menu [none]
'(menu-item "None"
menu-bar-no-scroll-bar
:help "Turn off scroll-bar"
:visible (display-graphic-p)
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars
(frame-parameters)))
nil))))
:button (:radio . (nilp vsb))))
menu))
(defun menu-bar-frame-for-menubar ()

View file

@ -420,10 +420,8 @@ must be one of the symbols `header', `mode', or `vertical'."
(let ((divider-width (frame-right-divider-width frame)))
(when (and (or (not (numberp divider-width))
(zerop divider-width))
(eq (cdr (assq 'vertical-scroll-bars
(frame-parameters frame)))
'left))
(setq window (window-in-direction 'left window t))))))
(eq (frame-parameter frame 'vertical-scroll-bars) 'left))
(setq window (window-in-direction 'left window t))))))
(let* ((exitfun nil)
(move
@ -1705,7 +1703,7 @@ and selects that window."
;; Font selection.
(defun font-menu-add-default ()
(let* ((default (cdr (assq 'font (frame-parameters (selected-frame)))))
(let* ((default (frame-parameter nil 'font))
(font-alist x-fixed-font-alist)
(elt (or (assoc "Misc" font-alist) (nth 1 font-alist))))
(if (assoc "Default" elt)

View file

@ -183,9 +183,7 @@ when they are turned on; if it is nil, they go on the left."
(interactive "P")
(if (null arg)
(setq arg
(if (cdr (assq 'vertical-scroll-bars
(frame-parameters (selected-frame))))
-1 1))
(if (frame-parameter nil 'vertical-scroll-bars) -1 1))
(setq arg (prefix-numeric-value arg)))
(modify-frame-parameters
(selected-frame)
@ -199,9 +197,7 @@ With ARG, turn vertical scroll bars on if and only if ARG is positive."
(interactive "P")
(if (null arg)
(setq arg
(if (cdr (assq 'horizontal-scroll-bars
(frame-parameters (selected-frame))))
-1 1))
(if (frame-parameter nil 'horizontal-scroll-bars) -1 1))
(setq arg (prefix-numeric-value arg)))
(modify-frame-parameters
(selected-frame)