From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 2EyZFOVVbWexfwAA62LTzQ:P1 (envelope-from ) for ; Thu, 26 Dec 2024 13:11:01 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 2EyZFOVVbWexfwAA62LTzQ (envelope-from ) for ; Thu, 26 Dec 2024 14:11:01 +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=FmMueobM; 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=1735218661; 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=E4+j5XQy6RBUMIG5JZZG/DT9NFVyPOYndmIK3q4KylyaqE9q6EgnbqHrrfRfsUtpnMfttH KRPtSFA/XHQln2jFLGTTmitjXvOEaiglaSEaWX4j4jSD7sIyPeIiJ/05Dg2Q0wCCuIKV3B HuVykQc/Ba0tJ0t2/KXIznPviplH4F3JoA5lSOrgwzrpunLPDlz6ckd1bfsZ7CmhB5YerW i4t4qirXCFAEhmvAFnhQ3PllVY/akIT2OapTjyylsBw2pNLOdwENEbHCdpU1d6dJsGXOdP j/1H5WicL/JqozmplVUGckRkNtdCcs1NczQeDET7cxOQNtGXqioOIZPfaKBvgA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=FmMueobM; 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=1735218661; a=rsa-sha256; cv=none; b=GfCoLBoczcBiKDUzdlrVb1l3Qmdn96VKpIIId0FjIKh6SCzOPVd6lBCPvIZWVzYH02oMwQ xd9abuujgyWR0YOxmzclIgW2rw+rmJdpfrYkR7SAggptPo9DNZlaEQhOQodMW358YXtOB1 7/Z1wEKvNdx/f4Puga8p8ogTgay2NSOFJsqat54nyRwNwQv5MGKCd/MFQfT2Flyv6xLLqd Y6y3lkFVK5Qd7MVguT1whKJIKxN2X10VzDYow9RXQIWPG1b5qUYTzMKT3/MVi5ORnQAhvy P1DLpFmvM6Aek5PZZZlI3Bnvq88BFqt9hv3VnGEfCtD1jbAtoWpmgXKkM8VPcA== 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 1D10B87EF6 for ; Thu, 26 Dec 2024 14:11:01 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQnKF-0004ny-NH; Thu, 26 Dec 2024 07:50:51 -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 1tQnKD-0004ni-1H for emacs-orgmode@gnu.org; Thu, 26 Dec 2024 07:50:49 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQnKA-0000LC-QY for emacs-orgmode@gnu.org; Thu, 26 Dec 2024 07:50:48 -0500 Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-2165448243fso87729885ad.1 for ; Thu, 26 Dec 2024 04:50:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735217445; x=1735822245; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=uWrYluIOi2RMxEug1j/Ux23pahZ0rSQEIMW0nKA0snA=; b=FmMueobM4GhwsuqwqPji+fC3tMRlGZCdviyX3hv5Kk1JaFwT5mSgCSNupBQIE7vb4m ziutcpTmGrMNZCfRzuKmwqvGqQagXEvBfmqAgpEqK0u2afW/MWxwDb3+jYdQ8axXdjXH HQJ1hETSU0Xt5eppfzEZdcslfRQXsqJfC6SujCHMHzGF/cco1k+wab45fWssyLNk3ChU QSA3l7ii0u5p7O/bt0OVXWECQjLVOQVFQ/NyhtzeRwX2wTd307wjHr1vR4NhWU31GknV dndYmEqS5SPfGUeEZq2X49Y6oGb2jaScwPecEkMq8XrqAT7w968B41F9gB6nHfsYoalr deWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735217445; x=1735822245; h=mime-version:user-agent:message-id:date: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=EXhSeTh2UXgE7a1duhOHZs3YfaDWL2Ku6aovt6xwzFEKest8Kqs7L0B3hjkMdIMGvc 7p6f9ouvIzdcMn4dR8miGMiIWW9/SI24tERvKHrjTMwrMgDkF5vnm1TQ39kIjfXvkJu+ jepiw0LA62hI+JKtGGr75zHffMlR5loaq+1SU9CHuS+p1sDG3YYd0US+ASKMeePa7cWY rOUL8jfPFr3rc8aMcqUA7WK6lQpNmEi97asEfyg7xkyPV20EeoQVeZthGcDrdSCxdC2s mJLIZbV7EvnnKpHsr2hTmKVci+yl24O5w8kZq7CtDyH8lNr1o2xaZCs5jHTb7ZDlqVE9 OEQg== X-Gm-Message-State: AOJu0YyqgiKL0jnyfK1GgR0HWTS3JbNZPO6sTiBL3UKGdQXs3JPZkZbl siJphLranoTOISRhuBNubmSCGj2po4DmTM0nLmLTMNLL1vX8+/ixWXPDlULU X-Gm-Gg: ASbGncsmwgXFY1oPMperqP5whSRktp2tRF4YOjpUgDbEL2mItoA3tjj6art8RQH/A+v W4wwEiN1NoAGO9cyDYga4WsPMm8bzVAnXsQ9r67Msw1zX77clgeydyzKqoxrnvQ2DR6RQJzxj7Y 9SPndgc76oj2xqaFuoRKPKtbClGKD+yZfArnqJgecFAV/RsVA0wxAyAen3TmH1fduYSufOwuQWo oXmC8S1OcRMIgXDmSTzl4KSOYBPS0X3eRThEnTWBvfBYb7Ai0w= X-Google-Smtp-Source: AGHT+IFXEkJ7G4PagUl+RJForP6/GXZD5y+4ANI7qRzNoQTJG0j3Jx6Dxs4SnGj0A+FJ3vpOf1MDOA== X-Received: by 2002:a17:902:d481:b0:216:6ef9:621 with SMTP id d9443c01a7336-219e6ebb212mr318941665ad.31.1735217445288; Thu, 26 Dec 2024 04:50:45 -0800 (PST) Received: from localhost ([49.205.85.12]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-842dc7eda63sm11838673a12.68.2024.12.26.04.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2024 04:50:44 -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> Date: Thu, 26 Dec 2024 18:20:41 +0530 Message-ID: <87ed1uehge.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=visuweshm@gmail.com; helo=mail-pl1-x644.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 4.49 X-Spam-Score: 4.49 X-Migadu-Queue-Id: 1D10B87EF6 X-TUID: WWnAgnqsaSjV --=-=-= 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 --=-=-=--