From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: `unreadablep' Date: Wed, 15 Dec 2021 12:16:17 +0100 Message-ID: <87sfuuktj2.fsf@gnus.org> References: <87bl1imhnd.fsf@gnus.org> <87h7bas2kb.fsf@yahoo.com> <87wnk6l0yu.fsf@gnus.org> <87czlyryq0.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25388"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 15 12:52:23 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mxSpa-0006MR-Qo for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Dec 2021 12:52:22 +0100 Original-Received: from localhost ([::1]:55600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxSpZ-000158-IR for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Dec 2021 06:52:21 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxSGs-0002Cb-7F for emacs-devel@gnu.org; Wed, 15 Dec 2021 06:16:31 -0500 Original-Received: from [2a01:4f9:2b:f0f::2] (port=41338 helo=quimby.gnus.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxSGq-0003Zq-6t for emacs-devel@gnu.org; Wed, 15 Dec 2021 06:16:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8WYKs0BVqVpnGqwCaLNeTytgUSpUThOpbIy9kCEay8k=; b=ZbCFb4Yoiaj+am35FpNyJC14DI XmsmVFzp5HMyIdwyelhHWBlNTQX/ie3RyFJnev1mUx8iAhr7F3Jw+ThjzuoJYlvz9AtPRcEhab0/v 3p+TkcXWOLrFww0KM2+Jpm9pzEDPsAyz8i3OZxJQYNKaJYFfIQL2ehlcmtu904OrqkhE=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxSGg-0004Ki-2x; Wed, 15 Dec 2021 12:16:25 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAD1BMVEVQPzIsKChaVlSQ dmH///9tYVkDAAAAAWJLR0QEj2jZUQAAAAd0SU1FB+UMDwsLHZtphzUAAAHDSURBVDjLXVTZgeww CBOkAXAFPhrYZ/ff23J5Jvvmw+NEyAYhAlKVaT+1X64ab2AAOzACGAk0A2ItyryUGQwjDI5gCxmS hAFpEfeH4n+gPN8o/a5OUASB3hSJLSohD0vKCEIASlVMUnKDT+5rnQzPNwiYKpeRKlAAdjKBQgAP YPY3BqQytgE6eG/SYmikogLIGco/fmRPIPIR3bLtRb8VIXN3OIBxn1EFiHKzo9o/qhPgTIsU6XMZ QJeCqrhb4mxlgOtSBEFaV+LHjsGVF3mDPVKz4IarGColjzNGe/bMyjIiAGHSB7eHyJR8xbGcJ0/X zQSqCLsDB7QnV9+/d1iiTIdf/cisaDQ1G4G/HQxH9S1Cc5y1b8/TVjImGvEP90nlEs1Wwto9uK9s pWtFSdGlDjwmc2lFZQImGTL1ofKYAWE1sZrIxFqUJvAxyF7uc0YzecNJrhU5xQV5NtwAdCdKyj7q RqEaNYv9+CptewEOoEUlbe2z/8ygpMPC5v0SJl5j1Pk1K3jNkjenF4HwJcy15x3e/hHR9uucfeeN FJ8J781qrxns2ag7swjfdq4+VK5uFq3vSrWW/vvuvGYw7PMRI4N+AZ1pZVxiDlGMAAAAJXRFWHRk YXRlOmNyZWF0ZQAyMDIxLTEyLTE1VDExOjExOjI5KzAwOjAwTvDncwAAACV0RVh0ZGF0ZTptb2Rp ZnkAMjAyMS0xMi0xNVQxMToxMToyOSswMDowMD+tX88AAAAASUVORK5CYII= X-Now-Playing: Propaganda's _Wishful Thinking_: "Abuse" In-Reply-To: <87czlyryq0.fsf@yahoo.com> (Po Lu's message of "Wed, 15 Dec 2021 17:42:15 +0800") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:4f9:2b:f0f::2 (failed) Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:282016 Archived-At: Po Lu writes: >> But having `prin1' return whether it printed something unreadable also >> sounds attractive. I guess it depends on the use case. If you're >> saying >> >> (if (unprintable o) >> (insert ";; " (prin1 o (current-buffer))) >> (prin1 o (current-buffer))) >> >> then you're traversing the data twice, which isn't efficient, so >> inserting it first and then checking would be nice. > > Yes, my thoughts exactly. And we could implement `readablep' (probably better without "un") as (defun readablep (object) (prin1 object #'ignore 'return-readablep)) and not actually print anything (for the cases where it's more convenient to call a predicate). There's perhaps a slight performance issue -- if the unreadable object is the first in a long list, we could have exited a lot sooner, but I'm not sure that's really much of an issue in practice. If it is, we could perhaps change PRINTCHARFUN to take two arguments in this case, where the second is EVERYTHING-IS-READABLE-SO-FAR, and then PRINTCHARFUN could throw an error if it wishes... Or, as has been suggested, add a new print-* variable to have the same effect -- it'd fit in with the current design (of having a bunch of print-* variables). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no