unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Luis Felipe <luis.felipe.la@protonmail.com>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: guile-user@gnu.org
Subject: Re: Indentation with inline comments in Emacs
Date: Sun, 17 Apr 2022 13:44:29 +0000	[thread overview]
Message-ID: <AcTGbEepolZj7RpRZwxyb7OsOkzc4wxj2DDuqkC6Gywsfs_---wvEigSi_EO8EitjMTyabIfyeiynuz667oBDvtZwdFowg--y3JmEmO_3jM=@protonmail.com> (raw)
In-Reply-To: <591cc2fe-6aec-37f4-4eb5-170c713b8ac1@posteo.de>


[-- Attachment #1.1: Type: text/plain, Size: 1487 bytes --]

Hi Zelphir,

On Sunday, April 17th, 2022 at 10:49 AM, Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> wrote:

> I have the same indentation issue though, when I use #||# comments for
> arguments, which are not keyword arguments, but I want to hint what they are
> used for. One could argue, that I should rewrite the called function to use
> keyword arguments, or, if it is a library function, I should wrap it. Hmmm.
> Maybe that's a valid point.

Or document the function and its parameter using a documentation string (docstring) instead of comments? This way, you or the users of your code can read that documentation with Emacs Geiser.

For instance:

(define (get-field record field)
  "Get the value of FIELD from RECORD.

  RECORD (Guile Record or SRFI 9 Record)
    A record of any type.

  FIELD (Symbol)
    The name of the field.

  RETURN VALUE (Anything)
    The value of the field.

  If the FIELD does not exist, a no-such-field exception is raised."
  (let* [(descriptor (record-type-descriptor record))
         (access-field (record-accessor descriptor field))]

    (access-field record)))

Then, in Emacs, when calling this procedure, you would place the caret in get-field, press C-c C-d C-d, and Emacs would show its documentation in a buffer.

That's my documentation style, though, which is not conventional, but just an example.

Using documentation string is also useful if you later want to [auto]generate API documentation.

[-- Attachment #1.2: publickey - luis.felipe.la@protonmail.com - 0x12DE1598.asc --]
[-- Type: application/pgp-keys, Size: 1815 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 509 bytes --]

  reply	other threads:[~2022-04-17 13:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16 12:12 Indentation with inline comments in Emacs Zelphir Kaltstahl
2022-04-16 14:57 ` Jérémy Korwin-Zmijowski
2022-04-17 10:49   ` Zelphir Kaltstahl
2022-04-17 13:44     ` Luis Felipe [this message]
2022-04-18 10:48       ` Zelphir Kaltstahl
2022-04-18 13:33         ` Ricardo G. Herdt
2022-04-18 14:09           ` Luis Felipe
2022-04-18 14:05         ` Luis Felipe
2022-04-17  3:03 ` Taylan Kammer
2022-04-17 11:06   ` Zelphir Kaltstahl
2022-04-17 14:58     ` Maxime Devos
2022-04-18 10:49       ` Zelphir Kaltstahl

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/guile/

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

  git send-email \
    --in-reply-to='AcTGbEepolZj7RpRZwxyb7OsOkzc4wxj2DDuqkC6Gywsfs_---wvEigSi_EO8EitjMTyabIfyeiynuz667oBDvtZwdFowg--y3JmEmO_3jM=@protonmail.com' \
    --to=luis.felipe.la@protonmail.com \
    --cc=guile-user@gnu.org \
    --cc=zelphirkaltstahl@posteo.de \
    /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.
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).