all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Noam Postavsky <npostavs@users.sourceforge.net>
Cc: emacs-devel@gnu.org, Leo Liu <sdl.web@gmail.com>,
	Kaushal Modi <kaushal.modi@gmail.com>
Subject: Re: [PATCH v3] RFC: eldoc-documentation-functions hook
Date: Sun, 17 Jul 2016 13:48:57 -0400	[thread overview]
Message-ID: <20160717174857.GA6060@holos.localdomain> (raw)
In-Reply-To: <CAM-tV-_S0jS=_5i1WbrvMQKvz-FndRmcsO_kGyS0tK8i7kK8rQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

On 17/07/16 at 11:17am, Noam Postavsky wrote:
> On Thu, Jul 7, 2016 at 6:02 AM, Kaushal Modi <kaushal.modi@gmail.com> wrote:
> > I'm neither for or against this change. But if this change is done in
> > eldoc.el, then shouldn't the add-function to add-hook change be done in all
> > the major modes too? Like in elisp-mode.el, etc.
> >
> 
> Ping! I just bumped into this elisp-mode.el case while playing with
> the bootstrap. Please revert this, or fix callers, thanks.

Pushed as 001d88b:



[-- Attachment #2: 0001-Use-eldoc-documentation-functions.patch --]
[-- Type: text/x-diff, Size: 7017 bytes --]

From 001d88b62ecb8163a148656acb103b354ce7613a Mon Sep 17 00:00:00 2001
From: Mark Oteiza <mvoteiza@udel.edu>
Date: Sun, 17 Jul 2016 12:49:57 -0400
Subject: [PATCH] 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.
---
 lisp/hexl.el                 |  4 ++--
 lisp/ielm.el                 |  4 ++--
 lisp/progmodes/cfengine.el   | 15 +++++++++------
 lisp/progmodes/elisp-mode.el |  4 ++--
 lisp/progmodes/octave.el     |  5 ++---
 lisp/progmodes/python.el     | 14 ++++++++------
 lisp/simple.el               |  4 ++--
 7 files changed, 27 insertions(+), 23 deletions(-)

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 @@ 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 @@ inferior-emacs-lisp-mode
   (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 @@ cfengine3-mode
                  (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 @@ emacs-lisp-mode
               (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 @@ octave-mode
   (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 @@ inferior-octave-mode
   (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 @@ python-mode
                                                  (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 @@ read--expression
     (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))
-- 
2.9.0


  reply	other threads:[~2016-07-17 17:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12  6:12 [PATCH] RFC: eldoc-documentation-functions hook Mark Oteiza
2016-06-12  7:09 ` Eli Zaretskii
2016-06-12  7:46   ` Leo Liu
2016-06-12  8:33     ` Eli Zaretskii
2016-06-12 18:24   ` Mark Oteiza
2016-06-13 21:17     ` Mark Oteiza
2016-06-17 21:08       ` [PATCH v3] " Mark Oteiza
2016-07-07  3:30         ` Mark Oteiza
2016-07-07  4:12           ` Leo Liu
2016-07-07 10:02             ` Kaushal Modi
2016-07-17 15:17               ` Noam Postavsky
2016-07-17 17:48                 ` Mark Oteiza [this message]
2016-07-17 23:47                   ` Dmitry Gutov
2016-07-18  0:09                     ` Leo Liu
2016-07-17 18:28             ` Stefan Monnier
2016-07-17 18:52               ` Stefan Monnier
2016-07-18 21:27                 ` Mark Oteiza
2016-07-19  2:47                   ` Stefan Monnier
2016-07-19 23:20                     ` Mark Oteiza
2016-07-20  1:50                       ` Clément Pit--Claudel
2016-07-20  4:50                       ` John Wiegley
2016-07-20 23:03                         ` Mark Oteiza
2016-07-07 14:55           ` Clément Pit--Claudel
2016-06-12 13:23 ` [PATCH] " Noam Postavsky
2016-06-12 18:52   ` Mark Oteiza
2016-06-12 18:57     ` Dmitry Gutov
2016-06-12 19:44       ` Mark Oteiza
2016-06-12 19:50         ` Dmitry Gutov
2016-06-13 20:36         ` Richard Stallman
2016-06-19  2:45           ` Dmitry Gutov
2016-06-20 23:00             ` Richard Stallman
2016-06-13  4:37     ` Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160717174857.GA6060@holos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=emacs-devel@gnu.org \
    --cc=kaushal.modi@gmail.com \
    --cc=npostavs@users.sourceforge.net \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.