From: "Keith Ponting" <k.ponting@aurix.com>
To: <2205@emacsbugs.donarmstrong.com>
Subject: bug#2205: My fix does not quite work
Date: Thu, 5 Feb 2009 08:12:29 -0500 [thread overview]
Message-ID: <0368DB7855FE094FBFF313BE6BC5A810D485BA@BE02.exg3.exghost.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1694 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 10459 bytes --]
next reply other threads:[~2009-02-05 13:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 13:12 Keith Ponting [this message]
2011-10-05 5:30 ` bug#2205: electric-perl-terminator leaves point at beginning of line on error Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0368DB7855FE094FBFF313BE6BC5A810D485BA@BE02.exg3.exghost.com \
--to=k.ponting@aurix.com \
--cc=2205@emacsbugs.donarmstrong.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.