From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: electric-pair-mode as a minor mode? Date: Sun, 26 Apr 2015 11:28:36 +0100 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 1430044138 28935 80.91.229.3 (26 Apr 2015 10:28:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Apr 2015 10:28:58 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 26 12:28:57 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YmJnz-0000C3-DJ for ged-emacs-devel@m.gmane.org; Sun, 26 Apr 2015 12:28:55 +0200 Original-Received: from localhost ([::1]:50320 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmJny-00039V-IU for ged-emacs-devel@m.gmane.org; Sun, 26 Apr 2015 06:28:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmJnr-00039I-39 for emacs-devel@gnu.org; Sun, 26 Apr 2015 06:28:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmJnl-0008HD-Mt for emacs-devel@gnu.org; Sun, 26 Apr 2015 06:28:47 -0400 Original-Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:37783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmJnl-0008H9-Fo for emacs-devel@gnu.org; Sun, 26 Apr 2015 06:28:41 -0400 Original-Received: by widdi4 with SMTP id di4so61500454wid.0 for ; Sun, 26 Apr 2015 03:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=7MVsKUVM0XeYL6wGhqRSRRkH0wwGnSZ+aNdE14uLjI0=; b=Titxh64pl+7mweWJsKR1LTJYS47zLZWoP1sEcNP4lLGD24z+HUSe+NvT2ZiRnE8686 Jt6INS6jR1Vh92ruXBYPATN9UMpXGKVA5eYCopJoDOoHlv5fr/vHQ9XLtbWGkoYEIKp9 TibBls1mqGKPLC+gWyx9Q9dKNoLIxRe6nxCvexBP2UsqwvFqd6SlrdZNaf56HT99vUkg oJ61AoIkIPhq8n4LeHmlaNcpe3LYzbxrF5tRn86I3RaO3v0O7rYHMO1qSVTMHzYT0xXw lZcBqdUnU4yGf+cpwp9PU466Vs97GdJwNZLeFVW0e6DknYymOxLN0JE+JpWGPTGHaRsn YCEQ== X-Received: by 10.180.84.67 with SMTP id w3mr12110608wiy.68.1430044120821; Sun, 26 Apr 2015 03:28:40 -0700 (PDT) Original-Received: from holy.lan.yourcompany.com (31.57.37.188.rev.vodafone.pt. [188.37.57.31]) by mx.google.com with ESMTPSA id cf12sm24562767wjb.10.2015.04.26.03.28.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Apr 2015 03:28:39 -0700 (PDT) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Wed, 15 Apr 2015 23:43:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185903 Archived-At: Lars Magne Ingebrigtsen writes: >> On a related subject, I was thinking of (require 'smiley) in message.el >> to avoid a `message-smiley' variable (a list o strings), and just use >> the cars of `smiley-regexp-alist'. Can that be problematic? > Requiring smiley should be unproblematic, I think. Not so, unfortunately. Requiring it eventually requires `message' recursively. I tried with `eval-when-compile'. It works when compiling message.el standalone, but not when making emacs (some interaction with eager-macroexpansion, apparently): How do I solve this? Jo=C3=A3o PS: Here's what I tried: diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 1371e70..fe2097e 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2964,15 +2964,13 @@ See also `message-forbidden-properties'." =20 (autoload 'ecomplete-setup "ecomplete") ;; for Emacs <23. =20 -(defvar message-smileys '(":-)" ":)" - ":-(" ":(" - ";-)" ";)") - "A list of recognized smiley faces in `message-mode'.") +(eval-when-compile (require 'smiley)) ;; for `smiley-regexp-alist,' + ;; `eval-when-compile' needed to + ;; prevent recursive require. =20 (defun message--syntax-propertize (beg end) "Syntax-propertize certain message text specially." - (let ((citation-regexp (concat "^" message-cite-prefix-regexp ".*$")) - (smiley-regexp (regexp-opt message-smileys))) + (let ((citation-regexp (concat "^" message-cite-prefix-regexp ".*$"))) (goto-char beg) (while (search-forward-regexp citation-regexp end 'noerror) @@ -2982,11 +2980,14 @@ See also `message-forbidden-properties'." `(syntax-table ,(string-to-syntax "<"))) (add-text-properties end (min (1+ end) (point-max)) `(syntax-table ,(string-to-syntax ">"))))) - (goto-char beg) - (while (search-forward-regexp smiley-regexp - end 'noerror) - (add-text-properties (match-beginning 0) (match-end 0) - `(syntax-table ,(string-to-syntax ".")))))) + (when (featurep 'smiley) + (mapc (lambda (smiley-regexp) + (goto-char beg) + (while (search-forward-regexp smiley-regexp + end 'noerror) + (add-text-properties (match-beginning 0) (match-end 0) + `(syntax-table ,(string-to-syntax "."= ))))) + (mapcar #'car smiley-regexp-alist))))) =20 ;;;###autoload (define-derived-mode message-mode text-mode "Message"