Add erc-compat adapter for xml-escape-string
* lisp/erc/erc-compat.el (erc-compat--xml-escape-string): New macro to call `xml-escape-string' sans the NO-ERROR argument on Emacs 27. * lisp/erc/erc-desktop-notifications.el (erc-notifications-notify): Use compat macro.
This commit is contained in:
parent
3db65ff5cb
commit
dd1b11d34c
2 changed files with 14 additions and 2 deletions
|
@ -369,6 +369,15 @@ If START or END is negative, it counts from the end."
|
|||
client-final-message))
|
||||
|
||||
|
||||
;;;; Misc 28.1
|
||||
|
||||
(defmacro erc-compat--xml-escape-string (string &optional noerror)
|
||||
"Call `xml-escape-string' with NO-ERROR if supported."
|
||||
(if (>= emacs-major-version 28)
|
||||
`(xml-escape-string ,string ,noerror)
|
||||
`(xml-escape-string ,string)))
|
||||
|
||||
|
||||
;;;; Misc 29.1
|
||||
|
||||
(defvar url-irc-function)
|
||||
|
|
|
@ -65,8 +65,11 @@ This will replace the last notification sent with this function."
|
|||
(dbus-ignore-errors
|
||||
(setq erc-notifications-last-notification
|
||||
(let* ((channel (if privp (erc-get-buffer nick) (current-buffer)))
|
||||
(title (format "%s in %s" (xml-escape-string nick t) channel))
|
||||
(body (xml-escape-string (erc-controls-strip msg) t)))
|
||||
(title (format "%s in %s"
|
||||
(erc-compat--xml-escape-string nick t)
|
||||
channel))
|
||||
(body (erc-compat--xml-escape-string (erc-controls-strip msg)
|
||||
t)))
|
||||
(funcall (cond ((featurep 'android)
|
||||
#'android-notifications-notify)
|
||||
((featurep 'haiku)
|
||||
|
|
Loading…
Add table
Reference in a new issue