unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2205: My fix does not quite work
@ 2009-02-05 13:12 Keith Ponting
  2011-10-05  5:30 ` bug#2205: electric-perl-terminator leaves point at beginning of line on error Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Ponting @ 2009-02-05 13:12 UTC (permalink / raw)
  To: 2205

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#2205: electric-perl-terminator leaves point at beginning of line on error
  2009-02-05 13:12 bug#2205: My fix does not quite work Keith Ponting
@ 2011-10-05  5:30 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2011-10-05  5:30 UTC (permalink / raw)
  To: 2205-done

Version: 24.0.91

I am sorry for the long delay. Hopefully this is now fixed, by stopping
perl-calculate-indent from throwing the error that was upsetting
perl-electric-terminator.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-05  5:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-05 13:12 bug#2205: My fix does not quite work Keith Ponting
2011-10-05  5:30 ` bug#2205: electric-perl-terminator leaves point at beginning of line on error Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).