all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Instrumenting macro calls
@ 2021-06-29 20:05 Trust me I am a Doctor
  2021-06-29 22:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 3+ messages in thread
From: Trust me I am a Doctor @ 2021-06-29 20:05 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]


Hi,

While exploring eieio I found that laconic comment

--- snip ---
;; In retrospect, this is a silly function.
(defun eieio-instance-tracker-find (key slot list-symbol)
  "Find KEY as an element of SLOT in the objects in LIST-SYMBOL.
Returns the first match."
  (object-assoc key slot (symbol-value list-symbol)))
--- snip ---

So I thought I could make my own query for a tracking list of eieio
objects. It is a macro that use pcase to destructuring-bind the argument
list into a query that may returns matching objects or slots
or whatever.


[-- Attachment #2: query macro --]
[-- Type: application/emacs-lisp, Size: 2784 bytes --]

[-- Attachment #3: Type: text/plain, Size: 293 bytes --]


Until now it seems to work ok.  The issue I have with it, is
instrumenting the macro calls with edebug.  Apparently edebug does not
understand that the forms are wrapped into (and ... ), and will evaluate
each of them even if some returns nil !

Is there a way to instruct edebug from that ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Instrumenting macro calls
  2021-06-29 20:05 Instrumenting macro calls Trust me I am a Doctor
@ 2021-06-29 22:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2021-06-29 22:50   ` Trust me I am a Doctor
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2021-06-29 22:16 UTC (permalink / raw)
  To: help-gnu-emacs

> Until now it seems to work ok.  The issue I have with it, is
> instrumenting the macro calls with edebug.  Apparently edebug does not
> understand that the forms are wrapped into (and ... ), and will evaluate
> each of them even if some returns nil !

Use `&rest form` instead of `def-body`.
(you don't need the "def-" version here anyway).


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Instrumenting macro calls
  2021-06-29 22:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2021-06-29 22:50   ` Trust me I am a Doctor
  0 siblings, 0 replies; 3+ messages in thread
From: Trust me I am a Doctor @ 2021-06-29 22:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs


Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> writes:

>> Until now it seems to work ok.  The issue I have with it, is
>> instrumenting the macro calls with edebug.  Apparently edebug does not
>> understand that the forms are wrapped into (and ... ), and will evaluate
>> each of them even if some returns nil !
>
> Use `&rest form` instead of `def-body`.
> (you don't need the "def-" version here anyway).
>
>
>         Stefan

Thanks !



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-29 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-29 20:05 Instrumenting macro calls Trust me I am a Doctor
2021-06-29 22:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-06-29 22:50   ` Trust me I am a Doctor

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.