help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regex to match underscore in function name in Python Mode?


From: Nate Bargmann
Subject: Regex to match underscore in function name in Python Mode?
Date: Sun, 23 Jul 2017 02:12:00 +0000 (UTC)
User-agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]