From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Dario Gjorgjevski <dario.gjorgjevski@gmail.com>
Cc: 45341@debbugs.gnu.org
Subject: bug#45341: [PATCH] Make python-mode fontify more assignment statements
Date: Sun, 20 Dec 2020 18:04:59 +0000 [thread overview]
Message-ID: <87sg80gxpw.fsf@tcd.ie> (raw)
In-Reply-To: <fv2zojh7og8mxf.fsf@gmail.com> (Dario Gjorgjevski's message of "Sun, 20 Dec 2020 17:25:16 +0100")
Dario Gjorgjevski <dario.gjorgjevski@gmail.com> writes:
> +(defun python-font-lock-assignment-matcher (regexp)
> + "Font lock matcher for assignments based on REGEXP.
> +Return nil if REGEXP matched within a `paren' context (to avoid,
> +e.g., default values for arguments or passing arguments by name
> +being treated as assignments) or is followed by an '=' sign (to
> +avoid '==' being treated as an assignment."
> + (lambda (limit)
> + (let ((res (re-search-forward regexp limit t)))
> + (unless (or (python-syntax-context 'paren)
> + (equal (char-after (point)) ?=))
Nit: char-after already defaults to looking at point, but you could also
use following-char which always returns a natnum.
--
Basil
next prev parent reply other threads:[~2020-12-20 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-20 16:25 bug#45341: [PATCH] Make python-mode fontify more assignment statements Dario Gjorgjevski
2020-12-20 18:04 ` Basil L. Contovounesios [this message]
2020-12-21 4:43 ` Lars Ingebrigtsen
2020-12-21 4:41 ` Lars Ingebrigtsen
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=87sg80gxpw.fsf@tcd.ie \
--to=contovob@tcd.ie \
--cc=45341@debbugs.gnu.org \
--cc=dario.gjorgjevski@gmail.com \
/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).