Make emoji--recent use multisession variables
* lisp/international/emoji.el (emoji--recent): Make into a multisession variable. (emoji-recent, emoji--recent-transient): Use it. (emoji--add-recent): Update it.
This commit is contained in:
parent
3fd9d48f9b
commit
35dbc79cc3
1 changed files with 12 additions and 8 deletions
|
@ -30,6 +30,7 @@
|
|||
(require 'cl-lib)
|
||||
(require 'cl-extra)
|
||||
(require 'transient)
|
||||
(require 'multisession)
|
||||
|
||||
(defgroup emoji nil
|
||||
"Inserting Emojis."
|
||||
|
@ -59,7 +60,7 @@
|
|||
(defvar emoji--derived nil)
|
||||
(defvar emoji--names (make-hash-table :test #'equal))
|
||||
(defvar emoji--done-derived nil)
|
||||
(defvar emoji--recent (list "😀" "😖"))
|
||||
(define-multisession-variable emoji--recent (list "😀" "😖"))
|
||||
(defvar emoji--insert-buffer)
|
||||
|
||||
;;;###autoload
|
||||
|
@ -83,7 +84,7 @@ of a visual interface."
|
|||
(unless (fboundp 'emoji--command-Emoji)
|
||||
(emoji--define-transient))
|
||||
(funcall (emoji--define-transient
|
||||
(cons "Recent" emoji--recent) t)))
|
||||
(cons "Recent" (multisession-value emoji--recent)) t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun emoji-search ()
|
||||
|
@ -529,15 +530,18 @@ character) under point is."
|
|||
(lambda ()
|
||||
(interactive)
|
||||
(funcall (emoji--define-transient
|
||||
(cons "Recent" emoji--recent) t end-function))))
|
||||
(cons "Recent" (multisession-value emoji--recent))
|
||||
t end-function))))
|
||||
|
||||
(defun emoji--add-recent (glyph)
|
||||
"Add GLYPH to the set of recently used emojis."
|
||||
(setq emoji--recent (delete glyph emoji--recent))
|
||||
(push glyph emoji--recent)
|
||||
;; Shorten the list.
|
||||
(when-let ((tail (nthcdr 30 emoji--recent)))
|
||||
(setcdr tail nil)))
|
||||
(let ((recent (multisession-value emoji--recent)))
|
||||
(setq recent (delete glyph recent))
|
||||
(push glyph recent)
|
||||
;; Shorten the list.
|
||||
(when-let ((tail (nthcdr 30 recent)))
|
||||
(setcdr tail nil))
|
||||
(setf (multisession-value emoji--recent) recent)))
|
||||
|
||||
(defun emoji--columnize (list columns)
|
||||
"Split LIST into COLUMN columns."
|
||||
|
|
Loading…
Add table
Reference in a new issue