From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25294: 26.0.50; Allow more catch-all values for cl-defmethod's &context plus major-mode specializer Date: Thu, 29 Dec 2016 23:35:05 -0500 Message-ID: <877f6i826e.fsf@users.sourceforge.net> References: <874m1mo8ez.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483072521 12069 195.159.176.226 (30 Dec 2016 04:35:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 30 Dec 2016 04:35:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 25294@debbugs.gnu.org To: Eric Abrahamsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 30 05:35:14 2016 Return-path: Envelope-to: geb-bug-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 1cMouN-0001T0-9A for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Dec 2016 05:35:11 +0100 Original-Received: from localhost ([::1]:38338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMouP-0000Tk-2C for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Dec 2016 23:35:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMouJ-0000SZ-FD for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2016 23:35:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMouE-00068h-IX for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2016 23:35:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44101) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cMouE-000686-EK for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2016 23:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cMouE-0002Gw-59 for bug-gnu-emacs@gnu.org; Thu, 29 Dec 2016 23:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Dec 2016 04:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25294-submit@debbugs.gnu.org id=B25294.14830724488667 (code B ref 25294); Fri, 30 Dec 2016 04:35:02 +0000 Original-Received: (at 25294) by debbugs.gnu.org; 30 Dec 2016 04:34:08 +0000 Original-Received: from localhost ([127.0.0.1]:59500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cMotM-0002Fh-IA for submit@debbugs.gnu.org; Thu, 29 Dec 2016 23:34:08 -0500 Original-Received: from mail-io0-f174.google.com ([209.85.223.174]:36328) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cMotL-0002FS-JZ for 25294@debbugs.gnu.org; Thu, 29 Dec 2016 23:34:08 -0500 Original-Received: by mail-io0-f174.google.com with SMTP id h133so128736775ioe.3 for <25294@debbugs.gnu.org>; Thu, 29 Dec 2016 20:34:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=saxfPLky69EevljSiobqkGc8uDeBXdT7o0E3zW/D1kc=; b=Oy59OUqt2j6oI/7w16mc66uZVaGOPxbgrjom4Kw0E8U9sNGuQQL8oMBSJU3kuxetdX HKI3huxKAFffnlkzqldXbSQ2tGu3ho0TWQlMyZQ0JN6G5/8oL/vaCN8Uk9uUHHGrYMYr g/EwGvBb7jS15EDfuNX9nX4uUk5D+D3lagKP3A/iw1JFwRczF2gGZX5d1RTIajCm8AQf wm2+h2Q9IAUKRzHa3wJj6feHYCfk0lrgMN2A8/tDr6F99agiK542yYafAKHuCC0meVkm +Q0vhAd3Pt+JgVwBMjFbQimyMB6oSQA3x6hNgv0NI1R+lTYyGpwdAKbD0Myuw20Hisiq TVhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=saxfPLky69EevljSiobqkGc8uDeBXdT7o0E3zW/D1kc=; b=D3VJXX4bNatX6k0h7BWQB8eDRmVWex+29HWtzjwTHbmmlktdTXOIJWw3tHGmj6EXAF DS/H5lHyS/WRrICLqC1P+18vo8ZFH0M1MnLpyCjG1HUrQzIAfqZdcd6wRd6YTQPlkHPW 77K4cKxc0A5HMlUg/2Qs9C29w4BisekLwRqkb57+iO14d6NAA0zRtOn02oA8V3fm26Dk OPWFwublk3zlp7/5K29v1dUfxLa2mmP3pxPrwQKpZ2qrwW6ihDhyJtiVlapMQGj9ikn7 PrKVifEzd9jWBKNpGQZ8oyEHMbm2ZccehA6eWwyoSKU/Dz4OfRLIYE1+OZoGzMjWDVfI 5hiw== X-Gm-Message-State: AIkVDXIJqyuaHRR76La6U4suP7+w2O14xkhibYS1rlMta1l4g0naL048qFTovMMvnlgoSw== X-Received: by 10.107.3.168 with SMTP id e40mr32122942ioi.89.1483072441886; Thu, 29 Dec 2016 20:34:01 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id g188sm15783628itg.8.2016.12.29.20.34.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2016 20:34:01 -0800 (PST) In-Reply-To: <874m1mo8ez.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 29 Dec 2016 11:13:40 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127569 Archived-At: Eric Abrahamsen writes: > When defining a method using cl-defmethod with the &context and > major-mode specializer, Is this about the undocumented specializer mentioned in cl-generic.el? ;;; Dispatch on major mode. ;; Two parts: ;; - first define a specializer (derived-mode ) to match symbols ;; representing major modes, while obeying the major mode hierarchy. ;; - then define a context-rewriter so you can write ;; "&context (major-mode c-mode)" rather than ;; "&context (major-mode (derived-mode c-mode))". > there should be more acceptable options for > catch-all or fall-through methods. Ie, we want to create a method that > fires regardless of the major mode. If you want to ignore the major mode, why do you want to use the major-mode specializer? > These signatures don't work, but > should: > > (cl-defmethod example-method ((&context (major-mode fundamental-mode)))) > Should that be (cl-defmethod example-method (&context (major-mode fundamental-mode))) The reason this doesn't work is because fundamental isn't actually the parent mode of text-mode or prog-mode, i.e., (get 'text-mode 'derived-mode-parent) => nil. > (cl-defmethod example-method ((&context (major-mode nil))) > > (cl-defmethod example-method ((&context (major-mode t)))) > > Right now the only thing that works is: > > (cl-defmethod example-method ())