From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id YGkQNcBdo2RK8QAASxT56A (envelope-from ) for ; Tue, 04 Jul 2023 01:46:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6JoLNcBdo2RVKwEAauVa8A (envelope-from ) for ; Tue, 04 Jul 2023 01:46:08 +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 5249F31EA6 for ; Tue, 4 Jul 2023 01:46:08 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGTEp-0001PP-Os; Mon, 03 Jul 2023 19:45:47 -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 1qGTEm-0001P7-Js for emacs-orgmode@gnu.org; Mon, 03 Jul 2023 19:45:46 -0400 Received: from out-8.mta0.migadu.com ([91.218.175.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGTEj-00007x-EM for emacs-orgmode@gnu.org; Mon, 03 Jul 2023 19:45:44 -0400 References: <20230630221120.21657-1-eugene.dev@lipklim.org> <87fs65gnzk.fsf@localhost> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lipklim.org; s=key1; t=1688427936; h=from:from: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; bh=9E1SGg6xL4Atp8K5p9EaObTkRLXYNeNeKQ7UBVDPv90=; b=y/u7akOpI7oB8+/BjFD7KZab2lgcNMPS+mkz55C2mE6OyY8dMvo0aQjwOQZPhJQO1sCu/Q xcygzUVPOLaKctxddDn0chMJFbIWZPsjvSwSPHqKqn2B4Si+MrJJ31kGTAcLX3NA3rrkrY ibsuCp7+2UjigQySLWPyyjVApnaUvWo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Evgenii Klimov To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH v2] Keep the link if the command was cancelled Date: Tue, 04 Jul 2023 00:43:33 +0100 In-reply-to: <87fs65gnzk.fsf@localhost> Message-ID: <87y1jwv9sw.fsf@lipklim.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=91.218.175.8; envelope-from=eugene.dev@lipklim.org; helo=out-8.mta0.migadu.com 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, 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-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688427968; a=rsa-sha256; cv=none; b=dsLBWBjXejhFBnFlI8q24CF0rB7S7qhKxRTbFZAcmQZUTHPNwvO1KQaHdzsdGtjlADQXLM d0VQfW8sgUnFAZNLRKG4JNcjXV2unVHHvAwx5BdsV9Y/efPXpGPpkRdOW/d1fjbQe1sC9r OSa3xN75JOvY74A0VpZ601dyy1rBdFNcePRf+rmj4xdrUuUulWBm32f60Ie5uRo/9JRwIk qcvruXhpPBLrJbHVUUlqUSN/BEzqJt3sE7f529ETum/Mxemm3pJPuaaaf9vQUf9MP9jfsW 1w0IM0r7AXqoUjnCg3xfAM9ls1U+rCkM+bicjP3VHOgdySBRB6ywz05jcw/JCg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lipklim.org header.s=key1 header.b="y/u7akOp"; dmarc=pass (policy=quarantine) header.from=lipklim.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688427968; 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=9E1SGg6xL4Atp8K5p9EaObTkRLXYNeNeKQ7UBVDPv90=; b=fG3T0UGsLPdeDkoL7kTXPJeAb15+huH6Vj6msflQ3Cs+0kPOEsKDUX93Prf+k6NIwHgGqO aQC2DhCYV+l9Pw5Ailt7Xs17c6UCZZUrpH7ONN1zmB9j3K4CgdHU4Elws2RGwWi/zmzWla 3i0lRe/6O05sA9tnS8C1vD6lnVlaqnx/F77Zftniw8smnELsKN8NGtqi5bTjtS8alwdWNu We1W55wmo8DwamdHQQ5QnC509ghnV+K5KoVkwQKuBOVyADbRjJzTClpQl1p3jVqRNqBupk DQn4vdHSQ8V7Oy10WqqDqTH1Re2v7XPydCgUZcWbIu/KPDyFGz6po1feZNMzqw== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lipklim.org header.s=key1 header.b="y/u7akOp"; dmarc=pass (policy=quarantine) header.from=lipklim.org; 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" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -11.46 X-Spam-Score: -11.46 X-Migadu-Queue-Id: 5249F31EA6 X-TUID: g5ak/sUE/NRT --=-=-= Content-Type: text/plain Ihor Radchenko writes: > Evgenii Klimov writes: > [...] >> - (when (funcall (if (equal complete-file '(64)) 'not 'identity) >> - (not org-link-keep-stored-after-insertion)) >> - (setq org-stored-links (delq (assoc link org-stored-links) >> - org-stored-links))) >> - >> (when (and (string-match org-link-plain-re link) >> (not (string-match org-ts-regexp link))) >> ;; URL-like link, normalize the use of angular brackets. >> @@ -1995,6 +1990,10 @@ Use TAB to complete link prefixes, then RET for type-specific completion support >> (read-string "Description: " initial-input) >> initial-input))) > > The code below the removed form can modify `link' variable. If such > modification does happen, your patch will fail to remove the link from > `org-stored-links' - (assoc link org-stored-links) will no longer return > non-nil. I added `link-original' variable to keep it intact until we want to remove the link from `org-stored-links'. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Keep-the-link-if-it-was-not-inserted.patch >From a5ff8d4fe27fd503a6ddb719a622a980a73789a7 Mon Sep 17 00:00:00 2001 From: Evgenii Klimov Date: Fri, 30 Jun 2023 22:56:39 +0100 Subject: [PATCH] Keep the link if it was not inserted * lisp/ol.el (org-insert-link): Keep the link in `org-stored-links' if the command was interrupted by the user during the reading of a description from the minibuffer. --- lisp/ol.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index e2bf90acd..1490bde86 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1820,7 +1820,7 @@ non-interactively, don't allow to edit the default description." (all-prefixes (append (mapcar #'car abbrevs) (mapcar #'car org-link-abbrev-alist) (org-link-types))) - entry) + entry link-original) (cond (link-location) ; specified by arg, just use it. ((org-in-regexp org-link-bracket-re 1) @@ -1896,11 +1896,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (or entry (push link org-link--insert-history)) (setq desc (or desc (nth 1 entry))))) - (when (funcall (if (equal complete-file '(64)) 'not 'identity) - (not org-link-keep-stored-after-insertion)) - (setq org-stored-links (delq (assoc link org-stored-links) - org-stored-links))) - + (setq link-original link) (when (and (string-match org-link-plain-re link) (not (string-match org-ts-regexp link))) ;; URL-like link, normalize the use of angular brackets. @@ -1995,6 +1991,10 @@ Use TAB to complete link prefixes, then RET for type-specific completion support (read-string "Description: " initial-input) initial-input))) + (when (funcall (if (equal complete-file '(64)) 'not 'identity) + (not org-link-keep-stored-after-insertion)) + (setq org-stored-links (delq (assoc link-original org-stored-links) + org-stored-links))) (unless (org-string-nw-p desc) (setq desc nil)) (when remove (apply #'delete-region remove)) (insert (org-link-make-string link desc)) -- 2.34.1 --=-=-=--