summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-01-18 18:41:39 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-01-18 18:50:23 +0100
commitefb9ec11bbee3871d77dc4e9217bd9293d525d5d (patch)
tree9fe93fad7e991be7877b535dd7b8b0960e3dc757 /lisp/emacs-lisp
parent1b52eaa190663756e79f44c02e7388ee53e756b2 (diff)
downloademacs-efb9ec11bbee3871d77dc4e9217bd9293d525d5d.tar.gz
emacs-efb9ec11bbee3871d77dc4e9217bd9293d525d5d.tar.bz2
emacs-efb9ec11bbee3871d77dc4e9217bd9293d525d5d.zip
Improved docstring single quote warning
* lisp/emacs-lisp/bytecomp.el (byte-compile-docstring-style-warn): More robust regexp. More explicit warning message.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index fb4b73b1c14..aa9521e5a65 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1772,10 +1772,16 @@ It is too wide if it has any lines longer than the largest of
kind name col))
;; There's a "naked" ' character before a symbol/list, so it
;; should probably be quoted with \=.
- (when (string-match-p "\\( [\"#]\\|[ \t]\\|^\\)'[a-z(]" docs)
+ (when (string-match-p (rx (| (in " \t") bol)
+ (? (in "\"#"))
+ "'"
+ (in "A-Za-z" "("))
+ docs)
(byte-compile-warn-x
- name "%s%sdocstring has wrong usage of unescaped single quotes (use \\= or different quoting)"
- kind name))
+ name
+ (concat "%s%sdocstring has wrong usage of unescaped single quotes"
+ " (use \\=%c or different quoting such as %c...%c)")
+ kind name ?' ?` ?'))
;; There's a "Unicode quote" in the string -- it should probably
;; be an ASCII one instead.
(when (byte-compile-warning-enabled-p 'docstrings-non-ascii-quotes)