From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ULlBLSFF82KUCgEAbAwnHQ (envelope-from ) for ; Wed, 10 Aug 2022 07:41:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GNlfLCFF82JgVAEAG6o9tA (envelope-from ) for ; Wed, 10 Aug 2022 07:41:53 +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 4A7CA7466 for ; Wed, 10 Aug 2022 07:41:53 +0200 (CEST) Received: from localhost ([::1]:43518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLeTX-0004vo-Sg for larch@yhetil.org; Wed, 10 Aug 2022 01:41:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLeQS-0004vM-Kv for emacs-orgmode@gnu.org; Wed, 10 Aug 2022 01:38:43 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:45634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLeQQ-0002qU-Ov for emacs-orgmode@gnu.org; Wed, 10 Aug 2022 01:38:40 -0400 Received: by mail-pl1-x62e.google.com with SMTP id 13so11871626plo.12 for ; Tue, 09 Aug 2022 22:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc; bh=yH6a9KIDmxpiYHGzqckEdodH/zGrWzgS3S8LruOPRgo=; b=NhxeZQSjevvmeJMljZqWM8M+95KNhW2Tz2wpisbHVjxNb2zhD1kKIfacEgif7BpUtT buGNxw19oF7BzjEfbSn9yggV3W5hos3MMNF8z5a+PRsDAcYBGxnoLjHkMzlZd2QKKkt1 addboV4Xt7cIXlvb6wMPj9YQM/3hZdXPPauoh0v+9UqDpzovrsECbm27WrYuM+xRUYBa 3Q2oXxnYJ0CcE9zl9ByJOi3QpFTOo6rdd6CzfgG82So4kGCkFAirxuSHAE0z1e/xi7nT D7g+iQtRB5OuqlOc3EuMtnHRSw6bs4nO6AgQ1a9aWqJyoVtU/KS1TXMLld1ecXOnZ3Ca 0bOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=yH6a9KIDmxpiYHGzqckEdodH/zGrWzgS3S8LruOPRgo=; b=IXQfNWI2QPyyA4VGd4JvUy/gMPeG87du/xMCQuU9z/ExV/XKJiFjog8ejUuq/tsNbf PMFOjv0BKxI5on4f+LaI30K0Iw0woQ80jxwy0ikds8on/0PORXtswurLIEaOoCyzDJtQ 64KOFG5le5L09FKNKUQ/T3CVWjO5Xb/JtDmR7jEm6jdhjCC1nH3UKqjjTAMp8X1XEzhI hop2bafPVNdApCBu4F8AhtJaz5r5eHFvB22WJShnedUpN1+H9wQB0i0aICEK/K+hx2P5 2pZRuhQEb33xS/nMnHlTT1hQs+wzJA30s9Ni1oxCw01Yczyw5xQ6OqIMWB6Rtf5oP07O +R7A== X-Gm-Message-State: ACgBeo3YKFcqo/x4OdGihFWcM7LlLOroc47dEvK0x8MReTiVtpxRGTg2 AykNM4MdEIATrDKfFv1vW3M= X-Google-Smtp-Source: AA6agR4iylZwjmKMAMaClhVIPHxoAix/2A8gDlO5lTLf44E1nOH1SnLHwwBqmMIttxLcEsPhZtR3pw== X-Received: by 2002:a17:902:b94b:b0:170:c9d6:a06d with SMTP id h11-20020a170902b94b00b00170c9d6a06dmr10206393pls.105.1660109915995; Tue, 09 Aug 2022 22:38:35 -0700 (PDT) Received: from localhost ([115.154.175.57]) by smtp.gmail.com with ESMTPSA id m12-20020a170902db0c00b0016bdf0032b9sm11918104plx.110.2022.08.09.22.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 22:38:35 -0700 (PDT) From: Ihor Radchenko To: Carlos Pita Cc: emacs-orgmode@gnu.org Subject: [PATCH] Re: Adding target and custom id links doesn't ask for description In-Reply-To: References: Date: Wed, 10 Aug 2022 13:39:39 +0800 Message-ID: <87a68c4pyc.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=yantar92@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1660110113; 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=yH6a9KIDmxpiYHGzqckEdodH/zGrWzgS3S8LruOPRgo=; b=eGjTODttpB0TjbERDIqx9RHS5l2MYz7xdlry4mqA4KewPg3Td63AIdO5qWtPeSfzJfqH8L Q9i+nVDxqTGKqBK1/QcpwVujw9/20EMpvYespt2c1b6BqVaYeT/Mg+ydsuOmMTTio7hosi fYv90ndUZzSmJ1jtwLQ4HvlZdak1nCFanvkpttxzGOKAxxLgc9niMqCadWukMNg7ktZ3c1 RsDlpimXDii7wZkc8JLhcIjyaY8vBm2kgiSEAQNbV+q2r50VAB5XXe8puaXA5B20q/fP4w oZIfrhZ6tQWZKYRpatliUkbKAu6atd6ZZzdVMsGl8lUn8ffA2Z3Pb6lMy6KNEA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1660110113; a=rsa-sha256; cv=none; b=g/NFBh6C/EKIqP2BexAmmRUVePr2D2KbhHijWRM2dEXPitUHxOZT4mRSCsHL3O1ZgOjfAi J8TiADDdR0z5CQ6im3iKj9ItBfMXrwRTNUGdKNtlS7ihs+g/EiWnDNTCctejd8HoZsFPJs /f4AXkTg5p/HRggVvRsIxqNcqOA/f3pRZpVy6pf8oh3X5aijM7ANPtsz6Knn8OcVYDnLuT cCXKPEY3UqI/s6UgA/8FvdnQnITyOuWokVzqoHRYBqmXBvQP5Tppa23G+1WGzcIH8ODUST 0jC7Qzw+kOr1OObO9yUNbGnm8GX7hNcnUS7YfxQoo5AGsYddsQLVWudr8z4xdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NhxeZQSj; dmarc=pass (policy=none) header.from=gmail.com; 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-Spam-Score: -9.19 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=NhxeZQSj; dmarc=pass (policy=none) header.from=gmail.com; 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-Queue-Id: 4A7CA7466 X-Spam-Score: -9.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: Ap7QieMWJlhw --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Carlos Pita writes: > When storing a <> or CUSTOM_ID link with org-store-link and then = adding it with C-c C-l, org doesn=E2=80=99t ask for a description but autom= atically inserts an ugly description like: > > ~/Desktop/Org/captures.org::target > > or: > > ~/Desktop/Org/captures.org::#7EFBCEA1-0D17-45B9-A125-10FE581752F8 > > The entire path is inserted even when the target itself is simply =E2=80= =9Ctarget=E2=80=9D. But, more importantly, no chance to change the descript= ion is given to the user. I can replicate. I do see much point copy-pasting the link into description. Moreover, this code is carried around since 15 years ago from the commit 93c665b56 Intermediate state, I am just trying comiting now :3 I suggest to set description to nil and thus ask the user in such scenario. See the attached patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-store-link-Default-to-empty-description-for-targ.patch >From 4a2079f237f5d23bfa83c2481f34d3bff27dd3e8 Mon Sep 17 00:00:00 2001 Message-Id: <4a2079f237f5d23bfa83c2481f34d3bff27dd3e8.1660109574.git.yantar92@gmail.com> From: Ihor Radchenko Date: Wed, 10 Aug 2022 13:25:26 +0800 Subject: [PATCH] org-store-link: Default to empty description for target/custom-id links * lisp/ol.el (org-store-link): Use empty description by default (ask user). Fixes https://orgmode.org/list/D99A712C-18D1-4A4F-8093-35A0BFB469C4@gmail.com --- lisp/ol.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index b7d74d0bf..29e0d3319 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1577,10 +1577,8 @@ (defun org-store-link (arg &optional interactive?) t)))) (setq link (plist-get org-store-link-plist :link)) ;; If store function actually set `:description' property, use - ;; it, even if it is nil. Otherwise, fallback to link value. - (setq desc (if (plist-member org-store-link-plist :description) - (plist-get org-store-link-plist :description) - link))) + ;; it, even if it is nil. Otherwise, fallback to nil (ask user). + (setq desc (plist-get org-store-link-plist :description))) ;; Store a link from a remote editing buffer. ((org-src-edit-buffer-p) @@ -1697,9 +1695,7 @@ (defun org-store-link (arg &optional interactive?) (and org-id-link-to-org-use-id (org-entry-get nil "ID")))) (setq link (condition-case nil (prog1 (org-id-store-link) - (setq desc (or (plist-get org-store-link-plist - :description) - ""))) + (setq desc (plist-get org-store-link-plist :description))) (error ;; Probably before first headline, link only to file. (concat "file:" -- 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92 --=-=-=--