From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#8660: 23.2; info-look.el makefile-mode derivatives Date: Sat, 16 Feb 2013 11:02:25 +1100 Message-ID: <877gm96s8e.fsf@blah.blah> References: <87zkmskbtr.fsf@blah.blah> <87y62ajc5b.fsf@blah.blah> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1360973006 24367 80.91.229.3 (16 Feb 2013 00:03:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 16 Feb 2013 00:03:26 +0000 (UTC) To: 8660@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 16 01:03:48 2013 Return-path: Envelope-to: geb-bug-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 1U6VFn-0005rg-Nq for geb-bug-gnu-emacs@m.gmane.org; Sat, 16 Feb 2013 01:03:43 +0100 Original-Received: from localhost ([::1]:48461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6VFU-0003mk-0s for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 Feb 2013 19:03:24 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6VFO-0003md-VV for bug-gnu-emacs@gnu.org; Fri, 15 Feb 2013 19:03:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U6VFM-0002m5-TN for bug-gnu-emacs@gnu.org; Fri, 15 Feb 2013 19:03:18 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U6VFM-0002lq-Qz for bug-gnu-emacs@gnu.org; Fri, 15 Feb 2013 19:03:16 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U6VG5-0001Qs-JF for bug-gnu-emacs@gnu.org; Fri, 15 Feb 2013 19:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kevin Ryde Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Feb 2013 00:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8660 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 8660-submit@debbugs.gnu.org id=B8660.13609730215467 (code B ref 8660); Sat, 16 Feb 2013 00:04:01 +0000 Original-Received: (at 8660) by debbugs.gnu.org; 16 Feb 2013 00:03:41 +0000 Original-Received: from localhost ([127.0.0.1]:58285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6VFk-0001Q7-UF for submit@debbugs.gnu.org; Fri, 15 Feb 2013 19:03:41 -0500 Original-Received: from mailout1-15.pacific.net.au ([125.255.80.134]:60897 helo=mailout3-syd3.pacific.net.au) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6VFh-0001Pv-AG for 8660@debbugs.gnu.org; Fri, 15 Feb 2013 19:03:40 -0500 Original-Received: from mailproxy3-syd3.pacific.net.au (mailproxy3-syd3.pacific.net.au [61.8.2.164]) by mailout3-syd3.pacific.net.au (Postfix) with ESMTP id 572E81179E7; Sat, 16 Feb 2013 11:02:47 +1100 (EST) Original-Received: from blah.blah (unknown [203.26.175.161]) by mailproxy3-syd3.pacific.net.au (Postfix) with ESMTP id 53A96578072; Sat, 16 Feb 2013 11:02:46 +1100 (EST) Original-Received: from gg by blah.blah with local (Exim 4.80) (envelope-from ) id 1U6VEX-0001ef-6r; Sat, 16 Feb 2013 11:02:25 +1100 In-Reply-To: (Stefan Monnier's message of "Sat, 14 May 2011 00:55:18 -0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:71365 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: > >> I suppose also info-look might check a derived-mode-parent if a mode >> doesn't have its own setup. That might pick up more things with less >> effort in each mode. > > Oh, yes, that would be a better change. Patch welcome. It took a while but I made the couple of lines below. I considered having the lookup bits such as info-lookup->mode-value do their lookups under a parent mode if the given mode has nothing. But I think there are too many complications from that. Some calls are asking if there's anything before adding and thus don't want a fallback. The caching bits probably would want to cache against the actual name rather than any derived child name. And behaviour would subtly change after a derived mode has loaded and thus gained a `derived-mode-parent' property. A nicer default `info-lookup-mode' should do only good, and it won't affect anything which explicitly selects an info-lookup-mode itself. 2013-02-16 Kevin Ryde * info-look.el (info-lookup-select-mode): If major-mode has no info-lookup-alist entry then search up derived-mode-parent. This means a define-derived-mode uses its parent's info-look setups if it has none of its own. Helps `makefile-gmake-mode' and friends automatically use their parent `makefile-mode' instead of prompting for a mode. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=info-look.el.derived-mode-parent.diff diff -u /home/gg/bug/info-look-parent/info-look.el.orig /home/gg/bug/info-look-parent/info-look.el --- /home/gg/bug/info-look-parent/info-look.el.orig 2012-09-09 07:58:12.000000000 +1000 +++ /home/gg/bug/info-look-parent/info-look.el 2013-02-16 10:47:30.000000000 +1100 @@ -298,6 +298,21 @@ (when (string-match (caar file-name-alist) file-name) (setq info-lookup-mode (cdar file-name-alist))) (setq file-name-alist (cdr file-name-alist))))) + + ;; If major-mode has no setups in info-lookup-alist, under any topic, then + ;; search up through derived-mode-parent to find a parent mode which does + ;; have some setups. This means that a `define-derived-mode' with no + ;; setups of its own will select its parent mode for lookups, if one of + ;; its parents has some setups. Good for example on `makefile-gmake-mode' + ;; and similar derivatives of `makefile-mode'. + ;; + (let ((mode major-mode)) ;; look for `mode' with some setups + (while (and mode (not info-lookup-mode)) + (dolist (topic-cell info-lookup-alist) ;; usually only two topics here + (if (info-lookup->mode-value (car topic-cell) mode) + (setq info-lookup-mode mode))) + (setq mode (get mode 'derived-mode-parent)))) + (or info-lookup-mode (setq info-lookup-mode major-mode))) (defun info-lookup-change-mode (topic) Diff finished. Sat Feb 16 10:48:55 2013 --=-=-=--