emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Visuwesh <visuweshm@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Unexpected error using org-gnus-follow-link
Date: Thu, 26 Dec 2024 13:22:01 +0000	[thread overview]
Message-ID: <87jzbm7f5y.fsf@localhost> (raw)
In-Reply-To: <87cyheehc6.fsf@gmail.com>

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	other threads:[~2024-12-26 13:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 12:57 Unexpected error using org-gnus-follow-link Fraga, Eric
2024-12-12 15:02 ` Visuwesh
2024-12-12 18:15   ` Fraga, Eric
2024-12-13  5:42     ` Visuwesh
2024-12-13 10:46       ` Fraga, Eric
2024-12-15 16:41       ` Max Nikulin
2024-12-22 12:45       ` Ihor Radchenko
     [not found]         ` <87pllic102.fsf@gmail.com>
     [not found]           ` <87jzbqluk9.fsf@localhost>
2024-12-26 12:50             ` Visuwesh
2024-12-26 12:53             ` Visuwesh
2024-12-26 13:22               ` Ihor Radchenko [this message]
2024-12-26 14:45                 ` Visuwesh
2024-12-27 17:10                   ` Ihor Radchenko

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87jzbm7f5y.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=visuweshm@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).