From: Julian Scheid <julians37@gmail.com>
To: 46662@debbugs.gnu.org
Subject: bug#46662: [PATCH] cl-extra: Fix docstring retrieval
Date: Sun, 21 Feb 2021 00:42:20 +1300 [thread overview]
Message-ID: <CAD1CDTUmPxxHu7P3Kn=P8BTJQvjDdQV0g5ESH5iW1tsCfosjQg@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1146 bytes --]
Given
(require 'cl-macs)
(cl-defstruct foobar
(baz nil :documentation "an important piece of information"))
Now, (describe-symbol 'foobar-baz) will include "an important piece of
information".
However, (describe-symbol 'foobar) will not:
Name Type Default
———— ———— ———————
baz t nil
... even though the intention to include it can be seen by looking for
the string ':documentation' in `cl--describe-class-slots`.
This is because `cl--describe-class-slots` accidentally uses
`alist-get` instead of `plist-get`.
With the attached patch, (describe-symbol 'foobar) works as intended:
Name Type Default Doc
———— ———— ——————— ———
baz t nil an important piece of information
Note: `cl--describe-class-slot' (a different function) appears to have
the same bug, but I have no idea how one would go about adding class
slots to a struct and therefore no way of testing any changes to this
other function.
Could it be a code path that is never executed anyway? I decided to
leave it alone, this patch should be an improvement regardless.
[-- Attachment #1.2: Type: text/html, Size: 1296 bytes --]
[-- Attachment #2: cl--describe-class-slots_plist-get.patch --]
[-- Type: application/octet-stream, Size: 1263 bytes --]
From d9b67052a595d03f228c61d05b0906ea74b0ee4e Mon Sep 17 00:00:00 2001
From: Julian Scheid <julians37@gmail.com>
Date: Sun, 21 Feb 2021 00:15:52 +1300
Subject: [PATCH] cl-extra: Fix docstring retrieval
* lisp/emacs-lisp/cl-extra.el (cl--describe-class-slots): Fix
docstring retrieval.
---
| 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index 28ce6b115a..84199c1612 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -898,8 +898,8 @@ cl--describe-class-slots
(list (cl-prin1-to-string (cl--slot-descriptor-name slot))
(cl-prin1-to-string (cl--slot-descriptor-type slot))
(cl-prin1-to-string (cl--slot-descriptor-initform slot))
- (let ((doc (alist-get :documentation
- (cl--slot-descriptor-props slot))))
+ (let ((doc (plist-get (cl--slot-descriptor-props slot)
+ :documentation)))
(if (not doc) ""
(setq has-doc t)
(substitute-command-keys doc)))))
--
2.30.1
next reply other threads:[~2021-02-20 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-20 11:42 Julian Scheid [this message]
2021-02-22 15:06 ` bug#46662: [PATCH] cl-extra: Fix docstring retrieval Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAD1CDTUmPxxHu7P3Kn=P8BTJQvjDdQV0g5ESH5iW1tsCfosjQg@mail.gmail.com' \
--to=julians37@gmail.com \
--cc=46662@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).