]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/info-look.el (info-lookup-select-mode): If major-mode has no
authorKevin Ryde <user42@zip.com.au>
Sat, 16 Feb 2013 17:20:43 +0000 (12:20 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 16 Feb 2013 17:20:43 +0000 (12:20 -0500)
info-lookup-alist entry then search up derived-mode-parent.

Fixes: debbugs:8660
lisp/ChangeLog
lisp/info-look.el

index eef4e033ed0c4dc528803b723c1bd028876121d2..0718296dffd3b6d954ef1e9ea45d1aaacd4529d6 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-16  Kevin Ryde  <user42@zip.com.au>
+
+       * info-look.el (info-lookup-select-mode): If major-mode has no
+       info-lookup-alist entry then search up derived-mode-parent (bug#8660).
+
 2013-02-16  Jambunathan K  <kjambunathan@gmail.com>
 
        * replace.el (read-regexp): Tighten the regexp that matches tag.
index a67fabc5a88e2a646216f01347ee785224ad9aa6..0b33dd51faf2b736168be8cfc396c7739408bf2b 100644 (file)
@@ -298,6 +298,21 @@ If optional argument QUERY is non-nil, query for the help mode."
        (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)