diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/electric.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/electric.el b/lisp/electric.el index 1564df5949c..4c1d9039d9a 100644 --- a/lisp/electric.el +++ b/lisp/electric.el | |||
| @@ -451,8 +451,15 @@ whitespace, opening parenthesis, or quote and leaves \\=` alone." | |||
| 451 | :version "26.1" | 451 | :version "26.1" |
| 452 | :type 'boolean :safe #'booleanp :group 'electricity) | 452 | :type 'boolean :safe #'booleanp :group 'electricity) |
| 453 | 453 | ||
| 454 | (defvar electric-quote-code-faces () | 454 | (defvar electric-quote-inhibit-functions () |
| 455 | "List of faces to treat as inline code in `text-mode'.") | 455 | "List of functions that should inhibit electric quoting. |
| 456 | When the variable `electric-quote-mode' is non-nil, Emacs will | ||
| 457 | call these functions in order after the user has typed an \\=` or | ||
| 458 | \\=' character. If one of them returns non-nil, electric quote | ||
| 459 | substitution is inhibited. The functions are called after the | ||
| 460 | \\=` or \\=' character has been inserted with point directly | ||
| 461 | after the inserted character. The functions in this hook should | ||
| 462 | not move point or change the current buffer.") | ||
| 456 | 463 | ||
| 457 | (defun electric-quote-post-self-insert-function () | 464 | (defun electric-quote-post-self-insert-function () |
| 458 | "Function that `electric-quote-mode' adds to `post-self-insert-hook'. | 465 | "Function that `electric-quote-mode' adds to `post-self-insert-hook'. |
| @@ -460,7 +467,9 @@ This requotes when a quoting key is typed." | |||
| 460 | (when (and electric-quote-mode | 467 | (when (and electric-quote-mode |
| 461 | (or (eq last-command-event ?\') | 468 | (or (eq last-command-event ?\') |
| 462 | (and (not electric-quote-context-sensitive) | 469 | (and (not electric-quote-context-sensitive) |
| 463 | (eq last-command-event ?\`)))) | 470 | (eq last-command-event ?\`))) |
| 471 | (not (run-hook-with-args-until-success | ||
| 472 | 'electric-quote-inhibit-functions))) | ||
| 464 | (let ((start | 473 | (let ((start |
| 465 | (if (and comment-start comment-use-syntax) | 474 | (if (and comment-start comment-use-syntax) |
| 466 | (when (or electric-quote-comment electric-quote-string) | 475 | (when (or electric-quote-comment electric-quote-string) |
| @@ -475,10 +484,6 @@ This requotes when a quoting key is typed." | |||
| 475 | (syntax-ppss (1- (point))))))))) | 484 | (syntax-ppss (1- (point))))))))) |
| 476 | (and electric-quote-paragraph | 485 | (and electric-quote-paragraph |
| 477 | (derived-mode-p 'text-mode) | 486 | (derived-mode-p 'text-mode) |
| 478 | ;; FIXME: There should be a ‘cl-disjoint’ function. | ||
| 479 | (null (cl-intersection (face-at-point nil 'multiple) | ||
| 480 | electric-quote-code-faces | ||
| 481 | :test #'eq)) | ||
| 482 | ;; FIXME: Why is the next form there? It’s never | 487 | ;; FIXME: Why is the next form there? It’s never |
| 483 | ;; nil. | 488 | ;; nil. |
| 484 | (or (eq last-command-event ?\`) | 489 | (or (eq last-command-event ?\`) |