diff options
| author | Michal Nazarewicz | 2014-12-05 19:34:42 +0100 |
|---|---|---|
| committer | Michal Nazarewicz | 2015-01-20 15:04:15 +0100 |
| commit | fd020a29316e573e96501dfc1c87d05085160b2c (patch) | |
| tree | 7e7eaf479ef8f2036c9fd5bf85bf60963d646460 | |
| parent | 81681ed9a1e609101377d674613832008a667587 (diff) | |
| download | emacs-fd020a29316e573e96501dfc1c87d05085160b2c.tar.gz emacs-fd020a29316e573e96501dfc1c87d05085160b2c.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 23 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eldoc.el | 7 | ||||
| -rw-r--r-- | lisp/hexl.el | 4 | ||||
| -rw-r--r-- | lisp/ielm.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cfengine.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/elisp-mode.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 4 | ||||
| -rw-r--r-- | lisp/simple.el | 4 |
9 files changed, 44 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ab338f8ed88..c34b7ea8a34 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,28 @@ | |||
| 1 | 2015-01-20 Michal Nazarewicz <mina86@mina86.com> | 1 | 2015-01-20 Michal Nazarewicz <mina86@mina86.com> |
| 2 | 2 | ||
| 3 | * emacs-lisp/eldoc.el (eldoc-documentation-function): Describe how | ||
| 4 | major modes should use `add-function' to alter value of the variable. | ||
| 5 | |||
| 6 | * hexl.el (hexl-mode): Set `eldoc-documentation-function' using | ||
| 7 | `add-function' so the default value is always used. | ||
| 8 | * ielm.el (inferior-emacs-lisp-mode): Set | ||
| 9 | `eldoc-documentation-function' using `add-function' so the default | ||
| 10 | value is always used. | ||
| 11 | * progmodes/cfengine.el (cfengine3-mode): Set | ||
| 12 | `eldoc-documentation-function' using `add-function' so the default | ||
| 13 | value is always used. | ||
| 14 | * progmodes/elisp-mode (emacs-lisp-mode): Set | ||
| 15 | `eldoc-documentation-function' using `add-function' so the default | ||
| 16 | value is always used. | ||
| 17 | * progmodes/octave.el (octave-mode): Set | ||
| 18 | `eldoc-documentation-function' using `add-function' so the default | ||
| 19 | value is always used. | ||
| 20 | * progmodes/python.el (python-mode): Set | ||
| 21 | `eldoc-documentation-function' using `add-function' so the default | ||
| 22 | value is always used. | ||
| 23 | * simple.el (read--expression): Set `eldoc-documentation-function' | ||
| 24 | using `add-function' so the default value is always used. | ||
| 25 | |||
| 3 | * descr-text.el (describe-char-eldoc): New function returning | 26 | * descr-text.el (describe-char-eldoc): New function returning |
| 4 | basic Unicode codepoint information (e.g. name) about character | 27 | basic Unicode codepoint information (e.g. name) about character |
| 5 | at point. It is meant to be used as a default value of the | 28 | at point. It is meant to be used as a default value of the |
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 0c74f3fedc0..d527d676d51 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el | |||
| @@ -336,7 +336,12 @@ the variables `eldoc-argument-case' and `eldoc-echo-area-use-multiline-p', | |||
| 336 | and the face `eldoc-highlight-function-argument', if they are to have any | 336 | and the face `eldoc-highlight-function-argument', if they are to have any |
| 337 | effect. | 337 | effect. |
| 338 | 338 | ||
| 339 | This variable is expected to be set buffer-locally by modes that support ElDoc.") | 339 | Major modes should modify this variable using `add-function', for example: |
| 340 | (add-function :before-until (local 'eldoc-documentation-function) | ||
| 341 | #'foo-mode-eldoc-function) | ||
| 342 | so that the global documentation function (i.e. the default value of the | ||
| 343 | variable) is taken into account if the major mode specific function does not | ||
| 344 | return any documentation.") | ||
| 340 | 345 | ||
| 341 | (defun eldoc-print-current-symbol-info () | 346 | (defun eldoc-print-current-symbol-info () |
| 342 | ;; This is run from post-command-hook or some idle timer thing, | 347 | ;; This is run from post-command-hook or some idle timer thing, |
diff --git a/lisp/hexl.el b/lisp/hexl.el index 3751bcf4bb3..27d46592698 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el | |||
| @@ -395,8 +395,8 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. | |||
| 395 | (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) | 395 | (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) |
| 396 | 396 | ||
| 397 | ;; Set a callback function for eldoc. | 397 | ;; Set a callback function for eldoc. |
| 398 | (hexl-mode--setq-local 'eldoc-documentation-function | 398 | (add-function :before-until (local 'eldoc-documentation-function) |
| 399 | #'hexl-print-current-point-info) | 399 | #'hexl-print-current-point-info) |
| 400 | (eldoc-add-command-completions "hexl-") | 400 | (eldoc-add-command-completions "hexl-") |
| 401 | (eldoc-remove-command "hexl-save-buffer" | 401 | (eldoc-remove-command "hexl-save-buffer" |
| 402 | "hexl-current-address") | 402 | "hexl-current-address") |
diff --git a/lisp/ielm.el b/lisp/ielm.el index d7bf60fe074..be877eb250a 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el | |||
| @@ -380,7 +380,7 @@ nonempty, then flushes the buffer." | |||
| 380 | (*3 ***) | 380 | (*3 ***) |
| 381 | (active-process (ielm-process)) | 381 | (active-process (ielm-process)) |
| 382 | (old-standard-output standard-output) | 382 | (old-standard-output standard-output) |
| 383 | new-standard-output | 383 | new-standard-output |
| 384 | ielm-temp-buffer) | 384 | ielm-temp-buffer) |
| 385 | (set-match-data ielm-match-data) | 385 | (set-match-data ielm-match-data) |
| 386 | (save-excursion | 386 | (save-excursion |
| @@ -542,8 +542,8 @@ Customized bindings may be defined in `ielm-map', which currently contains: | |||
| 542 | (set (make-local-variable 'completion-at-point-functions) | 542 | (set (make-local-variable 'completion-at-point-functions) |
| 543 | '(comint-replace-by-expanded-history | 543 | '(comint-replace-by-expanded-history |
| 544 | ielm-complete-filename elisp-completion-at-point)) | 544 | ielm-complete-filename elisp-completion-at-point)) |
| 545 | (setq-local eldoc-documentation-function | 545 | (add-function :before-until (local 'eldoc-documentation-function) |
| 546 | #'elisp-eldoc-documentation-function) | 546 | #'elisp-eldoc-documentation-function) |
| 547 | (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) | 547 | (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) |
| 548 | (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) | 548 | (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) |
| 549 | (setq comint-get-old-input 'ielm-get-old-input) | 549 | (setq comint-get-old-input 'ielm-get-old-input) |
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index b485a5d269b..aec7d208022 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el | |||
| @@ -1350,7 +1350,8 @@ to the action header." | |||
| 1350 | (when buffer-file-name | 1350 | (when buffer-file-name |
| 1351 | (shell-quote-argument buffer-file-name))))) | 1351 | (shell-quote-argument buffer-file-name))))) |
| 1352 | 1352 | ||
| 1353 | (setq-local eldoc-documentation-function #'cfengine3-documentation-function) | 1353 | (add-function :before-until (local 'eldoc-documentation-function) |
| 1354 | #'cfengine3-documentation-function) | ||
| 1354 | 1355 | ||
| 1355 | (add-hook 'completion-at-point-functions | 1356 | (add-hook 'completion-at-point-functions |
| 1356 | #'cfengine3-completion-function nil t) | 1357 | #'cfengine3-completion-function nil t) |
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 4de40eff538..b2c5fbfe60e 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -231,8 +231,8 @@ Blank lines separate paragraphs. Semicolons start comments. | |||
| 231 | (defvar xref-identifier-completion-table-function) | 231 | (defvar xref-identifier-completion-table-function) |
| 232 | (lisp-mode-variables nil nil 'elisp) | 232 | (lisp-mode-variables nil nil 'elisp) |
| 233 | (setq imenu-case-fold-search nil) | 233 | (setq imenu-case-fold-search nil) |
| 234 | (setq-local eldoc-documentation-function | 234 | (add-function :before-until (local 'eldoc-documentation-function) |
| 235 | #'elisp-eldoc-documentation-function) | 235 | #'elisp-eldoc-documentation-function) |
| 236 | (setq-local xref-find-function #'elisp-xref-find) | 236 | (setq-local xref-find-function #'elisp-xref-find) |
| 237 | (setq-local xref-identifier-completion-table-function | 237 | (setq-local xref-identifier-completion-table-function |
| 238 | #'elisp--xref-identifier-completion-table) | 238 | #'elisp--xref-identifier-completion-table) |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index cbdaae6fa71..8541cced3a5 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -601,7 +601,8 @@ Key bindings: | |||
| 601 | (add-hook 'before-save-hook 'octave-sync-function-file-names nil t) | 601 | (add-hook 'before-save-hook 'octave-sync-function-file-names nil t) |
| 602 | (setq-local beginning-of-defun-function 'octave-beginning-of-defun) | 602 | (setq-local beginning-of-defun-function 'octave-beginning-of-defun) |
| 603 | (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment)) | 603 | (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment)) |
| 604 | (setq-local eldoc-documentation-function 'octave-eldoc-function) | 604 | (add-function :before-until (local 'eldoc-documentation-function) |
| 605 | 'octave-eldoc-function) | ||
| 605 | 606 | ||
| 606 | (easy-menu-add octave-mode-menu)) | 607 | (easy-menu-add octave-mode-menu)) |
| 607 | 608 | ||
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1e8623dd901..d298f96bc81 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -4662,8 +4662,8 @@ Arguments START and END narrow the buffer region to work on." | |||
| 4662 | (current-column)))) | 4662 | (current-column)))) |
| 4663 | (^ '(- (1+ (current-indentation)))))) | 4663 | (^ '(- (1+ (current-indentation)))))) |
| 4664 | 4664 | ||
| 4665 | (set (make-local-variable 'eldoc-documentation-function) | 4665 | (add-function :before-until (local 'eldoc-documentation-function) |
| 4666 | #'python-eldoc-function) | 4666 | #'python-eldoc-function) |
| 4667 | 4667 | ||
| 4668 | (add-to-list 'hs-special-modes-alist | 4668 | (add-to-list 'hs-special-modes-alist |
| 4669 | `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" | 4669 | `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" |
diff --git a/lisp/simple.el b/lisp/simple.el index 25293edf88f..967fbc69cbc 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1407,8 +1407,8 @@ display the result of expression evaluation." | |||
| 1407 | (minibuffer-with-setup-hook | 1407 | (minibuffer-with-setup-hook |
| 1408 | (lambda () | 1408 | (lambda () |
| 1409 | ;; FIXME: call emacs-lisp-mode? | 1409 | ;; FIXME: call emacs-lisp-mode? |
| 1410 | (setq-local eldoc-documentation-function | 1410 | (add-function :before-until (local 'eldoc-documentation-function) |
| 1411 | #'elisp-eldoc-documentation-function) | 1411 | #'elisp-eldoc-documentation-function) |
| 1412 | (add-hook 'completion-at-point-functions | 1412 | (add-hook 'completion-at-point-functions |
| 1413 | #'elisp-completion-at-point nil t) | 1413 | #'elisp-completion-at-point nil t) |
| 1414 | (run-hooks 'eval-expression-minibuffer-setup-hook)) | 1414 | (run-hooks 'eval-expression-minibuffer-setup-hook)) |