aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-01-18 18:41:39 +0100
committerMattias EngdegÄrd2023-01-18 18:50:23 +0100
commitefb9ec11bbee3871d77dc4e9217bd9293d525d5d (patch)
tree9fe93fad7e991be7877b535dd7b8b0960e3dc757
parent1b52eaa190663756e79f44c02e7388ee53e756b2 (diff)
downloademacs-efb9ec11bbee3871d77dc4e9217bd9293d525d5d.tar.gz
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.
-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
1772 kind name col)) 1772 kind name col))
1773 ;; There's a "naked" ' character before a symbol/list, so it 1773 ;; There's a "naked" ' character before a symbol/list, so it
1774 ;; should probably be quoted with \=. 1774 ;; should probably be quoted with \=.
1775 (when (string-match-p "\\( [\"#]\\|[ \t]\\|^\\)'[a-z(]" docs) 1775 (when (string-match-p (rx (| (in " \t") bol)
1776 (? (in "\"#"))
1777 "'"
1778 (in "A-Za-z" "("))
1779 docs)
1776 (byte-compile-warn-x 1780 (byte-compile-warn-x
1777 name "%s%sdocstring has wrong usage of unescaped single quotes (use \\= or different quoting)" 1781 name
1778 kind name)) 1782 (concat "%s%sdocstring has wrong usage of unescaped single quotes"
1783 " (use \\=%c or different quoting such as %c...%c)")
1784 kind name ?' ?` ?'))
1779 ;; There's a "Unicode quote" in the string -- it should probably 1785 ;; There's a "Unicode quote" in the string -- it should probably
1780 ;; be an ASCII one instead. 1786 ;; be an ASCII one instead.
1781 (when (byte-compile-warning-enabled-p 'docstrings-non-ascii-quotes) 1787 (when (byte-compile-warning-enabled-p 'docstrings-non-ascii-quotes)