From: Stefan Monnier <monnier@iro.umontreal.ca>
To: JD Smith <jdtsmith@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Selective font-locking?
Date: Sun, 11 Apr 2021 12:31:10 -0400 [thread overview]
Message-ID: <jwva6q4hjnk.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <7A948673-E156-42BA-BA50-E91986908BB5@gmail.com> (JD Smith's message of "Sun, 11 Apr 2021 11:27:39 -0400")
> But then, why bother round-tripping text out to a special-use buffer anyway,
> vs. just letting font-lock operate in-situ in the shell buffer itself using
> python-mode’s fairly simple font-lock-defaults. The only thing needed to
> make this work is asking font-lock to ignore all the text with ‘field of
> ‘output?
Maybe you can try something like the following?
(defvar python--font-lock-keywords ...)
(defvar python-font-lock-keywords
'(python--apply-font-lock))
(defun python--apply-font-lock (limit)
(while (< (point) limit)
(let ((next-boundary (find-next-boundary limit)))
(if (we-should-skip-this-block)
(goto-char next-boundary)
(let ((font-lock-keywords python--font-lock-keywords))
(font-lock-ensure (point) limit))))))
-- Stefan
next prev parent reply other threads:[~2021-04-11 16:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 15:27 Selective font-locking? JD Smith
2021-04-11 16:31 ` Stefan Monnier [this message]
2021-04-11 20:54 ` JD Smith
2021-04-11 21:10 ` Stefan Monnier
2021-04-13 1:51 ` JD Smith
2021-04-13 2:07 ` Stefan Monnier
2021-04-13 3:33 ` JD Smith
2021-04-13 4:04 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwva6q4hjnk.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=jdtsmith@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.