From unknown Tue Jun 24 22:36:51 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#11661 <11661@debbugs.gnu.org> To: bug#11661 <11661@debbugs.gnu.org> Subject: Status: 24.1; (wrong-type-argument stringp t) in `display-completion-list' Reply-To: bug#11661 <11661@debbugs.gnu.org> Date: Wed, 25 Jun 2025 05:36:51 +0000 retitle 11661 24.1; (wrong-type-argument stringp t) in `display-completion-= list' reassign 11661 emacs submitter 11661 "Drew Adams" severity 11661 minor thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 09 13:53:45 2012 Received: (at submit) by debbugs.gnu.org; 9 Jun 2012 17:53:46 +0000 Received: from localhost ([127.0.0.1]:36207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SdPr7-0002vI-CW for submit@debbugs.gnu.org; Sat, 09 Jun 2012 13:53:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44893) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SdPr4-0002vB-EZ for submit@debbugs.gnu.org; Sat, 09 Jun 2012 13:53:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdPog-0006bI-By for submit@debbugs.gnu.org; Sat, 09 Jun 2012 13:51:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:47648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdPog-0006bD-8b for submit@debbugs.gnu.org; Sat, 09 Jun 2012 13:51:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdPoe-0003DT-Av for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 13:51:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdPoc-0006aT-6v for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 13:51:11 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:21917) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdPoc-0006a4-0l for bug-gnu-emacs@gnu.org; Sat, 09 Jun 2012 13:51:10 -0400 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q59Hp6AJ004921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 9 Jun 2012 17:51:07 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q59Hp5LI029296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 9 Jun 2012 17:51:06 GMT Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q59Hp5uv020896 for ; Sat, 9 Jun 2012 12:51:05 -0500 Received: from dradamslap1 (/10.159.219.243) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Jun 2012 10:51:05 -0700 From: "Drew Adams" To: Subject: 24.1; (wrong-type-argument stringp t) in `display-completion-list' Date: Sat, 9 Jun 2012 10:50:57 -0700 Message-ID: <53C8ABAE936443A3B97386D344C715E0@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac1GaGxk1hyKGEEGSQ+gOrmmm+YklQ== X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) This bug is at least as old as Emacs 20. So it is clearly not too important. ;-) emacs -Q M-x load-library minibuffer.el RET M-x load-library simple.el RET M-x debug-on-entry display-completion-list Evaluate this in buffer *scratch*, then walk through the debugger: (display-completion-list ()) First, you will notice that the recursive clause is called in this case, which puts the lie to this comment in the code: ;; This *never* (ever) happens, so there's no point trying to be clever. Continuing, the text "There are no possible completions of what you have typed." is inserted into the temporary buffer, which is expected. It is also princ'd, I'm not sure where (or why). Then the temporary buffer is killed. Perhaps it should not be killed in this recursive call of `display-completion-list'? Continuing, the code uses buffer standard-output, and it runs `completion-setup-hook' (again), which calls `completion-setup-function', which also tries (with-current-buffer standard-output...). But standard-output is `t' then, so we get: Debugger entered--Lisp error: (wrong-type-argument stringp t) * set-buffer(t) * (save-current-buffer (set-buffer standard-output) (let ((base-size completion-base-size) (base-position completion-base-position) (insert-fun completion-list-insert-choice-function)) (completion-list-mode) (set (make-local-variable (quote completion-base-size)) base-size) (set (make-local-variable (quote completion-base-position)) base-position) (set (make-local-variable (quote completion-list-insert-choice-function)) insert-fun)) (set (make-local-variable (quote completion-reference-buffer)) mainbuf) (if base-dir (setq default-directory base-dir)) (when completion-show-help (goto-char (point-min)) (if (display-mouse-p) (insert (substitute-command-keys "Click \\[mouse-choose-completion] on a completion to select it.\n"))) (insert (substitute-command-keys "In this buffer, type \\[choose-completion] to select the completion near point.\n\n")))) `display-completion-list' should do something sane for an empty completions list in an arbitrary buffer. Users should never see a `wrong-type-arg' error. Yes, it is the case that in the existing Emacs source code, `display-completion-list' is ALWAYS called within `with-output-to-temp-buffer', with this one exception in `message.el', where the code does something similar anyway: (with-temp-buffer (let ((standard-output (current-buffer))) (eval '(display-completion-list nil ""))) (defalias 'message-display-completion-list 'display-completion-list)) So the problem does not arise for the source code that Emacs provides. In that context (a) the source comment is true and (b) the error is not raised. But there is nothing in the doc of `display-completion-list' that says that it must be called with `standard-output' so bound etc. It says only: "It [`completion-setup-hook'] can find the completion buffer in `standard-output'." Which is true only if called within `with-output-to-temp-buffer' or a similar context. The doc in (elisp) suffers from the same problem. There, at least, it mentions `with-output-to-temp-buffer', but it does so only saying "a common way to use it...". In fact, that (or equivalent) is currently the ONLY way you can use it without getting a wrong-type-arg error. The function could try to support enforcement of using it only within `with-output-to-temp-buffer' by raising an error unless (bufferp standard-output) (with a better error message than wrong-type-arg). But at that point it is too late: it is the user and not the developer who would see the error. If the code is kept as it is or an error is raised like that, then the doc should be improved to mention the proper calling context. FWIW, in the similar Icicles function, I do this for the recursive case of `display-completion-list', instead of using (with-temp-buffer ...): (let ((standard-output (current-buffer))) (icicle-display-completion-list completions)) And I also do not do (princ (buffer-string)) in that case. This has the effect of inserting the text "There are no possible completions..." - or the completion candidates if there are some - into the current buffer. I think it always DTRT (including within `with-output-to-temp-buffer'). Perhaps that would make sense for `display-completion-list' too - dunno. In GNU Emacs 24.1.1 (i386-mingw-nt5.1.2600) of 2012-06-01 on MARVIN Windowing system distributor `Microsoft Corp.', version 5.1.2600 Configured using: `configure --with-gcc (4.6) --no-opt --enable-checking --cflags -ID:/devel/emacs/libs/libXpm-3.5.8/include -ID:/devel/emacs/libs/libXpm-3.5.8/src -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include -ID:/devel/emacs/libs/giflib-4.1.4-1/include -ID:/devel/emacs/libs/jpeg-6b-4/include -ID:/devel/emacs/libs/tiff-3.8.2-1/include -ID:/devel/emacs/libs/gnutls-3.0.9/include' From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 28 11:17:46 2016 Received: (at 11661) by debbugs.gnu.org; 28 Apr 2016 15:17:46 +0000 Received: from localhost ([127.0.0.1]:53244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avnhK-0003gb-7M for submit@debbugs.gnu.org; Thu, 28 Apr 2016 11:17:46 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:41468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avnhI-0003gS-5z for 11661@debbugs.gnu.org; Thu, 28 Apr 2016 11:17:45 -0400 Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1avngx-0007a2-6w; Thu, 28 Apr 2016 17:17:43 +0200 From: Lars Ingebrigtsen To: "Drew Adams" Subject: Re: bug#11661: 24.1; (wrong-type-argument stringp t) in `display-completion-list' References: <53C8ABAE936443A3B97386D344C715E0@us.oracle.com> Date: Thu, 28 Apr 2016 17:17:23 +0200 In-Reply-To: <53C8ABAE936443A3B97386D344C715E0@us.oracle.com> (Drew Adams's message of "Sat, 9 Jun 2012 10:50:57 -0700") Message-ID: <87h9eliwzg.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 11661 Cc: 11661@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) "Drew Adams" writes: > But there is nothing in the doc of `display-completion-list' that says > that it must be called with `standard-output' so bound etc. It says > only: "It [`completion-setup-hook'] can find the completion buffer in > `standard-output'." Which is true only if called within > `with-output-to-temp-buffer' or a similar context. It now says =91standard-output=92 must be a buffer. so I guess this is fixed. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 28 11:18:10 2016 Received: (at control) by debbugs.gnu.org; 28 Apr 2016 15:18:10 +0000 Received: from localhost ([127.0.0.1]:53248 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avnhi-0003hb-F2 for submit@debbugs.gnu.org; Thu, 28 Apr 2016 11:18:10 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:41476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avnhg-0003hT-Oj for control@debbugs.gnu.org; Thu, 28 Apr 2016 11:18:09 -0400 Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1avnhM-0007aO-0s for control@debbugs.gnu.org; Thu, 28 Apr 2016 17:18:08 +0200 Date: Thu, 28 Apr 2016 17:17:47 +0200 Message-Id: <87fuu5iwys.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #11661 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) close 11661 From unknown Tue Jun 24 22:36:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 27 May 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator