From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: ludvig-faddeev@gmx.com Newsgroups: gmane.emacs.help Subject: [External] : Supplying DOC string in a `defun' using `defvar' Date: Tue, 1 Jun 2021 01:46:16 +0200 Message-ID: References: <874keitr8t.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31106"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 01 01:47:03 2021 Return-path: Envelope-to: geh-help-gnu-emacs@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 1lnrcd-0007uj-1e for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Jun 2021 01:47:03 +0200 Original-Received: from localhost ([::1]:44158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnrcc-0007IZ-3u for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 31 May 2021 19:47:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnrbw-0007G4-BR for help-gnu-emacs@gnu.org; Mon, 31 May 2021 19:46:20 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:44809) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnrbu-0005M8-Cq for help-gnu-emacs@gnu.org; Mon, 31 May 2021 19:46:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1622504776; bh=mwZsGhjyypLYussJQUGAkHG07ReIGJB7sGBsgy4Kpbs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=XAlPGk4zu6Wr+gWfu3wLhc2QueXqn8fu4v7IYqWRlE4HZzFijAI/FMpu2V2ZnYrxP qhs/TeT9Q2NTrv8sCWq/sqM3mAa8gbGYXT13+u3as9xC8yy7PWL3b+WmoAXK2sM1Ym Lf58E7rDqdk38+diSJM+zIIL8GJSNNOcokr4U8VU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs01.server.lan [172.19.170.58]) (via HTTP); Tue, 1 Jun 2021 01:46:16 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <874keitr8t.fsf@web.de> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:yheK7VabGJd/o8Px9PlW7Dscxk9zG7tNHYQxieMt75Rggfe9snDKFLQY0V07JRs0xpr9A LFm5raDCrnkhxPiY45prb/Dq/AU3uwfQLzt75kQisVy4tya419WXk5L69e4sE5JlXeVdpoko8zsJ OXdC6IART9bozedMaopKBPIGKjCB43JKlr4Hg/PWLMpBWtCiEumGRiGbo3csStCMGiClBwECHRn6 nOspUu6t8nm/Wif6ZvoxCKRsBIJvcQI4Kuziaf1h/OIWeWZtdCxYn7kNIsh+TZ8sylsH139e+iZ3 c4= X-UI-Out-Filterresults: notjunk:1;V03:K0:rmoSiw4jP+k=:DcAeP9AbUjpNWqJ8ze+R3J I8upZMK5OfIMomHsU4u42P6GZbwW3oDN0Gxpy3GoLX6NDUKyul7wJCcMzjofp0VJRbsgxhDTk iuZ+lAXh3lpUaECGIKHTssCYMHaOhH0HX6oJ5TF0BJ0WW55bt7equcKaa3WizFLzPP+6AaxQr YLEqq6y0B0yq+jJ3LT2+Bwx9ZaLqJTPyJYtY7KH0FrNPEW1FzydQLGMHJpsNM0PZUx5FfTjoU PuGw9uumVH0Ix4MQdhJg3c6VP6oIW6WIHgRuAAMmhH2x8AJ177zCHh9Lnl+aGFvDjkFa4maHm kqf/Zp4OQnVW6j3Rg2Iy9hxSglc9Zx4qnrVn25QLlhEh+DQwnvWcwTdVx7RFJNH1UI/dSWSuq Jr9vfzF4dUgk018KvUzjgRHmIfUwlV0XrIp3K9GROYVRiY8rpbScCRHdwvXlrwMLxiV9Wfxtr SWcl8JmLyHEXKaR1/QcRSHtfPt/M2bpU3iU0kmklHAdEBllfyTP+Ps2B9eq0v1Jjqv6geXa5l kEq5e9/PscPdjXGi5X6IapE8tRCIYMJL8R5YcOdSgnSW9LepC20AYehEVH73C2BdzjFVzKY+s yItQn97QSWT4BEMqh0R7lA2bFWyhUX/9zuDtybXW9Huo8OjOL/hf753CXSjWFVSsDfOYBATeC BYpU2YiLrtfV+0OKBhXaHMMSqT5wuHrS8Wdgbca2pweRULGrHPvvbPRfhvwp5w3QWSiHmrkXD Q54vk7M51PLqqXpXu2gRW6vNRWeIBJLk1Pc4Y+E29pl+dhn5h+23xKQAFisRfydYPonAoFju Received-SPF: pass client-ip=212.227.17.21; envelope-from=ludvig-faddeev@gmx.com; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:130408 Archived-At: A useful tool would be to allow one to append to a docstring using a varia= ble. User could write a brief description, and append more details from a defva= r. I like my functions to be succinct without an overly long docstring. This= makes the implementation code readily displayed on the visible window. > Sent: Tuesday, June 01, 2021 at 11:31 AM > From: "Michael Heerdegen" > To: help-gnu-emacs@gnu.org > Subject: Re: [External] : Supplying DOC string in a `defun' using `defva= r' > > Drew Adams writes: > > > (let ((toto "WHAT?!!!!")) > > (put 'bar 'function-documentation toto)) > > > > (describe-function 'bar) > > Yes, the `function-documentation` property. Its value can even be an > expression, and that will be evaluated whenever the documentation is > requested. In one of the simplest cases, that expression is a variable > holding the documentation: > > #+begin_src emacs-lisp > (defvar my-doc "A test function > > And this is its documentation") > > (defun test () 1) > > (put 'test 'function-documentation 'my-doc) > > ;; Try C-h f test RET > #+end_src > > When you change the value of `my-doc' the documentation of `test' > changes magically. > > There are cases in Emacs where the expression is used to generate a > docstring dynamically - `pcase' is one example. > > > Michael. > > >