From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#43866: 26.3; italian postfix additions Date: Wed, 21 Oct 2020 22:39:08 +0300 Organization: LINKOV.NET Message-ID: <87h7qn1i8z.fsf@mail.linkov.net> References: <83tuv47vkn.fsf@gnu.org> <87ft6igdzi.fsf@mail.linkov.net> <837drt1qta.fsf@gnu.org> <874kmx443u.fsf@mail.linkov.net> <83k0vszw0e.fsf@gnu.org> <87d01kvbnj.fsf@mail.linkov.net> <83wnzsxln9.fsf@gnu.org> <87wnzmgd1f.fsf@mail.linkov.net> <83mu0hng0d.fsf@gnu.org> <87r1ps8xh4.fsf@mail.linkov.net> <831rhroexo.fsf@gnu.org> <87blgv60ug.fsf@mail.linkov.net> <83d01bmol5.fsf@gnu.org> <871rhr3057.fsf@mail.linkov.net> <83blgvmnpu.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35888"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: rpluim@gmail.com, 43866@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 21 22:14:38 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVKVJ-0009Cz-Be for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 22:14:37 +0200 Original-Received: from localhost ([::1]:59082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVKVI-0005v9-9Z for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 16:14:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVKUl-0005uT-BP for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 16:14:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVKUl-0001SF-1v for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 16:14:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVKUk-0001hd-U2 for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 16:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Oct 2020 20:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43866 X-GNU-PR-Package: emacs Original-Received: via spool by 43866-submit@debbugs.gnu.org id=B43866.16033112426537 (code B ref 43866); Wed, 21 Oct 2020 20:14:02 +0000 Original-Received: (at 43866) by debbugs.gnu.org; 21 Oct 2020 20:14:02 +0000 Original-Received: from localhost ([127.0.0.1]:50660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVKUj-0001hA-S7 for submit@debbugs.gnu.org; Wed, 21 Oct 2020 16:14:02 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVKUi-0001gv-LE for 43866@debbugs.gnu.org; Wed, 21 Oct 2020 16:14:00 -0400 X-Originating-IP: 91.129.102.160 Original-Received: from mail.gandi.net (m91-129-102-160.cust.tele2.ee [91.129.102.160]) (Authenticated sender: juri@linkov.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id F00F760004; Wed, 21 Oct 2020 20:13:52 +0000 (UTC) In-Reply-To: <83blgvmnpu.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 21 Oct 2020 21:35:25 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191213 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit >> >> (prin1 '(("'A" . [?Á]) >> >> ("'E" . [?É]) >> >> ("'I" . [?Í]) >> >> ("'O" . [?Ó]) >> >> ("'U" . [?Ú]) >> >> ("'Y" . [?Ý])) >> >> (current-buffer)) >> > >> > Why do you have to use prin1? >> >> Actually I need to use pp-to-string to pretty-print the list, >> but pp-to-string calls '(prin1 object (current-buffer))'. > > prin1 accepts a function as its 2nd argument; can you use that? I tried to use a function in the 2nd argument, but it's called for every digit of the integer that represents a character, so I don't know what to do with these digits. However, do you think something like the following is a good idea? Let-binding a new variable 'print-integers-as-chars' to t: (let ((print-integers-as-chars t)) (pp '(("'A" . [?Á]) ("'E" . [?É]) ("'I" . [?Í]) ("'O" . [?Ó]) ("'U" . [?Ú]) ("'Y" . [?Ý])) (current-buffer))) prints integers as characters: (("'A" . [?Á]) ("'E" . [?É]) ("'I" . [?Í]) ("'O" . [?Ó]) ("'U" . [?Ú]) ("'Y" . [?Ý])) with this patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=print-integers-as-chars.patch diff --git a/src/print.c b/src/print.c index dca095f281..1755eea738 100644 --- a/src/print.c +++ b/src/print.c @@ -1908,8 +1908,16 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) { case_Lisp_Int: { - int len = sprintf (buf, "%"pI"d", XFIXNUM (obj)); - strout (buf, len, len, printcharfun); + if (!NILP (Vprint_integers_as_chars) && CHARACTERP (obj)) + { + int len = sprintf (buf, "%s", SDATA (call1 (intern ("prin1-char"), obj))); + strout (buf, len, len, printcharfun); + } + else + { + int len = sprintf (buf, "%"pI"d", XFIXNUM (obj)); + strout (buf, len, len, printcharfun); + } } break; @@ -2247,6 +2255,10 @@ syms_of_print (void) that represents the number without losing information. */); Vfloat_output_format = Qnil; + DEFVAR_LISP ("print-integers-as-chars", Vprint_integers_as_chars, + doc: /* Print integers as characters. */); + Vprint_integers_as_chars = Qnil; + DEFVAR_LISP ("print-length", Vprint_length, doc: /* Maximum length of list to print before abbreviating. A value of nil means no limit. See also `eval-expression-print-length'. */); --=-=-=--