diff options
| author | João Távora | 2018-12-29 18:34:53 +0000 |
|---|---|---|
| committer | João Távora | 2018-12-29 18:34:53 +0000 |
| commit | 80a19b8b7a0f48eac410f66653d975c623d3c79c (patch) | |
| tree | d2bcbd73f4f8a1758ca0ec4437112a51ecd89c68 | |
| parent | ba97dad7c427f3d6c1861b0ff1e139e7a3226bc0 (diff) | |
| download | emacs-scratch/fix-33794-extend-electric-layout-mode.tar.gz emacs-scratch/fix-33794-extend-electric-layout-mode.zip | |
Another iteration for an improved electric-layout-modescratch/fix-33794-extend-electric-layout-mode
* lisp/electric.el (electric-layout-rules): Add nil back to
symbols list.
(electric-layout-post-self-insert-function-1): Call function in
correct position.
| -rw-r--r-- | lisp/electric.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/electric.el b/lisp/electric.el index b52efb07c7b..0484319ed47 100644 --- a/lisp/electric.el +++ b/lisp/electric.el | |||
| @@ -372,7 +372,8 @@ just inserted was CHAR. | |||
| 372 | 372 | ||
| 373 | WHERE can be: | 373 | WHERE can be: |
| 374 | 374 | ||
| 375 | * one of the symbols `before', `after', `around', `after-stay'. | 375 | * one of the symbols `before', `after', `around', `after-stay', |
| 376 | or nil. | ||
| 376 | 377 | ||
| 377 | * a list of the preceding symbols, processed in order of | 378 | * a list of the preceding symbols, processed in order of |
| 378 | appearance to insert multiple newlines; | 379 | appearance to insert multiple newlines; |
| @@ -408,10 +409,14 @@ If multiple rules match, only first one is executed.") | |||
| 408 | (eq (car probe) last-command-event)) | 409 | (eq (car probe) last-command-event)) |
| 409 | (throw 'done (cdr probe))) | 410 | (throw 'done (cdr probe))) |
| 410 | ((functionp probe) | 411 | ((functionp probe) |
| 411 | (let ((res (funcall probe last-command-event))) | 412 | (let ((res |
| 413 | (save-excursion | ||
| 414 | (goto-char | ||
| 415 | (or pos (setq pos (electric--after-char-pos)))) | ||
| 416 | (funcall probe last-command-event)))) | ||
| 412 | (when res (throw 'done res))))))))) | 417 | (when res (throw 'done res))))))))) |
| 413 | (when (and rule | 418 | (when (and rule |
| 414 | (setq pos (electric--after-char-pos)) | 419 | (or pos (setq pos (electric--after-char-pos))) |
| 415 | ;; Not in a string or comment. | 420 | ;; Not in a string or comment. |
| 416 | (not (nth 8 (save-excursion (syntax-ppss pos))))) | 421 | (not (nth 8 (save-excursion (syntax-ppss pos))))) |
| 417 | (goto-char pos) | 422 | (goto-char pos) |