unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nate Bargmann <n0nb.DO.NOT.SPAM@ME.n0nb.us>
To: help-gnu-emacs@gnu.org
Subject: Regex to match underscore in function name in Python Mode?
Date: Sun, 23 Jul 2017 02:12:00 +0000 (UTC)	[thread overview]
Message-ID: <ol10lg$10of$1@gioia.aioe.org> (raw)

In C mode I have the following in my ~/.emacs that will highlight a 
function name:

;; Highlight punctuation in C mode
(add-hook
 'c-mode-common-hook
 (lambda ()
   (font-lock-add-keywords
    nil
    '(("[<>:&*=+^%!~,.?;/-]"
       0 font-lock-warning-face nil)))
   ))

In C mode this will highlight all characters in a function name (left of 
the opening parentheses) to the word boundary including underscores.  I 
am attempting to use the same for python mode, however, the regex matches 
up to the first underscore, if there is one, but no further.  I'll admit 
to not be intimately familiar with Emacs regexes and I did try re-builder 
and was unable to get a match on the underscore.

Is it possible that Python Mode is blocking the regex from matching 
underscores?

TIA

- Nate

--

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Ham radio, Linux, bikes, and more: http://www.n0nb.us


             reply	other threads:[~2017-07-23  2:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-23  2:12 Nate Bargmann [this message]
2017-07-23  3:06 ` Regex to match underscore in function name in Python Mode? John Mastro
2017-07-24 18:38   ` John Mastro
2017-07-24 21:09     ` Emanuel Berg
2017-07-24 21:23       ` John Mastro
2017-07-24 23:43         ` Emanuel Berg
2017-07-29  2:10     ` Nate Bargmann
2017-07-29 23:21       ` Emanuel Berg
2017-07-23  3:20 ` Skip Montanaro
2017-07-23  3:34   ` Emanuel Berg

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='ol10lg$10of$1@gioia.aioe.org' \
    --to=n0nb.do.not.spam@me.n0nb.us \
    --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.
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).