From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 2KPyItOSu2SoIAEASxT56A (envelope-from ) for ; Sat, 22 Jul 2023 10:26:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YNoHItOSu2SbNwAAG6o9tA (envelope-from ) for ; Sat, 22 Jul 2023 10:26:59 +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 45A4E3813D for ; Sat, 22 Jul 2023 10:26:59 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=IOqUeH0Q; 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=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1690014419; 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=USpT+USmNvhuwfJPJmMu4tsRY7b+Twl8/qO8r3bzOxs=; b=HKNjYXLnnk3BsRDZs1F1ZZSvJxz4sJOb74dhutgzh1dMFiVBUTDUducHJMSKjg6VwGEe9p jY6dnx2Esx1+unWLTEndchn2NAGUJz5UAFBhi8SCWAXLbsESAmb/gmmIXiW3A/x54sEE41 l3qLrkDank63sk/hFkPJHG0ikIeTlmdvM4I1dwjfu8eDiIdkz+A7YSaco86cB95Ll5ZXQ4 80hfmzANuQv2hmTHn2OcU3fwCpk425QYhicYoqePkKqSHoSc3u+DnHBsgEgQ0FWPpMOOeH bZiotPGdXzaWBq73J5vhuowWJGiYMUAhAXW36Nue53vrek51OF0uM26WGemaxA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1690014419; a=rsa-sha256; cv=none; b=jcXFkYjEFtlQo4CPJPjS5trD+ybdFPiZwGB9PodeEGKjMSlGArIKm+PA1HL1c5Q4vrq4Yq JNQcpmyx7vLJsgietgf2zgiA32zk4LWjghNBbdpqO+PnkDbFIPZmNXnScslbUpHE9k5Ecx JAcKtaWZrNqXPhfQWEPBmjPzVsc6xvBOo3kFwgwtBXqNAgRiWb7C05cQKAI8w3rdYaRSuE ym2qMcF+TzoW62/jpqqCBHgx37Uz9AyCCbZGF+tAMvl0YXU0aJAXUeU77IvGVjk+BvwtOt pijSFqmTsn9i64Y1xGGZlKiU9u0wqfG08X6Su62ZJXCorpVxScnstS/1FMUguw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=IOqUeH0Q; 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=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qN7wJ-0000ed-1d; Sat, 22 Jul 2023 04:26:11 -0400 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 1qN7wF-0000dW-I3 for emacs-orgmode@gnu.org; Sat, 22 Jul 2023 04:26:07 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN7wB-0004Up-Nq for emacs-orgmode@gnu.org; Sat, 22 Jul 2023 04:26:07 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 757DA240101 for ; Sat, 22 Jul 2023 10:26:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690014361; bh=XS17shf6o/tumLFtDKNzrsQJAASe4Kpb8lxSNAh5xxk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=IOqUeH0Q8zQvbll8K0HJKY2lvVWJJESVy6ynUWgABeFflQcguw+G3FnVPncgtDunt GSB7zGFh+HvnXidnag2KiDQMMr226sQUW9xS3Q8B0DS3zige4wM+NQossBnznX/hyy jfaCCfavJq13GMtrFpdWy7HxK1Xj3yUNMFZhTsVCLbdw+4jGBn7sWSnkusyL8gwADV ezObskGt/tp3BDz70q+qu8F2K1I6K1aYqWX3eaUZATUDKR4e7FD55b+2IWkzlwFh+L 2oyfNUP0LQxr9rksm08fxyr9F0iA8sLAugUqzIoLq5yABstxFIqfo7LzD9youc8uC+ 3LteWpAjGXK1w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4R7KJ85M41z9rxT; Sat, 22 Jul 2023 10:26:00 +0200 (CEST) From: Ihor Radchenko To: Arthur Miller Cc: emacs-orgmode@gnu.org Subject: Re: Is there a better (built-in) way to insert an org link with title as description? In-Reply-To: References: <87351irjad.fsf@localhost> Date: Sat, 22 Jul 2023 08:26:13 +0000 Message-ID: <87h6pw8i8q.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , 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: mx2.migadu.com X-Migadu-Spam-Score: -8.24 X-Spam-Score: -8.24 X-Migadu-Queue-Id: 45A4E3813D X-TUID: J4L1e9xqFzQv Arthur Miller writes: >> (org-link-set-parameters "http" :insert-description #'your-function) >> (org-link-set-parameters "https" :insert-description #'your-function) > > Thanks, after some thinkering I got it: > > ... > (org-link-set-parameters "http" :insert-description #'org-desc-from-clipboard) > (org-link-set-parameters "https" :insert-description #'org-desc-from-clipboard) > #+end_src > > And I can do it async too, *but*; this will affect all insertions of links, > right? Indeed. By design, `org-insert-link' is synchronous - it expects the link and description to be available upon request. > I am not sure if it is safe/possible always to access the internet or do > it asynchronously, so I'll abandon the ship and revert to home-cooked one just > for the precautios measures: What you can do is (1) make url descriptions be something like ; (2) add an :after advice for `org-insert-link' that will queue asynchronous url fetching; (3) replace <title to be retrieved> with the fetched title upon finishing the request. If the request fails, the description will remain <title to be retrieved>. Or you can run description retrieval independently, as a minor mode that will search for <title to be retrieved> marks and try to fetch them. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>