unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* "fall-through" generic function args plus &context
@ 2016-12-26 20:34 Eric Abrahamsen
  2016-12-26 22:48 ` Eric Abrahamsen
  2016-12-27  1:27 ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Eric Abrahamsen @ 2016-12-26 20:34 UTC (permalink / raw)
  To: help-gnu-emacs

I have a few defmethods that use the &context construct to dispatch on
the value of major mode:

(cl-defmethod my-make-buffer-name (&context (major-mode gnus-summary-mode))
  ;; etc...
  )

I need a catch-all method, for default behavior when we're in other
modes that aren't targeted by an existing method.

I've tried things like:

(&context _major-mode)
(&context (major-mode t))
(&context (major-mode nil))
(&context (major-mode (eql _nuthin))

And a few other things. Everything raises cl-no-applicable-method.

What's the correct way to do this? Or do I need to override
`cl-no-applicable-method' and catch the error?

Thanks,
Eric




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

end of thread, other threads:[~2016-12-30 14:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-26 20:34 "fall-through" generic function args plus &context Eric Abrahamsen
2016-12-26 22:48 ` Eric Abrahamsen
2016-12-27  3:36   ` Stefan Monnier
2016-12-27 17:23     ` Eric Abrahamsen
2016-12-27 21:30       ` Stefan Monnier
2016-12-29  2:30         ` Eric Abrahamsen
2016-12-29 14:42           ` Stefan Monnier
2016-12-29 19:04             ` Eric Abrahamsen
2016-12-30 14:26               ` Stefan Monnier
2016-12-27  1:27 ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).