aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-11-04 06:38:22 +0100
committerLars Ingebrigtsen2021-11-04 06:38:22 +0100
commit1b2588998ac2e1b622a8e65be4951e4e5d5a8dc9 (patch)
tree92851b10b54a620215863ec45c11f069f530878c
parent742879f1b3d51a405971b845bba64a7f71979b8c (diff)
downloademacs-1b2588998ac2e1b622a8e65be4951e4e5d5a8dc9.tar.gz
emacs-1b2588998ac2e1b622a8e65be4951e4e5d5a8dc9.zip
Add a Gnus command to emojize symbols
* doc/misc/gnus.texi (Article Display): Document it. * lisp/gnus/gnus-art.el (gnus-treat-emojize-symbols): New user option. (gnus-treatment-function-alist): Map. (article-emojize-symbols): New command and keystroke.
-rw-r--r--doc/misc/gnus.texi9
-rw-r--r--etc/NEWS12
-rw-r--r--lisp/gnus/gnus-art.el30
-rw-r--r--lisp/gnus/gnus-sum.el1
-rw-r--r--lisp/gnus/gnus.el1
5 files changed, 53 insertions, 0 deletions
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index 6c892bc80a9..796bb3bac84 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -9843,6 +9843,13 @@ Gravatarify the @code{From} header (@code{gnus-treat-from-gravatar}).
9843Gravatarify all mail headers (i.e., @code{Cc}, @code{To}) 9843Gravatarify all mail headers (i.e., @code{Cc}, @code{To})
9844(@code{gnus-treat-from-gravatar}). 9844(@code{gnus-treat-from-gravatar}).
9845 9845
9846@item W D e
9847@kindex W D e @r{(Summary)}
9848@findex gnus-article-emojize-symbols
9849Some symbols have both a non-emoji presentation and an emoji
9850presentation. This command will make Gnus choose the emoji presentation
9851(@code{gnus-article-emojize-symbols}).
9852
9846@item W D D 9853@item W D D
9847@kindex W D D @r{(Summary)} 9854@kindex W D D @r{(Summary)}
9848@findex gnus-article-remove-images 9855@findex gnus-article-remove-images
@@ -12185,6 +12192,7 @@ controlling variable is a predicate list, as described above.
12185@vindex gnus-treat-capitalize-sentences 12192@vindex gnus-treat-capitalize-sentences
12186@vindex gnus-treat-overstrike 12193@vindex gnus-treat-overstrike
12187@vindex gnus-treat-strip-cr 12194@vindex gnus-treat-strip-cr
12195@vindex gnus-treat-emojize-symbols
12188@vindex gnus-treat-strip-headers-in-body 12196@vindex gnus-treat-strip-headers-in-body
12189@vindex gnus-treat-strip-leading-blank-lines 12197@vindex gnus-treat-strip-leading-blank-lines
12190@vindex gnus-treat-strip-multiple-blank-lines 12198@vindex gnus-treat-strip-multiple-blank-lines
@@ -12237,6 +12245,7 @@ possible but those listed are probably sufficient for most people.
12237@item gnus-treat-capitalize-sentences (t, integer) 12245@item gnus-treat-capitalize-sentences (t, integer)
12238@item gnus-treat-overstrike (t, integer) 12246@item gnus-treat-overstrike (t, integer)
12239@item gnus-treat-strip-cr (t, integer) 12247@item gnus-treat-strip-cr (t, integer)
12248@item gnus-treat-emojize-symbols (t, integer)
12240@item gnus-treat-strip-headers-in-body (t, integer) 12249@item gnus-treat-strip-headers-in-body (t, integer)
12241@item gnus-treat-strip-leading-blank-lines (t, first, integer) 12250@item gnus-treat-strip-leading-blank-lines (t, first, integer)
12242@item gnus-treat-strip-multiple-blank-lines (t, integer) 12251@item gnus-treat-strip-multiple-blank-lines (t, integer)
diff --git a/etc/NEWS b/etc/NEWS
index 8161c5b4c5c..bd5dbf16e9a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -157,6 +157,18 @@ change the terminal used on a remote host.
157*** New user option 'mml-attach-file-at-the-end'. 157*** New user option 'mml-attach-file-at-the-end'.
158If non-nil, 'C-c C-a' will put attached files at the end of the message. 158If non-nil, 'C-c C-a' will put attached files at the end of the message.
159 159
160** Gnus
161
162+++
163*** New user option 'gnus-treat-emojize-symbols'.
164If non-nil, symbols that have an emoji representation will be
165displayed as emojis.
166
167+++
168*** New command 'gnus-article-emojize-symbols'.
169This is bound to 'W D e' and will display symbols that have emoji
170representation as emojis.
171
160** EIEIO 172** EIEIO
161 173
162+++ 174+++
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 6b33680871a..89b4a63ad92 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1167,6 +1167,19 @@ predicate. See Info node `(gnus)Customizing Articles'."
1167 :link '(custom-manual "(gnus)Customizing Articles") 1167 :link '(custom-manual "(gnus)Customizing Articles")
1168 :type gnus-article-treat-custom) 1168 :type gnus-article-treat-custom)
1169 1169
1170(defcustom gnus-treat-emojize-symbols nil
1171 "Display emoji versions of symbol.
1172Some symbols have both a non-emoji presentation and an emoji
1173presentation. This treatment will make Gnus display the latter
1174as emojis even when they weren't sent as such.
1175
1176Valid values are nil, t, `head', `first', `last', an integer or a
1177predicate. See Info node `(gnus)Customizing Articles'."
1178 :version "29.1"
1179 :group 'gnus-article-treat
1180 :link '(custom-manual "(gnus)Customizing Articles")
1181 :type gnus-article-treat-custom)
1182
1170(defcustom gnus-treat-unsplit-urls nil 1183(defcustom gnus-treat-unsplit-urls nil
1171 "Remove newlines from within URLs. 1184 "Remove newlines from within URLs.
1172Valid values are nil, t, `head', `first', `last', an integer or a 1185Valid values are nil, t, `head', `first', `last', an integer or a
@@ -1650,6 +1663,7 @@ regexp."
1650(defvar gnus-article-mime-handle-alist-1 nil) 1663(defvar gnus-article-mime-handle-alist-1 nil)
1651(defvar gnus-treatment-function-alist 1664(defvar gnus-treatment-function-alist
1652 '((gnus-treat-strip-cr gnus-article-remove-cr) 1665 '((gnus-treat-strip-cr gnus-article-remove-cr)
1666 (gnus-treat-emojize-symbols gnus-article-emojize-symbols)
1653 (gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig) 1667 (gnus-treat-x-pgp-sig gnus-article-verify-x-pgp-sig)
1654 (gnus-treat-strip-banner gnus-article-strip-banner) 1668 (gnus-treat-strip-banner gnus-article-strip-banner)
1655 (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body) 1669 (gnus-treat-strip-headers-in-body gnus-article-strip-headers-in-body)
@@ -2360,6 +2374,20 @@ fill width."
2360 (while (search-forward "\r" nil t) 2374 (while (search-forward "\r" nil t)
2361 (replace-match "\n" t t))))) 2375 (replace-match "\n" t t)))))
2362 2376
2377(defun article-emojize-symbols ()
2378 "Display symbols (that have an emoji version) as emojis."
2379 (interactive nil gnus-article-mode)
2380 (when-let ((font (and (display-multi-font-p)
2381 (car (internal-char-font nil ?😀)))))
2382 (save-excursion
2383 (let ((inhibit-read-only t))
2384 (goto-char (point-min))
2385 (while (re-search-forward "[[:multibyte:]]" nil t)
2386 ;; If there's already a grapheme cluster here, skip it.
2387 (when (and (not (find-composition (point)))
2388 (font-has-char-p font (char-after (match-beginning 0))))
2389 (insert "\N{VARIATION SELECTOR-16}")))))))
2390
2363(defun article-remove-trailing-blank-lines () 2391(defun article-remove-trailing-blank-lines ()
2364 "Remove all trailing blank lines from the article." 2392 "Remove all trailing blank lines from the article."
2365 (interactive nil gnus-article-mode) 2393 (interactive nil gnus-article-mode)
@@ -4341,6 +4369,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
4341 article-fill-long-lines 4369 article-fill-long-lines
4342 article-capitalize-sentences 4370 article-capitalize-sentences
4343 article-remove-cr 4371 article-remove-cr
4372 article-emojize-symbols
4344 article-remove-leading-whitespace 4373 article-remove-leading-whitespace
4345 article-display-x-face 4374 article-display-x-face
4346 article-display-face 4375 article-display-face
@@ -4448,6 +4477,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
4448 ["Treat overstrike" gnus-article-treat-overstrike t] 4477 ["Treat overstrike" gnus-article-treat-overstrike t]
4449 ["Treat ANSI sequences" gnus-article-treat-ansi-sequences t] 4478 ["Treat ANSI sequences" gnus-article-treat-ansi-sequences t]
4450 ["Remove carriage return" gnus-article-remove-cr t] 4479 ["Remove carriage return" gnus-article-remove-cr t]
4480 ["Emojize Symbols" gnus-article-emojize-symbols t]
4451 ["Remove leading whitespace" gnus-article-remove-leading-whitespace t] 4481 ["Remove leading whitespace" gnus-article-remove-leading-whitespace t]
4452 ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t] 4482 ["Remove quoted-unreadable" gnus-article-de-quoted-unreadable t]
4453 ["Remove base64" gnus-article-de-base64-unreadable t] 4483 ["Remove base64" gnus-article-de-base64-unreadable t]
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index f7385d19c8d..3beeace8979 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -2267,6 +2267,7 @@ increase the score of each group you read."
2267 "x" #'gnus-article-display-x-face 2267 "x" #'gnus-article-display-x-face
2268 "d" #'gnus-article-display-face 2268 "d" #'gnus-article-display-face
2269 "s" #'gnus-treat-smiley 2269 "s" #'gnus-treat-smiley
2270 "e" #'gnus-article-emojize-symbols
2270 "D" #'gnus-article-remove-images 2271 "D" #'gnus-article-remove-images
2271 "W" #'gnus-article-show-images 2272 "W" #'gnus-article-show-images
2272 "F" #'gnus-article-toggle-fonts 2273 "F" #'gnus-article-toggle-fonts
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index dbbbb71e57f..9b3181fd4d0 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -2660,6 +2660,7 @@ are always t.")
2660 gnus-article-hide-headers gnus-article-hide-boring-headers 2660 gnus-article-hide-headers gnus-article-hide-boring-headers
2661 gnus-article-treat-overstrike 2661 gnus-article-treat-overstrike
2662 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines 2662 gnus-article-remove-cr gnus-article-remove-trailing-blank-lines
2663 gnus-article-emojize-symbols
2663 gnus-article-display-x-face gnus-article-de-quoted-unreadable 2664 gnus-article-display-x-face gnus-article-de-quoted-unreadable
2664 gnus-article-de-base64-unreadable 2665 gnus-article-de-base64-unreadable
2665 gnus-article-decode-HZ 2666 gnus-article-decode-HZ