GNU bug report logs -
#2205
electric-perl-terminator leaves point at beginning of line on error
Previous Next
Reported by: "Keith Ponting" <k.ponting <at> aurix.com>
Date: Thu, 5 Feb 2009 12:10:04 UTC
Severity: normal
Fixed in version 24.0.91
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #10 received at 2205 <at> emacsbugs.donarmstrong.com (full text, mbox):
[Message part 1 (text/plain, inline)]
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."
(interactive "P")
(let ((insertpos (point)))
(and (not arg) ;
decide whether to indent
(eolp)
(save-excursion
(beginning-of-line)
(and (not ;
eliminate comments quickly
(and comment-start-skip
(re-search-forward
comment-start-skip insertpos t)) )
(or (/= last-command-char ?:)
;; Colon is special only after a
label ....
(looking-at
"\\s-*\\(\\w\\|\\s_\\)+$"))
(let ((pps (parse-partial-sexp
(perl-beginning-of-function) insertpos)))
(not (or (nth 3 pps) (nth 4 pps) (nth
5 pps))))))
(progn ; must insert,
indent, delete
(insert-char last-command-char 1)
(save-excursion (perl-indent-line))
(delete-char -1))))
(self-insert-command (prefix-numeric-value arg)))
Keith Ponting
Aurix Ltd, Malvern WR14 3SZ UK
[Message part 2 (text/html, inline)]
This bug report was last modified 13 years and 292 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.