Commit fd020a29 authored by Michal Nazarewicz's avatar Michal Nazarewicz
Browse files

eldoc: modify `eldoc-documentation-function' using `add-function'

* lisp/emacs-lisp/eldoc.el (eldoc-documentation-function): Describe how
major modes should use `add-function' to alter value of the variable.

* lisp/hexl.el (hexl-mode): Set `eldoc-documentation-function' using
`add-function' so the default value is always used.
* lisp/ielm.el (inferior-emacs-lisp-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* lisp/progmodes/cfengine.el (cfengine3-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* lisp/progmodes/elisp-mode (emacs-lisp-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* lisp/progmodes/octave.el (octave-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* lisp/progmodes/python.el (python-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* lisp/simple.el (read--expression): Set `eldoc-documentation-function'
using `add-function' so the default value is always used.
parent 81681ed9
2015-01-20 Michal Nazarewicz <mina86@mina86.com> 2015-01-20 Michal Nazarewicz <mina86@mina86.com>
   
* emacs-lisp/eldoc.el (eldoc-documentation-function): Describe how
major modes should use `add-function' to alter value of the variable.
* hexl.el (hexl-mode): Set `eldoc-documentation-function' using
`add-function' so the default value is always used.
* ielm.el (inferior-emacs-lisp-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* progmodes/cfengine.el (cfengine3-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* progmodes/elisp-mode (emacs-lisp-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* progmodes/octave.el (octave-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* progmodes/python.el (python-mode): Set
`eldoc-documentation-function' using `add-function' so the default
value is always used.
* simple.el (read--expression): Set `eldoc-documentation-function'
using `add-function' so the default value is always used.
* descr-text.el (describe-char-eldoc): New function returning * descr-text.el (describe-char-eldoc): New function returning
basic Unicode codepoint information (e.g. name) about character basic Unicode codepoint information (e.g. name) about character
at point. It is meant to be used as a default value of the at point. It is meant to be used as a default value of the
......
...@@ -336,7 +336,12 @@ the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p', ...@@ -336,7 +336,12 @@ the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p',
and the face `eldoc-highlight-function-argument', if they are to have any and the face `eldoc-highlight-function-argument', if they are to have any
effect. effect.
This variable is expected to be set buffer-locally by modes that support ElDoc.") Major modes should modify this variable using `add-function', for example:
(add-function :before-until (local 'eldoc-documentation-function)
#'foo-mode-eldoc-function)
so that the global documentation function (i.e. the default value of the
variable) is taken into account if the major mode specific function does not
return any documentation.")
(defun eldoc-print-current-symbol-info () (defun eldoc-print-current-symbol-info ()
;; This is run from post-command-hook or some idle timer thing, ;; This is run from post-command-hook or some idle timer thing,
......
...@@ -395,7 +395,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. ...@@ -395,7 +395,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
(add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t)
;; Set a callback function for eldoc. ;; Set a callback function for eldoc.
(hexl-mode--setq-local 'eldoc-documentation-function (add-function :before-until (local 'eldoc-documentation-function)
#'hexl-print-current-point-info) #'hexl-print-current-point-info)
(eldoc-add-command-completions "hexl-") (eldoc-add-command-completions "hexl-")
(eldoc-remove-command "hexl-save-buffer" (eldoc-remove-command "hexl-save-buffer"
......
...@@ -542,7 +542,7 @@ Customized bindings may be defined in `ielm-map', which currently contains: ...@@ -542,7 +542,7 @@ Customized bindings may be defined in `ielm-map', which currently contains:
(set (make-local-variable 'completion-at-point-functions) (set (make-local-variable 'completion-at-point-functions)
'(comint-replace-by-expanded-history '(comint-replace-by-expanded-history
ielm-complete-filename elisp-completion-at-point)) ielm-complete-filename elisp-completion-at-point))
(setq-local eldoc-documentation-function (add-function :before-until (local 'eldoc-documentation-function)
#'elisp-eldoc-documentation-function) #'elisp-eldoc-documentation-function)
(set (make-local-variable 'ielm-prompt-internal) ielm-prompt) (set (make-local-variable 'ielm-prompt-internal) ielm-prompt)
(set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only)
......
...@@ -1350,7 +1350,8 @@ to the action header." ...@@ -1350,7 +1350,8 @@ to the action header."
(when buffer-file-name (when buffer-file-name
(shell-quote-argument buffer-file-name))))) (shell-quote-argument buffer-file-name)))))
(setq-local eldoc-documentation-function #'cfengine3-documentation-function) (add-function :before-until (local 'eldoc-documentation-function)
#'cfengine3-documentation-function)
(add-hook 'completion-at-point-functions (add-hook 'completion-at-point-functions
#'cfengine3-completion-function nil t) #'cfengine3-completion-function nil t)
......
...@@ -231,7 +231,7 @@ Blank lines separate paragraphs. Semicolons start comments. ...@@ -231,7 +231,7 @@ Blank lines separate paragraphs. Semicolons start comments.
(defvar xref-identifier-completion-table-function) (defvar xref-identifier-completion-table-function)
(lisp-mode-variables nil nil 'elisp) (lisp-mode-variables nil nil 'elisp)
(setq imenu-case-fold-search nil) (setq imenu-case-fold-search nil)
(setq-local eldoc-documentation-function (add-function :before-until (local 'eldoc-documentation-function)
#'elisp-eldoc-documentation-function) #'elisp-eldoc-documentation-function)
(setq-local xref-find-function #'elisp-xref-find) (setq-local xref-find-function #'elisp-xref-find)
(setq-local xref-identifier-completion-table-function (setq-local xref-identifier-completion-table-function
......
...@@ -601,7 +601,8 @@ Key bindings: ...@@ -601,7 +601,8 @@ Key bindings:
(add-hook 'before-save-hook 'octave-sync-function-file-names nil t) (add-hook 'before-save-hook 'octave-sync-function-file-names nil t)
(setq-local beginning-of-defun-function 'octave-beginning-of-defun) (setq-local beginning-of-defun-function 'octave-beginning-of-defun)
(and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment)) (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment))
(setq-local eldoc-documentation-function 'octave-eldoc-function) (add-function :before-until (local 'eldoc-documentation-function)
'octave-eldoc-function)
(easy-menu-add octave-mode-menu)) (easy-menu-add octave-mode-menu))
......
...@@ -4662,7 +4662,7 @@ Arguments START and END narrow the buffer region to work on." ...@@ -4662,7 +4662,7 @@ Arguments START and END narrow the buffer region to work on."
(current-column)))) (current-column))))
(^ '(- (1+ (current-indentation)))))) (^ '(- (1+ (current-indentation))))))
(set (make-local-variable 'eldoc-documentation-function) (add-function :before-until (local 'eldoc-documentation-function)
#'python-eldoc-function) #'python-eldoc-function)
(add-to-list 'hs-special-modes-alist (add-to-list 'hs-special-modes-alist
......
...@@ -1407,7 +1407,7 @@ display the result of expression evaluation." ...@@ -1407,7 +1407,7 @@ display the result of expression evaluation."
(minibuffer-with-setup-hook (minibuffer-with-setup-hook
(lambda () (lambda ()
;; FIXME: call emacs-lisp-mode? ;; FIXME: call emacs-lisp-mode?
(setq-local eldoc-documentation-function (add-function :before-until (local 'eldoc-documentation-function)
#'elisp-eldoc-documentation-function) #'elisp-eldoc-documentation-function)
(add-hook 'completion-at-point-functions (add-hook 'completion-at-point-functions
#'elisp-completion-at-point nil t) #'elisp-completion-at-point nil t)
......
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