From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: Regex to match underscore in function name in Python Mode? Date: Sat, 22 Jul 2017 20:06:32 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1500779250 31842 195.159.176.226 (23 Jul 2017 03:07:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Jul 2017 03:07:30 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 23 05:07:25 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZ7En-0007o9-UN for geh-help-gnu-emacs@m.gmane.org; Sun, 23 Jul 2017 05:07:22 +0200 Original-Received: from localhost ([::1]:49036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ7Er-0003UO-Vu for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Jul 2017 23:07:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dZ7EO-0003UJ-Rp for help-gnu-emacs@gnu.org; Sat, 22 Jul 2017 23:06:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dZ7EO-0001pT-55 for help-gnu-emacs@gnu.org; Sat, 22 Jul 2017 23:06:56 -0400 Original-Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:38172) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dZ7EN-0001oy-W4 for help-gnu-emacs@gnu.org; Sat, 22 Jul 2017 23:06:56 -0400 Original-Received: by mail-qk0-x235.google.com with SMTP id g6so41694612qkf.5 for ; Sat, 22 Jul 2017 20:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=M+4b7SqPeYVVomv7KcpXy06lzD0CDEaoMSKn/2LvbTQ=; b=CYx4pndgyzBFeAa+DGIJf92SDQhVl2XJTlYUoeTk6I8OhB4+PftaoxCNHo+aLUpHt6 nGhWc+wgTiy/W3eoO3EJBoThKWfDz1juLplS48ORCy1zWAbUfqbrVrWNx/o8SQ361UYK KO7g1Es8gDFGswR7cyfoN/riHM4aefwX6mWpgby1JU2JD+j+s1ASyFQM3HPBcGrvVhrL A6BZG1/QOc8TNgjLfQmRbK9/nMUOgWX0X9UQV4KF0WmzmCkwBQ3fzeXOo1fjGp/n6Xlu DrfoN/Eimf3NDGWPJgeMkbyEOHvpt/19PznZtuHKpYHIorlLgIn0ynBGlkFHvy2P17uS gGag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=M+4b7SqPeYVVomv7KcpXy06lzD0CDEaoMSKn/2LvbTQ=; b=bkAiQIFVfoUThsMGk9paFXSoN+VCaENnEwKGDH6ij87e/vaKxSGIgmqYjSpbH7KzhF jDP77HEn+dq9os7uJaUMY/sBNsBrd+jNKT/nMqWqhZMVAvkbNhXBLSwJz1JNQBCI4Eew 8gF6+ukwXFJ9N4Tcw8bwWoZourdRdIcrv3E0M0tgu/Czw2ImEd+2rTa2mIZbtAp1wzvB 8qum2peTb9sEce1Y7jgWBe6gWC+nHah0HDJcLFthq3BYZvcvhQBi77eeBlqEvtc4wRhz GCRfnS56LKxxXFZ2eOp3zruD4vNQEZPkt+GWj5v3ZZuN99nZr2AQVCBEg2Rvv7MCAll8 /8Lw== X-Gm-Message-State: AIVw110mAUIMRl11+tZacU/EvtTD/xHQuLrY79pemMU+G/K0HeDiaYoh Pipo5KRYiAEYNonAIRb7CQIoZzsVBmAL+Jw= X-Received: by 10.233.220.130 with SMTP id q124mr15134102qkf.284.1500779213523; Sat, 22 Jul 2017 20:06:53 -0700 (PDT) Original-Received: by 10.237.48.241 with HTTP; Sat, 22 Jul 2017 20:06:32 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::235 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113835 Archived-At: Nate Bargmann wrote: > 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))) > )) I think you may have posted the wrong snippet? This seems to fontify punctuation characters, not function names. > 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? Is the goal to fontify function names at use sites (e.g. the `foo` in `foo(0)`) in addition to declaration and definition sites (where they're already fontified by the major mode)? John