* lisp/gnus: Use lexical-binding in all the files
* lisp/gnus/gnus-group.el (features): Use `dlet`.
(gnus-tmp-level, gnus-tmp-marked, gnus-tmp-group): Declare vars.
(gnus-group-insert-group-line): Bind dynbound vars via `let` rather
than as formal args. Bind `number` as dynbound.
(gnus-visual, gnus-score-find-score-files-function)
(gnus-home-score-file, gnus-apply-kill-hook)
(gnus-summary-expunge-below): Declare vars.
(gnus-group-restart, gnus-group-list-plus): Fix `interactive` spec
since the arg is unused.
* lisp/gnus/mail-source.el (mail-source-bind, mail-source-bind-common):
Use `dlet` and suppress the warnings about the non-prefixed dynbound vars.
(mail-source-set-1): Remove unused var `auth-info`.
(mail-source-call-script): Remove unused var `background`.
(mail-source-fetch-pop, mail-source-check-pop): Bind pop3 vars with `dlet`.
* lisp/gnus/gnus-int.el (mail-source-plugged, gnus-inhibit-demon):
Declare vars.
(gnus-server-opened, gnus-status-message)
(gnus-open-server, gnus-close-server, gnus-request-list)
(gnus-finish-retrieve-group-infos, gnus-retrieve-group-data-early)
(gnus-request-list-newsgroups, gnus-request-newgroups)
(gnus-request-regenerate, gnus-request-compact, gnus-request-group)
(gnus-retrieve-groups, gnus-request-post, gnus-request-expunge-group)
(gnus-request-scan, gnus-request-update-info, gnus-request-marks)
(gnus-request-accept-article, gnus-request-create-group)
(gnus-asynchronous-p, gnus-remove-denial):
Bind `gnus-command-method` via `let` rather than as formal args.
* lisp/gnus/gnus-topic.el (gnus-topic-insert-topic-line):
Pass documented vars to eval for `gnus-topic-line-format-spec`.
* lisp/gnus/message.el (message-yank-original): Use `cl-progv` rather
than `eval` to bind the vars from `message-cite-style`.
* lisp/gnus/mml.el (mml-parse-1): Use `apply` instead of `eval`.
(gnus-newsgroup-name, gnus-displaying-mime, gnus-newsgroup-name)
(gnus-article-prepare-hook, gnus-newsgroup-charset)
(gnus-original-article-buffer, gnus-message-buffer)
(message-this-is-news, message-this-is-mail): Declare vars.
* lisp/gnus/deuglify.el (gnus-outlook-rearrange-article): Remove unused
var `cite-marks`.
* lisp/gnus/gnus-art.el (ansi-color-context-region): Declare var.
(gnus-mime-display-attachment-buttons-in-header): Move declaration
before first use.
(gnus-mime-display-alternative): Remove unused var `from`.
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-list): Remove unused
var `start` `end`.
* lisp/gnus/gnus-cache.el (gnus-article-decode-hook)
(nnml-generate-active-function): Declare var.
* lisp/gnus/gnus-cite.el (gnus-message-citation-mode): Remove unused
var `keywords`.
* lisp/gnus/gnus-cloud.el (gnus-cloud-encode-data): Remove unused var
`cipher`.
(gnus-cloud-ensure-cloud-group): Remove unused var `method`.
* lisp/gnus/gnus-delay.el (gnus-delay-article): Remove unused var `days`.
* lisp/gnus/gnus-html.el (gnus-html-wash-images): Remove unused vars
`tag`, `string`, and `images`.
(gnus-html-wash-tags): Remove unused vars `string` and `images`.
* lisp/gnus/gnus-msg.el (gnus-msg-mail): Remove unused var `group-name`.
(gnus-group-mail, gnus-group-news, gnus-summary-mail-other-window)
(gnus-summary-news-other-window):
Remove unused vars `group` and `buffer`.
(gnus-configure-posting-styles): Remove unused vars `style` and `attribute`.
* lisp/gnus/gnus-picon.el (gnus-picon-find-face): Remove unused vars
`database`, `directory`, and `instance`.
(gnus-picon-transform-newsgroups): Remove unused var `point`.
* lisp/gnus/gnus-range.el (gnus-range-difference): Remove unused var `safe`.
* lisp/gnus/gnus-score.el (gnus-score-load-file): Remove unused var
`score-fn`.
* lisp/gnus/gnus-sum.el (message-options-set-recipient): Declare var.
* lisp/gnus/gnus-undo.el (gnus-undo): Fix docstring lie.
* lisp/gnus/gnus-util.el (print-string-length)
(iswitchb-make-buflist-hook): Declare vars.
(gnus-emacs-version): Remove unused var `codename`.
(gnus-rename-file): Remove unused vars `old-name` and `new-name`.
* lisp/gnus/gnus-uu.el (gnus-uu-yenc-article): Remove unused var
`start-char`.
(gnus-asynchronous): Declare var.
* lisp/gnus/mm-partial.el (gnus-displaying-mime): Declare var.
(mm-inline-partial): Remove unused var `buffer`.
* lisp/gnus/mm-view.el (w3m-force-redisplay, w3m-safe-url-regexp)
(gnus-displaying-mime, gnus-original-article-buffer)
(gnus-article-prepare-hook): Declare vars.
* lisp/gnus/mml-smime.el (mml-smime-epg-encrypt): Remove unused var
`boundary`.
(mml-smime-epg-verify): Remove unused vars `plain` and `signature-file`.
* lisp/gnus/mml1991.el (pgg-text-mode): Declare var.
* lisp/gnus/mml2015.el (pgg-text-mode): Declare var.
(mml2015-pgg-decrypt): Remove unused var `result`.
(mml2015-epg-key-image-to-string): Remove unused var `error`.
(mml2015-epg-decrypt): Remove unused var `result`.
(mml2015-epg-verify): Remove unused vars `plain` and `signature-file`.
* lisp/gnus/nnbabyl.el (nnml-current-directory): Declare var.
* lisp/gnus/nndiary.el (nndiary-files): Move declaration before first use.
* lisp/gnus/nnfolder.el (nnfolder-request-accept-article):
Remove unused var `buf`.
* lisp/gnus/nnmail.el (nnmail-parse-active): Remove unused var `err`.
* lisp/gnus/nnmairix.el (nnmairix-request-group): Remove unused var `args`.
(nnmairix-request-create-group): Remove unused var `info`.
(nnmairix-request-list): Remove unused var `folder`.
(nnmairix-request-set-mark): Remove unused var `propto`.
(nnmairix-request-set-mark): Remove unused vars `number` and `method`.
(nnmairix-close-group): Remove unused var `method`.
(nnmairix-create-search-group-from-message): Remove unused var `cq`.
(nnmairix-create-server-and-default-group): Remove unused var `create`.
(nnmairix-purge-old-groups): Remove unused var `folder`.
(nnmairix-remove-tick-mark-original-article, nnmairix-get-valid-servers):
Remove unused var `cur`.
(nnmairix-replace-group-and-numbers): Remove unused var `header`.
(nnmairix-goto-original-article): Remove unused var `rval`.
(nnmairix-widget-create-query): Remove unused var `allwidgets`.
* lisp/gnus/nnmbox.el (nnml-current-directory): Declare var.
* lisp/gnus/nnmh.el (nnmh-toplev): Move declaration before first use.
(nnmh-request-list-1): Remove unused var `rdir`.
* lisp/gnus/nnml.el (nnml-generate-nov-file): Remove unused var `file`.
* lisp/gnus/nnrss.el (nnrss-request-article): Remove unused var `post`.
(nnrss-request-article): Remove unused var `fn`.
(nnrss-check-group): Remove unused var `rdf-ns`.
* lisp/gnus/nnweb.el (nnweb-request-article): Remove unused var `active`.
(nnweb-google-parse-1): Remove unused var `Score`.
* lisp/gnus/spam-stat.el (spam-stat-error-holder): Remove var.
(spam-stat-buffer-words-with-scores): Remove unused var `word`.
(spam-stat-score-buffer): Remove unused var `spam-stat-error-holder`.
(spam-stat-split-fancy): Use `err` instead of `spam-stat-error-holder`.
* lisp/gnus/spam-wash.el (spam-wash): Remove unused var `handle`.
* lisp/gnus/spam.el (spam-copy-or-move-routine): Remove unused vars
`article` and `mark`.
(spam-register-routine): Remove unused var `article`.
(spam-log-undo-registration): Remove unused var `found`.
(spam-ifile-register-with-ifile): Remove unused var `parameters`.
(spam-check-stat): Remove unused vars `category` and `return`.
(spam-parse-list): Remove unused var `found`.
(spam-filelist-register-routine): Remove unused var `from`.
2021-01-30 18:44:00 -05:00
|
|
|
;;; smiley.el --- displaying smiley faces -*- lexical-binding: t; -*-
|
2000-10-04 15:32:24 +00:00
|
|
|
|
2022-01-01 02:45:51 -05:00
|
|
|
;; Copyright (C) 2000-2022 Free Software Foundation, Inc.
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
;; Author: Dave Love <fx@gnu.org>
|
|
|
|
;; Keywords: news mail multimedia
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 03:56:49 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-09-20 17:08:54 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:56:49 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-05-06 03:56:49 +00:00
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2000-09-20 17:08:54 +00:00
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; A re-written, simplified version of Wes Hardaker's XEmacs smiley.el
|
|
|
|
;; which might be merged back to smiley.el if we get an assignment for
|
|
|
|
;; that. We don't have assignments for the images smiley.el uses, but
|
2000-10-04 15:32:24 +00:00
|
|
|
;; I'm not sure we need that degree of rococoness and defaults like a
|
|
|
|
;; yellow background. Also, using PBM means we can display the images
|
|
|
|
;; more generally. -- fx
|
2006-03-10 23:43:54 +00:00
|
|
|
;; `smiley.el' was replaced by `smiley-ems.el' on 2002-01-26 (after fx'
|
|
|
|
;; comment).
|
|
|
|
|
|
|
|
;; Test smileys:
|
|
|
|
;; smile ^:-) ^:)
|
|
|
|
;; blink ;-) ;)
|
|
|
|
;; forced :-]
|
|
|
|
;; braindamaged 8-)
|
|
|
|
;; indifferent :-|
|
|
|
|
;; wry :-/ :-\
|
|
|
|
;; sad :-(
|
2006-03-21 20:37:02 +00:00
|
|
|
;; frown :-{
|
2006-03-10 23:43:54 +00:00
|
|
|
;; evil >:-)
|
|
|
|
;; cry ;-(
|
|
|
|
;; dead X-)
|
|
|
|
;; grin :-D
|
2020-10-18 09:36:43 +02:00
|
|
|
;; halo O:-)
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'nnheader)
|
2004-09-04 13:13:48 +00:00
|
|
|
(require 'gnus-art)
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
(defgroup smiley nil
|
|
|
|
"Turn :-)'s into real images."
|
|
|
|
:group 'gnus-visual)
|
|
|
|
|
2007-10-28 09:18:39 +00:00
|
|
|
(defvar smiley-data-directory)
|
|
|
|
|
2020-08-18 23:15:09 +02:00
|
|
|
;; In batch mode, attributes can be unspecified.
|
|
|
|
(defcustom smiley-style (if (ignore-errors
|
|
|
|
(>= (face-attribute 'default :height) 160))
|
|
|
|
'medium
|
|
|
|
'low-color)
|
2007-10-28 09:18:39 +00:00
|
|
|
"Smiley style."
|
2016-02-14 14:56:21 +11:00
|
|
|
:type '(choice (const :tag "small, 3 colors" low-color) ;; 13x14
|
|
|
|
(const :tag "medium, ~10 colors" medium) ;; 16x16
|
2020-10-18 09:36:43 +02:00
|
|
|
(const :tag "dull, grayscale" grayscale) ;; 14x14
|
|
|
|
(const :tag "emoji, full color" emoji))
|
2007-10-28 09:18:39 +00:00
|
|
|
:set (lambda (symbol value)
|
|
|
|
(set-default symbol value)
|
|
|
|
(setq smiley-data-directory (smiley-directory))
|
|
|
|
(smiley-update-cache))
|
2021-01-30 00:35:24 -05:00
|
|
|
:initialize #'custom-initialize-default
|
|
|
|
:version "23.1") ;; No Gnus
|
2007-10-28 09:18:39 +00:00
|
|
|
|
|
|
|
;; For compatibility, honor the variable `smiley-data-directory' if the user
|
|
|
|
;; has set it.
|
|
|
|
|
|
|
|
(defun smiley-directory (&optional style)
|
|
|
|
"Return a the location of the smiley faces files.
|
|
|
|
STYLE specifies which style to use, see `smiley-style'. If STYLE
|
|
|
|
is nil, use `smiley-style'."
|
|
|
|
(unless style (setq style smiley-style))
|
|
|
|
(nnheader-find-etc-directory
|
|
|
|
(concat "images/smilies"
|
|
|
|
(cond ((eq smiley-style 'low-color) "")
|
|
|
|
((eq smiley-style 'medium) "/medium")
|
|
|
|
((eq smiley-style 'grayscale) "/grayscale")))))
|
|
|
|
|
|
|
|
(defcustom smiley-data-directory (smiley-directory)
|
Remove obsolete leading * from defcustom, defface doc strings.
* lisp/cedet/ede/linux.el, lisp/cedet/ede/project-am.el:
* lisp/cedet/ede/simple.el, lisp/cedet/semantic/bovine/c.el:
* lisp/cedet/semantic/complete.el, lisp/cedet/semantic/db.el:
* lisp/cedet/semantic/decorate/include.el:
* lisp/cedet/semantic/decorate/mode.el, lisp/cedet/semantic/format.el:
* lisp/cedet/semantic/ia.el, lisp/cedet/semantic/idle.el:
* lisp/cedet/semantic/imenu.el, lisp/cedet/semantic/lex-spp.el:
* lisp/cedet/semantic/mru-bookmark.el, lisp/cedet/semantic/sb.el:
* lisp/cedet/srecode/fields.el, lisp/ecomplete.el:
* lisp/gnus/gnus-agent.el, lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-async.el, lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-cite.el, lisp/gnus/gnus-delay.el:
* lisp/gnus/gnus-diary.el, lisp/gnus/gnus-dup.el:
* lisp/gnus/gnus-fun.el, lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-kill.el, lisp/gnus/gnus-msg.el:
* lisp/gnus/gnus-picon.el, lisp/gnus/gnus-salt.el:
* lisp/gnus/gnus-score.el, lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el, lisp/gnus/gnus-topic.el:
* lisp/gnus/gnus-util.el, lisp/gnus/gnus-uu.el, lisp/gnus/gnus-win.el:
* lisp/gnus/gnus.el, lisp/gnus/mail-source.el, lisp/gnus/message.el:
* lisp/gnus/mm-url.el, lisp/gnus/mm-uu.el, lisp/gnus/mml.el:
* lisp/gnus/nndiary.el, lisp/gnus/nnir.el, lisp/gnus/nnmail.el:
* lisp/gnus/smiley.el, lisp/gnus/smime.el, lisp/mail/mail-extr.el:
* lisp/mh-e/mh-e.el, lisp/net/mailcap.el, lisp/net/pop3.el:
* lisp/net/starttls.el, lisp/progmodes/cc-vars.el:
* lisp/progmodes/cperl-mode.el, test/manual/cedet/tests/test.el:
Remove obsolete leading * from defcustom, defface doc strings.
2016-06-09 20:13:12 -04:00
|
|
|
"Location of the smiley faces files."
|
2007-10-28 09:18:39 +00:00
|
|
|
:set (lambda (symbol value)
|
|
|
|
(set-default symbol value)
|
|
|
|
(smiley-update-cache))
|
2021-01-30 00:35:24 -05:00
|
|
|
:initialize #'custom-initialize-default
|
|
|
|
:type 'directory)
|
2000-09-20 17:08:54 +00:00
|
|
|
|
2020-10-18 09:36:43 +02:00
|
|
|
(defcustom smiley-emoji-regexp-alist
|
|
|
|
'(("\\(;-)\\)\\W" 1 "😉")
|
|
|
|
("[^;]\\(;)\\)\\W" 1 "😉")
|
|
|
|
("\\(:-]\\)\\W" 1 "😬")
|
|
|
|
("\\(8-)\\)\\W" 1 "🥴")
|
|
|
|
("\\(:-|\\)\\W" 1 "😐")
|
|
|
|
("\\(:-[/\\]\\)\\W" 1 "😕")
|
|
|
|
("\\(:-(\\)\\W" 1 "😠")
|
|
|
|
("\\(X-)\\)\\W" 1 "😵") ; 💀
|
|
|
|
("\\(:-{\\)\\W" 1 "😦")
|
|
|
|
("\\(>:-)\\)\\W" 1 "😈")
|
|
|
|
("\\(;-(\\)\\W" 1 "😢")
|
|
|
|
("\\(:-D\\)\\W" 1 "😀")
|
|
|
|
("\\(O:-)\\)\\W" 1 "😇")
|
|
|
|
;; "smile" must be come after "evil"
|
|
|
|
("\\(\\^?:-?)\\)\\W" 1 "🙂"))
|
|
|
|
"A list of regexps to map smilies to emoji.
|
|
|
|
The elements are (REGEXP MATCH EMOJI), where MATCH is the submatch in
|
|
|
|
regexp to replace with EMOJI."
|
|
|
|
:version "28.1"
|
|
|
|
:type '(repeat (list regexp
|
|
|
|
(integer :tag "Regexp match number")
|
|
|
|
(string :tag "Emoji")))
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
(set-default symbol value)
|
|
|
|
(smiley-update-cache))
|
2021-01-30 00:35:24 -05:00
|
|
|
:initialize #'custom-initialize-default)
|
2020-10-18 09:36:43 +02:00
|
|
|
|
2000-09-20 17:08:54 +00:00
|
|
|
;; The XEmacs version has a baroque, if not rococo, set of these.
|
|
|
|
(defcustom smiley-regexp-alist
|
2010-08-30 06:28:53 +00:00
|
|
|
'(("\\(;-)\\)\\W" 1 "blink")
|
|
|
|
("[^;]\\(;)\\)\\W" 1 "blink")
|
2004-09-04 13:13:48 +00:00
|
|
|
("\\(:-]\\)\\W" 1 "forced")
|
|
|
|
("\\(8-)\\)\\W" 1 "braindamaged")
|
|
|
|
("\\(:-|\\)\\W" 1 "indifferent")
|
|
|
|
("\\(:-[/\\]\\)\\W" 1 "wry")
|
|
|
|
("\\(:-(\\)\\W" 1 "sad")
|
2007-02-14 17:32:50 +00:00
|
|
|
("\\(X-)\\)\\W" 1 "dead")
|
2007-10-28 09:18:39 +00:00
|
|
|
("\\(:-{\\)\\W" 1 "frown")
|
|
|
|
("\\(>:-)\\)\\W" 1 "evil")
|
|
|
|
("\\(;-(\\)\\W" 1 "cry")
|
|
|
|
("\\(:-D\\)\\W" 1 "grin")
|
|
|
|
;; "smile" must be come after "evil"
|
|
|
|
("\\(\\^?:-?)\\)\\W" 1 "smile"))
|
Remove obsolete leading * from defcustom, defface doc strings.
* lisp/cedet/ede/linux.el, lisp/cedet/ede/project-am.el:
* lisp/cedet/ede/simple.el, lisp/cedet/semantic/bovine/c.el:
* lisp/cedet/semantic/complete.el, lisp/cedet/semantic/db.el:
* lisp/cedet/semantic/decorate/include.el:
* lisp/cedet/semantic/decorate/mode.el, lisp/cedet/semantic/format.el:
* lisp/cedet/semantic/ia.el, lisp/cedet/semantic/idle.el:
* lisp/cedet/semantic/imenu.el, lisp/cedet/semantic/lex-spp.el:
* lisp/cedet/semantic/mru-bookmark.el, lisp/cedet/semantic/sb.el:
* lisp/cedet/srecode/fields.el, lisp/ecomplete.el:
* lisp/gnus/gnus-agent.el, lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-async.el, lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-cite.el, lisp/gnus/gnus-delay.el:
* lisp/gnus/gnus-diary.el, lisp/gnus/gnus-dup.el:
* lisp/gnus/gnus-fun.el, lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-kill.el, lisp/gnus/gnus-msg.el:
* lisp/gnus/gnus-picon.el, lisp/gnus/gnus-salt.el:
* lisp/gnus/gnus-score.el, lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el, lisp/gnus/gnus-topic.el:
* lisp/gnus/gnus-util.el, lisp/gnus/gnus-uu.el, lisp/gnus/gnus-win.el:
* lisp/gnus/gnus.el, lisp/gnus/mail-source.el, lisp/gnus/message.el:
* lisp/gnus/mm-url.el, lisp/gnus/mm-uu.el, lisp/gnus/mml.el:
* lisp/gnus/nndiary.el, lisp/gnus/nnir.el, lisp/gnus/nnmail.el:
* lisp/gnus/smiley.el, lisp/gnus/smime.el, lisp/mail/mail-extr.el:
* lisp/mh-e/mh-e.el, lisp/net/mailcap.el, lisp/net/pop3.el:
* lisp/net/starttls.el, lisp/progmodes/cc-vars.el:
* lisp/progmodes/cperl-mode.el, test/manual/cedet/tests/test.el:
Remove obsolete leading * from defcustom, defface doc strings.
2016-06-09 20:13:12 -04:00
|
|
|
"A list of regexps to map smilies to images.
|
2006-03-10 23:43:54 +00:00
|
|
|
The elements are (REGEXP MATCH IMAGE), where MATCH is the submatch in
|
|
|
|
regexp to replace with IMAGE. IMAGE is the name of an image file in
|
2004-09-04 13:13:48 +00:00
|
|
|
`smiley-data-directory'."
|
2010-08-31 04:21:18 +00:00
|
|
|
:version "24.1"
|
2000-09-20 17:08:54 +00:00
|
|
|
:type '(repeat (list regexp
|
|
|
|
(integer :tag "Regexp match number")
|
|
|
|
(string :tag "Image name")))
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
(set-default symbol value)
|
|
|
|
(smiley-update-cache))
|
2021-01-30 00:35:24 -05:00
|
|
|
:initialize #'custom-initialize-default)
|
2000-09-20 17:08:54 +00:00
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
(defcustom gnus-smiley-file-types
|
|
|
|
(let ((types (list "pbm")))
|
|
|
|
(when (gnus-image-type-available-p 'xpm)
|
|
|
|
(push "xpm" types))
|
2011-05-29 23:28:45 +00:00
|
|
|
(when (gnus-image-type-available-p 'gif)
|
|
|
|
(push "gif" types))
|
2004-09-04 13:13:48 +00:00
|
|
|
types)
|
Remove obsolete leading * from defcustom, defface doc strings.
* lisp/cedet/ede/linux.el, lisp/cedet/ede/project-am.el:
* lisp/cedet/ede/simple.el, lisp/cedet/semantic/bovine/c.el:
* lisp/cedet/semantic/complete.el, lisp/cedet/semantic/db.el:
* lisp/cedet/semantic/decorate/include.el:
* lisp/cedet/semantic/decorate/mode.el, lisp/cedet/semantic/format.el:
* lisp/cedet/semantic/ia.el, lisp/cedet/semantic/idle.el:
* lisp/cedet/semantic/imenu.el, lisp/cedet/semantic/lex-spp.el:
* lisp/cedet/semantic/mru-bookmark.el, lisp/cedet/semantic/sb.el:
* lisp/cedet/srecode/fields.el, lisp/ecomplete.el:
* lisp/gnus/gnus-agent.el, lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-async.el, lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-cite.el, lisp/gnus/gnus-delay.el:
* lisp/gnus/gnus-diary.el, lisp/gnus/gnus-dup.el:
* lisp/gnus/gnus-fun.el, lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-kill.el, lisp/gnus/gnus-msg.el:
* lisp/gnus/gnus-picon.el, lisp/gnus/gnus-salt.el:
* lisp/gnus/gnus-score.el, lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el, lisp/gnus/gnus-topic.el:
* lisp/gnus/gnus-util.el, lisp/gnus/gnus-uu.el, lisp/gnus/gnus-win.el:
* lisp/gnus/gnus.el, lisp/gnus/mail-source.el, lisp/gnus/message.el:
* lisp/gnus/mm-url.el, lisp/gnus/mm-uu.el, lisp/gnus/mml.el:
* lisp/gnus/nndiary.el, lisp/gnus/nnir.el, lisp/gnus/nnmail.el:
* lisp/gnus/smiley.el, lisp/gnus/smime.el, lisp/mail/mail-extr.el:
* lisp/mh-e/mh-e.el, lisp/net/mailcap.el, lisp/net/pop3.el:
* lisp/net/starttls.el, lisp/progmodes/cc-vars.el:
* lisp/progmodes/cperl-mode.el, test/manual/cedet/tests/test.el:
Remove obsolete leading * from defcustom, defface doc strings.
2016-06-09 20:13:12 -04:00
|
|
|
"List of suffixes on smiley file names to try."
|
2011-05-29 23:28:45 +00:00
|
|
|
:version "24.1"
|
2021-01-30 00:35:24 -05:00
|
|
|
:type '(repeat string))
|
2004-09-04 13:13:48 +00:00
|
|
|
|
2000-09-20 17:08:54 +00:00
|
|
|
(defvar smiley-cached-regexp-alist nil)
|
|
|
|
|
|
|
|
(defun smiley-update-cache ()
|
2006-03-10 23:43:54 +00:00
|
|
|
(setq smiley-cached-regexp-alist nil)
|
2020-10-18 09:36:43 +02:00
|
|
|
(if (eq smiley-style 'emoji)
|
|
|
|
(setq smiley-cached-regexp-alist smiley-emoji-regexp-alist)
|
|
|
|
(dolist (elt (if (symbolp smiley-regexp-alist)
|
|
|
|
(symbol-value smiley-regexp-alist)
|
|
|
|
smiley-regexp-alist))
|
|
|
|
(let ((types gnus-smiley-file-types)
|
|
|
|
file type)
|
|
|
|
(while (and (not file)
|
|
|
|
(setq type (pop types)))
|
|
|
|
(unless (file-exists-p
|
|
|
|
(setq file (expand-file-name (concat (nth 2 elt) "." type)
|
|
|
|
smiley-data-directory)))
|
|
|
|
(setq file nil)))
|
|
|
|
(when type
|
|
|
|
(let ((image (gnus-create-image file (intern type) nil
|
|
|
|
:ascent 'center)))
|
|
|
|
(when image
|
|
|
|
(push (list (car elt) (cadr elt) image)
|
|
|
|
smiley-cached-regexp-alist))))))))
|
2000-09-20 17:08:54 +00:00
|
|
|
|
2006-03-10 23:43:54 +00:00
|
|
|
;; Not implemented:
|
|
|
|
;; (defvar smiley-mouse-map
|
|
|
|
;; (let ((map (make-sparse-keymap)))
|
|
|
|
;; (define-key map [down-mouse-2] 'ignore) ; override widget
|
|
|
|
;; (define-key map [mouse-2]
|
|
|
|
;; 'smiley-mouse-toggle-buffer)
|
|
|
|
;; map))
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun smiley-region (start end)
|
2004-09-04 13:13:48 +00:00
|
|
|
"Replace in the region `smiley-regexp-alist' matches with corresponding images.
|
|
|
|
A list of images is returned."
|
2000-09-20 17:08:54 +00:00
|
|
|
(interactive "r")
|
2016-02-11 16:39:23 +11:00
|
|
|
(when (display-graphic-p)
|
2000-09-20 17:08:54 +00:00
|
|
|
(unless smiley-cached-regexp-alist
|
|
|
|
(smiley-update-cache))
|
|
|
|
(save-excursion
|
|
|
|
(let ((beg (or start (point-min)))
|
2004-09-04 13:13:48 +00:00
|
|
|
group image images string)
|
2000-09-20 17:08:54 +00:00
|
|
|
(dolist (entry smiley-cached-regexp-alist)
|
2000-09-21 16:28:06 +00:00
|
|
|
(setq group (nth 1 entry)
|
|
|
|
image (nth 2 entry))
|
2000-09-20 17:08:54 +00:00
|
|
|
(goto-char beg)
|
|
|
|
(while (re-search-forward (car entry) end t)
|
2004-09-04 13:13:48 +00:00
|
|
|
(setq string (match-string group))
|
|
|
|
(goto-char (match-end group))
|
|
|
|
(delete-region (match-beginning group) (match-end group))
|
2000-09-20 17:08:54 +00:00
|
|
|
(when image
|
2004-09-04 13:13:48 +00:00
|
|
|
(push image images)
|
|
|
|
(gnus-add-wash-type 'smiley)
|
2020-10-18 09:36:43 +02:00
|
|
|
(if (symbolp image)
|
|
|
|
(progn
|
|
|
|
(gnus-add-image 'smiley image)
|
|
|
|
(gnus-put-image image string 'smiley))
|
2020-10-18 09:42:25 +02:00
|
|
|
;; This is a string, but mark the property for
|
|
|
|
;; deletion if the washing method is switched off.
|
|
|
|
(insert (propertize string
|
|
|
|
'display image
|
|
|
|
'gnus-image-category 'smiley))))))
|
2004-09-04 13:13:48 +00:00
|
|
|
images))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun smiley-buffer (&optional buffer)
|
2010-03-22 16:49:52 +01:00
|
|
|
"Run `smiley-region' at the BUFFER, specified in the argument or
|
|
|
|
interactively. If there's no argument, do it at the current buffer."
|
2004-09-04 13:13:48 +00:00
|
|
|
(interactive "bBuffer to run smiley-region: ")
|
|
|
|
(save-excursion
|
|
|
|
(if buffer
|
|
|
|
(set-buffer (get-buffer buffer)))
|
|
|
|
(smiley-region (point-min) (point-max))))
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
(defun smiley-toggle-buffer (&optional arg)
|
2004-09-04 13:13:48 +00:00
|
|
|
"Toggle displaying smiley faces in article buffer.
|
2000-09-20 17:08:54 +00:00
|
|
|
With arg, turn displaying on if and only if arg is positive."
|
2021-02-15 13:43:27 +01:00
|
|
|
(interactive "P" gnus-article-mode gnus-summary-mode)
|
2004-09-04 13:13:48 +00:00
|
|
|
(gnus-with-article-buffer
|
|
|
|
(if (if (numberp arg)
|
|
|
|
(> arg 0)
|
|
|
|
(not (memq 'smiley gnus-article-wash-types)))
|
|
|
|
(smiley-region (point-min) (point-max))
|
|
|
|
(gnus-delete-images 'smiley))))
|
2000-09-20 17:08:54 +00:00
|
|
|
|
|
|
|
(defun smiley-mouse-toggle-buffer (event)
|
|
|
|
"Toggle displaying smiley faces.
|
|
|
|
With arg, turn displaying on if and only if arg is positive."
|
|
|
|
(interactive "e")
|
|
|
|
(save-excursion
|
|
|
|
(save-window-excursion
|
|
|
|
(mouse-set-point event)
|
|
|
|
(smiley-toggle-buffer))))
|
|
|
|
|
|
|
|
(provide 'smiley)
|
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
;;; smiley.el ends here
|