bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18730: [PATCH] tildify.el: Add `auto-tildify' and `auto-tildify-mode


From: Michal Nazarewicz
Subject: bug#18730: [PATCH] tildify.el: Add `auto-tildify' and `auto-tildify-mode'.
Date: Thu, 16 Oct 2014 18:07:30 +0200
User-agent: Notmuch/0.17+15~gb65ca8e (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu)

On Thu, Oct 16 2014, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> Could it use the existing tildify-pattern-alist?
>> In the current implementation those two have to be a separate alists.
>> tildify-pattern-alist assumes that the whole text is available so the
>> patterns may check text before and after the soft space.  Patterns in
>> auto-tildify-pattern-alist can only look back before the space
>> character.
>
> Is there a particular reason we can't use tildify-pattern-alist anyway
> (and look both before *and* after)?
>
> Or recognize the entries of tildify-pattern-alist which can't be used
> (e.g. make sure that the char modified is the one right before point)?

No, because with the default pattern, it won't be the character before
point that is being changed.

You can create a buffer, set latex-mode, and insert "Foo v bar v "
(i.e. with trailing space at the end) and you'll see that when you run
`tildify-buffer') the space after first v will be replaced, but the
final one won't.

So with automatic tildifying, the space will be hardened only after some
word-character is inserted after the final space.

>> The implementation could be changed to use tildify-pattern-alist but:
>> * It will be slower because it would have to match pattern after every
>>   inserted character (whereas currently the pattern is matched only if
>>   character at point is space and character before it is a word
>>   character).
>
> Why?  Can't we just check (eq last-command-event ?\s)?

We cannot, see above.

Of course, we can change `tildify-pattern-alist''s default value and
require that it does not look past the white-space that is being
replaced, in which case auto-tildify will be able to use it.  I would be
fine with that myself, but I don't know how strict should we be about
backward compatibility.

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--





reply via email to

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