summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-11-17 20:08:54 +0100
committerStefan Kangas <stefankangas@gmail.com>2022-11-17 20:10:05 +0100
commit2967356891874c355e634e3f4c0cae5456d1bb09 (patch)
treefdac5d704df8614e8df91218fd18680022ada984
parent875a8582ec586afb2ff01b4cf8a81b0862c374d9 (diff)
downloademacs-2967356891874c355e634e3f4c0cae5456d1bb09.tar.gz
Avoid raw control characters in two files
* lisp/net/rcirc.el (rcirc-format, rcirc-unformat) (rcirc-format-bold, rcirc-format-italic, rcirc-format-underline) (rcirc-format-strike-trough, rcirc-format-fixed-width): * test/lisp/subr-tests.el (test-keymap-parse-macros): Don't use raw control characters.
-rw-r--r--lisp/net/rcirc.el20
-rw-r--r--test/lisp/subr-tests.el2
2 files changed, 11 insertions, 11 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 370f388b3e7..29957a62d04 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1353,10 +1353,10 @@ inserting the new one."
(if (use-region-p)
(let ((beg (region-beginning)))
(goto-char (region-end))
- (insert "")
+ (insert "\^O")
(goto-char beg)
(insert pre))
- (insert pre "")))
+ (insert pre "\^O")))
(when (or (not (region-active-p)) (< (point) (mark)))
(forward-char (length pre))))
@@ -1364,11 +1364,11 @@ inserting the new one."
"Remove the closes formatting found closes to the current point."
(interactive)
(save-excursion
- (when (and (search-backward-regexp (rx (or "" "" "" "" ""))
+ (when (and (search-backward-regexp (rx (or "\^B" "\^]" "\^_" "\^^" "\^Q"))
rcirc-prompt-end-marker t)
- (looking-at (rx (group (or "" "" "" "" ""))
+ (looking-at (rx (group (or "\^B" "\^]" "\^_" "\^^" "\^Q"))
(*? nonl)
- (group ""))))
+ (group "\^O"))))
(replace-match "" nil nil nil 2)
(replace-match "" nil nil nil 1))))
@@ -1378,7 +1378,7 @@ If REPLACE is non-nil or a prefix argument is given, any prior
formatting will be replaced before the bold formatting is
inserted."
(interactive "P")
- (rcirc-format "" replace))
+ (rcirc-format "\^B" replace))
(defun rcirc-format-italic (replace)
"Insert italic formatting.
@@ -1386,7 +1386,7 @@ If REPLACE is non-nil or a prefix argument is given, any prior
formatting will be replaced before the italic formatting is
inserted."
(interactive "P")
- (rcirc-format "" replace))
+ (rcirc-format "\^]" replace))
(defun rcirc-format-underline (replace)
"Insert underlining formatting.
@@ -1394,7 +1394,7 @@ If REPLACE is non-nil or a prefix argument is given, any prior
formatting will be replaced before the underline formatting is
inserted."
(interactive "P")
- (rcirc-format "" replace))
+ (rcirc-format "\^_" replace))
(defun rcirc-format-strike-trough (replace)
"Insert strike-trough formatting.
@@ -1402,7 +1402,7 @@ If REPLACE is non-nil or a prefix argument is given, any prior
formatting will be replaced before the strike-trough formatting
is inserted."
(interactive "P")
- (rcirc-format "" replace))
+ (rcirc-format "\^^" replace))
(defun rcirc-format-fixed-width (replace)
"Insert fixed-width formatting.
@@ -1410,7 +1410,7 @@ If REPLACE is non-nil or a prefix argument is given, any prior
formatting will be replaced before the fixed width formatting is
inserted."
(interactive "P")
- (rcirc-format "" replace))
+ (rcirc-format "\^Q" replace))
(defvar-keymap rcirc-mode-map
:doc "Keymap for rcirc mode."
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index cc9610cd393..e22d1c7be0e 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1106,7 +1106,7 @@ final or penultimate step during initialization."))
(ert-deftest test-keymap-parse-macros ()
(should (equal (key-parse "C-x ( C-d C-x )") [24 40 4 24 41]))
- (should (equal (kbd "C-x ( C-d C-x )") ""))
+ (should (equal (kbd "C-x ( C-d C-x )") "\^D"))
(should (equal (kbd "C-x ( C-x )") "")))
(defvar subr-test--global)