summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-11-22 08:08:11 +0100
committerStefan Kangas <stefan@marxist.se>2021-11-22 12:04:19 +0100
commite91f71676c19127dd90efabfc0da36483aa53a82 (patch)
tree832dfd92cf35d5f695d9ecb2c47500fa4d9757b0 /lisp/emacs-lisp
parent61c254cafc9caa3b52553fa0e7cca8a5086c5cea (diff)
downloademacs-e91f71676c19127dd90efabfc0da36483aa53a82.tar.gz
emacs-e91f71676c19127dd90efabfc0da36483aa53a82.tar.bz2
emacs-e91f71676c19127dd90efabfc0da36483aa53a82.zip
Avoid false positives about wide docstrings for key sequences
* lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p): Ignore literal key sequence substitutions. * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-substitutions.el: New file. * test/lisp/emacs-lisp/bytecomp-tests.el ("warn-wide-docstring-ignore-substitutions.el"): New test.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 3338c383171..bd74c79d717 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1674,7 +1674,12 @@ URLs."
(replace-regexp-in-string
(rx "\\" (or (seq "[" (* (not "]")) "]")))
(make-string byte-compile--wide-docstring-substitution-len ?x)
- docstring))))
+ ;; For literal key sequence substitutions (e.g. "\\`C-h'"), just
+ ;; remove the markup as `substitute-command-keys' would.
+ (replace-regexp-in-string
+ (rx "\\" (seq "`" (group (* (not "]"))) "'"))
+ "\\1"
+ docstring)))))
(defcustom byte-compile-docstring-max-column 80
"Recommended maximum width of doc string lines.