From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#61274: 29.0.60; dabbrev-capf signals errors Date: Sat, 04 Feb 2023 15:16:42 +0200 Message-ID: <83pmaptvt1.fsf@gnu.org> References: <87o7q9y9oh.fsf@daniel-mendler.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9536"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61274@debbugs.gnu.org, monnier@iro.umontreal.ca To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 04 14:17:31 2023 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 1pOIQ6-0002DC-2G for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Feb 2023 14:17:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOIPq-00006j-SI; Sat, 04 Feb 2023 08:17:14 -0500 Original-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 ) id 1pOIPe-0008WQ-SW for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 08:17:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOIPe-0004FL-Ju for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 08:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pOIPd-0001wg-RF for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 08:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Feb 2023 13:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61274 X-GNU-PR-Package: emacs Original-Received: via spool by 61274-submit@debbugs.gnu.org id=B61274.16755166077453 (code B ref 61274); Sat, 04 Feb 2023 13:17:01 +0000 Original-Received: (at 61274) by debbugs.gnu.org; 4 Feb 2023 13:16:47 +0000 Original-Received: from localhost ([127.0.0.1]:40830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOIPO-0001w8-L1 for submit@debbugs.gnu.org; Sat, 04 Feb 2023 08:16:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOIPL-0001vu-5J for 61274@debbugs.gnu.org; Sat, 04 Feb 2023 08:16:46 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOIPE-0004EI-MG; Sat, 04 Feb 2023 08:16:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=LMs9qCcQ++ggQS6Kf0R8GUAHK3q5lYQn9v/wT6cbkhU=; b=MTL0uw0awAms Ja9NI+oTC71wLMJEtXkDg/ObtY5JnbUTSM5Fy2rdlSYeuYc+sradffFbdkOFa6ELnTk+kJZ80HMfD iHzNPp3xCNcSat6vNwVogZzKUtzQ3hjzovB6f0jt+4mrzcDS+AD3ttHSVCd0/ENhHXCOkdTgx65F8 Dk+578Ur2tTtuKKJj4MythkL5G8vgwpBnRnrQHQjBVvE7nDhz3m1X5hubkb908jRwA6mwMyJR25rM PF0TQShjTauquR9YEGuhJwXFQaPdHK+BFCKNzvta4ld7c3jPAPWpK9mzJsK/p3AQr68XixUjpJ9Gd J4lmQgwsq/vx2RtXwmkCPQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOIPD-00086p-Vg; Sat, 04 Feb 2023 08:16:36 -0500 In-Reply-To: <87o7q9y9oh.fsf@daniel-mendler.de> (message from Daniel Mendler on Sat, 04 Feb 2023 12:03:26 +0100) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254773 Archived-At: > Cc: monnier@iro.umontreal.ca > From: Daniel Mendler > Date: Sat, 04 Feb 2023 12:03:26 +0100 > > The completion-at-point-function `dabbrev-capf' sometimes signals > errors. It would be good if the function would not do that but return > nil if no completions are found, such that the next Capf from the list > of completion functions gets its chance to run. > > 1. Start emacs -Q > 2. Evaluate (require 'dabbrev). > 3. Evaluate (setq completion-at-point-functions '(dabbrev-capf)) in the > scratch buffer. > 4. Type `x M-TAB` in the scratch buffer. I observe the following error: > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > dabbrev--goto-start-of-abbrev() > dabbrev--abbrev-at-point() > dabbrev-capf() > completion--capf-wrapper(dabbrev-capf all) > completion-at-point() > funcall-interactively(completion-at-point) > command-execute(completion-at-point) > > Furthermore if no completions are found `dabbrev-capf' signals an error. > The messages buffer will then contain: > > Scanning for dabbrevs...done > completion--some: No dynamic expansion for "xyz" found The patch below fixes the error. Regarding "No dynamic expansion" error: what did you expect to happen instead and why? IOW, what is the expected result of having dabbrev-capf alone in completion-at-point-functions, and then typing "x M-TAB"? diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index a4b4d07..deba082 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -400,6 +400,8 @@ dabbrev-completion (defun dabbrev-capf () "Dabbrev completion function for `completion-at-point-functions'." + (or (stringp dabbrev--abbrev-char-regexp) + (dabbrev--reset-global-variables)) (let* ((abbrev (dabbrev--abbrev-at-point)) (beg (progn (search-backward abbrev) (point))) (end (progn (search-forward abbrev) (point)))