all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Carlos Pita <carlosjosepita@gmail.com>
Cc: Max Nikulin <manikulin@gmail.com>,
	 emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH v2] Re: Adding target and custom id links doesn't ask for description
Date: Sat, 13 Aug 2022 13:01:08 +0800	[thread overview]
Message-ID: <8735e091pn.fsf@localhost> (raw)
In-Reply-To: <CAELgYhenDR5B8xuYk9L=nmkA7Nfb4WKxyf2e3dagCXdTm2B8Xg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

Carlos Pita <carlosjosepita@gmail.com> writes:

>> Carlos, have you tried Ihor's patch? I like the intention, but I do not
>> see any effect.
>>
>
> Yes, I've tested it with target and custom_id links and, as you said, there
> is no change in behavior. The entire URL is still pasted and no chance to
> edit it is given to the user.

Oops. Somehow some way things worked for me at some point when I was
making the patch.

See the updated version of the patch attached. It works on my side.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-org-store-link-Default-to-empty-description-for-t.patch --]
[-- Type: text/x-patch, Size: 2232 bytes --]

From 64c85eed9471b73e379e063dc3becefceb1ec650 Mon Sep 17 00:00:00 2001
Message-Id: <64c85eed9471b73e379e063dc3becefceb1ec650.1660366803.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Wed, 10 Aug 2022 13:25:26 +0800
Subject: [PATCH v2] 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 | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index b7d74d0bf..358a96aae 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:"
@@ -1761,8 +1757,7 @@ (defun org-store-link (arg &optional interactive?)
 
       ;; We're done setting link and desc, clean up
       (when (consp link) (setq cpltxt (car link) link (cdr link)))
-      (setq link (or link cpltxt)
-	    desc (or desc cpltxt))
+      (setq link (or link cpltxt))
       (cond ((not desc))
 	    ((equal desc "NONE") (setq desc nil))
 	    (t (setq desc (org-link-display-format desc))))
-- 
2.35.1


[-- Attachment #3: Type: text/plain, Size: 207 bytes --]



-- 
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

  reply	other threads:[~2022-08-13  5:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02 17:44 Adding target and custom id links doesn't ask for description Carlos Pita
2022-08-02 18:58 ` Carlos Pita
2022-08-03 11:35   ` Max Nikulin
2022-08-10  5:39 ` [PATCH] " Ihor Radchenko
2022-08-10 12:30   ` Carlos Pita
2022-08-11 15:50     ` Max Nikulin
2022-08-12 19:18       ` Carlos Pita
2022-08-13  5:01         ` Ihor Radchenko [this message]
2022-08-14  9:53           ` [PATCH v2] " Max Nikulin
2022-09-11 13:18             ` Max Nikulin
2022-09-12 11:02               ` Ihor Radchenko
2022-09-12 16:05                 ` Max Nikulin
2022-09-13 13:08           ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735e091pn.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=carlosjosepita@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.