GNU bug report logs -
#73880
Master: emacs-lisp-mode: Tab completion for a function position fails in a `let' form.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Sat, 19 Oct 2024 13:10:02 UTC
Severity: normal
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 73880 <at> debbugs.gnu.org (full text, mbox):
Hello again, Dmitry.
On Sat, Oct 26, 2024 at 04:50:15 +0300, Dmitry Gutov wrote:
> Hi Alan!
[ .... ]
> BTW, I had to move the corresponding piece of code to a separate
> function to debug it. Too bad edebug doesn't know how to jump into the
> 'guard' clauses.
I found the bug in pcase.el causing this. The edebug spec element
&interpose, which is used in pcase-PAT absolutely requires that the
function it uses (in this case pcase--edebug-match-pat-args) must call
PF. (See edebug.el around L1810.)
What PF (internal function in edebug) does is join up edebug specs with
what follows.
pcase--edebug-match-pat-args fails to do this for most cases it deals
with, including guard. As a result, there is no edebug instrumentation
generated for the argument of guard.
I'm going to raise a bug report for this (answering my question in my
last post). In the meantime, here is a rough first draught of a fix.
With it, I can debug the guard clauses in elisp-completion-at-point,
though I seem to be triggering other problems (I get a message about a
`_' argument being used after all).
Enjoy!
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 898d460c144..f600c62daa2 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -84,14 +84,28 @@ 'pcase-FUN
(defun pcase--edebug-match-pat-args (head pf)
;; (cl-assert (null (cdr head)))
(setq head (car head))
- (or (alist-get head '((quote sexp)
+;;;; OLD STOUGH, 2024-10-26
+ ;; (or
+;;;; NEW STOUGH, 2024-10-26
+ (let ((specs
+;;;; END OF NEW STOUGH
+ (alist-get head '((quote sexp)
(or &rest pcase-PAT)
(and &rest pcase-PAT)
(guard form)
(pred &or ("not" pcase-FUN) pcase-FUN)
(app pcase-FUN pcase-PAT)))
+;;;; NEW STOUGH, 2024-10-26
+ ))
+ (if specs
+ (funcall pf specs)
+;;;; END OF NEW STOUGH
(let ((me (pcase--get-macroexpander head)))
- (funcall pf (and me (symbolp me) (edebug-get-spec me))))))
+ (funcall pf (and me (symbolp me) (edebug-get-spec me)))))
+;;;; NEW STOUGH, 2024-10-26
+ )
+;;;; END OF NEW STOUGH
+ )
(defun pcase--get-macroexpander (s)
"Return the macroexpander for pcase pattern head S, or nil."
[ .... ]
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 205 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.