summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2016-07-05 08:33:29 +0300
committerDmitry Antipov <dmantipov@yandex.ru>2016-07-06 06:05:15 +0300
commita7e302dc1dc18770aaf9eeedfd638f73b574bc19 (patch)
tree7452f77ec6aa99f6155aafec4366eccaa28e0eb5
parentb1a64dba04146b1424eacd3bc363e5f0edeac2b2 (diff)
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'.
-rw-r--r--lisp/faces.el2
-rw-r--r--lisp/international/mule-diag.el2
-rw-r--r--lisp/menu-bar.el22
-rw-r--r--lisp/mouse.el8
-rw-r--r--lisp/scroll-bar.el8
5 files changed, 15 insertions, 27 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index d5fc3ce834..426de3b81d 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -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."
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index 731d6889ef..f543083b8c 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -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"))
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index a6541182e2..c4f094a179 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -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 ()
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 8d727536e0..53d5a22167 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -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)
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 838f9bf80c..e5fe31675d 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -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)