|Subject:||bug#2205: My fix does not quite work|
|Date:||Thu, 5 Feb 2009 08:12:29 -0500|
A small postscript - the save-excursion fix I suggested does not quite work as it leaves point _before_ the inserted terminator not after it.
The following rearrangement works around that:
(defun perl-electric-terminator (arg)
"Insert character and adjust indentation.
If at end-of-line, and not in a comment or a quote, correct the's indentation."
(let ((insertpos (point)))
(and (not arg) ; decide whether to indent
(and (not ; eliminate comments quickly
(re-search-forward comment-start-skip insertpos t)) )
(or (/= last-command-char ?:)
;; Colon is special only after a label ....
(let ((pps (parse-partial-sexp
(not (or (nth 3 pps) (nth 4 pps) (nth 5 pps))))))
(progn ; must insert, indent, delete
(insert-char last-command-char 1)
(self-insert-command (prefix-numeric-value arg)))
Aurix Ltd, Malvern WR14 3SZ UK
|[Prev in Thread]||Current Thread||[Next in Thread]|