From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#18730: [PATCH] tildify.el: Add `auto-tildify' and `auto-tildify-mode'. Date: Wed, 15 Oct 2014 10:35:34 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1413383789 18897 80.91.229.3 (15 Oct 2014 14:36:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Oct 2014 14:36:29 +0000 (UTC) Cc: Milan Zamazal , 18730@debbugs.gnu.org To: Michal Nazarewicz Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 15 16:36:22 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 1XePgc-0006AJ-74 for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Oct 2014 16:36:22 +0200 Original-Received: from localhost ([::1]:45067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XePgb-0000oT-OP for geb-bug-gnu-emacs@m.gmane.org; Wed, 15 Oct 2014 10:36:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XePgQ-0000e5-Re for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 10:36:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XePgJ-0008Is-2q for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 10:36:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XePgI-0008Ih-Vo for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 10:36:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XePgH-0005Er-Lh for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 10:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Oct 2014 14:36:01 +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.141338373920099 (code B ref 18730); Wed, 15 Oct 2014 14:36:01 +0000 Original-Received: (at 18730) by debbugs.gnu.org; 15 Oct 2014 14:35:39 +0000 Original-Received: from localhost ([127.0.0.1]:44578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XePft-0005E5-IH for submit@debbugs.gnu.org; Wed, 15 Oct 2014 10:35:38 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:8410) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XePfr-0005Dv-8m for 18730@debbugs.gnu.org; Wed, 15 Oct 2014 10:35:35 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94262161" Original-Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Oct 2014 10:35:34 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 6F7A47CFB; Wed, 15 Oct 2014 10:35:34 -0400 (EDT) In-Reply-To: (Michal Nazarewicz's message of "Wed, 15 Oct 2014 10:01:26 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) 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:94539 Hi Michal, Thanks for your patch. It looks like a good feature. See some comments below. Stefan > It is configured via two new customize variables: > `auto-tildify-pattern-alist' and `auto-tildify-check-envs'. Could it use the existing tildify-pattern-alist? > +Breaking line after a single-character words are forbidden > +by Czech and Polish typography (and may be discouraged in other > +languages), so `auto-tildify-mode' makes it easier to create > +a typographically-correct documents. Indeed, that's why we have fill-single-char-nobreak-p. You might like to write the above text is such a way to make it clear what's the difference between the two. > + "Alist specifying whether to insert hard space at point. IIUC this isn't quite right: "insert hard space" would imply adding a space without changing anything else, whereas what you code does is to replace a soft space by a hard space. So instead of "insert hard", I'd say maybe "harden". > +;;;###autoload > +(defun auto-tildify () [...] > +This function is meant to be used as a `post-self-insert-hook'." Why is it autoloaded? Are users expected to add it to post-self-insert-hook by hand? > + (interactive) Why is it interactive? Would it make sense to bind it to a key sequence or to run it via M-x ? > +;;;###autoload > +(define-minor-mode auto-tildify-mode I recommend you name it just `tildify-mode' (and generally just use a "tildify-" prefix rather than "auto-tildify-"). For that, it would most likely make sense to rename tildify-mode-alist (e.g. to tildify--mode-alist, tho another name could be even better since this name doesn't actually say what it does). > + (message "Hard space for %s is a single space character, auto-tildify won't have any effect." major-mode) Please try to stay within the limits of 80 columns.