From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 0H2SFYAUuWR+UAAASxT56A (envelope-from ) for ; Thu, 20 Jul 2023 13:03:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eIhiFYAUuWRrjQAA9RJhRA (envelope-from ) for ; Thu, 20 Jul 2023 13:03:28 +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 E6A95557F3 for ; Thu, 20 Jul 2023 13:03:27 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b="R542L/4q"; 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=1689851007; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=KHbpkBOtxBOgOY66lqZSahSi8gASdA98BLZk/1AmfvI=; b=a1W7fPEvDJyKS66aB3pPyrMYRSzjlqodBLn3NEbtEH1tn89iyGcSn5n1N2rLUhuTOyoSA2 TqiWJ2F1awKqc3MPXNmsaS2joG7HXnpr4LJfeZ+03CB4r4OHHhUICc32BnwbuvhpHXxtns hHpToXOHzS0kUC40gorVFTrqiEz0i04rCvSHkOC2Bl4+wByDGwky9EHrWG9oXvw5cidJpU kB2nb7dI+JcTqfYYcSEbz/65wMUaXbozLYAlmgp3p6pB0dc6ouhgb2wfKgtu0GGJAcuLqE 0BjBOlRjySQAMI7nkdFYjhjGzlCqyMJT0jbej3+ckl464cWB6kk0N1LJMzc27A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1689851007; a=rsa-sha256; cv=none; b=HRhj1+skCHfcGlseqhQJwkioQG6GObLgvwS70F0BN+qWk/5ISuTlq2QJVNVnqX7hS8hcC9 bdXOL4WRXBa2+ZkSUDBqDifptDnh2vC9yDu+R96FHVORpSbNTKDHveFm4QymdCHkFM4GLu n5bIFuTdtYkoONWOclL2Geg/QQQBpmXVJ3AYlbQ2VURgXf1Yjd14oPFrAfCcYGhP2it46k frJJ8D8dLK3V3N2oDaUq6wGzTBVuo1oYFovuKuExyoEBCq3//PZ03sKLkhgfKL2EaAuJ9H zOfHzLiwsxy2wxSoVds4aKsWeek2pZgKaYApqTEOpUQGJikWhbuyW4nw68r6ww== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b="R542L/4q"; 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) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMRQY-0001uj-3g; Thu, 20 Jul 2023 07:02:34 -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 1qMRQD-0001sn-7A for emacs-orgmode@gnu.org; Thu, 20 Jul 2023 07:02:13 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qMRQ7-0001cx-SR for emacs-orgmode@gnu.org; Thu, 20 Jul 2023 07:02:11 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2b703cbfaf5so9030361fa.1 for ; Thu, 20 Jul 2023 04:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689850918; x=1690455718; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=KHbpkBOtxBOgOY66lqZSahSi8gASdA98BLZk/1AmfvI=; b=R542L/4qco4JJPRMehcDyrNjzQNc8AP1WCWfBd1I/vQSRJ5ioAo8vPgtcOarUpQz3R 59KzWTahi5OA1/KxDCTwJxpJ/BL1jIpbZvOHdy+PxDcgUbrLYXfakhdSNcqMD6T11zQZ oifhj3U7gyBlMIrtcYPQ2H6phDcEEPNZggaPggrVf9xjlFvJOodNFota5OZs/kzXrJfF ib1CBI73yttNXbAVHfyNKJSSsmg2tbJfSQNtf09LjhozXCAmDL8yRGZM+C1zvV0H0l3I T5RcBl0rA0fI2zjFc/fMge9pBc9Sop4hQEzWaNr3L1+lsZL7RR/qA9IIM40F33LDYMRs Xl2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689850918; x=1690455718; h=content-transfer-encoding:in-reply-to:mail-followup-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=KHbpkBOtxBOgOY66lqZSahSi8gASdA98BLZk/1AmfvI=; b=UK6UQ2TzTDO/CNcqq5f5XEvsrKojCxE/NYFd+Pyl0J9y/eKQG7bmbnaN9bgCuUvZb9 DhNeepQv0nAsRMdq5PK+MI9+fLsYkkX2K4dDA9d7GmA295s3hk05G9vCfo9YSQoLV2rm mgaa+Ls+H1yVKAX3s1PXGoj7tgIHeBP03hXjImG72K0583Ef1LHdAgi+L17akd6D/B4M 7xJvdrqRZbDUpnaY/afxw0BAoROXaOjzxr0suR04PXJMWMC0468invOOGv/9IPSLPRyv zDJV6m9jQacVOJ/joyKRuWnBFCZgII4XNso511hMgKse0vMKg9MuF4K5xHbnDMY5G09R r33g== X-Gm-Message-State: ABy/qLau432c9mjWgsPPLT/oME8EfSCxPJkQsmhqog3HldGIxYmw5cM+ /pJLKI+FOFImnIooLMy34vw= X-Google-Smtp-Source: APBJJlEaw6plCP8ZdZEgbxIhdC0ch9euAL30Vgm3sT2xQwQ6MYyxsqgLmjAytkckz17vzdtA66eqgQ== X-Received: by 2002:a05:651c:102d:b0:2b6:dec9:2812 with SMTP id w13-20020a05651c102d00b002b6dec92812mr1926104ljm.33.1689850918382; Thu, 20 Jul 2023 04:01:58 -0700 (PDT) Received: from [192.168.0.101] (nat-0-0.nsk.sibset.net. [5.44.169.188]) by smtp.googlemail.com with ESMTPSA id h22-20020a2e9ed6000000b002b6cb40e9aasm201072ljk.103.2023.07.20.04.01.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jul 2023 04:01:57 -0700 (PDT) Message-ID: <68592813-e8d4-a9d6-cb3d-51804236413d@gmail.com> Date: Thu, 20 Jul 2023 18:01:56 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: Is there a better (built-in) way to insert an org link with title as description? Content-Language: en-US To: Arthur Miller , emacs-orgmode@gnu.org References: From: Max Nikulin Mail-Followup-To: Arthur Miller , emacs-orgmode@gnu.org In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=manikulin@gmail.com; helo=mail-lj1-x22e.google.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.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, NICE_REPLY_A=-0.089, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: -3.41 X-Spam-Score: -3.41 X-Migadu-Queue-Id: E6A95557F3 X-Migadu-Scanner: mx1.migadu.com X-TUID: jc60bJpeNjdR On 19/07/2023 19:06, Arthur Miller wrote: > I want to auto insert a title from an HTML page as description for an org link in > my notes. > (defun org-link-from-clipboard () ... > (url-retrieve url > (lambda (buffer) > (goto-char (point-min)) > (when (re-search-forward "\\(.*\\)" nil t) What are origins of your links? If it is an URL opened in browser then `org-capture' or org-protocol:/store-link/ may be used. There are a number of browser extensions for that. More metadata sometimes desired and just page title is not enough. For extracting it within Emacs see e.g. Ihor's https://github.com/yantar92/org-capture-ref Search for its discussions on this mailing lists. Some complications: - titles may have &...; entities - Not all pages have , so heuristics have to be used. - Some HTML files contains nothing besides JavaScript to load actual content - Some URLs are from minifiers or obfuscated by Outlook "protection", trampolines to prevent leaking of data through the Referer header, etc. Likely redirection target should be saved, not original URL. - Some sites like GitHub have API that allows to get metadata in JSON format. It is better than parsing HTML with regexp. Anyway I suggest to split non-interactive part of the command to allow code reuse (for drag and drop, etc.).