* Checking if cursor is inside a comment
@ 2008-07-18 7:10 Nordlöw
2008-07-18 8:59 ` Thien-Thi Nguyen
2008-07-18 19:06 ` Johan Bockgård
0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2008-07-18 7:10 UTC (permalink / raw)
To: help-gnu-emacs
Is there a general or mode-specific (c-mode for my application) way of
checking whether the cursor is currently placed inside a comment or
not? What is the most clever way of doing this? Should I use looking-
at(), use or perhaps extend thing-at-point(), or use search-forward/
backward() or is there some other state or function that should be
used for this specific case. I believe c-mode has some variables and
functions for accessing the result of its parsing, for example c-
syntactic-information-on-region().
My main reason for asking is that I have a lot of clever code helpers
especially for c-mode that I don't want to be enable inside comments.
Thanks in advance,
Nordlöw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Checking if cursor is inside a comment
2008-07-18 7:10 Checking if cursor is inside a comment Nordlöw
@ 2008-07-18 8:59 ` Thien-Thi Nguyen
2008-07-18 19:06 ` Johan Bockgård
1 sibling, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2008-07-18 8:59 UTC (permalink / raw)
To: Nordlöw; +Cc: help-gnu-emacs
() Nordlöw <per.nordlow@gmail.com>
() Fri, 18 Jul 2008 00:10:38 -0700 (PDT)
Is there a general or mode-specific (c-mode for my application) way of
checking whether the cursor is currently placed inside a comment or not?
Perhaps you can use `hs-inside-comment-p', which would require you to
enable/configure hideshow (not difficult, but not "out of the box").
What is the most clever way of doing this?
It depends on how you conceptualize "clever".
thi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Checking if cursor is inside a comment
2008-07-18 7:10 Checking if cursor is inside a comment Nordlöw
2008-07-18 8:59 ` Thien-Thi Nguyen
@ 2008-07-18 19:06 ` Johan Bockgård
1 sibling, 0 replies; 3+ messages in thread
From: Johan Bockgård @ 2008-07-18 19:06 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> Is there a general or mode-specific (c-mode for my application) way of
> checking whether the cursor is currently placed inside a comment or
> not?
(nth 4 (syntax-ppss))
--
Johan Bockgård
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-18 19:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-18 7:10 Checking if cursor is inside a comment Nordlöw
2008-07-18 8:59 ` Thien-Thi Nguyen
2008-07-18 19:06 ` Johan Bockgård
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).