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 SBA7Jvou+V7TXQAA0tVLHw (envelope-from ) for ; Sun, 28 Jun 2020 23:59:54 +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 QLsUIvou+V6JcgAAB5/wlQ (envelope-from ) for ; Sun, 28 Jun 2020 23:59:54 +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 BACFA94005D for ; Sun, 28 Jun 2020 23:59:53 +0000 (UTC) Received: from localhost ([::1]:50018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jphDD-0003vF-Ex for larch@yhetil.org; Sun, 28 Jun 2020 19:59:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jphCg-0003v7-Nk for emacs-orgmode@gnu.org; Sun, 28 Jun 2020 19:59:18 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:40072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jphCf-0000Kq-4G for emacs-orgmode@gnu.org; Sun, 28 Jun 2020 19:59:18 -0400 Received: by mail-pg1-x530.google.com with SMTP id e18so7484644pgn.7 for ; Sun, 28 Jun 2020 16:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:references:user-agent:from:to:cc:subject:in-reply-to :message-id:date:mime-version; bh=2AqTvYU9isdT/iz8hLiqpuMDo6YA8/ZFpejGi0+mseU=; b=OO+Q6ahkydwTteonxiubUY8sLZhSO0R8SQPPplK6VWEmyGfoRsjDTmWMw2BbSg64mZ QdZcY8RmpDOxGJIMDN5wtnADph/JozV8+fyXvC5lLYxtxRioX/3cM2UlfZeNuE4/xY0X GnqJps/BYsIqxl6O1lOYW/W7pTMlZYs5My5wdqsth6utajVoK/C+pTrNmjjRbDBK0aNk P/LhKSSzyWKwzF+nUPU5zwL1XMLtyLpHeTOSA8/9CWHyTZfI0JLlhAOa09sK4wzw1Do6 WMT5t+dl6dY2NR+IE4JpLga7jfRqxhkbFw/Jwbw4hDOVjlX4amb8VCehgXWCgGPaqg7I gK/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=2AqTvYU9isdT/iz8hLiqpuMDo6YA8/ZFpejGi0+mseU=; b=oL1gJBbufh2MS8XYI0PeyiKrPj3mlvRFpuJlTHnzbtmq/qwYdUN1ReU8v68SyzHwm+ 0v0QdodcbWqeSTgBGenNe0I8jPzhngBcCf5aR15XIpMVf6RqshysL+yhyZ4n6jajd8rc ULK3HkmgRQSIbZFR59SFeOJ5q8wUx3uqXXUu3m3+puXZWBAFIIO7CVIIo/r/N4qbGlBQ I/9m8Si3J/000KPTF7/+4CG16PYmmg8qNII2eSitQnCXRjMW1vSlGgR91E5FpGc/WRWG JPe0P75o0mIAM5BaUXWhK7fe5gpYV7PIvBpP7eCPR6FX3jPnBj9zUFL7jKVNElYo25dL 5QTg== X-Gm-Message-State: AOAM531NPq0/nN/p66Cg1jqbn37gZFLl+o6awjohFr2tLUIjG7xjfdry hi7BAphFWxhmIFrhdRLcnZlqVFTwAjg= X-Google-Smtp-Source: ABdhPJxPzl1+BpcBIGQIawliFWtADL3Fo4+DCyKzPUH56J5oG8YO+vZC7sW6fGGe0yGTUTWELfFnLA== X-Received: by 2002:a63:564e:: with SMTP id g14mr8006915pgm.326.1593388755511; Sun, 28 Jun 2020 16:59:15 -0700 (PDT) Received: from AIBRAGIM-M-J8Z8 (c-73-170-229-122.hsd1.ca.comcast.net. [73.170.229.122]) by smtp.gmail.com with ESMTPSA id g9sm31398365pfm.151.2020.06.28.16.59.14 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jun 2020 16:59:14 -0700 (PDT) References: <875zbac3al.fsf@kyleam.com> User-agent: mu4e 1.4.10; emacs 28.0.50 From: Ag Ibragimov To: Kyle Meyer Subject: Re: Smart processing of http(s) links In-reply-to: <875zbac3al.fsf@kyleam.com> Message-ID: Date: Sun, 28 Jun 2020 16:59:13 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=agzam.ibragimov@gmail.com; helo=mail-pg1-x530.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN X-Spam_action: no action 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=OO+Q6ahk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Spam-Score: 0.09 X-TUID: 31N8qXpOfaiP Oh cool. This is exactly what I needed: I was able to build this: #+begin_src emacs-lisp (defun get-gh-item-title (uri &optional include-number?) "Based on given github URI for (pull request or an issue), returns its title" (when (string-match "\\(github.com\\).*\\(issues\\|pull\\)" uri) ; either PR or issue (pcase-let* ((`(_ _ ,owner ,repo ,type ,number) (remove "" (split-string uri "/"))) (gh-resource (format "/repos/%s/%s/%s/%s" owner repo (if (string= type "pull") "pulls" type) number)) (resp (ghub-get gh-resource nil :auth 'forge))) (when resp (format "%s%s" (alist-get 'title resp) (when include-number? (format " #%s" number))))))) (defun org-link-make-description-function* (link desc) (cond ((string-match "\\(github.com\\).*\\(issues\\|pull\\)" link) (get-gh-item-title link :with-number)) (t desc))) (setq org-link-make-description-function 'org-link-make-description-function*) #+end_src https://gist.github.com/agzam/b2f2d441acb96e1d693a2c81e9c4518f On Sun 28 Jun 2020 at 14:02, Kyle Meyer wrote: > Ag Ibragimov writes: > >> Whenever I I use org-insert-link and it turns out to be a URI that >> starts with "https://github.com" I would like it to be processed >> differently than any other link, one example - if it is a PR or a >> Github Issue, I'd like it to fetch summary(title) of it and create a >> link that looks like this: >> >> [[https://github.com/user/repo/issues/3899][This issue needs to be fixed #3899]] >> >> Do we have any "built-in" mechanism for doing something like this? Can >> someone suggest how I can make it. Thank you! > > You can set org-link-make-description-function to a function that > detects links of interest and generates a custom description.