[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0621591 2/2: Ensure fns in electric-layout-rules ar
From: |
João Távora |
Subject: |
[Emacs-diffs] master 0621591 2/2: Ensure fns in electric-layout-rules are called in right position |
Date: |
Fri, 18 Jan 2019 17:06:25 -0500 (EST) |
branch: master
commit 0621591687c6f032077213e85280936e35e45af0
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Ensure fns in electric-layout-rules are called in right position
* lisp/electric.el (electric-layout-rules): Ensure rules are
called from right spot.
---
lisp/electric.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lisp/electric.el b/lisp/electric.el
index 4791f8e..6977a95 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -383,8 +383,8 @@ in the same place.
Instead of the (CHAR . WHERE) form, a rule can also be just a
function of a single argument, the character just inserted. It
-should return a value compatible with WHERE if the rule matches,
-or nil if it doesn't match.
+is called at that position, and should return a value compatible with
+WHERE if the rule matches, or nil if it doesn't match.
If multiple rules match, only first one is executed.")
@@ -408,7 +408,11 @@ If multiple rules match, only first one is executed.")
(save-excursion
(goto-char
(or pos (setq pos (electric--after-char-pos))))
- (funcall probe last-command-event))))
+ ;; Ensure probe is called at the
+ ;; promised place. FIXME: maybe warn if
+ ;; it isn't
+ (when (eq (char-before) last-command-event)
+ (funcall probe last-command-event)))))
(when res (throw 'done res)))))))))
(when (and rule
(or pos (setq pos (electric--after-char-pos)))