Commit 80a19b8b authored by João Távora's avatar João Távora

Another iteration for an improved 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.
parent ba97dad7
Pipeline #411 failed with stage
in 33 minutes and 17 seconds
...@@ -372,7 +372,8 @@ just inserted was CHAR. ...@@ -372,7 +372,8 @@ just inserted was CHAR.
WHERE can be: WHERE can be:
* one of the symbols `before', `after', `around', `after-stay'. * one of the symbols `before', `after', `around', `after-stay',
or nil.
* a list of the preceding symbols, processed in order of * a list of the preceding symbols, processed in order of
appearance to insert multiple newlines; appearance to insert multiple newlines;
...@@ -408,10 +409,14 @@ If multiple rules match, only first one is executed.") ...@@ -408,10 +409,14 @@ If multiple rules match, only first one is executed.")
(eq (car probe) last-command-event)) (eq (car probe) last-command-event))
(throw 'done (cdr probe))) (throw 'done (cdr probe)))
((functionp probe) ((functionp probe)
(let ((res (funcall probe last-command-event))) (let ((res
(save-excursion
(goto-char
(or pos (setq pos (electric--after-char-pos))))
(funcall probe last-command-event))))
(when res (throw 'done res))))))))) (when res (throw 'done res)))))))))
(when (and rule (when (and rule
(setq pos (electric--after-char-pos)) (or pos (setq pos (electric--after-char-pos)))
;; Not in a string or comment. ;; Not in a string or comment.
(not (nth 8 (save-excursion (syntax-ppss pos))))) (not (nth 8 (save-excursion (syntax-ppss pos)))))
(goto-char pos) (goto-char pos)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment