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, 23 Oct 2014 01:19:20 +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 1414020023 22881 80.91.229.3 (22 Oct 2014 23:20:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Oct 2014 23:20:23 +0000 (UTC) Cc: Milan Zamazal , 18730@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 23 01:20:16 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 1Xh5CR-00079p-QR for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Oct 2014 01:20:16 +0200 Original-Received: from localhost ([::1]:33240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xh5CR-0006zI-CO for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Oct 2014 19:20:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xh5CJ-0006w5-8w for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 19:20:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xh5CF-00034K-1P for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 19:20:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xh5CE-00033v-V4 for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 19:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xh5CE-0006Dt-AK for bug-gnu-emacs@gnu.org; Wed, 22 Oct 2014 19:20: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: Wed, 22 Oct 2014 23:20: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.141401997323878 (code B ref 18730); Wed, 22 Oct 2014 23:20:02 +0000 Original-Received: (at 18730) by debbugs.gnu.org; 22 Oct 2014 23:19:33 +0000 Original-Received: from localhost ([127.0.0.1]:60296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xh5Bk-0006D3-T4 for submit@debbugs.gnu.org; Wed, 22 Oct 2014 19:19:33 -0400 Original-Received: from mail-lb0-f175.google.com ([209.85.217.175]:63505) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xh5Bi-0006Cp-FS for 18730@debbugs.gnu.org; Wed, 22 Oct 2014 19:19:31 -0400 Original-Received: by mail-lb0-f175.google.com with SMTP id u10so3766334lbd.34 for <18730@debbugs.gnu.org>; Wed, 22 Oct 2014 16:19:24 -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=J7KmhBW3oZb5o5JGqMn8tW1w8+S7ezA/K8mifUxX/CI=; b=T0mqQUNBCVhWapExvFRXHcFzptQE7R6kiYG4FSrwiake6GwqiYh8wS5Xj87oeKqrjp m+A7YG73pslI2T25Ml7N4Fg3jJ311Oned1WdIrHSXyBehpdR6gFGfNGEXprydr63+dg8 aae3MXN/e37XYRjKYdUeKrLDDGn9sURUE8RI48Ta00puCfZUVEXFH96XeEi6+i/xxqa4 BeyQAqw88n1xwqEtqbKfHT+o3y9ihUJwVWZE8p8jRGzHfDA9AVNoq/j1ZnbYJayNLO2a EfkDRT5VvPExK8S4BpTa2T96qx5mWyPtMJOqutFBug0nwEEOe615bqUqUfr6C9BM0GDQ PA1w== 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=J7KmhBW3oZb5o5JGqMn8tW1w8+S7ezA/K8mifUxX/CI=; b=bcULuRPgJKJEtskb0IsLgac7zfTiuKMpPoU7UWMpllWqerhpoObW+dH4WxhxQe+3Vo qbKkFx4kYX9M9F7h5EOeyb8QuPXCPVwj+mwPNNvWpYeLSAD+Yh5Tncpzy44Mks8jXKhj pVOGe3b393/34pTre+w0Rq8nxlwq3HhbRvqNLQ+5vHzLJxPNLkcNk4etgxhw88lcC3J0 WIE4wJfLr6M3yamlfr8xvGEk2sh/L9ZO8dibHq8nrgnEGDgzKWOFOuusJJeuGiTuPt9w Ey9mHTOZHnwj6H2s4voCKtFdu6CZCOw8tEGosZmqC5MgZA8LkRFoGxLAHtRUi9CIGNtS RcgA== X-Gm-Message-State: ALoCoQlAHLFApHWL2nAphApQ857nQ9lU7BpznGmwokI1fdX8h0Pvp1CaeKeZLtagOlv/jdKbR4QA X-Received: by 10.152.206.11 with SMTP id lk11mr1198324lac.42.1414019964062; Wed, 22 Oct 2014 16:19:24 -0700 (PDT) Original-Received: from mpn-glaptop.roam.corp.google.com ([2620:0:105f:311:cd0b:be0e:902b:cbcf]) by mx.google.com with ESMTPSA id uh7sm80845lac.1.2014.10.22.16.19.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 22 Oct 2014 16:19:22 -0700 (PDT) In-Reply-To: User-Agent: Notmuch/0.17+15~gb65ca8e (http://notmuchmail.org) Emacs/25.0.50.1 (x86_64-unknown-linux-gnu) X-Face: PbkBB1w#)bOqd`iCe"Ds{e+!C7`pkC9a|f)Qo^BMQvy\q5x3?vDQJeN(DS?|-^$uMti[3D*#^_Ts"pU$jBQLq~Ud6iNwAw_r_o_4]|JO?]}P_}Nc&"p#D(ZgUb4uCNPe7~a[DbPG0T~!&c.y$Ur,=N4RT>]dNpd; KFrfMCylc}gc??'U2j,!8%xdD Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR 4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC X-PGP: 50751FF4 X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4 X-Hashcash: 1:20:141022:monnier@iro.umontreal.ca::oMFBhTkAIoES21YC:00000000000000000000000000000000000000mCq X-Hashcash: 1:20:141022:18730@debbugs.gnu.org::Gh03q1nlD1Hx4UGp:00000000000000000000000000000000000000002bBc X-Hashcash: 1:20:141022:pdm@zamazal.org::8/GkE6ViCKqfta03:004jjh 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:94962 On Fri, Oct 17 2014, Stefan Monnier wrote: >> So how would that work? Would I have to also add setting of >> tildify-string (or perhaps tildify-hard-space would be a better name) >> variable in all major modes that tildify-string-alist now includes? > > Yes, that's how it should work. So I came up with a patch whose excerpt is: ------ >8 -------------------------------------------------------------- diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index bc10eab..446cdd4 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1206,6 +1206,8 @@ Entering SliTeX mode runs the hook `text-mode-hook', = then the hook (defun tex-common-initialization () ;; Regexp isearch should accept newline and formfeed as whitespace. (setq-local search-whitespace-regexp "[ \t\r\n\f]+") + ;; Use tilde as hard-space character in tildify package. + (setq-local hard-space-string "~") ;; A line containing just $$ is treated as a paragraph separator. (setq-local paragraph-start "[ \t]*$\\|[\f\\\\%]\\|[ \t]*\\$\\$") ;; A line starting with $$ starts a paragraph, diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 91f5a38..9f9e472 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -86,17 +86,29 @@ mode, the item for the mode SYMBOL is looked up in the = alist instead." (integer :tag "Group ")) (symbol :tag "Like other"))))) =20 +(defcustom hard-space-string nil + "Representation of a hard (a.k.a. no-break) space in current major mode. + +Used by `tildify-buffer' in places where space is required but line +cannot be broken. For example \"~\" for TeX or \" \" for SGML, +HTML and XML modes. A no-break space Unicode character (\"\\u00A0\") +might be used for other modes if compatible encoding is used. + +If nil, current major mode has no way to represent a hard space." + :version "25.1" + :group 'tildify + :type '(choice (const :tag "No hard-space representation") + (const :tag "No-break space (U+00A0)" "\u00A0") + (string :tag "Custom string")) + :safe t) + (defcustom tildify-string-alist ------ >8 -------------------------------------------------------------- but now compilation fails with: textmodes/tex-mode.el:1210:15:Warning: assignment to free variable `hard-space-string' Requiring tildify in tex-mode (and other affected modes) seems a bit of an overkill. Am I doing something stupid here? Or would moving the local variable to another file? --=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--