From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uF3wMKS2+V6ufgAA0tVLHw (envelope-from ) for ; Mon, 29 Jun 2020 09:38:44 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id GGaHLKS2+V6FSAAAbx9fmQ (envelope-from ) for ; Mon, 29 Jun 2020 09:38:44 +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 3B7CE9404E2 for ; Mon, 29 Jun 2020 09:38:44 +0000 (UTC) Received: from localhost ([::1]:47986 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jpqFO-0005QC-Ii for larch@yhetil.org; Mon, 29 Jun 2020 05:38:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jpqCd-0000iy-64 for emacs-orgmode@gnu.org; Mon, 29 Jun 2020 05:35:51 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:45626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jpqCa-0008Bz-TJ for emacs-orgmode@gnu.org; Mon, 29 Jun 2020 05:35:50 -0400 Received: by mail-wr1-x434.google.com with SMTP id s10so15780253wrw.12 for ; Mon, 29 Jun 2020 02:35:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=6ce81jNyJUfiIKHHr5KUG2cRp+iiuHeAfncNG7hxL/E=; b=pocaP7vTDlbjvw4Ih8NFbip6yKNhss2ODMJXuKETJCsrpX1cRToX9qJ6Ct4WSS2tuD 6nVxE06DvRlaY65s4meyIDIgMR8+/FU1w1+mDyBg39q++fqgWhs9UE8hw6eeh2JnhUVH EY1Oph9UhPY5KZ0tJho1lAaY8X8/cUEbGWbdcBe9xggwU0tmfEuBGl7WiHR8fNVsyxNo 3hqjuUPK5+P9aQk2goMnvrrKLHV87KRMvWeg+S7iCFgbUUDT5TfJbc2QXPq7CnnA/XbU v5OQggieIP3TZ0ausBkvhoJ5JTSgKa8nxV/IOZ4nhJbjtMKDH76g1ucG3UkP31RwRpfx ochQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=6ce81jNyJUfiIKHHr5KUG2cRp+iiuHeAfncNG7hxL/E=; b=rRPh07HYwW6yGGnQpIUyOD0inB+DL3wS2R6pY4uG1zHCgrC41n23yXC69j5BqMbTk5 P4r51daxO1Sp5TfLv1F8ZimXZedqaKcc/iui0SNnoeVzsup2b0j/e3H5a03SRXus89B4 xOfn9oRsgr0RZDRxP4T3YtHUNI2DkmiekfJF553pP+Vd1L2FNWa25jRcWNpI55VYxrz/ V4/aNpEip0YyZJuW8NokccjE4RUn71V5WOG+zoZwHspj3Y+3OUKH/0lfHTS+lmt12rd1 W7g+TYMdUnGez0GyQsO/rYa5wapIdSC1LrzDr79ZAMwZyuAbWEqt+nzo0LI1R1o9IlMJ hTJQ== X-Gm-Message-State: AOAM531GO//4wRahFKqthkxkIuY09z0aQYawDQKGTxmjfV9GvGMK4Vq6 f33/hBnQzmazRkhq0Trp03a4pM4D X-Google-Smtp-Source: ABdhPJxwzMjLoc0xzE4XQKEOFQfxYYimJEQdHv6GC3hdZSaN5BTm8trjDvTliWmrfEastCujn9g37Q== X-Received: by 2002:adf:e3c5:: with SMTP id k5mr16283949wrm.121.1593423346553; Mon, 29 Jun 2020 02:35:46 -0700 (PDT) Received: from susa ([41.80.75.245]) by smtp.gmail.com with ESMTPSA id x14sm47590328wrt.60.2020.06.29.02.35.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jun 2020 02:35:46 -0700 (PDT) From: bonfacemunyoki@gmail.com (Bonface M. K.) To: Ag Ibragimov Subject: Re: Smart processing of http(s) links References: <875zbac3al.fsf@kyleam.com> Date: Mon, 29 Jun 2020 12:35:41 +0300 In-Reply-To: (Ag Ibragimov's message of "Sun, 28 Jun 2020 16:59:13 -0700") Message-ID: <864kqurz82.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=bonfacemunyoki@gmail.com; helo=mail-wr1-x434.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, URIBL_BLOCKED=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=pocaP7vT; 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: qtoHitB6C3Bo Ag Ibragimov writes: > 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 > Thanks for this! > 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. > > -- Bonface M. K. (https://www.bonfacemunyoki.com) One Divine Emacs To Rule Them All GPG key = D4F09EB110177E03C28E2FE1F5BBAE1E0392253F