[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing function only if another function is defined
From: |
carlmarcos |
Subject: |
Re: Executing function only if another function is defined |
Date: |
Mon, 25 Jul 2022 13:30:58 +0200 (CEST) |
Jul 25, 2022, 11:14 by incal@dataswamp.org:
> carlmarcos--- via Users list for the GNU Emacs text editor wrote:
>
>> (defun docboost (fname doc-boost)
>> "Appends a string to the documentation of a function.
>> FNAME Name of function
>> DOC-BOOST Documentation"
>>
>
> Nice!
>
> It should be automated to appear like that by default and
> automatically, and incorrect docstrings shouldn't not just be
> "considered" bugs, they should be bugs ...
>
What don't you agree with exactly? The docstring in the function
definition would only be a brief description. If additional information
in required, that can be added later, as not to encumber the function with
too much text before one can start seeing the implementation.
> Well, automated - one would still have to write (and read)
> the information manually ...
>
> However the first argument's name is perhaps not so good as
> its inclusion of "name" implies it is a string, better to call
> that just "fun" perhaps. And not just for fun ...
>
> The second argument's isn't so good either as the "boost"
> suffix doesn't add anything. Maybe call it "doc" or
> "str" instead?
>
>> (if (functionp fname)
>> (put fname 'function-documentation
>> (concat (documentation fname t) doc-boost))))
>>
>
> `when'
>
>> Is `functionp' appropriate for testing whether `fname'
>> was defined?
>>
>
> I don't see why not?
>
In case there is a superior way to test whether the function was
defined.
>> Adding a newline before printing the additional
>> documentation would be a sensible thing to do. How to do it
>> within docboost?
>>
>
> "\n"
>
> --
> underground experts united
> https://dataswamp.org/~incal
>