From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 67523@debbugs.gnu.org
Cc: "Adam Porter" <adam@alphapapa.net>,
"Jonas Bernoulli" <jonas@bernoul.li>,
"João Távora" <joaotavora@gmail.com>
Subject: bug#67523: check-declare doesn't account for shorthands
Date: Wed, 29 Nov 2023 00:03:50 -0800 [thread overview]
Message-ID: <87o7fcgbyx.fsf@ushin.org> (raw)
On Emacs 29.1, when running `check-declare-file' on a file with
`declare-function' forms, I get
Warning (check-declare): said ‘some-nice-string-utils-foobar’ 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
next reply other threads:[~2023-11-29 8:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 8:03 Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-11-29 9:56 ` bug#67523: check-declare doesn't account for shorthands João Távora
2023-11-29 10:35 ` João Távora
2023-11-29 11:12 ` João Távora
2023-12-10 10:57 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7fcgbyx.fsf@ushin.org \
--to=bug-gnu-emacs@gnu.org \
--cc=67523@debbugs.gnu.org \
--cc=adam@alphapapa.net \
--cc=joaotavora@gmail.com \
--cc=jonas@bernoul.li \
--cc=joseph@ushin.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.