From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id iLhvHchVbWc3BQAAe85BDQ:P1 (envelope-from ) for ; Thu, 26 Dec 2024 13:10:32 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id iLhvHchVbWc3BQAAe85BDQ (envelope-from ) for ; Thu, 26 Dec 2024 14:10:32 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=JEaN3IPI; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735218632; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=c0G92JLyNVLBgE0IKFA4ufDX1J+6H8+S7SG5Mvo2PfA=; b=ShAWFJ1FWZaaY/yLVd0HmG9oP7jnu0P6TKotY7VeJrVUzEiUszYWaavEISrn08WOa5MN3v 5/NidL+GaYkVHxT0bwxK5GxV1fKBvgnI+SQBJXu/rlYSkre171I0JFwRuEqf+1Soezf3QH lEPr0OmSXVw5tXMqMQuPq1dcfdsXfLOd5XQlowQLiKuJ5O/JaUd16RoKbBm4FQK6EQgM32 tyxXg7DzQn7ZbdCaQMHyghJVDxukBHh9+xXl3+Z9afn6PoscIbkKg2Io7TXLCQBAaMMKkX cR7VF+nPU3uNz2BMgLkIMXK39Vq3BbBRjgAHnkYP8gVYFd+1AuBY21mQNH+Diw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=JEaN3IPI; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735218632; a=rsa-sha256; cv=none; b=AQwM8eq4Rl299ZcjQCrCg3+iCcIcSENdn74zNOuMYDtBN/6niwpJ0R2GlZKiOwxSgi9laN URiqYNA9lUrCQrCdoX5RGM7KN1woSk71iFNI5QDcpx2vBK0g9T3dxSWoC6EpXATsvpHY+Q QjXjOgYVa+Wcdeh/V3i/HPrJ4+GK5FPEWy5xJhLdKqrjFxrubriP2qWtpo6SU3W5exBFX5 rh9fcGhndQoRUaOvZn7vjf21sgNOlgv5Rculc7g2AUCDU9mfcmLqZ5iimlarVbnzc7vgMk 2CLDIlKbe4GinX90BIyCLKpN+h1fUncWCY2/7u8Js0a2q1BftUUPZmZYcpR4qQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4A07F1E645 for ; Thu, 26 Dec 2024 14:10:32 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQnMg-00065N-Ac; Thu, 26 Dec 2024 07:53:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQnMe-000657-BM for emacs-orgmode@gnu.org; Thu, 26 Dec 2024 07:53:20 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQnMc-0000Zy-I7 for emacs-orgmode@gnu.org; Thu, 26 Dec 2024 07:53:20 -0500 Received: by mail-pl1-x642.google.com with SMTP id d9443c01a7336-21680814d42so66006015ad.2 for ; Thu, 26 Dec 2024 04:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735217597; x=1735822397; darn=gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=uWrYluIOi2RMxEug1j/Ux23pahZ0rSQEIMW0nKA0snA=; b=JEaN3IPIsOaj8Hw3651xgRfgQLZyBRM8aKEMBFYTQ2KbeGWyOlGaagrvycbZGkDgd4 3/TaWB7G9WEVXKo1xnsKCINOSm+mmjb+GKbINgoqKAQSxJGXw9zKamkYgJZc2SFG9h1Z gUKr5+wVhmO+HOjdbrH28htdWpmw9rMuxF8GtV5EtMIK2hn4D8AAnIZRm74WeZBJtBYz oHSsBUs4SojVT3gpi+gtF6wzT5lyQOj6Pze67BRaUNVa087MMb3XTfyCmJvgxoCjRhlh Q64u0ugh3h9hO2vESMKBaN2OCMSJYXDVVayWr8M1gMxvHQlrbXZwfGGZo3I84Bg5VeyZ Kqbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735217597; x=1735822397; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uWrYluIOi2RMxEug1j/Ux23pahZ0rSQEIMW0nKA0snA=; b=m6iegWIKOCI9lrai/l9RB0UzvoUl/rpBH6+76p51dSmUqs5r99iYIpXZjAd/13/auK 1GXXsKfGfDSv3QOC4FGwo6WbdmVaR68V8LRXX8xa5dVvg+z65CM11OS2uFJ62jqqvjyU N/dG5SNdmOn6mrqJJOqnUQ7USyqKxgHxep4aVgJQSkRlULGwJxOegc4jVQU25e0B/gGD fvCSkFebjH1O9AUNj7BorLvqaZfbU/tnKJAhd9HgLbqZYe/7jmLuM12pCfars7bWHskA DH9CVegFrjPYc5PAsH0Vion6wn5xqq5l3kHOqk3j8o3LcZ5D0q2moeJ8cShmpkpPLo2S w4UA== X-Gm-Message-State: AOJu0YyBnJ4rsBtgR47n6p7/pglVc7kc3l49gIbS+m78ADH7NNsvu39j L5tmWFEmUUULnoEQo/8X6NoOda0AJAo5IrsatnISTfxuGgdUWqDc X-Gm-Gg: ASbGnctSs+vwDzNW7NGSx6XuH1y2U7DatxmJ+engLMBLWSyMGI+jQaq0UVpQ7d1Xin4 bkA+iqJR8HK3AYJCZHT/y1EeqLiatcfo6bhTPCFGuXxT1hNg9+90b6ahx7khGBzPvZywJNPtg7F NKeUBPKAZXtr7LtjXICJIcbbWqKlssGpqH+zJm5ib08+qIMcFC19W7unPdQOXgvDbw/awqZj5E6 mKF5ltTwFRF4ITQXIXxv8F0v9OM3WcrcSGi0JMd9PC5EJmegvo= X-Google-Smtp-Source: AGHT+IHT2E0izPoAvHIWOpqS3rQ9U8uL03CrZAD/4fIWf9yl8TugfyktVs8FNQUaS1mhR6DLxisp1Q== X-Received: by 2002:a05:6a20:2d11:b0:1e1:b062:f3fa with SMTP id adf61e73a8af0-1e5e080283amr33200941637.34.1735217597123; Thu, 26 Dec 2024 04:53:17 -0800 (PST) Received: from localhost ([49.205.85.12]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842b2b3e83dsm10024229a12.32.2024.12.26.04.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2024 04:53:16 -0800 (PST) From: Visuwesh To: Ihor Radchenko Cc: Org Mode List Subject: Re: Unexpected error using org-gnus-follow-link In-Reply-To: <87jzbqluk9.fsf@localhost> (Ihor Radchenko's message of "Mon, 23 Dec 2024 07:36:38 +0000") References: <874j39vz29.fsf@ucl.ac.uk> <87y10lhrlb.fsf@gmail.com> <878qsku5rp.fsf@ucl.ac.uk> <87cyhw3zrp.fsf@gmail.com> <87a5cn998u.fsf@localhost> <87pllic102.fsf@gmail.com> <87jzbqluk9.fsf@localhost> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Thu, 26 Dec 2024 18:23:13 +0530 Message-ID: <87cyheehc6.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::642; envelope-from=visuweshm@gmail.com; helo=mail-pl1-x642.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 4.69 X-Spam-Score: 4.69 X-Migadu-Queue-Id: 4A07F1E645 X-Migadu-Scanner: mx10.migadu.com X-TUID: L3+HaM0kZcR7 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D =E0=AE=9F= =E0=AE=BF=E0=AE=9A=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 23, 2024] I= hor Radchenko wrote: > Visuwesh writes: > >>> Do you want to make a patch to that effect? >> >> How about the attached? It falls back to the default value if the key >> is not found in the alist. > > I'd rather just throw an error. If the value is not right in the > customization, the user likely tried to customize things but failed to > follow the value format. Falling back in such situation will create a > headache "why Org is doing not what I tell Org to do?". > > Also, (cdr (assq 'gnus org-link-frame-setup)) =3D 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? BTW, I hope the function would not erroneously signal an error when the frame setup function isn't yet loaded because of the fboundp check (but I guess the chances of that are quite slim). --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Error-if-org-link-frame-setup-is-ill-defined.patch >From a12fc868aba018814be366594a21cad46827f05d Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Mon, 23 Dec 2024 11:59:16 +0530 Subject: [PATCH] Error if org-link-frame-setup is ill-defined * lisp/ol.el (org-link-frame-setup-function): Define new helper function get the frame-setup-function for the corresponding link-type. * lisp/ol-gnus.el (org-gnus-follow-link): * lisp/org.el (org-open-file): Use the new function to better inform the user when the user option `org-link-frame-setup-function' is ill-defined. Reported-by: Eric Fraga Link: https://list.orgmode.org/874j39vz29.fsf@ucl.ac.uk/ --- lisp/ol-gnus.el | 2 +- lisp/ol.el | 10 ++++++++++ lisp/org.el | 12 ++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lisp/ol-gnus.el b/lisp/ol-gnus.el index b9ee8683f..2b20e80b2 100644 --- a/lisp/ol-gnus.el +++ b/lisp/ol-gnus.el @@ -227,7 +227,7 @@ (defun org-gnus-open (path _) (defun org-gnus-follow-link (&optional group article) "Follow a Gnus link to GROUP and ARTICLE." (require 'gnus) - (funcall (cdr (assq 'gnus org-link-frame-setup))) + (funcall (org-link-frame-setup-function)) (when gnus-other-frame-object (select-frame gnus-other-frame-object)) (let ((group (org-no-properties group)) (article (org-no-properties article))) diff --git a/lisp/ol.el b/lisp/ol.el index fa16b5920..757f2b1fd 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1539,6 +1539,16 @@ (defun org-link-add-angle-brackets (s) (unless (equal (substring s -1) ">") (setq s (concat s ">"))) s) +(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)))) + ;;; Built-in link types diff --git a/lisp/org.el b/lisp/org.el index 2e91dd508..6af67359d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8489,7 +8489,7 @@ (defun org-open-file (path &optional in-emacs line search) (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)))) ((or (stringp cmd) (eq cmd 'emacs)) - (funcall (cdr (assq 'file org-link-frame-setup)) file) + (funcall (org-link-frame-setup-function 'file) file) (widen) (cond (line (org-goto-line line) (when (derived-mode-p 'org-mode) (org-fold-reveal))) @@ -8517,7 +8517,7 @@ (defun org-open-file (path &optional in-emacs line search) ;; `org-file-apps' with sexp instead of a function for `cmd'. (user-error "Please see Org News for version 9.0 about \ `org-file-apps'--Error: Deprecated usage of %S" cmd)) - (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) + (t (funcall (org-link-frame-setup-function 'file) file))) (funcall save-position-maybe))) ;;;###autoload @@ -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))) - + ((org-pos-in-match-range pos 6) ;; POS on "dmwy" repeater char. (setq pos-match-group 6 new (car (rassoc (+ nincrements (cdr (assoc (match-string 6 ts-string) idx))) idx)))) - + ((org-pos-in-match-range pos 5) ;; POS on X in "Xd" repeater. (setq pos-match-group 5 ;; Never drop below X=1. new (format "%d" (max 1 (+ nincrements (string-to-number (match-string 5 ts-string))))))) - + ((org-pos-in-match-range pos 9) ;; POS on "dmwy" repeater in warning interval. (setq pos-match-group 9 new (car (rassoc (+ nincrements (cdr (assoc (match-string 9 ts-string) idx))) idx)))) - + ((org-pos-in-match-range pos 8) ;; POS on X in "Xd" in warning interval. (setq pos-match-group 8 ;; Never drop below X=0. -- 2.45.2 --=-=-=--