GNU bug report logs - #73748
31.0.50; Problems with company-dabbrev in GNU ELPA package company

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stephen Berman <stephen.berman@HIDDEN>; dated Fri, 11 Oct 2024 17:10:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Oct 2024 17:09:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 11 13:09:21 2024
Received: from localhost ([127.0.0.1]:35205 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1szJ8i-00060k-NU
	for submit <at> debbugs.gnu.org; Fri, 11 Oct 2024 13:09:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:48010)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stephen.berman@HIDDEN>) id 1szJ8g-00060b-R0
 for submit <at> debbugs.gnu.org; Fri, 11 Oct 2024 13:09:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <stephen.berman@HIDDEN>)
 id 1szJ8A-0004gj-Bw
 for bug-gnu-emacs@HIDDEN; Fri, 11 Oct 2024 13:08:51 -0400
Received: from mout.gmx.net ([212.227.15.19])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <stephen.berman@HIDDEN>)
 id 1szE31-0001aa-Pr
 for bug-gnu-emacs@HIDDEN; Fri, 11 Oct 2024 07:43:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net;
 s=s31663417; t=1728646979; x=1729251779; i=stephen.berman@HIDDEN;
 bh=KXktBzawks8Hyiq0qewpiJi8NXNOoDLofkskYRdH+yo=;
 h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version:
 Content-Type:cc:content-transfer-encoding:content-type:date:from:
 message-id:mime-version:reply-to:subject:to;
 b=AcZygVdo3/m/sEAliXuSJTgSSHu/clxNbiC9+9Ez2nga5nKe+xVHKF8La3rD/rfj
 pBEqL5H6cPnvyq+bwVFvJR+gLfPULTpJ/b/7ucq+XUQq74PYFd3fE2OjxfVjKD8Bu
 1zq8dX6fJuCVDC5CKKPquWm06/rSTIx+60+KtF6XrrGHDoCPG+2PukpA5kc90/z/X
 FFBslqZDu/AFNcauQTDoEaqwY2rP0bOvS5gihiJH0vHMUighIRkRKGHp+VYWb35p7
 PDvekWVdqp58RNa/PA8PLFKxts/0WTUHAoftgWsHMA5zqb0Y3wGSj4lA2v+r0fjuW
 /U7fuLcPYHkwQPNHdg==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from strobelfssd ([94.134.94.63]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mel7v-1tZNg61aWz-00cBmh for
 <bug-gnu-emacs@HIDDEN>; Fri, 11 Oct 2024 13:42:59 +0200
From: Stephen Berman <stephen.berman@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; Problems with company-dabbrev in GNU ELPA package company
X-Debbugs-Cc: 
Date: Fri, 11 Oct 2024 13:42:54 +0200
Message-ID: <87plo6uapt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:7jqGEfvNVvvwtfb0W5XUYZFQckEWz7kLIB9iyPuGImKDodXUNr4
 E8X7+bURhhykDjXJTnh3gp0lhzWkQGaC+O513v8BNRXyf9e/xB4M9kkQNI0lfvbSZEft55D
 LBQU0hRoZ9HmWnEB6ctMVkG8gnsIzFWrC5fZJU22eNCu8HTEnxbYoV1HNhkJaiY+8QbCl3p
 Tiv0PYA7mPpX/UwxQAclg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:mumePrp8U4I=;dRSWXtN0H6/A9Yq0hKb1ZHZ/jUN
 MpQzKZAHf/EE/OsukRoPhdcz4gQgpN6xReQ+eTHi0jLgShkdGss/iVjMAwe1viAw5L0sCcK7Y
 wcfRYanCRwKGh+QiYduK770sdRu/rnBgPEcAHgiCRvF8raqLsY70P2LOG+rBx2kWkgmM2YVA/
 ciSpoTGqloVGXSrHb+Do3xHAI+U4CUCGPt+PlZoqPStD2NSdFWZvJhSawwpYDiPsQVdhFYBLC
 W35RPC0jd7EEgusAYtHfFnKVAJS2+VjbGTFn/2RyLbRP21tMpSLTG/PNFg9lmPN9aMXcxKVtp
 2V1xvSGrJRA258ldHkzZij+ig1wTGjXHtd5p/Cz3YLX69T9g4YQ3n7lkwbBimr8MBSs88s58a
 H2YZBPSTpzg/eBiwhaB3Iju4/+zmRZ1rYSIYmx7UtMUCq2VMX9xzQR2tdzAuXOP1J8O8JPLGT
 SJgal+LF/FoB1bKJEba9efynIpt6IWJOSVhT73MInJkrORqbp5Ln43F4DC8JFy88KoqWd0771
 vOis1YcKWfzOzgQrCqrUK9AnXDiXptQgHYPN+ikE2LQFkfTotSOm/mQJIwYGZq023ocdwc4rL
 dbqKNUqGWZ4aokB2RndGkXC/GbNH0q4lF0IfW3AKy1K8DrWsZjzpvB/WMSITWgLWo+I/Ca5/e
 bOMZl41oKDA2rVsdWPtpU7YTSLxFAJb9QgKxnyBOUcOOO0BEyOnGMzPQtHAgotQvjtRohinaU
 J+kc3jtE5uhTTbiFbeO108OCQDbLzsaeCYP1Kge4zu7N+VTB10eEJq1wiDWcbiupev84yNmf0
 npn4tMrl3ES2E+XKMBHg/PfA==
Received-SPF: pass client-ip=212.227.15.19;
 envelope-from=stephen.berman@HIDDEN; helo=mout.gmx.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

0. Install the GNU ELPA packages company and gnu-elpa.
1. emacs -Q
2. M-x package-initialize and M-x toggle-debug-on-error
3. C-x b a M-x company-mode (switch to buffer "a" in fundamental-mode
   and enable company-mode there)
4. Type three arbitrary letters, e.g. dkf
5. On typing the third letter, the following prompt appears in the echo
   area: "Install package all? (yes or no) ".  Type "no".
==> This raises the error "Abort!" and pops up a *Backtrace* buffer,
whose content is attached.

Looking at the backtrace here is what I think happens (though I couldn't
actually get Edebug to stop execution before the prompt in step 5):
company-dabbrev--fetch call company-dabbrev--search, in which the sexp
`(eq other-buffer-modes 'all)' is evaluated as t ('all being the default
value of company-dabbrev-other-buffers), and this causes
gnu-elpa--perform-autoload (in gnu-elpa-utils.el) to be invoked, which
invokes the install package prompt in step 5 because the symbol `all' is
in gnu-elpa-features.el (from the GNU ELPA package "all").

It would not be unreasonable to lay the blame for this problem on the
"all" package with its namespace-unclean autoloaded command `all'
(naming it something like `all-show' would have avoided the problem).
However, the pcase code in company-dabbrev--fetch actually triggers the
problem, and `M-x eval-buffer' on company-dabbrev.el points to why: that
invocation issues the warning "pcase pattern `all shadowed by previous
pcase pattern".

The attached patch (I don't have a local clone of the company package
repo, so it's just a plain diff) avoids both this warning and the
problematic interaction with gnu-elpa--perform-autoload.  This patch
uses 'all instead of `all, since they are the same for symbols in pcase
patterns, and replaces `t by _, in accordance with (info "(elisp) pcase
Macro").  In addition, the patch fixes a typo in the defcustom
`company-dabbrev-other-buffers' that prevents choosing "Function to
return similar major-modes" from the value menu.


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2024-10-05 built on strobelfssd
Repository revision: 4c7a6dc1a0ce8fe7bb603c907efb52d2ecf30858
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Linux From Scratch r12.2-17-systemd

Configured using:
 'configure -C 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt6/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=company-dabbrev-backtrace
Content-Transfer-Encoding: base64

RGVidWdnZXIgZW50ZXJlZC0tTGlzcCBlcnJvcjogKGVycm9yICJBYm9ydCEiKQogIGVycm9yKCJB
Ym9ydCEiKQogIGdudS1lbHBhLS1wZXJmb3JtLWF1dG9sb2FkKCkKICBieXRlLWNvZGUoIlwzMDBc
MzAxIVwyMTBcMzAyIFwyMDciIFtyZXF1aXJlIGdudS1lbHBhLXV0aWxzIGdudS1lbHBhLS1wZXJm
b3JtLWF1dG9sb2FkXSAyKQogIGFsbCgjPGJ1ZmZlciBhPikKICBjb21wYW55LWRhYmJyZXYtLWZl
dGNoKCkKICBjb21wYW55LWNhY2hlLWZldGNoKGRhYmJyZXYtY2FuZGlkYXRlcyBjb21wYW55LWRh
YmJyZXYtLWZldGNoIDpleHBpcmUgdCkKICBjb21wYW55LWRhYmJyZXYoY2FuZGlkYXRlcyAiZGtm
IiAiIikKICBhcHBseShjb21wYW55LWRhYmJyZXYgKGNhbmRpZGF0ZXMgImRrZiIgIiIpKQogIGNv
bXBhbnktY2FsbC1iYWNrZW5kLXJhdyhjYW5kaWRhdGVzICJka2YiICIiKQogIGNvbXBhbnktLWZl
dGNoLWNhbmRpZGF0ZXMoImRrZiIgIiIpCiAgY29tcGFueS1jYWxjdWxhdGUtY2FuZGlkYXRlcygi
ZGtmIiBuaWwgIiIpCiAgY29tcGFueS0tYmVnaW4tbmV3KCkKICBjb21wYW55LS1wZXJmb3JtKCkK
ICBjb21wYW55LWF1dG8tYmVnaW4oKQogIGNvbXBhbnktaWRsZS1iZWdpbigjPGJ1ZmZlciBhPiAj
PHdpbmRvdyAzIG9uIGE+IDQgNCkKICBhcHBseShjb21wYW55LWlkbGUtYmVnaW4gKCM8YnVmZmVy
IGE+ICM8d2luZG93IDMgb24gYT4gNCA0KSkKICB0aW1lci1ldmVudC1oYW5kbGVyKFt0IDI2Mzc2
IDIyMTE5IDIzODc1OSBuaWwgY29tcGFueS1pZGxlLWJlZ2luICgjPGJ1ZmZlciBhPiAjPHdpbmRv
dyAzIG9uIGE+IDQgNCkgbmlsIDc3MDAwMCBuaWxdKQo=
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment
Content-Description: company-dabbrev patch
Content-Transfer-Encoding: quoted-printable

*** /home/steve/.emacs.d/elpa/company-1.0.2/company-dabbrev.el_orig	2024-0=
9-23 15:23:02.270065887 +0200
=2D-- /home/steve/.emacs.d/elpa/company-1.0.2/company-dabbrev.el	2024-10-1=
1 11:17:54.607254997 +0200
***************
*** 41,47 ****
    :type '(choice (const :tag "Off" nil)
                   (const :tag "Same major mode" t)
                   (const :tag "All" all)
!                  (function :tag "Function to return similar major-modes"=
 group)))

  (defcustom company-dabbrev-ignore-buffers "\\`[ *]"
    "Regexp matching the names of buffers to ignore.
=2D-- 41,47 ----
    :type '(choice (const :tag "Off" nil)
                   (const :tag "Same major mode" t)
                   (const :tag "All" all)
!                  (function :tag "Function to return similar major-modes"=
)))

  (defcustom company-dabbrev-ignore-buffers "\\`[ *]"
    "Regexp matching the names of buffers to ignore.
***************
*** 198,206 ****
    (company-dabbrev--search (company-dabbrev--make-regexp)
                             company-dabbrev-time-limit
                             (pcase company-dabbrev-other-buffers
!                              (`t (list major-mode))
!                              ((pred functionp) (funcall company-dabbrev-=
other-buffers (current-buffer)))
!                              (`all `all))))

  ;;;###autoload
  (defun company-dabbrev (command &optional arg &rest _ignored)
=2D-- 198,208 ----
    (company-dabbrev--search (company-dabbrev--make-regexp)
                             company-dabbrev-time-limit
                             (pcase company-dabbrev-other-buffers
!                              ('all 'all)
!                              ((pred functionp)
!                               (funcall company-dabbrev-other-buffers
!                                        (current-buffer)))
!                              (_ (list major-mode)))))

  ;;;###autoload
  (defun company-dabbrev (command &optional arg &rest _ignored)

--=-=-=--




Acknowledgement sent to Stephen Berman <stephen.berman@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#73748; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.