From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cPnsAxXzm175AwAA0tVLHw (envelope-from ) for ; Sun, 19 Apr 2020 06:43:33 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0Od6HRnzm17NXAAAB5/wlQ (envelope-from ) for ; Sun, 19 Apr 2020 06:43:37 +0000 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 E3273941E4C for ; Sun, 19 Apr 2020 06:43:36 +0000 (UTC) Received: from localhost ([::1]:38280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ3g0-0000pQ-8l for larch@yhetil.org; Sun, 19 Apr 2020 02:43:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42820) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQ3er-0000DD-CR for emacs-orgmode@gnu.org; Sun, 19 Apr 2020 02:42:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQ3eq-0008QU-Qb for emacs-orgmode@gnu.org; Sun, 19 Apr 2020 02:42:25 -0400 Received: from w4.tutanota.de ([81.3.6.165]:37638) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jQ3eq-0008NT-20 for emacs-orgmode@gnu.org; Sun, 19 Apr 2020 02:42:24 -0400 Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 0F0E510600E8 for ; Sun, 19 Apr 2020 06:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1587278539; s=s1; d=lambda.icu; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=58817odB93AP43gaSUT8b/22Ul5oHdu6f3vWSrF1uJQ=; b=2+fKEYMzq7kUFQlwnlI+retocdEZ7N4+LovK1YTzqTp+I4kKkAVQ5lo2lk+qyxRJ gtXc4VlpiM0vmNrujf3Ev6mJiiK3HXVHkyGiCoibrQTMI3p2WWUEg62qMUp/XUEH2Gk yYeOIe96XyHWQABfqyGwthuJ1gWy3INC16yUBD4PH1+xA53or5l/jjT2BAMmwh30nrj c6DZcNfrZx4o2UqSgVjTBtJKzKDKwYZ/Tidu6ICSSWzJDJZWETAb5sxdtcZ/dPksHp2 cBUPjzC0ody6G5E7Swm9mZ/EnZtfJdZKsafZTWhhGTsbKHrESs7EZaF9FY9tN4y0+wX H/WIZQNokA== Date: Sun, 19 Apr 2020 08:42:19 +0200 (CEST) To: emacs-orgmode@gnu.org Message-ID: Subject: Public API change: How to handle function signature change gracefully MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=81.3.6.165; envelope-from=benny@lambda.icu; helo=w4.tutanota.de X-detected-operating-system: by eggs.gnu.org: Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 81.3.6.165 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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" Reply-to: Benjamin Andresen From: Benjamin Andresen via "General discussions about Org-mode." X-Scanner: scn0 X-Spam-Score: -0.11 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=lambda.icu header.s=s1 header.b=2+fKEYMz; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-0.11 / 13.00]; HAS_REPLYTO(0.00)[benny@lambda.icu]; GENERIC_REPUTATION(0.00)[-0.57235360881313]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.24), country: US(-0.01), ip: 209.51.188.17(-0.57)]; TO_DN_NONE(0.00)[]; R_DKIM_REJECT(1.00)[lambda.icu:s=s1]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; DKIM_TRACE(0.00)[lambda.icu:-]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[209.51.188.17:from]; TO_EQ_FROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[emacs-orgmode@gnu.org,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[gnu.org]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: k3j1Gq4uTR12 Hello everyone, I would like to change the public API of the :face part of `org-link-set-pa= rameters': =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (org-link-set-parameters "file" = :face 'org-link) My ultimate goal is to have org-links be able to be have their face changed= based on the contents, not just the path of the link. I found the relevant code in org.el in the function `org-activate-links': =C2=A0=C2=A0 'face (pcase (org-link-get-parameter type :face) =C2=A0=C2=A0 ((and (pred functionp) face) (funcall face path)) =C2=A0=C2=A0 ((and (pred facep) face) face) =C2=A0=C2=A0 ((and (pred consp) face) face) ;anonymous =C2=A0=C2=A0 (_ 'org-link)) and would like to change this to=20 =C2=A0=C2=A0 'face (pcase (org-link-get-parameter type :face) =C2=A0=C2=A0 ((and (pred functionp) face) (funcall face path contents)) ;; = this is the change =C2=A0=C2=A0 ((and (pred facep) face) face) =C2=A0=C2=A0 ((and (pred consp) face) face) ;anonymous =C2=A0=C2=A0 (_ 'org-link)) Now that will introduce a host of call issues because the callees don't exp= ect to the amount of arguments changed under their bottom. I would like some guidance how I could get what I think is neat: The conten= ts of the bracket-style links as an additional parameter to set faces on an= d not breaking existing hookups. I'm thinking to change the above code to look at the callee's function sign= ature and checking how many arguments it accepts and then use the right fun= call for the situation. To make this more palatable I would suggest it's changed so that the 2nd ar= gument will be a list of alists or keywords so to not have this function si= gnature problem if someone else comes up with a reason to introduce yet mor= e data. Thanks in advance, Benjamin Andresen