]> code.delx.au - gnu-emacs/commitdiff
Prefer 'frame-parameter' where it is expected to be a bit faster
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 5 Jul 2016 05:33:29 +0000 (08:33 +0300)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 6 Jul 2016 03:05:15 +0000 (06:05 +0300)
* 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'.

lisp/faces.el
lisp/international/mule-diag.el
lisp/menu-bar.el
lisp/mouse.el
lisp/scroll-bar.el

index d5fc3ce834b0919379f324426861524dfc8e1293..426de3b81dbfb065b6aeece50114d30920f4b5d1 100644 (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))
                           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."
 
 (defcustom font-list-limit 100
   "This variable is obsolete and has no effect."
index 731d6889ef5a3a9d69d93a5380ad99e066cbfaaf..f543083b8c5b18c9cca3cac9c1c93f95d602f352 100644 (file)
@@ -1114,7 +1114,7 @@ system which uses fontsets)."
       (insert "\n\n")
 
       (if window-system
       (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"))
            (insert "The font and fontset of the selected frame are:\n"
                    "     font: " font "\n"
                    "  fontset: " (face-attribute 'default :fontset) "\n"))
index a6541182e24ce073565dca0ad5e96053cd84e87a..c4f094a17933ad396fb0a39b84cac15766689277 100644 (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
   (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)
     (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)
 
     (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)
 
     (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)
 
     (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)
 
     (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 ()
     menu))
 
 (defun menu-bar-frame-for-menubar ()
index 8d727536e05e018b9b390006508d475697eff544..53d5a22167e95daf81e2e5bd7b140e4aca32c615 100644 (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))
       (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
 
     (let* ((exitfun nil)
            (move
@@ -1705,7 +1703,7 @@ and selects that window."
 ;; Font selection.
 
 (defun font-menu-add-default ()
 ;; 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)
         (font-alist x-fixed-font-alist)
         (elt (or (assoc "Misc" font-alist) (nth 1 font-alist))))
     (if (assoc "Default" elt)
index 838f9bf80cd1d717a4ea7974bf2cf61904e52e23..e5fe31675da3c199c037a80e614f4ae8b1de7214 100644 (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
   (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)
     (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
   (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)
     (setq arg (prefix-numeric-value arg)))
   (modify-frame-parameters
    (selected-frame)