diff options
| author | Stephen Leake | 2015-08-26 15:33:41 -0500 |
|---|---|---|
| committer | Stephen Leake | 2015-08-26 16:45:06 -0500 |
| commit | 2e8750c76940a712f0be93667c042c8987d919d4 (patch) | |
| tree | 5d5b5a3df7b9240a3a1317579caee04ef44b2ac4 /lisp | |
| parent | 1be208c2b061a6849760579f185be9b9e05de569 (diff) | |
| download | emacs-2e8750c76940a712f0be93667c042c8987d919d4.tar.gz emacs-2e8750c76940a712f0be93667c042c8987d919d4.zip | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/cedet/mode-local.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 01e37005b5d..ce30a985a79 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el | |||
| @@ -625,6 +625,30 @@ SYMBOL is a function that can be overridden." | |||
| 625 | ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE | 625 | ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE |
| 626 | ))) | 626 | ))) |
| 627 | 627 | ||
| 628 | (defun describe-mode-local-overload (symbol) | ||
| 629 | "For `help-fns-describe-function-functions'; add overloads for SYMBOL." | ||
| 630 | (when (get symbol 'mode-local-overload) | ||
| 631 | (let ((default (or (intern-soft (format "%s-default" (symbol-name symbol))) | ||
| 632 | symbol)) | ||
| 633 | (override (and | ||
| 634 | (boundp 'describe-function-orig-buffer) ;; added in Emacs 25 | ||
| 635 | describe-function-orig-buffer | ||
| 636 | (with-current-buffer describe-function-orig-buffer | ||
| 637 | (fetch-overload symbol))))) | ||
| 638 | (insert (overload-docstring-extension symbol) "\n\n") | ||
| 639 | (insert (substitute-command-keys (format "default function: `%s'\n" default))) | ||
| 640 | (when (and (boundp 'describe-function-orig-buffer) ;; added in Emacs 25 | ||
| 641 | describe-function-orig-buffer) | ||
| 642 | (if override | ||
| 643 | (insert (substitute-command-keys | ||
| 644 | (format "\noverride in buffer '%s': `%s'\n" | ||
| 645 | describe-function-orig-buffer override))) | ||
| 646 | (insert (substitute-command-keys (format "\nno override in buffer '%s'\n" | ||
| 647 | describe-function-orig-buffer))))) | ||
| 648 | ))) | ||
| 649 | |||
| 650 | (add-hook 'help-fns-describe-function-functions 'describe-mode-local-overload) | ||
| 651 | |||
| 628 | ;; Help for mode-local bindings. | 652 | ;; Help for mode-local bindings. |
| 629 | (defun mode-local-print-binding (symbol) | 653 | (defun mode-local-print-binding (symbol) |
| 630 | "Print the SYMBOL binding." | 654 | "Print the SYMBOL binding." |