From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: "fall-through" generic function args plus &context Date: Mon, 26 Dec 2016 14:48:08 -0800 Message-ID: <87d1gexq6v.fsf@ericabrahamsen.net> References: <87r34u8m55.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1482806401 28412 195.159.176.226 (27 Dec 2016 02:40:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Dec 2016 02:40:01 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 27 03:39:57 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLhgA-0006cW-VE for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Dec 2016 03:39:55 +0100 Original-Received: from localhost ([::1]:52478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLhgF-0003re-Pr for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Dec 2016 21:39:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLe4C-00038M-UI for help-gnu-emacs@gnu.org; Mon, 26 Dec 2016 17:48:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLe49-0003tv-ST for help-gnu-emacs@gnu.org; Mon, 26 Dec 2016 17:48:28 -0500 Original-Received: from [195.159.176.226] (port=41789 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLe49-0003td-Lw for help-gnu-emacs@gnu.org; Mon, 26 Dec 2016 17:48:25 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cLe40-0001II-7O for help-gnu-emacs@gnu.org; Mon, 26 Dec 2016 23:48:16 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 35 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:UWzaeuqQPtlqXTHX1fC2NNCtQ9w= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Mon, 26 Dec 2016 21:38:52 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112003 Archived-At: Eric Abrahamsen writes: > 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? Come to think of it, how does one override `cl-no-applicable-method' for a specific generic? The defgeneric looks like: (cl-defgeneric cl-no-applicable-method (generic &rest args) "Function called when a method call finds no applicable method." (signal 'cl-no-applicable-method `(,(cl--generic-name generic) ,@args))) How do I specialize on "generic"? Thanks, Eric