unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sam Steingold <sds@gnu.org>
To: emacs-devel@gnu.org
Subject: how do I find out the syntactic status of a location?
Date: Thu, 15 Mar 2012 12:44:37 -0400	[thread overview]
Message-ID: <873999ak5m.fsf@gnu.org> (raw)

I want to find out whether I am in a symbol, string, constant, comment
&c without knowing the details of the syntax of the specific mode, i.e.,
the code should work the same in, e.g., C and Lisp modes.
If font-lock is enabled, I can check that I am in a string or comment
using

    (memq (plist-get (text-properties-at (point)) 'face)
          '(font-lock-comment-face font-lock-string-face))

is there a better way?

thanks.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://mideasttruth.com http://iris.org.il
http://jihadwatch.org http://camera.org http://www.PetitionOnline.com/tap12009/
What garlic is to food, insanity is to art.




             reply	other threads:[~2012-03-15 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15 16:44 Sam Steingold [this message]
2012-03-15 18:53 ` how do I find out the syntactic status of a location? Davis Herring

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873999ak5m.fsf@gnu.org \
    --to=sds@gnu.org \
    --cc=emacs-devel@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 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).