From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#31376: 26.0.50; print-charset-text-property not honored Date: Sat, 12 May 2018 16:02:01 -0400 Message-ID: <871seglk1y.fsf@gmail.com> References: <87d0y7ew2h.fsf@linux-m68k.org> <87603zmxna.fsf@gmail.com> <83mux6nws8.fsf@gnu.org> <837eoani9b.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1526155273 5376 195.159.176.226 (12 May 2018 20:01:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 12 May 2018 20:01:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 31376@debbugs.gnu.org, schwab@linux-m68k.org, eller.helmut@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 12 22:01:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHahX-0001Gi-J0 for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 May 2018 22:01:07 +0200 Original-Received: from localhost ([::1]:38842 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHaje-0004JW-KY for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 May 2018 16:03:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHajU-000497-Ct for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 16:03:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHajP-00068S-Ef for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 16:03:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51974) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHajP-00068M-9x for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 16:03:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fHajO-0000QB-Gq for bug-gnu-emacs@gnu.org; Sat, 12 May 2018 16:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 May 2018 20:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31376 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31376-submit@debbugs.gnu.org id=B31376.15261553321562 (code B ref 31376); Sat, 12 May 2018 20:03:02 +0000 Original-Received: (at 31376) by debbugs.gnu.org; 12 May 2018 20:02:12 +0000 Original-Received: from localhost ([127.0.0.1]:59871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHaiY-0000P2-Q8 for submit@debbugs.gnu.org; Sat, 12 May 2018 16:02:11 -0400 Original-Received: from mail-it0-f50.google.com ([209.85.214.50]:36707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fHaiW-0000Oh-Ua; Sat, 12 May 2018 16:02:09 -0400 Original-Received: by mail-it0-f50.google.com with SMTP id e20-v6so6242513itc.1; Sat, 12 May 2018 13:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=eGDqlxXPdswLNub3yzpEBEQI2NybA3NgtJuXlKN+vIE=; b=hfKCt2fOxPDvzqGuqPlRIpRi2k2lwLERiOKZiVq76ShjiKjJZHDgabFyGEcXZ4Rr7k yc8U4KWx+sJJAT/16YH87G1MRekRmZr+GNY21l+z586fg2Xql41LmxetXJLYWfMdJMrK 1xF9y0mnHUgsmM7zOJBPjlTJR5zmgxWHghEGPRU0yEqkZv3AsDa1e1DYpAn7541oIQt/ ujlGYw0Qg0vUe3dmgn4PneiZ+mPTUvRttdzYwv4Q6hPe39VrjWEKHv6Egq6hwPcFK6l/ IbGvgUcNqoG3hpoXFr2epj2qqqdcGqMyv/seBKevVJgQTH2SvmlVZJcHyGrbRsyxKBrS XicA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=eGDqlxXPdswLNub3yzpEBEQI2NybA3NgtJuXlKN+vIE=; b=LDdn1mK6G4AJF0633ij+sKrlu335MfhyIJXflXIp8f4n6UNr5jbAcseX+E+ydZE5MK cuaxn805q+R8EG0NTT0ZQuYgueIGyeVw3rKSMvcN+HTVvSeYZC3OKZO6hxbdssPzvBzP yIJx10dq8Lfp6qmKqbMDeGmxjzXBChjVEYDzR91VK4BQ00Uq7CF5maLprflD7u+EwikA xTWILd3K2oWonRj7ogDX3bKT84wghHORwNQdPD3j8Ql3rSJv6rZfm4yaO0Z01EHpGwre JJ2yNHoiKQK8K3nsTmpX5ePzhQyfloDx4vqOlzLat8PvDo55nGyNKG/BE0lFInrXVbRo IVHA== X-Gm-Message-State: ALKqPwdUTaGpDdIUybd3MMYZCo6nw11zeO5+Z4u6VeYchltJ+UsDJnuN fmmuxClB7/vulCuKxI7vbII6tg== X-Google-Smtp-Source: AB8JxZpBiuXfluf/OBfFvVFvSkWT+J0zxFVPrRMvwGRels2gn/Csf2RrlppzVLYXgR5VhMd5W7Qf1w== X-Received: by 2002:a24:2706:: with SMTP id g6-v6mr3502274ita.5.1526155323201; Sat, 12 May 2018 13:02:03 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id p101-v6sm3303013ioo.12.2018.05.12.13.02.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 May 2018 13:02:02 -0700 (PDT) In-Reply-To: <837eoani9b.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 11 May 2018 21:45:36 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:146139 Archived-At: --=-=-= Content-Type: text/plain tags 31376 + patch quit Eli Zaretskii writes: >> As far as I can tell, setting to 'default' just makes Emacs do >> pointless extra checking for "unsafe" charsets even after it has >> found one. > > You mean, setting it to nil makes it do pointless extra work, yes? ;-) Hah! I guess I really can't tell the difference :) > Yes, that sounds right, thanks. We should also mention in the doc > string that any non-nil, non-t value is treated as 'default'. > And this variable should be mentioned in the ELisp manual, in the node > "Output Variables". Okay, how about this: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Honor-print-charset-text-property-value-of-nil-Bug-3.patch Content-Description: patch >From eed29c8e7164cbc13df4d7b4e3974ae90d9ecb51 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 11 May 2018 13:44:46 -0400 Subject: [PATCH] Honor print-charset-text-property value of nil (Bug#31376) * src/print.c (print_check_string_charset_prop): Move check for nil Vprint_charset_text_property from here... (print_prune_string_charset): ... to here. (syms_of_print) : Clarify that any non-boolean values are treated the same as `default'. * doc/lispref/streams.texi (Output Variables): Add print-prune-string-charset. --- doc/lispref/streams.texi | 13 +++++++++++++ src/print.c | 11 ++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/doc/lispref/streams.texi b/doc/lispref/streams.texi index ebd806601e..ae3b982080 100644 --- a/doc/lispref/streams.texi +++ b/doc/lispref/streams.texi @@ -809,6 +809,19 @@ Output Variables one. @end defvar +@defvar print-charset-text-property +This variable controls printing of `charset' text property on printing +a string. The value should be @code{nil}, @code{t}, or +@code{default}. + +If the value is @code{nil}, @code{charset} text properties are never +printed. If @code{t}, they are always printed. If the value is +@code{default}, print the text property @code{charset} only when the +value is different from what is guessed in the current charset +priorities. Values other than @code{nil} or @code{t} are treated the +same as @code{default}. +@end defvar + @defvar print-length @cindex printing limits The value of this variable is the maximum number of elements to print in diff --git a/src/print.c b/src/print.c index 15177759cf..427ab7d158 100644 --- a/src/print.c +++ b/src/print.c @@ -1317,8 +1317,7 @@ print_check_string_charset_prop (INTERVAL interval, Lisp_Object string) || CONSP (XCDR (XCDR (val)))) print_check_string_result |= PRINT_STRING_NON_CHARSET_FOUND; } - if (NILP (Vprint_charset_text_property) - || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) + if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) { int i, c; ptrdiff_t charpos = interval->position; @@ -1348,7 +1347,8 @@ print_prune_string_charset (Lisp_Object string) print_check_string_result = 0; traverse_intervals (string_intervals (string), 0, print_check_string_charset_prop, string); - if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) + if (NILP (Vprint_charset_text_property) + || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) { string = Fcopy_sequence (string); if (print_check_string_result & PRINT_STRING_NON_CHARSET_FOUND) @@ -2422,7 +2422,7 @@ representation) and `#N#' in place of each subsequent occurrence, DEFVAR_LISP ("print-charset-text-property", Vprint_charset_text_property, doc: /* A flag to control printing of `charset' text property on printing a string. -The value must be nil, t, or `default'. +The value should be nil, t, or `default'. If the value is nil, don't print the text property `charset'. @@ -2430,7 +2430,8 @@ representation) and `#N#' in place of each subsequent occurrence, If the value is `default', print the text property `charset' only when the value is different from what is guessed in the current charset -priorities. */); +priorities. Values other than nil or t are also treated as +`default'. */); Vprint_charset_text_property = Qdefault; /* prin1_to_string_buffer initialized in init_buffer_once in buffer.c */ -- 2.11.0 --=-=-=--