From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: Re: [PATCH v3] RFC: eldoc-documentation-functions hook Date: Sun, 17 Jul 2016 13:48:57 -0400 Message-ID: <20160717174857.GA6060@holos.localdomain> References: <20160612061229.GA6463@holos.localdomain> <838tyahoim.fsf@gnu.org> <20160612182453.GA12034@holos.localdomain> <20160613211735.GA5969@holos.localdomain> <20160617210849.GA3775@holos.localdomain> <20160707033019.GA22360@holos.localdomain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1468777789 3580 80.91.229.3 (17 Jul 2016 17:49:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Jul 2016 17:49:49 +0000 (UTC) Cc: emacs-devel@gnu.org, Leo Liu , Kaushal Modi To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 17 19:49:42 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bOqCD-0003g7-MF for ged-emacs-devel@m.gmane.org; Sun, 17 Jul 2016 19:49:41 +0200 Original-Received: from localhost ([::1]:42573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOqCC-0007yN-Ti for ged-emacs-devel@m.gmane.org; Sun, 17 Jul 2016 13:49:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOqBd-0007yI-Ex for emacs-devel@gnu.org; Sun, 17 Jul 2016 13:49:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bOqBZ-0007DX-A2 for emacs-devel@gnu.org; Sun, 17 Jul 2016 13:49:04 -0400 Original-Received: from mail-yw0-x233.google.com ([2607:f8b0:4002:c05::233]:33973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bOqBZ-0007DI-3B for emacs-devel@gnu.org; Sun, 17 Jul 2016 13:49:01 -0400 Original-Received: by mail-yw0-x233.google.com with SMTP id i12so142011213ywa.1 for ; Sun, 17 Jul 2016 10:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=E5btIV4c27VQk5+WtvClAjTc1elQ49NjFxU/p1iBQ4o=; b=APiGG2UAQh/ULENjWFTRuS3AYpM6mEDaIItj/UDGmE+x5xNAMrg1B9pELBSaAIu8NT Vmeet/evbtBr48+EUdgDQ+cupvzkHo5oXhrxSboeosBydCd3kaHql668m8PIJxzms+Zz HzzgTK5xDiPlSl/ZOfS8Vr4nH5RkybpMbHz7l48Z0HcR5ZFQyNVcE8XwJBD79sGqR2u8 Zcp++pnAJcx+QqvoY6S3Tu64qX4nRkc6XBVllopLkXcXKMh+Z5PMGu3hbZMhkgx1xnuv XiFGFsw8aWCtamhazTjknmpIcBIFyITBrquS0dmKeH7X1hZ5mEjtoPKVN0FKszCNHEka Q3kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=E5btIV4c27VQk5+WtvClAjTc1elQ49NjFxU/p1iBQ4o=; b=Z1ghmH9y1qZ7q0/vFAJu72fs7NGEMrbnrPvPGJPRyfCmSf441Y0rwFAYYPf8w7jWSv x6OoV+uTZpE5SFkh9xNYbMI07ZOFD+eWRmKGKcz84NtugdYG/7o8O4+yJexEDYJT4/0v NTDV0lnkAwI8nEpSW4MbZkyZJentowTNkIsJX2XZC0RaHmBXyTy6wtpjtWto/qT8eW+P Tu2bhQpanDiEbvuOxouqKOPmWgDg6dgJ1MEPidWurJ617aI9LoR3x8UWbCpqhffelnqO 2Z/BxYxiYpOCbicT/WdNZHT1iT8rj7zpVFXr6/PKtrUjb3SZyOAd+s3NDTMgMnJCr0jb 6KGQ== X-Gm-Message-State: ALyK8tJtu61I06TTSd1sPAMYYaQGOkvKXH67X7iPLt7HpuIrNnay5e2g+Y4bewCskFEIO1sv X-Received: by 10.129.160.149 with SMTP id x143mr22459301ywg.11.1468777739437; Sun, 17 Jul 2016 10:48:59 -0700 (PDT) Original-Received: from holos.localdomain (pool-96-227-84-10.phlapa.fios.verizon.net. [96.227.84.10]) by smtp.gmail.com with ESMTPSA id 139sm8941995ywe.14.2016.07.17.10.48.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jul 2016 10:48:58 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id D39B766C35; Sun, 17 Jul 2016 13:48:57 -0400 (EDT) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.2+13 (488f91a85115) (2016-07-01) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::233 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205784 Archived-At: --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 17/07/16 at 11:17am, Noam Postavsky wrote: > On Thu, Jul 7, 2016 at 6:02 AM, Kaushal Modi 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: --k+w/mQv8wyuph6w0 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Use-eldoc-documentation-functions.patch" Content-Transfer-Encoding: 8bit >From 001d88b62ecb8163a148656acb103b354ce7613a Mon Sep 17 00:00:00 2001 From: Mark Oteiza 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 --k+w/mQv8wyuph6w0--