From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UCxpCwxwWV/cLwAA0tVLHw (envelope-from ) for ; Thu, 10 Sep 2020 00:15:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MFZtBwxwWV/eOwAA1q6Kng (envelope-from ) for ; Thu, 10 Sep 2020 00:15:08 +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 13C58940917 for ; Thu, 10 Sep 2020 00:15:05 +0000 (UTC) Received: from localhost ([::1]:44270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGAEx-0004XK-GM for larch@yhetil.org; Wed, 09 Sep 2020 20:15:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGADc-0004X3-Kn for emacs-orgmode@gnu.org; Wed, 09 Sep 2020 20:13:40 -0400 Received: from mx.flintfam.org ([107.191.44.89]:51359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGADa-00016D-AB for emacs-orgmode@gnu.org; Wed, 09 Sep 2020 20:13:40 -0400 Received: by mx.flintfam.org (Postfix, from userid 114) id 7F6FF1F595; Thu, 10 Sep 2020 00:13:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.9.2 mx.flintfam.org 7F6FF1F595 Received: from landau.flintfam.org (162-210-5-149.lnk.ne.static.allophone.net [162.210.5.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.flintfam.org (Postfix) with ESMTPSA id 5F12D1F565 for ; Thu, 10 Sep 2020 00:13:23 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.9.2 mx.flintfam.org 5F12D1F565 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flintfam.org; s=mail; t=1599696803; bh=HgnoBzKe5fU1XWMBVOyUxtjQs2VhvM9F/8y6n1CTuSY=; h=From:To:Subject:Date:From; b=Hkr6/rb9MbTEaf2fhuThDFAFRYK8kSrIh6IH23AOPJk/g1gP7FzzolprkIBDs/c+Q qdkyHHVDOaADClnrbs9MHxeACeC9OEZUfsUbyzhB2vOcZADLxvTN2WPL7cw9DRx3Ji 4gqizK/5UpoLnoF9/L5lPh0it1GdIvzzHoqUwgKGHHRxSqMxtyuq7/StfxIVsHKbL3 sW0Sh5ZFqY6GaHNZ5y135e6BJUslmyPfB9Q4SnATcNlhEpfLV/7BTCg0r1eV5HAqGs W6tYbrBv+OtajbNGQYy+YkEUggjvuTyy5vadrxRKUrku9/ApuQnbKTsNYv4NNtOwiQ ty1WGXxTbO2xg== From: swflint@flintfam.org (Samuel W. Flint) To: "Org-Mode" Subject: [PATCH] Add %L (the link content *not* as a full link) to Capture expansions Date: Wed, 09 Sep 2020 19:13:22 -0500 Message-ID: <87pn6uij4t.fsf@flintfam.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=107.191.44.89; envelope-from=swflint@flintfam.org; helo=mx.flintfam.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/09 20:13:25 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=flintfam.org header.s=mail header.b=Hkr6/rb9; 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-Spam-Score: -1.21 X-TUID: yomT91D6rvpX --=-=-= Content-Type: text/plain Hello, In an attempt at automating a part of my workflow, I found that org-capture's %l didn't quite fit what I needed. Normally, org-store-link does the right thing, but for some capture tasks, I want to custom generate the description, so %l doesn't work. I've attached a patch that adds %L, a version that doesn't add the link brackets. Thanks, Sam Flint -- Samuel W. Flint 4096R/FA13D704 (F50D 862B 4F65 5943 A8C2 EF0E 86C9 3E7A FA13 D704) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=org-capture.el.diff diff --git i/lisp/org-capture.el w/lisp/org-capture.el index 2cc1ce394..e638eabfa 100644 --- i/lisp/org-capture.el +++ w/lisp/org-capture.el @@ -308,6 +308,7 @@ be replaced with content and expanded: %a Annotation, normally the link created with `org-store-link'. %A Like %a, but prompt for the description part. %l Like %a, but only insert the literal link. + %L Like %l, but no brackets (the link content itself). %c Current kill ring head. %x Content of the X clipboard. %k Title of currently clocked task. @@ -1574,6 +1575,9 @@ The template may still contain \"%?\" for cursor positioning." (v-l (if (and v-a (string-match l-re v-a)) (replace-match "[[\\1]]" nil nil v-a) v-a)) + (v-L (if (or v-a (string-match l-re v-a)) + (replace-match "\\1" nil nil v-a) + v-a)) (v-n user-full-name) (v-k (if (marker-buffer org-clock-marker) (org-no-properties org-clock-heading) @@ -1626,7 +1630,7 @@ The template may still contain \"%?\" for cursor positioning." ;; Mark %() embedded elisp for later evaluation. (org-capture-expand-embedded-elisp 'mark) ;; Expand non-interactive templates. - (let ((regexp "%\\(:[-A-Za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlntTuUx]\\)")) + (let ((regexp "%\\(:[-A-Za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlLntTuUx]\\)")) (save-excursion (while (re-search-forward regexp nil t) ;; `org-capture-escaped-%' may modify buffer and cripple @@ -1663,6 +1667,7 @@ The template may still contain \"%?\" for cursor positioning." (?k v-k) (?K v-K) (?l v-l) + (?L v-L) (?n v-n) (?t v-t) (?T v-T) --=-=-=--