Commit 2e8750c7 authored by Stephen Leake's avatar Stephen Leake

Add mode local overrides to describe-function

* lisp/cedet/mode-local.el (describe-mode-local-overload): New; add mode
local overrides to describe-function.

* etc/NEWS: Document change.
parent 1be208c2
......@@ -88,7 +88,11 @@ command line when `initial-buffer-choice' is non-nil.
* Changes in Emacs 25.1
** New display-buffer action function display-buffer-use-some-frame
** `describe-function' now displays information about mode local
overrides (defined by cedet/mode-local.el
`define-overloadable-function' and `define-mode-local-overrides'.
** New `display-buffer' action function `display-buffer-use-some-frame'
This displays the buffer in an existing frame other than the current
frame, and allows the caller to specify a frame predicate to exclude
frames.
......
......@@ -625,6 +625,30 @@ SYMBOL is a function that can be overridden."
;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE
)))
(defun describe-mode-local-overload (symbol)
"For `help-fns-describe-function-functions'; add overloads for SYMBOL."
(when (get symbol 'mode-local-overload)
(let ((default (or (intern-soft (format "%s-default" (symbol-name symbol)))
symbol))
(override (and
(boundp 'describe-function-orig-buffer) ;; added in Emacs 25
describe-function-orig-buffer
(with-current-buffer describe-function-orig-buffer
(fetch-overload symbol)))))
(insert (overload-docstring-extension symbol) "\n\n")
(insert (substitute-command-keys (format "default function: `%s'\n" default)))
(when (and (boundp 'describe-function-orig-buffer) ;; added in Emacs 25
describe-function-orig-buffer)
(if override
(insert (substitute-command-keys
(format "\noverride in buffer '%s': `%s'\n"
describe-function-orig-buffer override)))
(insert (substitute-command-keys (format "\nno override in buffer '%s'\n"
describe-function-orig-buffer)))))
)))
(add-hook 'help-fns-describe-function-functions 'describe-mode-local-overload)
;; Help for mode-local bindings.
(defun mode-local-print-binding (symbol)
"Print the SYMBOL binding."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment