[PATCH] emacs: remove hardcoded defaults values from docstrings

Tomi Ollila tomi.ollila at iki.fi
Tue Jun 4 23:05:43 PDT 2013


On Tue, Jun 04 2013, David Bremner <david at tethera.net> wrote:

> Austin Clements <amdragon at MIT.EDU> writes:
>>
>> Right.  I think we should both reference the variable and say what the
>> default behavior is (there's no reason not to do both).  But isn't
>> that what these docstrings used to do?
>
> Looking at the old docstrings in notmuch-show.el, I agree they basically
> implement Tomi's suggestion.  While I think copying default values of
> variables into docstrings creates some minor maintainability traps
> (since we then need to remember to look at all the places a variable is
> referenced if we change the default value), I'm willing to revert the
> patch if people think the tradeoff of better usability is worth it.

Well, revert would be the worst option -- maintainability traps there
and no reference to the variable used ;/

So either what we currently have in repository (and merge Mark's similar
patches) or have both. In addition to my quick suggestion, what is been
seen in notmuch-show.el docstrings this is what `split-string' has:

...
If SEPARATORS is non-nil, it should be a regular expression matching text
which separates, but is not part of, the substrings.  If nil it defaults to
`split-string-default-separators', normally "[ \f\t\n\r\v]+", and
OMIT-NULLS is forced to t.
...

By looking the code, doc hardcoded, defconst split-string-default-separators
-- from maintainability point of view those are close to each other...

IMO what we currently have is OK, unless SomeOne(tm) provides a neat patch
and agrees that maintainability is not really a problem here :D

> It is unfortunate emacs doesn't provide a way to expand the current
> value of a variable in the help string, but there we are. It probably
> wouldn't be as easy to understand as hand crafted text in any case.

We could have placeholders in *.el files and tune byte compiler
to fill in the docstrings >;) Imagine the added bonus we get by
the confusion that causes !


> d

Tomi


More information about the notmuch mailing list