From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67523: check-declare doesn't account for shorthands Date: Wed, 29 Nov 2023 00:03:50 -0800 Message-ID: <87o7fcgbyx.fsf@ushin.org> Reply-To: Joseph Turner Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40030"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Adam Porter , Jonas Bernoulli , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: 67523@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 29 10:13:34 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 1r8GdS-000AFI-1Q for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Nov 2023 10:13:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8Gcz-0003Az-1n; Wed, 29 Nov 2023 04:13:05 -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 1r8Gcw-0003AD-16 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 04:13:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8Gct-0007tV-OY for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 04:13:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8Gcw-0008L6-Hq; Wed, 29 Nov 2023 04:13:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Joseph Turner Original-Sender: "Debbugs-submit" Resent-CC: adam@alphapapa.net, jonas@bernoul.li, joaotavora@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Nov 2023 09:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67523 X-GNU-PR-Package: emacs X-Debbugs-Original-To: Emacs Bugs Mailing List X-Debbugs-Original-Xcc: Adam Porter , Jonas Bernoulli , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Received: via spool by submit@debbugs.gnu.org id=B.170124916532028 (code B ref -1); Wed, 29 Nov 2023 09:13:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Nov 2023 09:12:45 +0000 Original-Received: from localhost ([127.0.0.1]:48874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8Gce-0008KW-RN for submit@debbugs.gnu.org; Wed, 29 Nov 2023 04:12:45 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:40602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8Gcc-0008K9-L2 for submit@debbugs.gnu.org; Wed, 29 Nov 2023 04:12:43 -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 1r8GcD-0002vq-P0 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 04:12:18 -0500 Original-Received: from out-175.mta1.migadu.com ([95.215.58.175]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8GcB-0007hT-56 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 04:12:17 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ushin.org; s=key1; t=1701249130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wv8lTwm4H+wpSzWssC0OJEy+tu3AuzsHw++1lHauOlM=; b=Z/VJhiFlkUjDTQecDdU8oUSbRBDjlY84Dk+EbiBn51K4MEWK4FIQI3ok6ct4X5lwCtns5J 5bzE4lbqMHzOTK1COOkHpTirs4ssPXcmzcuaMbLt5vC9MAmLNexTNihFhaTLEzLf5V0ray /TFR4pagJmNEwmu0nirqWOja+Ao1wsdij1f9UGuu2XNg0+c3l7MMN7HM5ETGWgrMGxjj5z Raab0Gk7uQhZ69ozVELSKuy0o3qpcxaaDPlPlYtLXHJNw1NeuqghzfwF9EpvdNDqOJRNNY 4n3sVChZf5bLoOfb8ajd5Ix7Ro65seBRBroqQ58fGkXrWqn/PBknp3rM0PBsCw== X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=95.215.58.175; envelope-from=joseph@ushin.org; helo=out-175.mta1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:275205 Archived-At: On Emacs 29.1, when running `check-declare-file' on a file with `declare-function' forms, I get Warning (check-declare): said =E2=80=98some-nice-string-utils-foobar=E2=80= =99 was defined in some-nice-string-utils.el: function not found The problem is that `check-declare-verify' attempts to search for the full symbol name using this regular expression: (setq re (format (if cflag "^[ \t]*\\(DEFUN\\)[ \t]*([ \t]*\"%s\"" "^[ \t]*(\\(fset[ \t]+'\\|\ cl-def\\(?:generic\\|method\\|un\\)\\|\ def\\(?:un\\|subst\\|foo\\|method\\|class\\|\ ine-\\(?:derived\\|generic\\|\\(?:global\\(?:ized\\)?-\\)?minor\\)-mode\\|\ \\(?:ine-obsolete-function-\\)?alias[ \t]+'\\|\ ine-overloadable-function\\)\\)\ [ \t]*%s\\([ \t;]+\\|$\\)") (regexp-opt (mapcar 'cadr fnlist) t))) (while (re-search-forward re nil t) ... ) where (mapcar 'cadr fnlist) is the full symbol name. Since the full symbol name never appears in the file in which it was defined, re-search-forward never finds it, and so "function not found". A potential solution could be to convert the longhand symbol into its shorthand form and pass that into re-search-forward. This is tricky since there may be multiple different shorthands which could yield the same longhand form. It might be more feasible to run re-search-forward on a known common suffix portion of the symbol name, then with point on the suspected definition, run `intern-soft' to get the full symbol name. A workaround is to not use shorthands in function definitions. Thoughts? Joseph