emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2e8750c 1/2: Add mode local overrides to describe-f


From: Stephen Leake
Subject: [Emacs-diffs] master 2e8750c 1/2: Add mode local overrides to describe-function
Date: Wed, 26 Aug 2015 21:59:16 +0000

branch: master
commit 2e8750c76940a712f0be93667c042c8987d919d4
Author: Stephen Leake <address@hidden>
Commit: Stephen Leake <address@hidden>

    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.
---
 etc/NEWS                 |    6 +++++-
 lisp/cedet/mode-local.el |   24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 4851c35..cf0804d 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 01e3700..ce30a98 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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]