From: Michael Mauger <mmaug@yahoo.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Need help fixing comint fontification for python.
Date: Mon, 8 Oct 2012 12:05:43 -0700 (PDT) [thread overview]
Message-ID: <1349723143.33123.YahooMailNeo@web160905.mail.bf1.yahoo.com> (raw)
On Sun, 07 Oct 2012 10:37:28 -0400, Stefan Monnier said: > > What would be the best way remove the syntax class for all the output?
>
> Use a syntax-propertize-function.
>
> Look at the `field' property and wherever its value is `output', place
> an appropriate syntax-table property.
> Or alternatively, use a "safe" syntax-table in the buffer, but add
> Python's syntax-table as a property whereas the `field' property is nil.
>
>
> Stefan I've tried this and it doesn't appear that the field text property has
been applied to the output text when the syntax-propertize-function
fires. Once the display is complete, the field property is present but
in the hook function it isn't present. Am I missing something? At the start of the syntax-propertize-function on the START location: ------------------------------------------------------------------------ position: 12182 of 13643 (89%), column: 4 character: [ (displayed as [) (codepoint 91, #o133, #x5b) preferred charset: iso-8859-1 (Latin-1 (ISO/IEC 8859-1))
code point in charset: 0x5B syntax: (] which means: open, matches ] category: .:Base, a:ASCII, l:Latin, r:Roman to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME" buffer code: #x5B file code: #x5B (encoded by coding system iso-latin-1-unix) display: by this font (glyph code) xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1 (#x3E) Character code properties: customize what to show name: LEFT SQUARE BRACKET old-name: OPENING SQUARE BRACKET general-category: Ps (Punctuation, Open) decomposition: (91) ('[') There is an overlay here: From 12182 to 12182 face hl-line window #<window 44 on *Python*> There are text properties here: charset iso-8859-1 fontified nil ------------------------------------------------------------------------ At the same location, in the comint buffer ------------------------------------------------------------------------ position: 12182 of
13643 (89%), column: 0 character: [ (displayed as [) (codepoint 91, #o133, #x5b) preferred charset: iso-8859-1 (Latin-1 (ISO/IEC 8859-1))
code point in charset: 0x5B syntax: (] which means: open, matches ] category: .:Base, a:ASCII, l:Latin, r:Roman to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME" buffer code: #x5B file code: #x5B (encoded by coding system iso-latin-1-unix) display: by this font (glyph code) xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1 (#x3E) Character code properties: customize what to show name: LEFT SQUARE BRACKET old-name: OPENING SQUARE BRACKET general-category: Ps (Punctuation, Open) decomposition: (91) ('[') There is an overlay here: From 12182 to 12183 face show-paren-match priority 1000 There are text properties here: charset iso-8859-1 field output fontified t front-sticky (field inhibit-line-move-field-capture) inhibit-line-move-field-capture t rear-nonsticky t [back] ------------------------------------------------------------------------
Here's what I did:
(defun my-comint-output-propertize (start end)
(let (output-start output-end)
(while (< start end)
(describe-char start)
(setq output-start (text-property-any start end 'field 'output))
(if output-start ;; <-- Never satisfied
(progn
(setq output-end
(min
(next-single-char-property-change output-start 'field nil end)
(next-single-char-property-change output-start 'font-lock-face nil end)))
(unless (eq (get-char-property output-start 'font-lock-face)
'comint-highlight-prompt)
(put-text-property output-start output-end 'font-lock-face 'italic))
(setq start output-end))
(setq start end)))))
(add-hook 'comint-mode-hook
(lambda () (setq syntax-propertize-function 'my-comint-output-propertize)))
The output above is from the `describe-char' call; the
`text-property-any' call is never detecting the `field' property being
set to `output'. The second output is from me positioning the caret and
hitting C-u C-x =.
Obviously, dope slap me if appropriate, I can't learn
otherwise. Be gentle.
-- Michael
next reply other threads:[~2012-10-08 19:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 19:05 Michael Mauger [this message]
2012-10-09 1:04 ` Need help fixing comint fontification for python Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2012-10-07 13:58 Fabian Ezequiel Gallina
2012-10-07 14:37 ` 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=1349723143.33123.YahooMailNeo@web160905.mail.bf1.yahoo.com \
--to=mmaug@yahoo.com \
--cc=emacs-devel@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.
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.