+
+ ;; 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))))
+