commit 85b3eca57a5ae5335c11b157bb481cf8f7a35684 (HEAD, refs/remotes/origin/master) Author: Dmitry Gutov Date: Mon Jul 18 02:22:24 2016 +0300 ; Revert "Replace eldoc-documentation-function with a hook" This reverts commit 5811404f0b86c9fa92c3e0b22505a9bb05f04145. It doesn't have the consensus, as evidenced by http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00138.html diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 3dbfed0..368d882 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -417,7 +417,7 @@ variable @code{imenu-generic-expression}, for the two variables @item The mode can specify a local value for -@code{eldoc-documentation-functions} to tell ElDoc mode how to handle +@code{eldoc-documentation-function} to tell ElDoc mode how to handle this mode. @item diff --git a/etc/NEWS b/etc/NEWS index c58349c..403a6b7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -265,11 +265,6 @@ viewing HTML files and the like. breakpoint (e.g. with "f" and "o") by customizing the new option 'edebug-sit-on-break'. -** ElDoc - -+++ -*** 'eldoc-documentation-functions' replaces 'eldoc-documentation-function'. - ** eww +++ diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 5cc16a8..6c2f869 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -43,7 +43,7 @@ ;; Major modes for other languages may use ElDoc by defining an ;; appropriate function as the buffer-local value of -;; `eldoc-documentation-functions'. +;; `eldoc-documentation-function'. ;;; Code: @@ -80,7 +80,7 @@ Actually, any name of a function which takes a string as an argument and returns another string is acceptable. Note that this variable has no effect, unless -`eldoc-documentation-functions' handle it explicitly." +`eldoc-documentation-function' handles it explicitly." :type '(radio (function-item upcase) (function-item downcase) function) @@ -103,7 +103,7 @@ display in the echo area. Function or variable symbol name may be truncated to make more of the arglist or documentation string visible. Note that this variable has no effect, unless -`eldoc-documentation-functions' handle it explicitly." +`eldoc-documentation-function' handles it explicitly." :type '(radio (const :tag "Always" t) (const :tag "Never" nil) (const :tag "Yes, but truncate symbol names if it will\ @@ -113,8 +113,8 @@ Note that this variable has no effect, unless (defface eldoc-highlight-function-argument '((t (:inherit bold))) "Face used for the argument at point in a function's argument list. -Note that this face has no effect unless the `eldoc-documentation-functions' -handle it explicitly." +Note that this face has no effect unless the `eldoc-documentation-function' +handles it explicitly." :group 'eldoc) ;;; No user options below here. @@ -186,7 +186,7 @@ expression point is on." :group 'eldoc :lighter eldoc-minor-mode-string (setq eldoc-last-message nil) (cond - ((not (eldoc-supported-p)) + ((memq eldoc-documentation-function '(nil ignore)) (message "There is no ElDoc support in this buffer") (setq eldoc-mode nil)) (eldoc-mode @@ -211,7 +211,7 @@ the mode if ARG is omitted or nil, and toggle it if ARG is ‘toggle’. If Global Eldoc mode is on, `eldoc-mode' will be enabled in all buffers where it's applicable. These are buffers that have modes -that have enabled eldoc support. See `eldoc-documentation-functions'." +that have enabled eldoc support. See `eldoc-documentation-function'." :group 'eldoc :global t :initialize 'custom-initialize-delay @@ -236,7 +236,9 @@ that have enabled eldoc support. See `eldoc-documentation-functions'." eldoc-idle-delay nil (lambda () (when (or eldoc-mode - (and global-eldoc-mode (eldoc-supported-p))) + (and global-eldoc-mode + (not (memq eldoc-documentation-function + '(nil ignore))))) (eldoc-print-current-symbol-info)))))) ;; If user has changed the idle delay, update the timer. @@ -332,11 +334,10 @@ Otherwise work like `message'." ;;;###autoload -(defvar eldoc-documentation-functions #'ignore - "Hook to run to return doc string. -A function in this hook should accept no args and return a -one-line string for displaying documentation of a function, -variable, etc. appropriate to the context around point. +(defvar eldoc-documentation-function #'ignore + "Function to call to return doc string. +The function of no args should return a one-line string for displaying +doc about a function etc. appropriate to the context around point. It should return nil if there's no doc appropriate for the context. Typically doc is returned if point is on a function-like name or in its arg list. @@ -346,15 +347,13 @@ 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 effect. -Major modes should modify this variable using `add-hook', for example: - (add-hook \\='eldoc-documentation-functions #\\='foo-eldoc nil t) +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.") -(define-obsolete-variable-alias 'eldoc-documentation-function - 'eldoc-documentation-functions "25.2") - (defun eldoc-print-current-symbol-info () ;; This is run from post-command-hook or some idle timer thing, ;; so we need to be careful that errors aren't ignored. @@ -364,20 +363,7 @@ return any documentation.") (when eldoc-last-message (eldoc-message nil) nil)) - (eldoc-message - (run-hook-with-args-until-success 'eldoc-documentation-functions))))) - -(defun eldoc-supported-p () - "Return t if `eldoc-documentation-functions' has non-null elements." - (if (listp eldoc-documentation-functions) - (catch :eldoc-supported - (mapc - (lambda (fun) - (when (not (memq fun '(nil ignore))) - (throw :eldoc-supported t))) - eldoc-documentation-functions) - nil) - (not (memq eldoc-documentation-functions '(nil ignore))))) + (eldoc-message (funcall eldoc-documentation-function))))) ;; If the entire line cannot fit in the echo area, the symbol name may be ;; truncated or eliminated entirely from the output to make room for the commit 6dc0bafd5915b01a341cc0efbc744abd73163872 Author: Dmitry Gutov Date: Mon Jul 18 02:17:06 2016 +0300 ; Revert "Use eldoc-documentation-functions" This reverts commit 001d88b62ecb8163a148656acb103b354ce7613a. It doesn't have the consensus, as evidenced by http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00138.html diff --git a/lisp/hexl.el b/lisp/hexl.el index 61d7dd0..5f099a5 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. (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) ;; Set a callback function for eldoc. - (add-hook 'eldoc-documentation-functions - #'hexl-print-current-point-info nil t) + (add-function :before-until (local 'eldoc-documentation-function) + #'hexl-print-current-point-info) (eldoc-add-command-completions "hexl-") (eldoc-remove-command "hexl-save-buffer" "hexl-current-address") diff --git a/lisp/ielm.el b/lisp/ielm.el index 278a637..dd02778 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -541,8 +541,8 @@ Customized bindings may be defined in `ielm-map', which currently contains: (set (make-local-variable 'completion-at-point-functions) '(comint-replace-by-expanded-history ielm-complete-filename elisp-completion-at-point)) - (add-hook 'eldoc-documentation-functions - #'elisp-eldoc-documentation-function nil t) + (add-function :before-until (local 'eldoc-documentation-function) + #'elisp-eldoc-documentation-function) (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) (setq comint-get-old-input 'ielm-get-old-input) diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index ace012f..0830214 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el @@ -1390,15 +1390,12 @@ to the action header." (when buffer-file-name (shell-quote-argument buffer-file-name))))) - (if (boundp 'eldoc-documentation-functions) - (add-hook 'eldoc-documentation-functions - #'cfengine3-documentation-function nil t) - ;; For emacs < 25.1 where `eldoc-documentation-function' defaults to - ;; nil. - (or eldoc-documentation-function - (setq-local eldoc-documentation-function #'ignore)) - (add-function :before-until (local 'eldoc-documentation-function) - #'cfengine3-documentation-function)) + ;; For emacs < 25.1 where `eldoc-documentation-function' defaults to + ;; nil. + (or eldoc-documentation-function + (setq-local eldoc-documentation-function #'ignore)) + (add-function :before-until (local 'eldoc-documentation-function) + #'cfengine3-documentation-function) (add-hook 'completion-at-point-functions #'cfengine3-completion-function nil t) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 5f9bdac..f360791 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -235,8 +235,8 @@ Blank lines separate paragraphs. Semicolons start comments. (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs)) (setq-local electric-quote-string t) (setq imenu-case-fold-search nil) - (add-hook 'eldoc-documentation-functions - #'elisp-eldoc-documentation-function nil t) + (add-function :before-until (local 'eldoc-documentation-function) + #'elisp-eldoc-documentation-function) (add-hook 'xref-backend-functions #'elisp--xref-backend nil t) (setq-local project-vc-external-roots-function #'elisp-load-path-roots) (add-hook 'completion-at-point-functions diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index b9a86e7..4f223f2 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -596,7 +596,8 @@ Key bindings: (add-hook 'before-save-hook 'octave-sync-function-file-names nil t) (setq-local beginning-of-defun-function 'octave-beginning-of-defun) (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment)) - (add-hook 'eldoc-documentation-functions 'octave-eldoc-function nil t) + (add-function :before-until (local 'eldoc-documentation-function) + 'octave-eldoc-function) (easy-menu-add octave-mode-menu)) @@ -732,7 +733,7 @@ Key bindings: (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) (setq-local info-lookup-mode 'octave-mode) - (add-hook 'eldoc-documentation-functions 'octave-eldoc-function nil t) + (setq-local eldoc-documentation-function 'octave-eldoc-function) (setq-local comint-input-ring-file-name (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ba3cdfe..ad69f87 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5153,14 +5153,12 @@ returned as is." (current-column)))) (^ '(- (1+ (current-indentation)))))) - (if (boundp 'eldoc-documentation-functions) - (add-hook 'eldoc-documentation-functions #'python-eldoc-function nil t) - (if (null eldoc-documentation-function) - ;; Emacs<25 - (set (make-local-variable 'eldoc-documentation-function) - #'python-eldoc-function) - (add-function :before-until (local 'eldoc-documentation-function) - #'python-eldoc-function))) + (if (null eldoc-documentation-function) + ;; Emacs<25 + (set (make-local-variable 'eldoc-documentation-function) + #'python-eldoc-function) + (add-function :before-until (local 'eldoc-documentation-function) + #'python-eldoc-function)) (add-to-list 'hs-special-modes-alist diff --git a/lisp/simple.el b/lisp/simple.el index 06d1b92..a757876 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1443,8 +1443,8 @@ result of expression evaluation." (minibuffer-with-setup-hook (lambda () ;; FIXME: call emacs-lisp-mode? - (add-hook 'eldoc-documentation-functions - #'elisp-eldoc-documentation-function nil t) + (add-function :before-until (local 'eldoc-documentation-function) + #'elisp-eldoc-documentation-function) (add-hook 'completion-at-point-functions #'elisp-completion-at-point nil t) (run-hooks 'eval-expression-minibuffer-setup-hook)) commit 02ca5db040b57ca4a36c317fcb3fb56f43ab371e Author: Alan Third Date: Wed Jun 29 20:17:18 2016 +0100 Remove separate pool for popup dialogs (bug#23856) * src/nsmenu.m (pop_down_menu, ns_popup_dialog): Remove references to autorelease pool and Popdown_data struct. diff --git a/src/nsmenu.m b/src/nsmenu.m index 10dfe8a..83ded6d 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1420,29 +1420,19 @@ - (NSRect) frame ========================================================================== */ -struct Popdown_data -{ - NSAutoreleasePool *pool; - EmacsDialogPanel *dialog; -}; - static void pop_down_menu (void *arg) { - struct Popdown_data *unwind_data = arg; + EmacsDialogPanel *panel = arg; - block_input (); if (popup_activated_flag) { - EmacsDialogPanel *panel = unwind_data->dialog; + block_input (); popup_activated_flag = 0; [panel close]; - [unwind_data->pool release]; [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; + unblock_input (); } - - xfree (unwind_data); - unblock_input (); } @@ -1453,7 +1443,6 @@ - (NSRect) frame Lisp_Object tem, title; NSPoint p; BOOL isQ; - NSAutoreleasePool *pool; NSTRACE ("ns_popup_dialog"); @@ -1473,18 +1462,13 @@ - (NSRect) frame contents = list2 (title, Fcons (build_string ("Ok"), Qt)); block_input (); - pool = [[NSAutoreleasePool alloc] init]; dialog = [[EmacsDialogPanel alloc] initFromContents: contents isQuestion: isQ]; { ptrdiff_t specpdl_count = SPECPDL_INDEX (); - struct Popdown_data *unwind_data = xmalloc (sizeof (*unwind_data)); - - unwind_data->pool = pool; - unwind_data->dialog = dialog; - record_unwind_protect_ptr (pop_down_menu, unwind_data); + record_unwind_protect_ptr (pop_down_menu, dialog); popup_activated_flag = 1; tem = [dialog runDialogAt: p]; unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ commit 001d88b62ecb8163a148656acb103b354ce7613a Author: Mark Oteiza Date: Sun Jul 17 12:49:57 2016 -0400 Use eldoc-documentation-functions * lisp/hexl.el (hexl-mode): * lisp/ielm.el (inferior-emacs-lisp-mode): * lisp/progmodes/cfengine.el (cfengine3-mode): * lisp/progmodes/elisp-mode.el (emacs-lisp-mode): * lisp/progmodes/octave.el (octave-mode, inferior-octave-mode): * lisp/progmodes/python.el (python-mode): * lisp/simple.el (read--expression): Add buffer-locally to hook eldoc-documentation-functions. diff --git a/lisp/hexl.el b/lisp/hexl.el index 5f099a5..61d7dd0 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. (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t) ;; Set a callback function for eldoc. - (add-function :before-until (local 'eldoc-documentation-function) - #'hexl-print-current-point-info) + (add-hook 'eldoc-documentation-functions + #'hexl-print-current-point-info nil t) (eldoc-add-command-completions "hexl-") (eldoc-remove-command "hexl-save-buffer" "hexl-current-address") diff --git a/lisp/ielm.el b/lisp/ielm.el index dd02778..278a637 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -541,8 +541,8 @@ Customized bindings may be defined in `ielm-map', which currently contains: (set (make-local-variable 'completion-at-point-functions) '(comint-replace-by-expanded-history ielm-complete-filename elisp-completion-at-point)) - (add-function :before-until (local 'eldoc-documentation-function) - #'elisp-eldoc-documentation-function) + (add-hook 'eldoc-documentation-functions + #'elisp-eldoc-documentation-function nil t) (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) (set (make-local-variable 'comint-prompt-read-only) ielm-prompt-read-only) (setq comint-get-old-input 'ielm-get-old-input) diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el index 0830214..ace012f 100644 --- a/lisp/progmodes/cfengine.el +++ b/lisp/progmodes/cfengine.el @@ -1390,12 +1390,15 @@ to the action header." (when buffer-file-name (shell-quote-argument buffer-file-name))))) - ;; For emacs < 25.1 where `eldoc-documentation-function' defaults to - ;; nil. - (or eldoc-documentation-function - (setq-local eldoc-documentation-function #'ignore)) - (add-function :before-until (local 'eldoc-documentation-function) - #'cfengine3-documentation-function) + (if (boundp 'eldoc-documentation-functions) + (add-hook 'eldoc-documentation-functions + #'cfengine3-documentation-function nil t) + ;; For emacs < 25.1 where `eldoc-documentation-function' defaults to + ;; nil. + (or eldoc-documentation-function + (setq-local eldoc-documentation-function #'ignore)) + (add-function :before-until (local 'eldoc-documentation-function) + #'cfengine3-documentation-function)) (add-hook 'completion-at-point-functions #'cfengine3-completion-function nil t) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index f360791..5f9bdac 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -235,8 +235,8 @@ Blank lines separate paragraphs. Semicolons start comments. (append '((?\` . ?\') (?‘ . ?’)) electric-pair-text-pairs)) (setq-local electric-quote-string t) (setq imenu-case-fold-search nil) - (add-function :before-until (local 'eldoc-documentation-function) - #'elisp-eldoc-documentation-function) + (add-hook 'eldoc-documentation-functions + #'elisp-eldoc-documentation-function nil t) (add-hook 'xref-backend-functions #'elisp--xref-backend nil t) (setq-local project-vc-external-roots-function #'elisp-load-path-roots) (add-hook 'completion-at-point-functions diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 4f223f2..b9a86e7 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -596,8 +596,7 @@ Key bindings: (add-hook 'before-save-hook 'octave-sync-function-file-names nil t) (setq-local beginning-of-defun-function 'octave-beginning-of-defun) (and octave-font-lock-texinfo-comment (octave-font-lock-texinfo-comment)) - (add-function :before-until (local 'eldoc-documentation-function) - 'octave-eldoc-function) + (add-hook 'eldoc-documentation-functions 'octave-eldoc-function nil t) (easy-menu-add octave-mode-menu)) @@ -733,7 +732,7 @@ Key bindings: (setq font-lock-defaults '(inferior-octave-font-lock-keywords nil nil)) (setq-local info-lookup-mode 'octave-mode) - (setq-local eldoc-documentation-function 'octave-eldoc-function) + (add-hook 'eldoc-documentation-functions 'octave-eldoc-function nil t) (setq-local comint-input-ring-file-name (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ad69f87..ba3cdfe 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5153,12 +5153,14 @@ returned as is." (current-column)))) (^ '(- (1+ (current-indentation)))))) - (if (null eldoc-documentation-function) - ;; Emacs<25 - (set (make-local-variable 'eldoc-documentation-function) - #'python-eldoc-function) - (add-function :before-until (local 'eldoc-documentation-function) - #'python-eldoc-function)) + (if (boundp 'eldoc-documentation-functions) + (add-hook 'eldoc-documentation-functions #'python-eldoc-function nil t) + (if (null eldoc-documentation-function) + ;; Emacs<25 + (set (make-local-variable 'eldoc-documentation-function) + #'python-eldoc-function) + (add-function :before-until (local 'eldoc-documentation-function) + #'python-eldoc-function))) (add-to-list 'hs-special-modes-alist diff --git a/lisp/simple.el b/lisp/simple.el index a757876..06d1b92 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1443,8 +1443,8 @@ result of expression evaluation." (minibuffer-with-setup-hook (lambda () ;; FIXME: call emacs-lisp-mode? - (add-function :before-until (local 'eldoc-documentation-function) - #'elisp-eldoc-documentation-function) + (add-hook 'eldoc-documentation-functions + #'elisp-eldoc-documentation-function nil t) (add-hook 'completion-at-point-functions #'elisp-completion-at-point nil t) (run-hooks 'eval-expression-minibuffer-setup-hook))