From: Stephen Leake Date: Wed, 26 Aug 2015 20:33:41 +0000 (-0500) Subject: Add mode local overrides to describe-function X-Git-Tag: emacs-25.0.90~1242 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2e8750c76940a712f0be93667c042c8987d919d4;p=emacs.git 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. --- diff --git a/etc/NEWS b/etc/NEWS index 4851c350f17..cf0804d791e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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. 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." ;; 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."