emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Unexpected error using org-gnus-follow-link


From: Ihor Radchenko
Subject: Re: Unexpected error using org-gnus-follow-link
Date: Thu, 26 Dec 2024 13:22:01 +0000

Visuwesh <visuweshm@gmail.com> writes:

>> Also, (cdr (assq 'gnus org-link-frame-setup)) = nil is not the only
>> possible incorrect customization. I'd rather check if the cdr is a
>> function and throw a descriptive error otherwise asking to fix
>> `org-link-frame-setup'.
>
> How about the attached?

You still do not check if the value is a function.
Consider totally wrong values like '(wrong). `fboundp' will then throw
an error.  You may consider `functionp' instead.

> +(defun org-link-frame-setup-function (link-type)
> +  "Return the frame setup function for the link type LINK-TYPE.
> +This signals an error if the value of the key LINK-TYPE in
> +`org-link-frame-setup' is not a function."
> +  (let ((fun (cdr (assq link-type org-link-frame-setup))))
> +    (if (fboundp fun)
> +        fun
> +      (error "The frame setup configuration for `%s' link type is 
> ill-defined"
> +             link-type))))

In the error, we can also show the problematic value to aid the user.

> @@ -15311,20 +15311,20 @@ (defun org-modify-ts-extra (ts-string pos 
> nincrements increment-step)
>       (setq hour (mod hour 24))
>       (setq pos-match-group 1
>                new (format "-%02d:%02d" hour minute)))
> -       
> +
> ...

Please remove irrelevant whitespace-only changes.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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