From: LanX <lanx.perl@googlemail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: cperl-indent-for-comment
Date: Thu, 6 May 2010 14:39:15 -0700 (PDT) [thread overview]
Message-ID: <d967528c-b4e8-427c-977a-4580bf13322b@b18g2000yqb.googlegroups.com> (raw)
In-Reply-To: slrnhu680j.fq5.nospam-abuse@powdermilk.math.berkeley.edu
Hi
> Why not do it more agressively, and just avoid it after $ ?
hmm ... technically I was worrying about #-delimiters like in
regexes ... but testing the face should already be sufficient.
I th this DWIM behavior should be restricted to the same end-of-line
scenarios like auto-newline.
If I need it explicitly from within the code I can use C-#.
But indeed thats a matter of taste and could be made customizable ...
> Keep in mind that one needs to force update of syntaxification before
> checking text-properties.
>
> (cperl-update-syntaxification (point) (point))
Good point 8)
-------------------------------------- Version 0.02
(defun my-indent-for-comment (arg)
"dwim indent-for-comment"
(interactive "p")
(cperl-update-syntaxification (point) (point))
(if (and (memq (preceding-char) '( ?\; ?{ ?\( ?\[ ) )
(not (get-text-property (point) 'face)))
(indent-for-comment)
(insert "#"))
)
(local-set-key (kbd "#") 'my-indent-for-comment)
----------------------------------------
TODO:
- checking for after code (whitespace till end of line)
- adding this case to cperl-electric-backspace
- handling the case of auto-newline.
> Not in my version.
your still running emacs 19 right?
For completeness:
putting the cursor right after the doublequote and pressing M-;
results in this
------------------------------------
$a=" # #
------------------------------------
every new try appends a new " #"
I started "emacs22 -q" and emacs23 and tested it with cperl "5.23 and
"6.2". (perl-mode is OK)
But this is not a really important bug...
next prev parent reply other threads:[~2010-05-06 21:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 19:42 [cperl-mode] cperl-indent-for-comment LanX
2010-05-06 0:17 ` cperl-indent-for-comment LanX
2010-05-06 20:01 ` [cperl-mode] cperl-indent-for-comment Ilya Zakharevich
2010-05-06 21:39 ` LanX [this message]
2010-05-09 0:21 ` cperl-indent-for-comment Ilya Zakharevich
2010-05-10 12:58 ` cperl-indent-for-comment LanX
2010-05-10 23:56 ` cperl-indent-for-comment Ilya Zakharevich
2010-05-14 16:08 ` [cperl] electric-backspace and variable-refactoring LanX
2010-05-07 2:35 ` [cperl-mode] cperl-indent-for-comment Stefan Monnier
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=d967528c-b4e8-427c-977a-4580bf13322b@b18g2000yqb.googlegroups.com \
--to=lanx.perl@googlemail.com \
--cc=help-gnu-emacs@gnu.org \
/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.