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 | |
| 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.
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/cedet/mode-local.el | 24 |
2 files changed, 29 insertions, 1 deletions
| @@ -88,7 +88,11 @@ command line when `initial-buffer-choice' is non-nil. | |||
| 88 | 88 | ||
| 89 | * Changes in Emacs 25.1 | 89 | * Changes in Emacs 25.1 |
| 90 | 90 | ||
| 91 | ** New display-buffer action function display-buffer-use-some-frame | 91 | ** `describe-function' now displays information about mode local |
| 92 | overrides (defined by cedet/mode-local.el | ||
| 93 | `define-overloadable-function' and `define-mode-local-overrides'. | ||
| 94 | |||
| 95 | ** New `display-buffer' action function `display-buffer-use-some-frame' | ||
| 92 | This displays the buffer in an existing frame other than the current | 96 | This displays the buffer in an existing frame other than the current |
| 93 | frame, and allows the caller to specify a frame predicate to exclude | 97 | frame, and allows the caller to specify a frame predicate to exclude |
| 94 | frames. | 98 | frames. |
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." |