emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 188f657: Fix false negatives in tex--prettify-s


From: Artur Malabarba
Subject: Re: [Emacs-diffs] master 188f657: Fix false negatives in tex--prettify-symbols-compose-p.
Date: Tue, 29 Sep 2015 14:14:53 +0100

2015-09-29 13:31 GMT+01:00 Tassilo Horn <address@hidden>:
> Artur Malabarba <address@hidden> writes:
>
>> Would it be possible to also use `tex--prettify-symbols-compose-p' to
>> avoid composing the symbol-at-point? (perhaps by checking window-point
>> or something). That would toggleable by a user-option, of course.
>
> You mean, when point enters a prettified symbol the original text would
> be shown?  Indeed, that sounds like a neat idea.  If I think about it, I
> don't use prettification in LaTeX exactly because there are so many
> prettified symbols which partly overlap and then editing becomes
> cumbersome, e.g., when deleting a char from the prettified integral \int
> you'll get the prettification of the set membership relation \in.

Yes. I like prettify-symbols quite a bit, but this slight
inconvenience when editing symbols prevents me from using the mode
right now.

>> Or maybe that feature should be implemented in `prettify-symbols-mode'
>> itself.
>
> Yes, I think the only thing to be done would be to change the
>
>   (if (funcall prettify-symbols-compose-predicate start end match) ...
>
> in `prettify-symbols--compose-symbol' to
>
>   (if (and (or prettify-symbols-compose-at-point
>                (< (window-point) start)
>                (> (window-point) end))
>            (funcall prettify-symbols-compose-predicate start end match)))

I was actually thinking of using `<=', so that placing point at the
edges would already be enough.

> where `prettify-symbols-compose-at-point' would be the user option.

I tried something similar, and unfortunately it's not that simple.
Firstly, (window-point) didn't seem to work as expected here, so I had
to define a variable in font-lock-mode to hold the value of (point)
before fontification started.

After doing that, the feature sort of works while you're writing. That
is, it doesn't prettify a symbol you've just written, but it does
prettify a symbol after you hit SPC, which is nice.
However, it does not work while navigating. That is, when you move
point to a prettified symbol, it doesn't get decomposed.

Then I tried adding a post-command-hook function to invalidate the
font-locking at point. This correctly decomposes a symbol when you
move the cursor to it, but it's still not perfect. When you move the
cursor *out* of the symbol, if you move far enough, the symbol doesn't
get prettified again until you edit something close to it.



reply via email to

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