GNU bug report logs - #77124
[PATCH] Optionally display function docstring in eldoc

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Elijah Gabe Pérez <eg642616@HIDDEN>; Keywords: patch; dated Wed, 19 Mar 2025 18:33:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Mar 2025 18:32:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 19 14:32:46 2025
Received: from localhost ([127.0.0.1]:53069 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tuyDd-0001lD-Fj
	for submit <at> debbugs.gnu.org; Wed, 19 Mar 2025 14:32:45 -0400
Received: from lists.gnu.org ([2001:470:142::17]:53300)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>)
 id 1tuyDY-0001kv-Sb
 for submit <at> debbugs.gnu.org; Wed, 19 Mar 2025 14:32:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1tuyDG-0002Vx-1h
 for bug-gnu-emacs@HIDDEN; Wed, 19 Mar 2025 14:32:24 -0400
Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>)
 id 1tuyDD-0001Ti-Em
 for bug-gnu-emacs@HIDDEN; Wed, 19 Mar 2025 14:32:21 -0400
Received: by mail-ot1-x343.google.com with SMTP id
 46e09a7af769-72bbd3a3928so2920972a34.2
 for <bug-gnu-emacs@HIDDEN>; Wed, 19 Mar 2025 11:32:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1742409137; x=1743013937; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=GlJlD/aOof5emWJ6FhIF6xisIE+mh6llrVCVin+08Cw=;
 b=LhTQoFoNsNQYJ+xLfnbv1zpQEFOWVpK+YNr27Rx/BqGmWmrTrN+VNrLPp1AVy3PS4/
 BNC0F9vyv5+5fugdforFfowffA5W/30l5nhJjW1Janj6IGKoUKd7aHGtiU76L4rZSUoT
 iSgKDn580ygjzoYMfI9dNXkoWVaoYZJyUGiibdvsXdLJMPRc/CQQR00iFUe5UdN0vrk4
 S0NNsKCbhpbEK7iLR7k5wG7BDKB3XOwUrcdyBvh+1yxYe6t+9/GTgHFAG8unLrv/7XcE
 TP8fvdOjZYk/wGIeQttyXwj3BYN6zWXbviEsB0YIFjV+VDMq8McijxUS2/eCZPJ4HF6p
 +iVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1742409137; x=1743013937;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=GlJlD/aOof5emWJ6FhIF6xisIE+mh6llrVCVin+08Cw=;
 b=wSyQWlZsUo9sZI+yMXo2IlQVAQg03HQF3LEY+BdXcFxPFN0fRcSrLTcDu1Naxi3taq
 aGy5OOTA7MPkn2a/RfUd1cciTVhisittmTDCraj/ZIUmqX+Id7uxaHln9kDs7HuAk6w5
 cIHkK89RRX8psqtynLB8avcMFZweMwbig3ECyq43FxYRmerdPCtQTGtW2uAMr6nq+SbK
 jJQa2CPYwcqlulfGLoo1OQYdRydSZox5TUsaiA9ZhcvqtnfKKhqu0ySMQr1QyG30cs8p
 Su3sOBOplwMFH/oUKfeFiLVMh68F/tcew0oq/cWo7V8Qh5OVIHKLA3h9i51CNfX3+ldw
 E0dA==
X-Gm-Message-State: AOJu0Yy0zoKmBqGb6DjotX4P6bfrpuKgZAL4GiCTQBcTJnWLzuUsoaYi
 iALbYj9R7y/f3gXad26SXgm54tvVuwdwfaZCCXZjohDxL3lCHyJ4deYAldQt
X-Gm-Gg: ASbGncve6EIkvIl71zvr2haFnnc2TsPF2KtcNV9lzo69UwDVOQQYtn8iz85plR2zsnt
 bnSGngC7eJi8lRduXZYNdnyHSoYHE/OhcGDWI6Fz3P2l4aQ3jxHSMOAEkZpJl1Ttg1/kHE1CsP3
 uNTNEfAOn/7526Jd/74cblpPMej4gjXjHbn/VGiMVqCQ2aJiKol5gVN4yDVRS8z2Ac60Ts+3qBv
 0bLAM009+hCT7LL3cIfebQdcYUid6h0oG8LCa2EBlgwpkHPUhiO9Qd/1JjdpncVsdYL39/w+xZW
 mj1YFNZknE2J
X-Google-Smtp-Source: AGHT+IF4TkloXdIhRFTCTvnNaCloaeyXpCv/ygSyYxN5HOG0+VxnojLSCVfyV3lAokkh83mqgcS72A==
X-Received: by 2002:a05:6830:640a:b0:727:3664:ca28 with SMTP id
 46e09a7af769-72c02d77a98mr503756a34.0.1742409137083; 
 Wed, 19 Mar 2025 11:32:17 -0700 (PDT)
Received: from fedora ([2806:10ae:e:622a::3]) by smtp.gmail.com with ESMTPSA id
 46e09a7af769-72bb26bb82dsm2560323a34.32.2025.03.19.11.32.16
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Mar 2025 11:32:16 -0700 (PDT)
From: =?utf-8?Q?Elijah_Gabe_P=C3=A9rez?= <eg642616@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Optionally display function docstring in eldoc
X-Debbugs-Cc: 
Date: Wed, 19 Mar 2025 12:32:15 -0600
Message-ID: <871pus50sw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::343;
 envelope-from=eg642616@HIDDEN; helo=mail-ot1-x343.google.com
