From: João Távora Date: Fri, 18 Jan 2019 22:05:36 +0000 (+0000) Subject: Ensure fns in electric-layout-rules are called in right position X-Git-Tag: emacs-27.0.90~3787 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0621591687c6f032077213e85280936e35e45af0;p=emacs.git Ensure fns in electric-layout-rules are called in right position * lisp/electric.el (electric-layout-rules): Ensure rules are called from right spot. --- diff --git a/lisp/electric.el b/lisp/electric.el index 4791f8e18c4..6977a950349 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)))