From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id GFI9K4sI2mTC0wAASxT56A (envelope-from ) for ; Mon, 14 Aug 2023 12:57:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oDA3KosI2mQBGAEAG6o9tA (envelope-from ) for ; Mon, 14 Aug 2023 12:57:15 +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 5317A6EA91 for ; Mon, 14 Aug 2023 12:57:15 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=QXneqkFx; dmarc=pass (policy=none) header.from=posteo.net; 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=1692010635; 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=1MRv92wanETZcCG8LWxQ7s862//DrHIJi9kaAVnOXDo=; b=HjEk5WdwYGc2+SVOWGoo8jXFP7hp0pjivuvUDIJ29pdTwUxzcccvGNqYN0orfAheLu5wB5 Ywogn9GLI2JLZ2ORGK68E0hGrn0/r9urbm1jNhKaUQmnnv0TVvSjDTKLfoPdAPo7hZtlti TDaH2tCkwvFQ8FQvsL1oVS/+0iLMxSksjClz6mWdPPkyZxASd3BA9TMLfElkuf8N8sTzbg OML6PF9UJrGyLB0AcAsQ5vzekgJLWiXkw6OIwSrwLJuHSMant1jfpg74M9kpfxc42Wfg5f XgPmCoWUrftOPwA7UjmQOjc3ZuEc4coRUg+HOb09UNJ7LXvtyArB1BacAIqk1w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=QXneqkFx; dmarc=pass (policy=none) header.from=posteo.net; 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-Seal: i=1; s=key1; d=yhetil.org; t=1692010635; a=rsa-sha256; cv=none; b=Izcwl4qTL2ngXKaTmcMVwLKQZB1vZl0S118pcoSvfA0Xj6+bzgiGUDzWXviEA5H60z5OvV cNQQyXsaGHylwcnE5atSYMY/oQgPYFX7FTymuaPFbqe2zXnJ9pK8HhZNl3Bccv3Nu3euP0 TKMJivQyW1VulDDlJNp5P6t38nBiJ8Hj9M92KJyRtbAFCLT7Wcg46A8Uw9q3fl6ZCi+U0Q NiBtRn0tQDYHYidOlUWRz/lSdobxhVNwUtj8LxYjO61NOqmPMcQZftXLzAzTSR/Qt6ryJF 6bsRczPCY7IGsXnh3loeeGQSyZDCiZIW4QtXFOL/TJpX69zrEf+V2W9Y1cCyUA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qVVAX-0008IQ-AS; Mon, 14 Aug 2023 06:51:29 -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 1qVVAW-0008Hu-BZ for emacs-orgmode@gnu.org; Mon, 14 Aug 2023 06:51:28 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVVAU-0000JX-5Y for emacs-orgmode@gnu.org; Mon, 14 Aug 2023 06:51:28 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 25302240028 for ; Mon, 14 Aug 2023 12:51:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692010284; bh=EGofK7AE3hs3PM1ZSu7Ohlg8/Pwi3FDCJrVdaDyLFfk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=QXneqkFx64CSMnvfzPHrRXRrgoLxyVoh/FMuuqWN8YIyGEX5KBu5D3Ep9g3XhaYkm qOmxdSz/iVdQ1rgydE01Bi4NftWUjBIhs5EJte7osLhfLuTWmH9olMWb2feac1CDqs xeHFFjPlEtSs47sZS4Hvs3kloT0NTIrV7+V6ikqcw38Cym5F8HxgvVCCrpbuv73SuV 4tYx0SOC/2FssB+WIjwmh2dsZynzAaG0dikGtG6szJPZRtYXj5M+wNhuMgOlNv4gzv Y2P5IcnhtSJeLDpU/KGcsglRsm9XRLKv4vLWRZPgp4iNkv4uOmo6i4zJjJqPapL9lD Dz0mJb2/Vt7Yg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RPWRH0VCJz6tw6; Mon, 14 Aug 2023 12:51:22 +0200 (CEST) From: Ihor Radchenko To: Bastien Guerry Cc: Anthony Carrico , emacs-orgmode@gnu.org Subject: Re: [PATCH] Re: what is the purpose of "This link has already been stored"? In-Reply-To: <87fs4n2smr.fsf@bzg.fr> References: <87ilb8vsns.fsf@localhost> <87mt0iwoii.fsf@localhost> <87h6qqwh23.fsf@localhost> <87fs62acea.fsf@localhost> <874jlcovnw.fsf@gnu.org> <87leelrjku.fsf@localhost> <87a5v1pscr.fsf@bzg.fr> <87edkasz6z.fsf@localhost> <87fs4n2smr.fsf@bzg.fr> Date: Mon, 14 Aug 2023 10:51:48 +0000 Message-ID: <87wmxxq4l7.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -8.37 X-Migadu-Queue-Id: 5317A6EA91 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -8.37 X-TUID: p8Q+vvfP3vrv --=-=-= Content-Type: text/plain Bastien Guerry writes: > Here is another suggestion: > > 1) Remove the option and make adding the dup link on top the default. > > (1) is because removing this option would be a breaking change, and > inflincting a new option to every user to deal with a hypothetical > use-case does not seem right. > See the attached tentative patch. > 2) Also remove the current C-u C-u C-u arg and make it the default > when a region is active. > ... > (2) should be done anyway. I studied this further and what you suggest will interfere with `org-link-context-for-files'. It will no longer be possible to select text very long and multi-line link description, M-x org-store-link, and get the selected text as stored link description. The current default of using active region as description makes more sense, IMHO. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-store-link-Never-allow-link-duplicates-in-org-st.patch >From 7d8ed8f767c632bbb94f236fd08ee31e0d573e39 Mon Sep 17 00:00:00 2001 Message-ID: <7d8ed8f767c632bbb94f236fd08ee31e0d573e39.1692010108.git.yantar92@posteo.net> From: Ihor Radchenko Date: Mon, 14 Aug 2023 13:39:47 +0300 Subject: [PATCH] org-store-link: Never allow link duplicates in `org-stored-links' * lisp/ol.el (org-link-store-existing): Remove the previously added custom option. (org-store-link): Do not use `org-link-store-existing' removing all the code branches for values other than 'move-to-front. * etc/ORG-NEWS (~org-store-link~ now moves an already stored link to front of the ~org-stored-links~): Remove reference to the removed custom option. Link: https://orgmode.org/list/87leeffd1z.fsf@localhost --- etc/ORG-NEWS | 6 ------ lisp/ol.el | 37 +++++++++++-------------------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 1dc0a4519..6169dacf9 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -31,12 +31,6 @@ Now, ~org-store-link~ moves the stored link to front of the list of stored links. This way, the link will show up first in the completion and when inserting all the stored links with ~org-insert-all-links~. -The new behavior is controlled by new customization ~org-link-store-existing~. - -Users can set ~org-link-store-existing~ to nil to revert previous -defaults. The value of =store-duplicate= will force duplicate links -in ~org-stored-links~. The default value is =move-to-front=. - *** Major changes and additions to Org API **** New term: "syntax node" diff --git a/lisp/ol.el b/lisp/ol.el index 3a8ca5f39..20aab6bb8 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -509,20 +509,6 @@ (defcustom org-link-keep-stored-after-insertion nil :type 'boolean :safe #'booleanp) -(defcustom org-link-store-existing 'move-to-front - "Variable controlling how to deal with already stored links. -When nil, ignore store request for an already stored link. -When symbol `move-to-front', move the stored link to the front of -`org-stored-links'. -When symbol `store-duplicate', add a duplicate in front." - :group 'org-link-store - :type '(choice - (const :tag "Do no store duplicate" nil) - (const :tag "Move stored duplicate to front" move-to-front) - (const :tag "Store duplicate" store-duplicate)) - :safe #'symbolp - :package-version '(Org . "9.7")) - ;;; Public variables (defconst org-target-regexp (let ((border "[^<>\n\r \t]")) @@ -1764,18 +1750,17 @@ (defun org-store-link (arg &optional interactive?) (if (not (and interactive? link)) (or agenda-link (and link (org-link-make-string link desc))) (dotimes (_ (if custom-id 2 1)) ; Store 2 links when CUSTOM-ID is non-nil. - (pcase org-link-store-existing - ((or `store-duplicate - (guard (not (member (list link desc) org-stored-links)))) - (push (list link desc) org-stored-links) - (message "Stored: %s" (or desc link))) - ((or`nil (guard (equal (list link desc) (car org-stored-links)))) - (message "This link has already been stored")) - (`move-to-front - (setq org-stored-links - (delete (list link desc) org-stored-links)) - (push (list link desc) org-stored-links) - (message "Link moved to front: %s" (or desc link)))) + (cond + ((not (member (list link desc) org-stored-links)) + (push (list link desc) org-stored-links) + (message "Stored: %s" (or desc link))) + ((equal (list link desc) (car org-stored-links)) + (message "This link has already been stored")) + (t + (setq org-stored-links + (delete (list link desc) org-stored-links)) + (push (list link desc) org-stored-links) + (message "Link moved to front: %s" (or desc link)))) (when custom-id (setq link (concat "file:" (abbreviate-file-name -- 2.41.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--