Rename the textsec-check function to textsec-suspicious-p
* lisp/net/shr.el (shr-tag-a): * lisp/international/textsec-check.el (textsec-suspicious-p): * lisp/gnus/message.el (message-send-mail): * lisp/gnus/gnus-art.el (article--check-suspicious-addresses): * etc/NEWS (like): * doc/lispref/text.texi (Suspicious Text): (Suspicious Text): Rename the textsec-check function to textsec-suspicious-p.
This commit is contained in:
parent
2de01ff1ba
commit
55c1670bc5
6 changed files with 15 additions and 14 deletions
|
@ -4971,7 +4971,7 @@ more details about them.) Packages that present data that might be
|
|||
suspicious should use this library to flag suspicious text on display.
|
||||
|
||||
@vindex textsec-check
|
||||
@defun textsec-check object type
|
||||
@defun textsec-suspicious-p object type
|
||||
This function is the high-level interface function that packages
|
||||
should use. It respects the @code{textsec-check} user option, which
|
||||
allows the user to disable the checks.
|
||||
|
@ -5025,7 +5025,7 @@ function returns @code{nil}.
|
|||
@vindex textsec-suspicious@r{ (face)}
|
||||
If the text is suspicious, the application should mark the suspicious
|
||||
text with the @code{textsec-suspicious} face, and make the explanation
|
||||
returned by @code{textsec-check} available to the user in some way
|
||||
returned by @code{textsec-suspicious-p} available to the user in some way
|
||||
(for example, in a tooltip). The application might also prompt the
|
||||
user for confirmation before taking any action on a suspicious string
|
||||
(like sending an email to a suspicious email address).
|
||||
|
|
2
etc/NEWS
2
etc/NEWS
|
@ -1029,7 +1029,7 @@ suspicious address. If this variable is nil, these checks aren't
|
|||
performed.
|
||||
|
||||
+++
|
||||
*** New function 'textsec-check'.
|
||||
*** New function 'textsec-suspicious-p'.
|
||||
This is the main function Emacs applications should be using to check
|
||||
whether a string is suspicious. It heeds the 'textsec-check' user
|
||||
option.
|
||||
|
|
|
@ -2661,7 +2661,7 @@ If PROMPT (the prefix), prompt for a coding system to use."
|
|||
(dolist (header (mail-header-parse-addresses addresses t))
|
||||
(when-let* ((address (car (ignore-errors
|
||||
(mail-header-parse-address header))))
|
||||
(warning (textsec-check address 'email-address)))
|
||||
(warning (textsec-suspicious-p address 'email-address)))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward address nil t)
|
||||
(put-text-property (match-beginning 0) (match-end 0)
|
||||
|
|
|
@ -4907,8 +4907,8 @@ If you always want Gnus to send messages in one piece, set
|
|||
(let ((addr (message-fetch-field hdr)))
|
||||
(when (stringp addr)
|
||||
(dolist (address (mail-header-parse-addresses addr t))
|
||||
(when-let ((warning (textsec-check address
|
||||
'email-address-header)))
|
||||
(when-let ((warning (textsec-suspicious-p
|
||||
address 'email-address-header)))
|
||||
(unless (y-or-n-p
|
||||
(format "Suspicious address: %s; send anyway?"
|
||||
warning))
|
||||
|
|
|
@ -39,8 +39,8 @@ If nil, these checks are disabled."
|
|||
"Face used to highlight suspicious strings.")
|
||||
|
||||
;;;###autoload
|
||||
(defun textsec-check (object type)
|
||||
"Test whether OBJECT is suspicious for use as TYPE.
|
||||
(defun textsec-suspicious-p (object type)
|
||||
"Say whether OBJECT is suspicious for use as TYPE.
|
||||
If OBJECT is suspicious, return a string explaining the reason
|
||||
for considering it suspicious, otherwise return nil.
|
||||
|
||||
|
|
|
@ -1469,12 +1469,13 @@ ones, in case fg and bg are nil."
|
|||
(when url
|
||||
(shr-urlify (or shr-start start) (shr-expand-url url) title)
|
||||
;; Check whether the URL is suspicious.
|
||||
(when-let ((warning (or (textsec-check (shr-expand-url url) 'url)
|
||||
(textsec-check (cons (shr-expand-url url)
|
||||
(buffer-substring
|
||||
(or shr-start start)
|
||||
(point)))
|
||||
'link))))
|
||||
(when-let ((warning (or (textsec-suspicious-p
|
||||
(shr-expand-url url) 'url)
|
||||
(textsec-suspicious-p
|
||||
(cons (shr-expand-url url)
|
||||
(buffer-substring (or shr-start start)
|
||||
(point)))
|
||||
'link))))
|
||||
(add-text-properties (or shr-start start) (point)
|
||||
(list 'face '(shr-link textsec-suspicious)))
|
||||
(insert (propertize "⚠️" 'help-echo warning))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue