Allow listing Emoji from a read-only buffer

* lisp/international/emoji.el (emoji-list): Don't barf here if the
original buffer is read-inly...
(emoji-list-select): ...barf here instead.  (Bug#67400)
(emoji-list): Doc fix.
This commit is contained in:
Eli Zaretskii 2023-11-23 16:07:31 +02:00
parent 8256bf4cdf
commit dfb3dcb404

View file

@ -103,11 +103,11 @@ and also consults the `emoji-alternate-names' alist."
;;;###autoload ;;;###autoload
(defun emoji-list () (defun emoji-list ()
"List emojis and insert the one that's selected. "List emojis and allow selecting and inserting one of them.
Select the emoji by typing \\<emoji-list-mode-map>\\[emoji-list-select] on its picture. Select the emoji by typing \\<emoji-list-mode-map>\\[emoji-list-select] on its picture.
The glyph will be inserted into the buffer that was current The glyph will be inserted into the buffer that was current
when the command was invoked." when the command was invoked."
(interactive "*") (interactive)
(let ((buf (current-buffer))) (let ((buf (current-buffer)))
(emoji--init) (emoji--init)
(switch-to-buffer (get-buffer-create "*Emoji*")) (switch-to-buffer (get-buffer-create "*Emoji*"))
@ -219,7 +219,9 @@ the name is not known."
(let ((buf emoji--insert-buffer)) (let ((buf emoji--insert-buffer))
(quit-window) (quit-window)
(if (buffer-live-p buf) (if (buffer-live-p buf)
(switch-to-buffer buf) (progn
(switch-to-buffer buf)
(barf-if-buffer-read-only))
(error "Buffer disappeared")))))) (error "Buffer disappeared"))))))
(if (not derived) (if (not derived)
;; Glyph without derivations. ;; Glyph without derivations.