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 16:16:38 +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, Ted Zlatanov <tzz@lifelogs.com> wrote:
> On Wed, 15 Oct 2014 10:01:26 +0200 Michal Nazarewicz <mina86@mina86.com> 
> wrote: 
> MN> +** `auto-tildify-mode' allows to automatically add hard spaces as one 
> types
> MN> +the text.  Breaking line after a single-character words are forbidden
> MN> +by Czech and Polish typography (and may be discouraged in other
> MN> +languages), so `auto-tildify-mode' makes it easier to create
> MN> +a typographically-correct documents.
>
> The name is kind of opaque, I expected it to do with tildes like the "~"
> character or maybe home directories but it's actually about
> typography.

The name, as I understand it, is historical because in the past it
indeed had to do with tildes.  In TeX (and LaTeX) tilde denotes
a non-breaking space.

I agree that the name may be confusing, but the mode has been around for
years, so changing the name now may be not worth it.

> As a suggestion, could it be a general `auto-typography-mode' with
> options, one of which would be
> `typography-no-linebreak-after-single-character-word'?  Similar to how
> `whitespace-mode' works?  There surely are other such typography
> options.

The way I see it, tildify is for fixing soft spaces, so perhaps a better
option would be to add a whitespace-mode style for that?

In particular, tildify is a bit heavy-weight as it implements
environment (or context) checking (e.g. checking if one is inside of
<pre> in HTML or inside of \begin{math} in LaTeX), which may be too slow
for whitespace-mode.  I don't have experience with fontifying though.

On Thu, Oct 16 2014, Ted Zlatanov <tzz@lifelogs.com> wrote:
> Another followup: it would be nice if `auto-{tildify,typography}-mode'
> worked with `fill-paragraph' as well. I don't think it will, as
> proposed (but haven't tested it).

There is, somewhat unrelated, fill-single-char-nobreak-p predicated:

  (when (fboundp 'fill-single-char-nobreak-p)
    (add-hook 'fill-nobreak-predicate 'fill-single-char-nobreak-p))

Again, it's much simpler than tildify since it does not check context,
but the way I see it is that one would use fill-paragraph for text that
needs to be formatted in source, while tildify is for cases where the
source is interpreted and rendered (like HTML where new lines are
treated the same way spaces are so how fill-paragraph fills does not
matter).

-- 
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]