diff options
author | João Távora <joaotavora@gmail.com> | 2019-01-25 13:04:13 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2019-01-25 17:32:18 +0000 |
commit | 682ab5d92a6922694a92fcde029811bccf98d700 (patch) | |
tree | 8ae6bace81652a4feff7e5abdb14890e1665f028 /lisp/electric.el | |
parent | f845f8a279cfc2acd1051b4cd4924e2aede54017 (diff) | |
download | emacs-682ab5d92a6922694a92fcde029811bccf98d700.tar.gz |
Adjust previous electric.el and elec-pair.el change
This fixes a serious bug introduced previously
electric-pair-inhibit-if-helps-balance and
electric-pair-skip-if-helps-balance, whereby "innocent" markers were
being pushed by those function's new save-change-and-restore
semantics. The fix can probably still be improved.
It also adds comments to parts of the code, where deemed necessary.
* lisp/elec-pair.el (electric-pair--insert): Add comment.
(electric-pair--save-literal-point-excursion): New helper macro.
(electric-pair-inhibit-if-helps-balance)
(electric-pair-skip-if-helps-balance): Don't use
insert-before-markers since it may hurt other markers that have
nothing to do with the 'save-excursion'.
(electric-pair-post-self-insert-function): Use
electric-pair--save-literal-point-excursion.
* lisp/electric.el (electric-indent-post-self-insert-function):
Remove lexical variable.
Diffstat (limited to 'lisp/electric.el')
-rw-r--r-- | lisp/electric.el | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lisp/electric.el b/lisp/electric.el index b9458776e3b..657913a3961 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -270,14 +270,12 @@ or comment." ;; hence copied). (let ((at-newline (<= pos (line-beginning-position)))) (when at-newline - (let ((before (copy-marker (1- pos) t)) - inhibit-reindentation) + (let ((before (copy-marker (1- pos) t))) (save-excursion (unless - (setq inhibit-reindentation - (or (memq indent-line-function - electric-indent-functions-without-reindent) - electric-indent-inhibit)) + (or (memq indent-line-function + electric-indent-functions-without-reindent) + electric-indent-inhibit) ;; Don't reindent the previous line if the ;; indentation function is not a real one. (goto-char before) |