From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Catching no generic method in EIEIO Date: Sat, 28 May 2016 14:29:26 -0400 Message-ID: References: <8760u2gm6c.fsf@russet.org.uk> <87mvncg8nd.fsf@russet.org.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1464460223 24508 80.91.229.3 (28 May 2016 18:30:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 May 2016 18:30:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat May 28 20:30:14 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b6j02-0002Dx-CZ for geh-help-gnu-emacs@m.gmane.org; Sat, 28 May 2016 20:30:14 +0200 Original-Received: from localhost ([::1]:53912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6izy-0006nC-D9 for geh-help-gnu-emacs@m.gmane.org; Sat, 28 May 2016 14:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6izY-0006mt-5K for help-gnu-emacs@gnu.org; Sat, 28 May 2016 14:29:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6izT-00043b-0o for help-gnu-emacs@gnu.org; Sat, 28 May 2016 14:29:43 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:51572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6izS-00043M-QI for help-gnu-emacs@gnu.org; Sat, 28 May 2016 14:29:38 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1b6izR-000205-9R for help-gnu-emacs@gnu.org; Sat, 28 May 2016 20:29:37 +0200 Original-Received: from 45.72.245.251 ([45.72.245.251]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 May 2016 20:29:37 +0200 Original-Received: from monnier by 45.72.245.251 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 May 2016 20:29:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 31 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 45.72.245.251 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:mZtPOBIDjX3655qEkbabwY2FIhw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:110134 Archived-At: >>> The last form crashes -- I could, of course, implement this using >>> defmethod on Two, but I want to this for any method. >> (defmethod ((o t)) >> ...) >> should do the trick. > Didn't know you could do that, but it's not what I wanted. It implements > the method for all objects. Where was what I wanted was to implement all > methods on one object (or class). FWIW, I think you can might be able to do that (at least for those methods which don't have a default case like the one I provided above) with something like (cl-defmethod cl-no-applicable-method (generic (x ) &rest args) aka (defmethod no-applicable-method ((x ) generic &rest args) but this will only catch those methods where the dispatch on was done on the first argument. >> PS: Of course, I also recommend you switch to cl-generic >> (i.e. use (cl-defmethod ...)). It's more featureful and much faster. > I'm going to fix all that when I port everything to emacs-25. I'm just > waiting till that hits the shelf. There's a forward compatibility cl-generic package in GNU ELPA, so you should be able to start using it without dropping backward compatibility. Stefan