From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michal Nazarewicz Newsgroups: gmane.emacs.bugs Subject: bug#18730: [PATCH] tildify.el: Add `auto-tildify' and `auto-tildify-mode'. Date: Thu, 16 Oct 2014 16:16:38 +0200 Organization: http://mina86.com/ Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1413469045 27829 80.91.229.3 (16 Oct 2014 14:17:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Oct 2014 14:17:25 +0000 (UTC) Cc: Milan Zamazal , 18730@debbugs.gnu.org To: Ted Zlatanov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 16 16:17:17 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xelrg-0004fp-HW for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Oct 2014 16:17:16 +0200 Original-Received: from localhost ([::1]:50644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xelrg-0001nE-2e for geb-bug-gnu-emacs@m.gmane.org; Thu, 16 Oct 2014 10:17:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XelrX-0001n4-V9 for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2014 10:17:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XelrT-0002BH-5j for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2014 10:17:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XelrT-0002BA-1e for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2014 10:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XelrS-0007uc-FQ for bug-gnu-emacs@gnu.org; Thu, 16 Oct 2014 10:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michal Nazarewicz Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Oct 2014 14:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18730 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 18730-submit@debbugs.gnu.org id=B18730.141346901330395 (code B ref 18730); Thu, 16 Oct 2014 14:17:02 +0000 Original-Received: (at 18730) by debbugs.gnu.org; 16 Oct 2014 14:16:53 +0000 Original-Received: from localhost ([127.0.0.1]:46043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelrI-0007u9-Vf for submit@debbugs.gnu.org; Thu, 16 Oct 2014 10:16:53 -0400 Original-Received: from mail-wi0-f177.google.com ([209.85.212.177]:43842) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelrH-0007u1-9N for 18730@debbugs.gnu.org; Thu, 16 Oct 2014 10:16:52 -0400 Original-Received: by mail-wi0-f177.google.com with SMTP id fb4so4884703wid.4 for <18730@debbugs.gnu.org>; Thu, 16 Oct 2014 07:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:organization:references :user-agent:face:date:message-id:mime-version:content-type :content-transfer-encoding; bh=smguPZkoG4/xzcsYxHUxBQQnGoIF6uw8sn/9zaQma6I=; b=Q0nkNFp5qiFxUEKpUGW46A9FVLwOIA+PhDpjJq/L4Rn7ppoOVb+K8wrbj2Y3nwiacN 1fCx5Vp210KDF4nTszjR8N3I+CHXYs3DLY8Gt0AkynTX1yxXoQ/rfJ5ngIMrdbj24mNv Urk3doGKSv2/kAf/OltzMLH/le1DeCL6KKHYR8LvjLk4wtFnPnQRZU75lxOhzXRm4Uup aZGIZox867NHiAcbbEtH7tvcMrKHpSdx/iMF2YuKn7Z2B69tYjV/ei3EjADFOPKuAJYX 3zcQndVWtp7HDeGyqg9mwyBFcd/fueSgfXOSzyJMM7eIU3eAxviRiJ+1KqTPaKtnhPkb eqLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to :organization:references:user-agent:face:date:message-id :mime-version:content-type:content-transfer-encoding; bh=smguPZkoG4/xzcsYxHUxBQQnGoIF6uw8sn/9zaQma6I=; b=gsemnouNW38a+nzbL7dNoa6MYRdxIHmG7rY8k1mr6/t0XZ6u3mzXu/WRxuQI8CxIbM EXdP9Hl6s2EtHwkhCH9HiQOkBtqRSs2LFsuerFcasdlA34dv7i7L4aTGoV1tKPS70VGn uM02yiuG92/8Rj8hLuxb2ZkdA4pH116jB5PNtx0Iabip0lGE8wC1nf14BlCFrdh2+8gP n8UvzEJLzQQtvFqJCbWUYmenDjUhLKxl0+lHhHdCzcB5Z+jS7RAfCuNO10TrBVmiCKHT Q0kWVewkqTHSTJYPuXuqCkyYy2R6WsTwVxN0Xqrk+OxCcqjnKfcw9rcBc9DedUoJMz+w sH0Q== X-Gm-Message-State: ALoCoQkyw2w5owE/YTVGu76LLx2GullnmboCniebqKI2BtZp2U3XWdnlaaWldNIhW22jdBa/TQtj X-Received: by 10.180.211.206 with SMTP id ne14mr21278449wic.79.1413469010478; Thu, 16 Oct 2014 07:16:50 -0700 (PDT) Original-Received: from mpn-glaptop.roam.corp.google.com ([62.156.150.204]) by mx.google.com with ESMTPSA id t10sm9842450wja.43.2014.10.16.07.16.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014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kKTFHDWfPniR 4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:141016:tzz@lifelogs.com::7V0RLTNe22aXHzpI:02T9t X-Hashcash: 1:20:141016:pdm@zamazal.org::A5qHdFr8z7shnpmf:001+WA X-Hashcash: 1:20:141016:18730@debbugs.gnu.org::6lDJUj9SoMdRnvxX:00000000000000000000000000000000000000005tAM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:94615 On Thu, Oct 16 2014, Ted Zlatanov wrote: > On Wed, 15 Oct 2014 10:01:26 +0200 Michal Nazarewicz = wrote:=20 > MN> +** `auto-tildify-mode' allows to automatically add hard spaces as on= e 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
 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  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).

--=20
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=3D./ `o
..o | Computer Science,  Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz   =
 (o o)
ooo +------ooO--(_)--Ooo--