Skip to content

Commit

Permalink
In describe-function, print the parent of a derived mode.
Browse files Browse the repository at this point in the history
* lisp/help-fns.el (describe-function-1): If the function is a derived
major mode, print the parent mode.
  • Loading branch information
Chong Yidong committed May 28, 2011
1 parent d90cf6d commit 2e341dd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lisp/ChangeLog
@@ -1,5 +1,8 @@
2011-05-28 Chong Yidong <cyd@stupidchicken.com>

* help-fns.el (describe-function-1): If the function is a derived
major mode, print the parent mode.

* progmodes/cc-mode.el (c-mode, c++-mode, objc-mode, java-mode)
(idl-mode, pike-mode, awk-mode): Inherit from prog-mode.

Expand Down
15 changes: 15 additions & 0 deletions lisp/help-fns.el
Expand Up @@ -557,6 +557,21 @@ suitable file is found, return nil."
(insert (car high) "\n")
(fill-region fill-begin (point)))
(setq doc (cdr high))))

;; If this is a derived mode, link to the parent.
(let ((parent-mode (and (symbolp real-function)
(get real-function
'derived-mode-parent))))
(when parent-mode
(with-current-buffer standard-output
(insert "\nParent mode: `")
(let ((beg (point)))
(insert (format "%s" parent-mode))
(make-text-button beg (point)
'type 'help-function
'help-args (list parent-mode))))
(princ "'.\n")))

(let* ((obsolete (and
;; function might be a lambda construct.
(symbolp function)
Expand Down

0 comments on commit 2e341dd

Please sign in to comment.