[Top][All Lists]

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

bug#28257: 26.0.50; [PATCH] expose eldoc functions in a hook

From: Stefan Monnier
Subject: bug#28257: 26.0.50; [PATCH] expose eldoc functions in a hook
Date: Fri, 14 Feb 2020 09:50:47 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> +*** 'eldoc-documentation-function' is now a custom variable.

I think this should be expanded to clarify that packages should stop
using this var and use `eldoc-documentation-functions` instead.

>  (defun eldoc--supported-p ()
>    "Non-nil if an ElDoc function is set for this buffer."
> -  (not (memq eldoc-documentation-function '(nil ignore))))
> +  (let ((hook 'eldoc-documentation-functions))
> +    (and eldoc-documentation-function
> +         (or (and (local-variable-p hook)
> +                  (buffer-local-value hook (current-buffer)))
> +             (default-value hook)))))


    (and eldoc-documentation-function

should really be

    (and (not (memq eldoc-documentation-function '(nil ignore))))

>  ;;;###autoload
> -(defvar eldoc-documentation-function #'ignore
> +(defvar eldoc-documentation-functions nil

There's no reason to autoload this new var.
[ Of course, it makes no practical difference since eldoc is preloaded
  anyway, but if it weren't preloaded this var should be autoloaded.  ]

> +(defun eldoc-documentation-default ()
> +  "Show doc string for item at point.
> +Default value for `eldoc-documentation-function'."

This doc should clarify that it shows the *first* doc.

> +;;;###autoload
> +(defcustom eldoc-documentation-function #'eldoc-documentation-default

Now that it's a defcustom this shouldn't be autoloaded either (currently
packages are expected to use `add-function` on it even if there's no
indication that the user will actually use eldoc, which is why it is/was
autoloaded.  But with its new meaning this need disappears).

> +  (if (> emacs-major-version 25)
> +      (add-hook 'eldoc-documentation-functions
> +                #'cfengine3-documentation-function nil t)

The test should be fixed (I guess you could use (boundp

> +    (if (< emacs-major-version 26)
> +        (add-function :before-until (local 'eldoc-documentation-function)
> +                      #'python-eldoc-function)
> +      (add-hook 'eldoc-documentation-functions #'python-eldoc-function nil 
> t)))

Same here.


reply via email to

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