diff options
| author | Noam Postavsky | 2018-03-10 18:12:55 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2019-11-28 18:10:07 -0500 |
| commit | b2790db049da98b541d07bac21ca7d7c220d3be0 (patch) | |
| tree | 61aba17be4946bf84dc0dd57b1d7157b88725c83 /doc | |
| parent | 85f586f3ce5c6d9598d345440fd57e0fc9b8d98b (diff) | |
| download | emacs-b2790db049da98b541d07bac21ca7d7c220d3be0.tar.gz emacs-b2790db049da98b541d07bac21ca7d7c220d3be0.zip | |
Improve errors & warnings due to fancy quoted vars (Bug#32939)
Add some hints to the message for byte compiler free & unused variable
warnings, and 'void-variable' errors where the variable has confusable
quote characters in it.
* lisp/help.el (uni-confusables), uni-confusables-regexp): New
constants.
(help-command-error-confusable-suggestions): New function, added to
`command-error-function'.
(help-uni-confusable-suggestions): New function.
* lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref):
* lisp/emacs-lisp/cconv.el (cconv--analyze-use): Use it.
* lisp/emacs-lisp/lisp-mode.el
(lisp--match-confusable-symbol-character): New function.
(lisp-fdefs): Use it to fontify confusable characters with
font-lock-warning-face when they occur in symbol names.
* doc/lispref/modes.texi (Faces for Font Lock):
* doc/lispref/objects.texi (Basic Char Syntax): Recommend backslash
escaping of confusable characters, and mention new fontification.
* etc/NEWS: Announce the new fontification behavior.
* test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fontify-confusables):
New test.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/modes.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/objects.texi | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 7283930507f..c554ccdf4a0 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -3287,7 +3287,8 @@ assigned using the ordering as a guide. | |||
| 3287 | @table @code | 3287 | @table @code |
| 3288 | @item font-lock-warning-face | 3288 | @item font-lock-warning-face |
| 3289 | @vindex font-lock-warning-face | 3289 | @vindex font-lock-warning-face |
| 3290 | for a construct that is peculiar, or that greatly changes the meaning of | 3290 | for a construct that is peculiar (e.g., an unescaped confusable quote |
| 3291 | in an Emacs Lisp symbol like @samp{‘foo}), or that greatly changes the meaning of | ||
| 3291 | other text, like @samp{;;;###autoload} in Emacs Lisp and @samp{#error} | 3292 | other text, like @samp{;;;###autoload} in Emacs Lisp and @samp{#error} |
| 3292 | in C. | 3293 | in C. |
| 3293 | 3294 | ||
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index d9971f6839e..e948814d1f7 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi | |||
| @@ -424,7 +424,11 @@ without a special escape meaning; thus, @samp{?\+} is equivalent to | |||
| 424 | characters. However, you must add a backslash before any of the | 424 | characters. However, you must add a backslash before any of the |
| 425 | characters @samp{()[]\;"}, and you should add a backslash before any | 425 | characters @samp{()[]\;"}, and you should add a backslash before any |
| 426 | of the characters @samp{|'`#.,} to avoid confusing the Emacs commands | 426 | of the characters @samp{|'`#.,} to avoid confusing the Emacs commands |
| 427 | for editing Lisp code. You can also add a backslash before whitespace | 427 | for editing Lisp code. You should also add a backslash before Unicode |
| 428 | characters which resemble the previously mentioned @acronym{ASCII} | ||
| 429 | ones, to avoid confusing people reading your code. Emacs will | ||
| 430 | highlight some non-escaped commonly confused characters such as | ||
| 431 | @samp{‘} to encourage this. You can also add a backslash before whitespace | ||
| 428 | characters such as space, tab, newline and formfeed. However, it is | 432 | characters such as space, tab, newline and formfeed. However, it is |
| 429 | cleaner to use one of the easily readable escape sequences, such as | 433 | cleaner to use one of the easily readable escape sequences, such as |
| 430 | @samp{\t} or @samp{\s}, instead of an actual whitespace character such | 434 | @samp{\t} or @samp{\s}, instead of an actual whitespace character such |