update packages, fix
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
;; -*- no-byte-compile: t; lexical-binding: nil -*-
|
||||
(define-package "nerd-icons" "20251108.1545"
|
||||
(define-package "nerd-icons" "20251125.1823"
|
||||
"Emacs Nerd Font Icons Library."
|
||||
'((emacs "25.1"))
|
||||
:url "https://github.com/rainstormstudio/nerd-icons.el"
|
||||
:commit "940b28d3dbd134696ef448e906e42a87a9d61e20"
|
||||
:revdesc "940b28d3dbd1"
|
||||
:commit "772987a28d6408f840331c52c91d04b623a87048"
|
||||
:revdesc "772987a28d64"
|
||||
:keywords '("lisp")
|
||||
:authors '(("Hongyu Ding" . "rainstormstudio@yahoo.com")
|
||||
("Vincent Zhang" . "seagle0128@gmail.com"))
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
;; Author: Hongyu Ding <rainstormstudio@yahoo.com>, Vincent Zhang <seagle0128@gmail.com>
|
||||
;; Keywords: lisp
|
||||
;; Package-Version: 20251108.1545
|
||||
;; Package-Revision: 940b28d3dbd1
|
||||
;; Package-Version: 20251125.1823
|
||||
;; Package-Revision: 772987a28d64
|
||||
;; Package-Requires: ((emacs "25.1"))
|
||||
;; URL: https://github.com/rainstormstudio/nerd-icons.el
|
||||
;; Keywords: convenient, lisp
|
||||
@@ -1069,18 +1069,17 @@
|
||||
(defun nerd-icons-auto-mode-match? (&optional file)
|
||||
"Whether or not FILE's `major-mode' match against its `auto-mode-alist'."
|
||||
(let* ((file (or file (buffer-file-name) (buffer-name)))
|
||||
(auto-mode (nerd-icons-match-to-alist file auto-mode-alist)))
|
||||
(auto-mode (nerd-icons--auto-mode-lookup (file-name-nondirectory file))))
|
||||
(eq major-mode auto-mode)))
|
||||
|
||||
(defvar nerd-icons--file-cache (make-hash-table :test 'equal)
|
||||
"Cache for file extension to mode mapping.")
|
||||
(defun nerd-icons--auto-mode-lookup (file)
|
||||
"Return the mode-setting function associated with FILE via `auto-mode-alist'.
|
||||
NOTE: The mode-setting function may not be the same as the mode itself."
|
||||
(nerd-icons-match-to-alist file auto-mode-alist))
|
||||
|
||||
(defun nerd-icons-match-to-alist (file alist)
|
||||
"Match FILE against an entry in ALIST using `string-match'."
|
||||
(or (gethash file nerd-icons--file-cache)
|
||||
(puthash file
|
||||
(cdr (cl-find-if (lambda (it) (string-match (car it) file)) alist))
|
||||
nerd-icons--file-cache)))
|
||||
(defun nerd-icons-match-to-alist (string alist)
|
||||
"Match STRING against an entry in ALIST using `string-match'."
|
||||
(cdr (assoc string alist #'string-match)))
|
||||
|
||||
(defun nerd-icons-dir-is-submodule (dir)
|
||||
"Checker whether or not DIR is a git submodule."
|
||||
@@ -1285,23 +1284,25 @@ icon."
|
||||
(unless (get func 'nerd-icons--cached)
|
||||
(let ((cache (make-hash-table :test #'equal
|
||||
:size nerd-icons--cache-limit))
|
||||
(orig-fn (symbol-function func)))
|
||||
(orig-fn (symbol-function func))
|
||||
(unset (make-symbol "unset")))
|
||||
(fset func
|
||||
(lambda (&rest args)
|
||||
(or (gethash args cache)
|
||||
(progn
|
||||
(when (> (hash-table-count cache)
|
||||
nerd-icons--cache-limit)
|
||||
(clrhash cache))
|
||||
(puthash args (apply orig-fn args) cache)))))))
|
||||
|
||||
(put func 'nerd-icons--cached t))
|
||||
(let ((value (gethash args cache unset)))
|
||||
(when (eq value unset)
|
||||
(when (> (hash-table-count cache)
|
||||
nerd-icons--cache-limit)
|
||||
(clrhash cache))
|
||||
(setq value (puthash args (apply orig-fn args) cache)))
|
||||
value))))
|
||||
(put func 'nerd-icons--cached t)))
|
||||
|
||||
(nerd-icons-cache #'nerd-icons-icon-for-dir)
|
||||
(nerd-icons-cache #'nerd-icons-icon-for-file)
|
||||
(nerd-icons-cache #'nerd-icons-icon-for-extension)
|
||||
(nerd-icons-cache #'nerd-icons-icon-for-mode)
|
||||
(nerd-icons-cache #'nerd-icons-icon-for-url)
|
||||
(nerd-icons-cache #'nerd-icons--auto-mode-lookup)
|
||||
|
||||
;; Weather icons
|
||||
(defun nerd-icons-icon-for-weather (weather)
|
||||
@@ -1310,6 +1311,8 @@ icon."
|
||||
(when icon
|
||||
(apply (car icon) (cdr icon)))))
|
||||
|
||||
(nerd-icons-cache #'nerd-icons-icon-for-weather)
|
||||
|
||||
(eval-and-compile
|
||||
(defun nerd-icons--function-name (name)
|
||||
"Get the symbol for an icon function name for icon set NAME."
|
||||
|
||||
Reference in New Issue
Block a user