emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] ol.el: add description format parameter to org-link-param


From: Hugo Heagren
Subject: Re: [PATCH v3] ol.el: add description format parameter to org-link-parameters
Date: Tue, 21 Jun 2022 13:03:32 +0100

I've finally had time to the `:default-description' parameter in
`org-link-parameters'.

Ihor Radchenko <yantar92@gmail.com> writes:

> I recommend writing tests for org-insert-link in
> testing/lisp/test-ol.el and testing expected behaviour for various
> values of :default-description.

Good advice! I haven't written many tests before, so this was a
challenge. I've attached a patch with some tests for the expected
behaviour. These include a couple of macros and a function, to stop
the definitions being too huge and unwieldy.

All the tests pass on my machine.

They're very nearly just right, but for some reason
`test-ol-with-link-parameters-as' doesn't always reset the parameters
correctly for me. However I have them set to originally, it sets
`:default-description' to a lambda. This might be a quirk at my end
though -- if someone else could have a look I'd be very grateful.

The tests showed that my previous approach doesn't work generally
enough. I've moved where `type' is defined in the code, to cover all
cases.

> Firstly, def will be undefined inside the error clause.

I've defined def a bit further up in a `let', and run the error clause
inside this.

> Secondly, when :default-description is a lambda expression and that
> expression fails, your code will fail with "wrong-type-argument
> symbolp" when executing (symbol-name def). Please consider cases
> when `def' is not a string and not a function symbol.

Dealt with this by just using `message "<text> %S: "', since %S will
print a symbol, a string or a lambda correctly.

Hope this is a bit better!

Best,
Hugo

Attachment: 0002-test-ol-tests-for-default-description-param-when-ins.patch
Description: Text Data

Attachment: 0001-ol.el-add-description-format-parameter-to-org-link-p.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]