From: Mattias EngdegÄrd Date: Fri, 24 Jan 2020 20:01:47 +0000 (+0100) Subject: Remove (or double) redundant backslashes in string literals X-Git-Tag: emacs-28.0.90~7908^2~50 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0c6c8aa002d321db61afdd14c70744f7bc27f268;p=emacs.git Remove (or double) redundant backslashes in string literals See discussion at https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00749.html . * lisp/obsolete/iswitchb.el (iswitchb-summaries-to-end): * test/src/regex-emacs-tests.el (regex-tests-BOOST-frob-escapes): * test/lisp/help-fns-tests.el (help-fns-test-lisp-macro) (help-fns-test-lisp-defun, help-fns-test-lisp-defsubst) (help-fns-test-alias-to-defun, help-fns-test-bug23887): Double backslashes for desired effect. * lisp/org/ol.el (org-link-escape): * lisp/net/nsm.el (nsm-protocol-check--rsa-kx) (nsm-protocol-check--anon-kx, nsm-protocol-check--sha1-sig): * lisp/obsolete/old-whitespace.el (whitespace-buffer): * lisp/obsolete/rcompile.el (remote-compile-run-before): * lisp/obsolete/vi.el (vi-end-of-blank-delimited-word): * lisp/obsolete/vip.el (vip-current-major-mode) (vip-paren-match, vip-switch-to-buffer) (vip-switch-to-buffer-other-window, vip-kill-buffer) (vip-get-ex-token, ex-edit): * lisp/org/org-element.el (org-element--cache-sync-requests): * lisp/org/org.el (org-sparse-tree): * lisp/textmodes/reftex.el (reftex-report-bug): * test/lisp/ibuffer-tests.el (ibuffer-save-filters): * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-tests--insert-failing-lines): * test/lisp/simple-tests.el (undo-test-kill-c-a-then-undo): * test/lisp/textmodes/conf-mode-tests.el (conf-test-toml-mode): * test/src/regex-emacs-tests.el (regex-tests-compare): Remove redundant backslashes. --- diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index 1b0f04e5a19..2d36c5e2571 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el @@ -371,7 +371,7 @@ Reference: Sheffer, Holz, Saint-Andre (May 2015). \"Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)\", \"(4.1. General Guidelines)\" -`https://tools.ietf.org/html/rfc7525\#section-4.1'" +`https://tools.ietf.org/html/rfc7525#section-4.1'" (let ((kx (plist-get status :key-exchange))) (and (string-match "^\\bRSA\\b" kx) (format-message @@ -468,7 +468,7 @@ Reference: GnuTLS authors (2018). \"GnuTLS Manual 4.3.3 Anonymous authentication\", -`https://www.gnutls.org/manual/gnutls.html\#Anonymous-authentication'" +`https://www.gnutls.org/manual/gnutls.html#Anonymous-authentication'" (let ((kx (plist-get status :key-exchange))) (and (string-match "\\bANON\\b" kx) (format-message @@ -603,7 +603,7 @@ References: full SHA-1\", `https://shattered.io/static/shattered.pdf' [2]: Chromium Security Education TLS/SSL. \"Deprecated and Removed Features (SHA-1 Certificate Signatures)\", -`https://www.chromium.org/Home/chromium-security/education/tls\#TOC-SHA-1-Certificate-Signatures' +`https://www.chromium.org/Home/chromium-security/education/tls#TOC-SHA-1-Certificate-Signatures' [3]: Jones J.C (2017). \"The end of SHA-1 on the Public Web\", `https://blog.mozilla.org/security/2017/02/23/the-end-of-sha-1-on-the-public-web/' [4]: Apple Support (2017). \"Move to SHA-256 signed certificates to diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el index 350eabdb0c1..96b063be701 100644 --- a/lisp/obsolete/iswitchb.el +++ b/lisp/obsolete/iswitchb.el @@ -1393,7 +1393,7 @@ Copied from `icomplete-tidy'." "Move the summaries to the end of the list. This is an example function which can be hooked on to `iswitchb-make-buflist-hook'. Any buffer matching the regexps -`Summary' or `output\*$'are put to the end of the list." +`Summary' or `output\\*$'are put to the end of the list." (let ((summaries (delq nil (mapcar (lambda (x) diff --git a/lisp/obsolete/old-whitespace.el b/lisp/obsolete/old-whitespace.el index 95010c00200..2f46d7ddda5 100644 --- a/lisp/obsolete/old-whitespace.el +++ b/lisp/obsolete/old-whitespace.el @@ -383,10 +383,10 @@ To disable timer scans, set this to zero." (defun whitespace-buffer (&optional quiet) "Find five different types of white spaces in buffer. These are: -1. Leading space \(empty lines at the top of a file\). -2. Trailing space \(empty lines at the end of a file\). -3. Indentation space \(8 or more spaces, that should be replaced with TABS\). -4. Spaces followed by a TAB. \(Almost always, we never want that\). +1. Leading space \(empty lines at the top of a file). +2. Trailing space \(empty lines at the end of a file). +3. Indentation space \(8 or more spaces, that should be replaced with TABS). +4. Spaces followed by a TAB. \(Almost always, we never want that). 5. Spaces or TABS at the end of a line. Check for whitespace only if this buffer really contains a non-empty file diff --git a/lisp/obsolete/rcompile.el b/lisp/obsolete/rcompile.el index 5ef8be20d98..6d95b7136b1 100644 --- a/lisp/obsolete/rcompile.el +++ b/lisp/obsolete/rcompile.el @@ -89,7 +89,7 @@ nil means use the value returned by \\[user-login-name]." "Command to run before compilation. This can be used for setting up environment variables, since rsh does not invoke the shell as a login shell and files like .login -\(tcsh\) and .bash_profile \(bash\) are not run. +\(tcsh) and .bash_profile \(bash) are not run. nil means run no commands." :type '(choice string (const nil)) :group 'remote-compile) diff --git a/lisp/obsolete/vi.el b/lisp/obsolete/vi.el index df5ddfdbcf9..eee00b43a26 100644 --- a/lisp/obsolete/vi.el +++ b/lisp/obsolete/vi.el @@ -1225,7 +1225,7 @@ SPECIAL FEATURE: char argument can be used to specify shift amount(1-9)." (defun vi-end-of-blank-delimited-word (count) "Forward to the end of the COUNT'th blank-delimited word." (interactive "p") - (if (re-search-forward "[^ \t\n\']+[ \t\n\']" nil t count) + (if (re-search-forward "[^ \t\n']+[ \t\n']" nil t count) (if (not (eobp)) (backward-char 2)))) (defun vi-home-window-line (arg) diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el index 4a9b8fff264..37defd1c5a4 100644 --- a/lisp/obsolete/vip.el +++ b/lisp/obsolete/vip.el @@ -80,7 +80,7 @@ (defvar vip-current-major-mode nil "vip-current-major-mode is the major-mode vi considers it is now. -\(buffer specific\)") +\(buffer specific)") (make-variable-buffer-local 'vip-current-major-mode) @@ -1510,7 +1510,7 @@ used. This behavior is controlled by the sign of prefix numeric value." (* (/ (point-max) 100) arg) (/ (* (point-max) arg) 100))) (back-to-indentation)) - (cond ((looking-at "[\(\[{]") + (cond ((looking-at "[([{]") (if com (move-marker vip-com-point (point))) (forward-sexp 1) (if com @@ -1719,7 +1719,7 @@ STRING. Search will be forward if FORWARD, otherwise backward." (let (buffer) (setq buffer (read-buffer - (format "switch to buffer \(%s\): " + (format "switch to buffer (%s): " (buffer-name (other-buffer (current-buffer)))))) (switch-to-buffer buffer) (vip-change-mode-to-vi))) @@ -1730,7 +1730,7 @@ STRING. Search will be forward if FORWARD, otherwise backward." (let (buffer) (setq buffer (read-buffer - (format "Switch to buffer \(%s\): " + (format "Switch to buffer (%s): " (buffer-name (other-buffer (current-buffer)))))) (switch-to-buffer-other-window buffer) (vip-change-mode-to-vi))) @@ -1741,7 +1741,7 @@ STRING. Search will be forward if FORWARD, otherwise backward." (let (buffer buffer-name) (setq buffer-name (read-buffer - (format "Kill buffer \(%s\): " + (format "Kill buffer (%s): " (buffer-name (current-buffer))))) (setq buffer (if (null buffer-name) @@ -2162,7 +2162,7 @@ is a command.") (defun vip-get-ex-token () "get an ex-token which is either an address or a command. -a token has type \(command, address, end-mark\) and value." +a token has type \(command, address, end-mark) and value." (with-current-buffer " *ex-working-space*" (skip-chars-forward " \t") (cond ((looking-at "[k#]") @@ -2668,7 +2668,7 @@ a token has type \(command, address, end-mark\) and value." "ex-edit" (vip-get-ex-file) (if (and (not ex-variant) (buffer-modified-p) buffer-file-name) - (error "No write since last change \(:e! overrides\)")) + (error "No write since last change (:e! overrides)")) (vip-change-mode-to-emacs) (set-buffer (find-file-noselect (concat default-directory ex-file))) diff --git a/lisp/org/ol.el b/lisp/org/ol.el index baed23bc9a4..c9e4da598ff 100644 --- a/lisp/org/ol.el +++ b/lisp/org/ol.el @@ -845,8 +845,8 @@ E.g. \"%C3%B6\" becomes the german o-Umlaut." (insert link) (insert (make-string (- (skip-chars-backward "\\\\")) ?\\)) - (while (search-backward "\]" nil t) - (when (looking-at-p "\\]\\(?:[][]\\|\\'\\)") + (while (search-backward "]" nil t) + (when (looking-at-p "]\\(?:[][]\\|\\'\\)") (insert (make-string (1+ (- (skip-chars-backward "\\\\"))) ?\\)))) (buffer-string))) diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 4b5f9a19e6d..be74dfdbeff 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -4892,7 +4892,7 @@ with `org-element--cache-compare'. This cache is used in A request is a vector with the following pattern: - \[NEXT BEG END OFFSET PARENT PHASE] + [NEXT BEG END OFFSET PARENT PHASE] Processing a synchronization request consists of three phases: diff --git a/lisp/org/org.el b/lisp/org/org.el index 5c8b02b9d1f..1581625a8e5 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -11410,8 +11410,8 @@ D Show deadlines and scheduled items between a date range." (setq type (or type org-sparse-tree-default-date-type)) (setq org-ts-type type) (message "Sparse tree: [r]egexp [t]odo [T]odo-kwd [m]atch [p]roperty - \[d]eadlines [b]efore-date [a]fter-date [D]ates range - \[c]ycle through date types: %s" + [d]eadlines [b]efore-date [a]fter-date [D]ates range + [c]ycle through date types: %s" (cl-case type (all "all timestamps") (scheduled "only scheduled") diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 542f1fef14e..4071c0dd074 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -2371,7 +2371,7 @@ what in fact did happen. Check if the bug is reproducible with an up-to-date version of RefTeX available from https://www.gnu.org/software/auctex/. -If the bug is triggered by a specific \(La)TeX file, you should try +If the bug is triggered by a specific (La)TeX file, you should try to produce a minimal sample file showing the problem and include it in your report. diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el index 4c808d8372e..ef42d4bda29 100644 --- a/test/lisp/help-fns-tests.el +++ b/test/lisp/help-fns-tests.el @@ -56,28 +56,28 @@ Return first line of the output of (describe-function-1 FUNC)." (should (string-match regexp result)))) (ert-deftest help-fns-test-lisp-macro () - (let ((regexp "a Lisp macro in .subr\.el") + (let ((regexp "a Lisp macro in .subr\\.el") (result (help-fns-tests--describe-function 'when))) (should (string-match regexp result)))) (ert-deftest help-fns-test-lisp-defun () - (let ((regexp "a compiled Lisp function in .subr\.el") + (let ((regexp "a compiled Lisp function in .subr\\.el") (result (help-fns-tests--describe-function 'last))) (should (string-match regexp result)))) (ert-deftest help-fns-test-lisp-defsubst () - (let ((regexp "a compiled Lisp function in .subr\.el") + (let ((regexp "a compiled Lisp function in .subr\\.el") (result (help-fns-tests--describe-function 'posn-window))) (should (string-match regexp result)))) (ert-deftest help-fns-test-alias-to-defun () - (let ((regexp "an alias for .set-file-modes. in .subr\.el") + (let ((regexp "an alias for .set-file-modes. in .subr\\.el") (result (help-fns-tests--describe-function 'chmod))) (should (string-match regexp result)))) (ert-deftest help-fns-test-bug23887 () "Test for https://debbugs.gnu.org/23887 ." - (let ((regexp "an alias for .re-search-forward. in .subr\.el") + (let ((regexp "an alias for .re-search-forward. in .subr\\.el") (result (help-fns-tests--describe-function 'search-forward-regexp))) (should (string-match regexp result)))) diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el index 8dadb920547..2211cae305b 100644 --- a/test/lisp/ibuffer-tests.el +++ b/test/lisp/ibuffer-tests.el @@ -82,7 +82,7 @@ (test1 '((mode . org-mode) (or (size-gt . 10000) (and (not (starred-name)) - (directory . "\"))))) + (directory . ""))))) (test2 '((or (mode . emacs-lisp-mode) (file-extension . "elc?") (and (starred-name) (name . "elisp")) (mode . lisp-interaction-mode)))) diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el index 82ea2078f16..ec77e65271d 100644 --- a/test/lisp/international/ucs-normalize-tests.el +++ b/test/lisp/international/ucs-normalize-tests.el @@ -299,7 +299,7 @@ implementations: (list " var var)) (dolist (linos (seq-partition newval 8)) (insert (mapconcat #'number-to-string linos " ") "\n")) - (insert ")\)")) + (insert "))")) (defun ucs-normalize-check-failing-lines () (interactive) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 276df795fca..ae201465678 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -427,7 +427,7 @@ See bug#35036." (with-temp-buffer (switch-to-buffer (current-buffer)) (setq buffer-undo-list nil) - (insert "a\nb\n\c\n") + (insert "a\nb\nc\n") (goto-char (point-max)) ;; We use a keyboard macro because it adds undo events in the same ;; way as if a user were involved. diff --git a/test/lisp/textmodes/conf-mode-tests.el b/test/lisp/textmodes/conf-mode-tests.el index 814cb06b960..7e870269959 100644 --- a/test/lisp/textmodes/conf-mode-tests.el +++ b/test/lisp/textmodes/conf-mode-tests.el @@ -162,7 +162,7 @@ image/tiff tiff tif (ert-deftest conf-test-toml-mode () ;; From `conf-toml-mode' docstring. (with-temp-buffer - (insert "\[entry] + (insert "[entry] value = \"some string\"") (goto-char (point-min)) (conf-toml-mode) diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index 6a661afeff9..ad0271049c3 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -161,7 +161,7 @@ what failed, if anything; valid values are 'search-failed, 'compilation-failed and nil. I compare the beginning/end of each group with their expected values. This is done with either BOUNDS-REF or SUBSTRING-REF; one of those should be non-nil. -BOUNDS-REF is a sequence \[start-ref0 end-ref0 start-ref1 +BOUNDS-REF is a sequence [start-ref0 end-ref0 start-ref1 end-ref1 ....] while SUBSTRING-REF is the expected substring obtained by indexing the input string by start/end-ref. @@ -327,7 +327,7 @@ emacs requires an extra symbol character" (defun regex-tests-BOOST-frob-escapes (s ispattern) "Mangle \\ the way it is done in frob_escapes() in regex-tests-BOOST.c in glibc: \\t, \\n, \\r are interpreted; -\\\\, \\^, \{, \\|, \} are unescaped for the string (not +\\\\, \\^, \\{, \\|, \\} are unescaped for the string (not pattern)" ;; this is all similar to (regex-tests-unextend)