From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: eldoc-docstring-format-sym-doc Date: Sun, 26 Jul 2020 11:16:31 +0100 Message-ID: <87imeatwcg.fsf@gmail.com> References: <86lfj9rl57.fsf@m12000.fhaun.de> <87sgdgsngn.fsf@gnu.org> <835zacdsqj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33590"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel , fh@fhaun.de, Tassilo Horn To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 26 12:17:30 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jzdik-0008dT-Es for ged-emacs-devel@m.gmane-mx.org; Sun, 26 Jul 2020 12:17:30 +0200 Original-Received: from localhost ([::1]:41532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzdij-0007LN-GD for ged-emacs-devel@m.gmane-mx.org; Sun, 26 Jul 2020 06:17:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzdhy-0006oX-KJ for emacs-devel@gnu.org; Sun, 26 Jul 2020 06:16:42 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:34399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jzdhu-00084M-2L; Sun, 26 Jul 2020 06:16:40 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id f7so12068380wrw.1; Sun, 26 Jul 2020 03:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=yvAWNX4CP5eqHW9bo9K56cqxEyNouV46KyW+t3jHRRU=; b=UnlYUSQ5us44RkdKGaKtd8lGeIM3hz7cJ+nIFbsZ0w0d9k+ENs/hCb50IX6EXg8yAA FVx+oBn9v43NJ79U2jJNxLnmWvis9zWQ1ukmQauXS15qFEBF29cPitdGIuBLKLuJ6h/r jxXgULWtqQbjdojpNf0y7rJs3cp02nOp4hzQOigGr6xuzz9W1npYnpk7mOFIOK9XCnYV WZLuO81MSKgDlxEGp3m89XG06Xl6UG8ciCqU6NfNvV81DPEphDkufOLcyK6t794badjx MYUk/XgVVLxtiVRozAV1m3rfopIP645K9bLJJG9viDs5ng+QmzC89jZoIKrK+hxfQv5O Iylg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=yvAWNX4CP5eqHW9bo9K56cqxEyNouV46KyW+t3jHRRU=; b=C4Poz+CfaWbqF7zX5yCMsgvkP/AZ7MakUy9ok0O376l2mGTT9kir5tOcfH98tNw1hp 4aH75H8V/SknNRNGPgAVVfR8+Zm0jQlIrclXscMO6xWNjPt3XTiuh2OZetzHHgReFUf1 c3UupEvX+YcMp4/YEeirYENv1IbibXwki+Y1/thTOnnvbbNa679YIaF+AM8HjwXPvaPc 9IvXS5IYRO1Zq78h7ovKtCqfRubDSrmVo2sMAWWc9bNyPtvGx0tccPT/tq2FbDbMungP Qt2I538Ul+x9qBYSsBpN2/r85LE72ehSS3nfbqNj053pSsw58tsnf3KCB96EX41fQAYm Zcww== X-Gm-Message-State: AOAM530LYeGcGB8OrWCnawxTs7x2sNL5BzggZ41u8DdFPIpiUxsZLVZa cr2ugfYG2e9I7yMhgIN3nhavLmwZ X-Google-Smtp-Source: ABdhPJwHbHXxgvP+ubXHaV2L/nbXskKF9fav1Zr0UL8zS0ljYCZYWiBK1QxWIpIC1Admbe00lTDbdg== X-Received: by 2002:adf:bc4b:: with SMTP id a11mr15117719wrh.381.1595758593710; Sun, 26 Jul 2020 03:16:33 -0700 (PDT) Original-Received: from krug (bl20-196-228.dsl.telepac.pt. [2.81.196.228]) by smtp.gmail.com with ESMTPSA id t11sm7903117wrs.66.2020.07.26.03.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jul 2020 03:16:32 -0700 (PDT) In-Reply-To: (=?utf-8?Q?=22Jo=C3=A3o_T=C3=A1vora=22's?= message of "Sat, 25 Jul 2020 10:26:31 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=joaotavora@gmail.com; helo=mail-wr1-x429.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:253247 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jo=C3=A3o T=C3=A1vora writes: > On Sat, Jul 25, 2020 at 7:16 AM Eli Zaretskii wrote: > > > From: Tassilo Horn > > Date: Fri, 24 Jul 2020 21:49:12 +0200 > > Cc: emacs-devel@gnu.org > >=20 > > > when was the function "eldoc-docstring-format-sym-doc" removed? I ca= nt > > > find nothing in the logs. > >=20 > > In this commit: > >=20 > > commit 1203626f472b0d99d2746f5999711137c0c1fd0c > > Author: Jo=C3=A3o T=C3=A1vora > > Date: Sat Jun 6 14:04:48 2020 +0100 > >=20 > > > Elpy is using it. > >=20 > > It seems like it was removed including allmost all calls except for in > > semantic/grammar.el: > >=20 > > * lisp/cedet/semantic/grammar.el (semantic--docstring-format-sym-d= oc): > > New function. > > (semantic-grammar-eldoc-get-macro-docstring): Adjust. > >=20 > > Basically semantic--docstring-format-sym-doc is the old > > eldoc-docstring-format-sym-doc. But I guess the plan is to remove that > > eventually, too. Eldoc got a overhaul recently... > > Jo=C3=A3o, based on this report, do we need some backward-compatibility > shim to help 3rd party packages which use this removed function? > > From memory, maybe just bringing back the function as-is should > do the trick, since eldoc-docstring-format-sym-doc is just a=20 > string formatting function, I seem to recall. > > I hope this can wait for monday, as I don't have much time > for emacs devel this weekend. > > Ideally though, elpy would rely on the new API, if possible. > Is Elpy using the new eldoc.el because it's being started > with Emacs 28 or because it's fetching the package from=20 > GNU ELPA? Here's a patch that should fix this, by bringing back the function to eldoc and marking it obsolete. I'd of course much prefer if Elpy starts using the new features of eldoc-documentation-functions instead, if indeed it must be made to work with Emacs 28. The bits of that variable's docstring concerning the `:THING` and `:FACE` keyword arguments should, in principle, be enough to do the same as the defunct eldoc-docstring-format-sym-doc. If they're not, then it's something to be iterated in eldoc.el. Jo=C3=A3o --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Bring-back-eldoc-docstring-format-sym-doc-but-obsole.patch >From a8ac95944ca84ae094b5ae33d00b9966da969cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 26 Jul 2020 11:10:11 +0100 Subject: [PATCH] Bring back eldoc-docstring-format-sym-doc but obsolete it * lisp/cedet/semantic/grammar.el (semantic--docstring-format-sym-doc): Call eldoc-docstring-format-sym-doc. * lisp/emacs-lisp/eldoc.el (eldoc-docstring-format-sym-doc): Bring back from dead. --- lisp/cedet/semantic/grammar.el | 36 ++----------------------------- lisp/emacs-lisp/eldoc.el | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 1ed18339a7..4acaa2fb22 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1664,40 +1664,8 @@ semantic-grammar-syntax-help (defvar semantic-grammar-eldoc-last-data (cons nil nil)) (defun semantic--docstring-format-sym-doc (prefix doc &optional face) - "Combine PREFIX and DOC, and shorten the result to fit in the echo area. - -When PREFIX is a symbol, propertize its symbol name with FACE -before combining it with DOC. If FACE is not provided, just -apply the nil face. - -See also: `eldoc-echo-area-use-multiline-p'." - ;; Hoisted from old `eldoc-docstring-format-sym-doc'. - ;; 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 - ;; description. - (when (symbolp prefix) - (setq prefix (concat (propertize (symbol-name prefix) 'face face) ": "))) - (let* ((ea-multi eldoc-echo-area-use-multiline-p) - ;; Subtract 1 from window width since emacs will not write - ;; any chars to the last column, or in later versions, will - ;; cause a wraparound and resize of the echo area. - (ea-width (1- (window-width (minibuffer-window)))) - (strip (- (+ (length prefix) - (length doc)) - ea-width))) - (cond ((or (<= strip 0) - (eq ea-multi t) - (and ea-multi (> (length doc) ea-width))) - (concat prefix doc)) - ((> (length doc) ea-width) - (substring (format "%s" doc) 0 ea-width)) - ((>= strip (string-match-p ":? *\\'" prefix)) - doc) - (t - ;; Show the end of the partial symbol name, rather - ;; than the beginning, since the former is more likely - ;; to be unique given package namespace conventions. - (concat (substring prefix strip) doc))))) + "Call obsolete `eldoc-docstring-format-sym-doc', which see." + (eldoc-docstring-format-sym-doc prefix doc face)) (defun semantic-grammar-eldoc-get-macro-docstring (macro expander) "Return a one-line docstring for the given grammar MACRO. diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index fcb104e547..d2d68b30fe 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -809,6 +809,45 @@ eldoc-remove-command-completions (apply #'eldoc-remove-command (all-completions name eldoc-message-commands)))) +(make-obsolete 'eldoc-docstring-format-sym-doc + "Use features of `eldoc-documentation-functions' instead" + "eldoc-1.1.0") + +(defun eldoc-docstring-format-sym-doc (prefix doc &optional face) + "Combine PREFIX and DOC, and shorten the result to fit in the echo area. + +When PREFIX is a symbol, propertize its symbol name with FACE +before combining it with DOC. If FACE is not provided, just +apply the nil face. + +See also: `eldoc-echo-area-use-multiline-p'." + ;; 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 + ;; description. + (when (symbolp prefix) + (setq prefix (concat (propertize (symbol-name prefix) 'face face) ": "))) + (let* ((ea-multi eldoc-echo-area-use-multiline-p) + ;; Subtract 1 from window width since emacs will not write + ;; any chars to the last column, or in later versions, will + ;; cause a wraparound and resize of the echo area. + (ea-width (1- (window-width (minibuffer-window)))) + (strip (- (+ (length prefix) + (length doc)) + ea-width))) + (cond ((or (<= strip 0) + (eq ea-multi t) + (and ea-multi (> (length doc) ea-width))) + (concat prefix doc)) + ((> (length doc) ea-width) + (substring (format "%s" doc) 0 ea-width)) + ((>= strip (string-match-p ":? *\\'" prefix)) + doc) + (t + ;; Show the end of the partial symbol name, rather + ;; than the beginning, since the former is more likely + ;; to be unique given package namespace conventions. + (concat (substring prefix strip) doc))))) + ;; Prime the command list. (eldoc-add-command-completions -- 2.25.1 --=-=-=--