[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Redisplay slower in Emacs 28 than Emacs 27
From: |
Lars Ingebrigtsen |
Subject: |
Re: Redisplay slower in Emacs 28 than Emacs 27 |
Date: |
Tue, 08 Dec 2020 00:48:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
It's getting a bit late, I think. This is the one! For sure:
diff --git a/lisp/image.el b/lisp/image.el
index 9ebb603086..4b6710e4a3 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -679,8 +679,10 @@ image-search-load-path
(setq path (cdr path)))
(if found filename)))
+(defvar find-image--cache (make-hash-table :test #'equal))
+
;;;###autoload
-(defun find-image (specs)
+(defun find-image (specs &optional cache)
"Find an image, choosing one of a list of image specifications.
SPECS is a list of image specifications.
@@ -698,23 +700,28 @@ find-image
The image is looked for in `image-load-path'.
Image files should not be larger than specified by `max-image-size'."
- (let (image)
- (while (and specs (null image))
- (let* ((spec (car specs))
- (type (plist-get spec :type))
- (data (plist-get spec :data))
- (file (plist-get spec :file))
- found)
- (when (image-type-available-p type)
- (cond ((stringp file)
- (if (setq found (image-search-load-path file))
- (setq image
- (cons 'image (plist-put (copy-sequence spec)
- :file found)))))
- ((not (null data))
- (setq image (cons 'image spec)))))
- (setq specs (cdr specs))))
- image))
+ (or (and cache
+ (gethash specs find-image--cache))
+ (let ((orig-specs specs)
+ image)
+ (while (and specs (null image))
+ (let* ((spec (car specs))
+ (type (plist-get spec :type))
+ (data (plist-get spec :data))
+ (file (plist-get spec :file))
+ found)
+ (when (image-type-available-p type)
+ (cond ((stringp file)
+ (if (setq found (image-search-load-path file))
+ (setq image
+ (cons 'image (plist-put (copy-sequence spec)
+ :file found)))))
+ ((not (null data))
+ (setq image (cons 'image spec)))))
+ (setq specs (cdr specs))))
+ (when cache
+ (setf (gethash orig-specs find-image--cache) image))
+ image)))
;;;###autoload
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 8456216430..37f42be3f4 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -159,7 +159,8 @@ tool-bar--image-expression
((< (display-color-cells) 256)
',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec))
(t
- ',(list xpm-spec pbm-spec xbm-spec))))))
+ ',(list xpm-spec pbm-spec xbm-spec)))
+ t)))
;;;###autoload
(defun tool-bar-local-item (icon def key map &rest props)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: Redisplay slower in Emacs 28 than Emacs 27, (continued)
- Re: Redisplay slower in Emacs 28 than Emacs 27, Gregory Heytings, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Gregory Heytings, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Gregory Heytings, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Gregory Heytings, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Gregory Heytings, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27,
Lars Ingebrigtsen <=
- Re: Redisplay slower in Emacs 28 than Emacs 27, Gregory Heytings, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/07
- Re: Redisplay slower in Emacs 28 than Emacs 27, João Távora, 2020/12/08
- Re: Redisplay slower in Emacs 28 than Emacs 27, Eli Zaretskii, 2020/12/08
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/08
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/08
- Re: Redisplay slower in Emacs 28 than Emacs 27, Eli Zaretskii, 2020/12/08
- Re: Redisplay slower in Emacs 28 than Emacs 27, Lars Ingebrigtsen, 2020/12/08