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 QORSGuRybWdBEwEAe85BDQ:P1 (envelope-from ) for ; Thu, 26 Dec 2024 15:14:44 +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 QORSGuRybWdBEwEAe85BDQ (envelope-from ) for ; Thu, 26 Dec 2024 16:14:44 +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=fuqXY+nC; 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=1735226084; 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=Ai4eWk7BVJE81MLont9OyxQkrxrleFmxmbZXSxdiHhs=; b=u5JhtzUFJS9PuB/oWI0ozz6BFcNqH7ZdyA2ynJL3fIBVNbVi4yGCbhmGGhVsqi7WxcsCk+ 8mCX2dA/KKfk5ihvFBvVpaB1aB/Er8QPTfvvd5pJA4DiX+G+WBWK2FOn6eqG+ZKsjJn5ti n3BnSPpJZTcSuslkGe4AzbCDeLKlHfOw/jRBG7JdRr7fSVpOTgZjQQLUbaLpkvP2+Dbb1/ laN0oCtNA1X2x1JaEAMgedaBBomPNSbNKwQejsqZFbDFexPKBRtXXmZTYLq8F9Mljb26iB FZM7nkIeimr/JKZsvKkTV47BKakwK8FAa66ERO2BO9Zm0ciA9kAkVqd4hrShfg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=fuqXY+nC; 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=1735226084; a=rsa-sha256; cv=none; b=d+1TlL+pxJ01VstkkAgKnsYHMPSwU6wZiplsrJhUQ9SSF+PPMRIUVUvb2xgg8yU37nfPyk iOLD4b017MhR+6dAwGKYixtDmnIzVOdZ32d7MtbzFaRq3GbPQ6AyqGsAGBn75oQDPoX8kd Jf+fVg7D5l7HCYlyh9Y1/FJKpkskK66gGozzG6d8u9e9+dxiAZz1pbHRn7m7nA9wCjH6WI ZAm2Hup/X3LI7qGGf0SNYjY2eCbzAsbN4bK9OzksuAoYvN/7ulV6Cw9vzznUEReOnYbnwf NJcEHiHwnppeOuieDVOHbv79rlfU5Eqh4C3ICd02WkSZOFMx/hS6EWtKfrQzJw== 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 D746684FEA for ; Thu, 26 Dec 2024 16:14:43 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQp7p-0005Zl-L8; Thu, 26 Dec 2024 09:46:09 -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 1tQp7k-0005ZN-U7 for emacs-orgmode@gnu.org; Thu, 26 Dec 2024 09:46:05 -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 1tQp7i-0003F0-UG for emacs-orgmode@gnu.org; Thu, 26 Dec 2024 09:46:04 -0500 Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-2166651f752so84405855ad.3 for ; Thu, 26 Dec 2024 06:46:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735224361; x=1735829161; 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=+5PxkObudzaYiPNvmckvAEY1tMT0OOK8EjF6powmpcc=; b=fuqXY+nC5mtuynlDeQFiOFaRyZ9Kbdbrm4rQZD6F4nhqTU7f9PGKBDEk0DnoRJAZE3 7Q1H4Uwr7PUURB2g/1UTLhTrkLJWP003eBZ2R5o6tIOs3v1NWq7BHHjD9sdAMgURkoA6 AHXVH9KRlXPQGHjpdr6ouFhV0lC/CqOQkT9hM/gAu05RdftfluCtxbtdATrZY2dvWXKQ GHeuOqMAlwpceZZDOUL24J4oqs5TAirP7x/fvOVzQ2qFTBJ50lBo2V0k5Ee6wKDTOlJ/ 4DmT7kMQv+N2oSF4isUuwxpe2tj44+Kwsw6TpBfI/slIg5CorhWhIF0wOIGaEYIzk/My i4Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735224361; x=1735829161; 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=+5PxkObudzaYiPNvmckvAEY1tMT0OOK8EjF6powmpcc=; b=iYQXVi3S+SViUd8/0HT5xSDeDe8xU5SwXTsqpjTISiNRoozWPPdzh9dVYYscgPTq22 hyfJYqb6XzGPeWAk5l3JRCagSsgf3zbIUP+AFV3dgCvpMkYL+K/OkBD9vgF8N7aL4Tkb D+tUstuGQSirm2Cd05vdQ7i6BnJAdx5PQXpfKvGwPGMMt76jsy4KNHKJRZTDIXlw8N+H BPlCuycQ0qh5yB1GHTVAaORPnXSgZHYOjoBgfoeumJJa7jxCw7rCI6MIAr2twlXjEwwW khI3ddeam4PlpJT4FZIEOxRVYZ6N15thJrPPvHW2GNGcu4nleCuZiltUBFxO180Dd9eJ DStg== X-Gm-Message-State: AOJu0YyuxAP+zYNWKanLjJE8S59V6MNAc+1psGl6j2QKjcvjGG8GEtPz qY23SN+Xw7Z4ysHZDC5IpXX4L0W9Ghl1EA7wp57pzBlxaJcJIsxb X-Gm-Gg: ASbGncsOW6HY9NaUHlsxj7TpPl7+NLV+B2PsburUlX9LKpbSz+Lfcn5dBveGfsInp/J MvZyBrIWAt1zZZZp58DoX7i3Z8P6Foa9gS2TQrwSZ3SKSrqmST/gqkyjPdbluEla6h1QRGaxbMv +6ZJGEhPx17Hsmb/a5Uk/qSl+/l6sFMyiiRNiejXdBuMFQdiT7bg+Z8XEYyOvmWKKfOcoHUuqJN 2VWNI/MIMDflzeb7b8GvMrhV0wnnso4dFCWm2wsdKwinRs9yH0= X-Google-Smtp-Source: AGHT+IEtPmZwhVGVa21JLxQYLN771LfB7GRVhA1QChjRa1hbedt0GiYBc0w566q6g0MKjtlWtazd7A== X-Received: by 2002:a17:902:f602:b0:216:3c2b:a5e5 with SMTP id d9443c01a7336-219e6ebb682mr313314385ad.27.1735224361309; Thu, 26 Dec 2024 06:46:01 -0800 (PST) Received: from localhost ([49.205.85.12]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc96e764sm120602195ad.62.2024.12.26.06.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Dec 2024 06:46:00 -0800 (PST) From: Visuwesh To: Ihor Radchenko Cc: Org Mode List Subject: Re: Unexpected error using org-gnus-follow-link In-Reply-To: <87jzbm7f5y.fsf@localhost> (Ihor Radchenko's message of "Thu, 26 Dec 2024 13:22:01 +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> <87cyheehc6.fsf@gmail.com> <87jzbm7f5y.fsf@localhost> Date: Thu, 26 Dec 2024 20:15:57 +0530 Message-ID: <87h66qcxju.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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 4.29 X-Spam-Score: 4.29 X-Migadu-Queue-Id: D746684FEA X-Migadu-Scanner: mx10.migadu.com X-TUID: 1qLjp2/kIgL8 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=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 26, 2024] I= hor Radchenko wrote: > Visuwesh writes: > >>> 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? > > 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. Ah, I wasn't aware that functionp also returned t if you gave a symbol. Thanks for the hint. >> +(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-d= efined" >> + link-type)))) > > In the error, we can also show the problematic value to aid the user. Now done. >> @@ -15311,20 +15311,20 @@ (defun org-modify-ts-extra (ts-string pos ninc= rements increment-step) >> (setq hour (mod hour 24)) >> (setq pos-match-group 1 >> new (format "-%02d:%02d" hour minute))) >> -=20=20=20=20=20=20=20 >> + >> ... > > Please remove irrelevant whitespace-only changes. Done. Please find attached. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Error-if-org-link-frame-setup-is-ill-defined.patch >From ee57860915308dc9bf30172cfd94f8985b536361 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 | 4 ++-- 3 files changed, 13 insertions(+), 3 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..102b68bab 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 (functionp fun) + fun + (error "The frame setup configuration `%S' for `%s' link type is ill-defined" + fun link-type)))) + ;;; Built-in link types diff --git a/lisp/org.el b/lisp/org.el index 2e91dd508..2c35bed5f 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 -- 2.45.2 --=-=-=--