From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 9ce1d38: Use curved quotes in core elisp diagnostics Date: Tue, 18 Aug 2015 14:31:53 +0300 Message-ID: <55D317A9.6000805@yandex.ru> References: <20150816160149.9416.80132@vcs.savannah.gnu.org> <55D1043C.3030909@yandex.ru> <55D15899.2070105@cs.ucla.edu> <55D1C9CE.2060407@yandex.ru> <55D20EDF.5070906@cs.ucla.edu> <55D223CA.4080109@yandex.ru> <55D22A1F.8040508@cs.ucla.edu> <55D22CF4.9030608@yandex.ru> <55D2747D.10809@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1439897546 19256 80.91.229.3 (18 Aug 2015 11:32:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Aug 2015 11:32:26 +0000 (UTC) To: Paul Eggert , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 18 13:32:15 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 1ZRf7m-00051C-CE for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2015 13:32:14 +0200 Original-Received: from localhost ([::1]:55870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRf7l-0000rW-Ml for ged-emacs-devel@m.gmane.org; Tue, 18 Aug 2015 07:32:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRf7f-0000mr-BH for emacs-devel@gnu.org; Tue, 18 Aug 2015 07:32:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRf7W-0007tM-1Z for emacs-devel@gnu.org; Tue, 18 Aug 2015 07:32:07 -0400 Original-Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:38329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRf7V-0007tE-Rz for emacs-devel@gnu.org; Tue, 18 Aug 2015 07:31:57 -0400 Original-Received: by wicja10 with SMTP id ja10so105642405wic.1 for ; Tue, 18 Aug 2015 04:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=86965FcoJQ5AD5TijDJ2I/fhPMaSH5JQS9H7Ii6VJPM=; b=INcupl83tdKyyYtnF3yih9oqmdH+Ng0jA6ODPPVst4fUqEr7cunaEiqDVd4Ur7rjf4 DzhjqHDlHnwGnivYywIJ9EGqyBK5tdubozSS2PjWeVpgqenD1d5f7BJVPWrk9tLLsy8T pAnqjekmns1s0FcbhqlcDKDrd7wvTEq4I+lgMKYI0s6m6mAt6psbbKliKKipKPSOcBGS GudX4eWM+PR78r1ZLF3xiQr4BCdutgJXXlh75u4MxgksOP9EKfR1qT6y3txme82ukMsI lmbqAWtV6i2iQici1ptlfJw+an6toFwk+zRAPO2XQI3qEQMtOuQvIHpiTLzFLyDzXJUY +EWg== X-Received: by 10.180.215.101 with SMTP id oh5mr43233901wic.6.1439897517173; Tue, 18 Aug 2015 04:31:57 -0700 (PDT) Original-Received: from [10.9.0.103] (nat.webazilla.com. [78.140.128.228]) by smtp.googlemail.com with ESMTPSA id l13sm26106803wjr.18.2015.08.18.04.31.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Aug 2015 04:31:56 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Thunderbird/40.0 In-Reply-To: <55D2747D.10809@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::232 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:188870 Archived-At: On 08/18/2015 02:55 AM, Paul Eggert wrote: > Do you mean replacing this sort of thing: > > (message "Press ‘?’ or ‘h’ for help, ‘q’ to quit") > > with this? > > (message "Press %qs or %qs for help, %qs to quit" "?" "h" "q") Yes. > If so, this doesn't sound like a good idea, as it would make the code > harder to read. It looks okay to me, but if you don't like it, the first option is available as well: two format sequences, one for opening quote, and one for closing. That would be more cumbersome, though. I've taken the idea for %qs from GCC. Do you know if they handle the above kind of situation somehow specially? > Also, it wouldn't suffice for code like this: > > (insert (symbol-name type) > (format " is a type (of kind ‘")) > (help-insert-xref-button (symbol-name metatype) > 'cl-help-type metatype) > (insert (format "’)")) But this is not about diagnostic messages anymore, right? At the moment, IIRC, these situations are handled by substitute-command-keys (and there's no need to have curly quotes in the strings here). > which formats the matching quotes separately. Of course in general one > could rewrite even the latter example to use %qs (if only to grab the > quote characters out of the result string and reuse them individually!) > but the rewritten version would be significantly harder to read and > maintain. I'm definitely not suggesting that. > As we need to support formatting individual curved quotes anyway, there > is an argument for keeping it simple and omitting the attached patch for > paired quotes. With all this in mind, do you still think the complexity > of the attached draft patch is a good idea? This patch solves the problem of "curved quotes in core elisp diagnostics", which you've felt neccessary to resolve with 9ce1d38890a77e93af0d20f51c53419c097200d3, kicking off this discussion. So yes, I think it's valuable. And if your point is that by having this logic in `format', we won't need it in `substitute-command-keys', then I stand by the assertion that a separate, different, function should translate the quotes. text -> (substitute-command-keys) -> text with "escaped" text prop -> (translate-quotes) -> text with non-escaped straight quotes replaces with curly ones `format' can't serve as `translate-quotes', because, like you said, "\\`%s\\'" is a relatively common format string.