From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KG/yG0JzTmKefgAAgWs5BA (envelope-from ) for ; Thu, 07 Apr 2022 07:14:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IBpDGUJzTmLQDgEA9RJhRA (envelope-from ) for ; Thu, 07 Apr 2022 07:14:42 +0200 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 F2BE3100E6 for ; Thu, 7 Apr 2022 07:14:41 +0200 (CEST) Received: from localhost ([::1]:59048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncKTg-0006sa-8Q for larch@yhetil.org; Thu, 07 Apr 2022 01:14:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncKS7-0006sL-7b for emacs-orgmode@gnu.org; Thu, 07 Apr 2022 01:13:03 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:53141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncKS5-0001LN-No for emacs-orgmode@gnu.org; Thu, 07 Apr 2022 01:13:02 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 2so4571039pjw.2 for ; Wed, 06 Apr 2022 22:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=8RobSjtRODvG988HbsF7W1pvKlnr1Rasy8TGppmJFQ0=; b=LpYx1tBEExliObr8XD7JA3sbyJj3GFvHgisIEIbnFwxJiTi0OzUOpWGMXWJ7hS6Hti 5MoYOGILxlQL/oBDm5uWOgrfKe6GggxmgemoMCFgEyv1TWoogNW+4zAFnCdICHlTKs7r QxG/PwyxYWpyx5V3vG10CpRP+g6ztOW+FONxFWRvoBkGj1IdZ/3O3rmWK6J+uO9uc4Sk 4utAEZ0oTsURFpmfdkGxFJpD89vTurOzXFEsQ9BCqos9ySNwEKHLYmhudmmkIYrdoxV2 sR8hRFpVVTyE4RZCHSxHiIiDomgWriqyWsFE4CJFbl+iyU41a3Q97ypj3X1ljImzNXla 2R1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=8RobSjtRODvG988HbsF7W1pvKlnr1Rasy8TGppmJFQ0=; b=ghQd3VdDD2wBjiLwXgunPEOGlpkBriMetZ29L6zHIm5WI2MDTUkNzGB2GNj4m1dkBJ 5gPAI3gPR1cPm2jn2FOblpoJwCyKynJl+E3vvjat3Y8OUP/rg9n1OgTBTII8cDHyNNDO VbYi2fcxgwruqRFKCXQVbQ6dXLIrJy57NBfc5a+6bOfZk/qvaWd109ZOQK/1SjwgOikZ vMttFxnYO7LEt/gUqsdVYXybB56hp1k3rFUk4drZl6uA/tJNGFKS5KSH4BsI/8VBj+fv DHAw4x0JkAQhzP/SQCQ0tLejgXus7LQTrJ4LeDi7LaB/4RcspwmWfKaCaBXJvC1gSMQu J7IA== X-Gm-Message-State: AOAM532bLBHXT0aj4HSuOVdL85CPW9NUpO6eCww2mk8TF8qcEdCxc9Qx mAYB6aPW5lAMJrFb2JNo20OU/akbD/eq2Q== X-Google-Smtp-Source: ABdhPJxTyR+qcG6Tuxj3yTEQCLrKk8LHI+HE5Hnw49e0tzb6qVjEgCstYxU7rRXOXvGANjPQWJv8XA== X-Received: by 2002:a17:902:a98b:b0:156:40cc:ddf6 with SMTP id bh11-20020a170902a98b00b0015640ccddf6mr12283729plb.111.1649308380297; Wed, 06 Apr 2022 22:13:00 -0700 (PDT) Received: from localhost ([208.115.232.2]) by smtp.gmail.com with ESMTPSA id w13-20020a17090a5e0d00b001c7d4099670sm7276292pjf.28.2022.04.06.22.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 22:12:59 -0700 (PDT) From: Ihor Radchenko To: Hugo Heagren Subject: Re: [PATCH v2] ol.el: add description format parameter to org-link-parameters In-Reply-To: <20220405192931.6747-1-hugo@heagren.com> References: <87zgl1npow.fsf@localhost> <20220405192931.6747-1-hugo@heagren.com> Date: Thu, 07 Apr 2022 13:13:24 +0800 Message-ID: <87a6cx79xn.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1032.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649308482; 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=8RobSjtRODvG988HbsF7W1pvKlnr1Rasy8TGppmJFQ0=; b=hyA0Fj611BkzQZrB1IoDaRQi3YyAUsNqwdjAnKOlEvhWglqWsY7Ooa84aRdDkBhAXvQC8U oeknihd9HPCk7g0k89SPjnt/LCNCx3AHQleYL0ywve1cLAlKYeg9FDC/agN74VQ0KsS1OM lG0zIYOZtmZB9psj4rIahOC73QBoKSaseQVqN59uLvMzV07p3Kia7YoKUZAO4txHI0dsY8 xKLZ5caEDjNUyGnZftr3tB9GL0Ykm0uuTOqWyB7hrPm5yVPw5yme+BuyNvzhMkm5jhma9g e5P9QBL0Xt84qH6v8COsM6jPg7PuuBWpuHRc0E0LTr1ykUksxQllGCaHIYSCXw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649308482; a=rsa-sha256; cv=none; b=AvS0F2FOWcts4bJ2OkOwYxhu+gVmV6EmtbdV9XKgmEM1QSgA189HYV2GAlw6aGoQbjNF9i dFQzaMr2HPnMlo4VJdbn0bRILmnnLx70rQUr66aXC/v4ZsnHqDDyAclbwY+dVytA3SKcl2 tIf1MrZ/hTuPaHgf3UGfWunNwzK8ImSG18kjnCC5Q3v0K94g7x3i8UAnkZQrHJduFUtg86 7ah/6RWXJSuS2x7/wcroc9OqQq5VFPhWqcPpomFw2ZVvh3lGtnrEbo0siSAJ+Qx4raPSRR tnRNsMbDNA7vChxnOTpo7343QJSwLISbqkliJTSFBaUNE9UeixvzrXc0KeM2bg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LpYx1tBE; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -3.57 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LpYx1tBE; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: F2BE3100E6 X-Spam-Score: -3.57 X-Migadu-Scanner: scn1.migadu.com X-TUID: fPIqLvMbkJjm Hugo Heagren writes: > I've added the condition-case back to the check on > `org-link-make-description', and added a new one to the check for the > `:default-description' parameter, as Ihor suggested. I've also > modified the handling of that parameter, to reflect > `org-link-make-description', and updated the docstring accordingly. Thanks! Some more comments: > + (condition-case nil > + (let ((def (org-link-get-parameter > + type > + :default-description))) > + (cond > + ((stringp def) def) > + ((functionp def) > + (funcall def link desc)))) > + (error > + (message "Can't get link description from %S" > + (symbol-name def)) Firstly, def will be undefined inside the error clause. Secondly, when :default-description is a lambda expression and that expression fails, your code will fail with "wrong-type-argument symbolp" when executing (symbol-name def). Please consider cases when `def' is not a string and not a function symbol. I recommend writing tests for org-insert-link in testing/lisp/test-ol.el and testing expected behaviour for various values of :default-description. > Apologies if the subject formatting is not correct, I'm still getting > the hang of git-send-email. You don't have to use git-send-email to submit simple patches. An easier (as for me) alternative is a simple email with attached patch. magit makes it trivial to create patch files. Best, Ihor