From 682ab5d92a6922694a92fcde029811bccf98d700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 25 Jan 2019 13:04:13 +0000 Subject: 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. --- lisp/electric.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lisp/electric.el') 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) -- cgit v1.2.1