X-Spam_score_int: -15
X-Spam_score: -1.6
X-Spam_bar: -
X-Spam_report: (-1.6 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001,
 HTML_OBFUSCATE_05_10=0.26, 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-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: Tags: patch This user option tell whether 'eldoc' should
 display
 elisp function docstring. If set to 'short' only display a short docstring,
 otherwise if set to 'full', display full docstring. If set to nil do no [...]
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
 in digit (eg642616[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (eg642616[at]gmail.com)
 0.0 HTML_OBFUSCATE_05_10   BODY: Message is 5% to 10% HTML obfuscation
 0.0 HTML_MESSAGE           BODY: HTML included in message
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

--=-=-=
Content-Type: multipart/alternative; boundary="==-=-="

--==-=-=
Content-Type: text/plain

Tags: patch

This user option tell whether 'eldoc' should display elisp function docstring.
If set to 'short' only display a short docstring, otherwise if set to
'full', display full docstring.
If set to nil do not show function docstring.

In GNU Emacs 31.0.50 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2025-03-18 built on
 0dae0d7b05b64c3db75f27d2c3f0cd33
System Description: Fedora Linux 41 (Workstation Edition)




--==-=-=
Content-Type: text/html

<p>
Tags: patch<br />
</p>

<p>
This user option tell whether 'eldoc' should display elisp function docstring.<br />
If set to 'short' only display a short docstring, otherwise if set to<br />
'full', display full docstring.<br />
If set to nil do not show function docstring.<br />
</p>

<p>
In GNU Emacs 31.0.50 (build 1, x86<sub>64</sub>-redhat-linux-gnu, GTK+ Version<br />
 3.24.43, cairo version 1.18.2) of 2025-03-18 built on<br />
 0dae0d7b05b64c3db75f27d2c3f0cd33<br />
System Description: Fedora Linux 41 (Workstation Edition)<br />
</p>

--==-=-=--

--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Optionally-display-function-docstring-in-eldoc.patch

From 1b97cd0dff054c862e81434f1376109bb9d30c66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN>
Date: Wed, 19 Mar 2025 12:01:22 -0600
Subject: [PATCH] Optionally display function docstring in eldoc

Allow display (optionally) function docstring in eldoc.
* etc/NEWS: Announce changes.
* lisp/progmodes/elisp-mode.el (elisp-eldoc-var-docstring-with-value):
New user option.
(elisp-get-fnsym-args-string): Display function docstring.
---
 etc/NEWS                     |  7 +++++++
 lisp/progmodes/elisp-mode.el | 24 ++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0797fc03217..b0a0e6cb6a3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1900,6 +1900,13 @@ another pattern matching syntax that is different from that of 'pcase',
 which some users might find less cryptic.
 See the Info node "(elisp) cond* Macro" for details.
 
+---
+** New user option 'elisp-eldoc-show-function-docstring'.
+This user option tell whether 'eldoc' should display function docstring.
+If set to 'short' only display a short docstring, otherwise if set to
+'full', display full docstring.
+If set to nil do not show function docstring.
+
 ---
 ** New function 'shell-command-do-open'.
 This lets a Lisp program access the core functionality of the
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index a34f29bffea..761d392be63 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1882,6 +1882,17 @@ elisp-eldoc-var-docstring-with-value
 				   (format "[%sc more]" more)))))
 	       :thing cs
 	       :face 'font-lock-variable-name-face))))
+(defcustom elisp-eldoc-show-function-docstring nil
+  "Show function docstring in `eldoc-mode'.
+If set to `short' only display a short docstring, otherwise if set to
+`full', display full docstring.
+
+If set to nil do not show function docstring."
+  :type '(choice
+          (const :tag "None")
+          (const :tag "Short" short)
+          (const :tag "Full" full))
+  :group 'elisp)
 
 (defun elisp-get-fnsym-args-string (sym &optional index)
   "Return a string containing the parameter list of the function SYM.
@@ -1908,8 +1919,17 @@ elisp-get-fnsym-args-string
 		     (substitute-command-keys (car doc)))
 		    (t (help-function-arglist sym)))))
              ;; Stringify, and store before highlighting, downcasing, etc.
-	     (elisp--last-data-store sym (elisp-function-argstring args)
-                                     'function))))))
+	     (elisp--last-data-store
+              sym
+              (concat (elisp-function-argstring args)
+                      (pcase elisp-eldoc-show-function-docstring
+                        ('full
+                         (concat "\n" (cdr doc)))
+                        ('short
+                         (save-match-data
+                           (when (string-match "\\." (cdr doc))
+                             (concat "\n" (substring (cdr doc) 0 (match-end 0))))))))
+              'function))))))
     ;; Highlight
     (if argstring
 	(elisp--highlight-function-argument
-- 
2.48.1


--=-=-=
Content-Type: text/plain


-- 
                                          - E.G via GNU Emacs and Org.

--=-=-=--




Acknowledgement sent to Elijah Gabe Pérez <eg642616@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#77124; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 19 Mar 2025 21:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.