all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Josh <josh@foxtail.org>, 17180@debbugs.gnu.org
Subject: bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases
Date: Wed, 26 Jun 2019 16:27:03 +0200	[thread overview]
Message-ID: <m3ef3g1ky0.fsf@gnus.org> (raw)
In-Reply-To: <jwvy4zms4c8.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Thu, 03 Apr 2014 13:37:05 -0400")

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> Incidentally, I wondered whether this would be better addressed
>> within `documentation-property' itself
>
> Yes, it should be fixed there directly.
>
>> but I wasn't sure it would be correct to preclude the possibility of
>> unique docstrings between aliases and their targets.
>
> documentation-property should simply first check variable-documentation
> and only when that fails, follow the alias indirection.

I've now implemented this like what's below, and I hope that's what you
meant.  :-)

diff --git a/src/doc.c b/src/doc.c
index 3fa0eaac20..bc05d09df4 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -436,8 +436,20 @@ DEFUN ("documentation-property", Fdocumentation_property,
  documentation_property:
 
   tem = Fget (symbol, prop);
+
+  /* If we don't have any documentation for this symbol, try to see whether
+     it's an indirect variable and get the documentation from there instead. */
+  if (NILP (tem))
+    {
+      Lisp_Object indirect = Findirect_variable (symbol);
+      if (!NILP (indirect))
+	tem = Fget (indirect, prop);
+    }
+
   if (EQ (tem, make_fixnum (0)))
     tem = Qnil;
+
+  /* See if we want to look for the string in the DOC file. */
   if (FIXNUMP (tem) || (CONSP (tem) && FIXNUMP (XCDR (tem))))
     {
       Lisp_Object doc = tem;


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2019-06-26 14:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 16:40 bug#17180: [PATCH] eldoc doesn't find docstrings for variable aliases Josh
2014-04-03 17:37 ` Stefan Monnier
2019-06-26 14:27   ` Lars Ingebrigtsen [this message]
2019-06-26 14:35     ` Stefan Monnier
2019-06-26 14:37       ` 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

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

  git send-email \
    --in-reply-to=m3ef3g1ky0.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=17180@debbugs.gnu.org \
    --cc=josh@foxtail.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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.