emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bhavin Gandhi <bhavin7392@gmail.com>
To: gusbrs.2016@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: Double trailing slash for default candidate in org-refile-get-target [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
Date: Sun, 23 May 2021 23:35:05 +0530	[thread overview]
Message-ID: <CAOn=hbe4q7Ym2ApNH5zKd1E3MBNHHY8yr-33mi0xqQEWdnJ+_A@mail.gmail.com> (raw)
In-Reply-To: <CAOn=hbcSeGYonTBKzV7kcns66iVWQUzmrThT+rLLj18GwHw8Ew@mail.gmail.com>

[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]

Finally after spending a couple of hours, I was able to understand the code
of org-refile-get-location \o/. The detailed bug report helped me to
understand the issue. I'm attaching a patch here which should fix the
problem, it has other details as well. I have tested a few basic scenarios
as mentioned in the report.

OTOH, I haven't signed the FSF Copyright assignment yet, should I do it
before this gets merged or it can be done later?

[-- Attachment #1.2: Type: text/html, Size: 534 bytes --]

[-- Attachment #2: 0001-org-refile-Fix-double-slashes-in-the-refile-targets.patch --]
[-- Type: text/x-patch, Size: 2126 bytes --]

From 234316ed49023362d116d884ba7f2859e5f04c1b Mon Sep 17 00:00:00 2001
From: Bhavin Gandhi <bhavin192@geeksocket.in>
Date: Sun, 23 May 2021 23:07:13 +0530
Subject: [PATCH] org-refile: Fix double slashes in the refile targets

* org-refile.el (org-refile-get-location): When we generate the `tbl'
variable, we add extra slash depending on the value of
`org-refile-use-outline-path'.  This patch updates some locations which
add another extra slash assuming the target did not have it.

`org-refile--get-location' does lookup for entries with and without
slash, so it was not causing any issues before.  It works as it is now
as well.

Thanks to Gustavo Barros for a very detailed bug report.

 lisp/org-refile.el | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index bffad0a81..c4ac1c108 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -649,20 +649,18 @@ this function appends the default value from
     (setq old-hist org-refile-history)
     (setq answ (funcall cfunc prompt tbl nil (not new-nodes)
 			nil 'org-refile-history
-			(or cdef (concat (car org-refile-history) extra))))
+			(or cdef (car org-refile-history))))
     (if (setq pa (org-refile--get-location answ tbl))
-	(let* ((last-refile-loc (car org-refile-history))
-	       (last-refile-loc-path (concat last-refile-loc extra)))
+	(let* ((last-refile-loc (car org-refile-history)))
 	  (org-refile-check-position pa)
 	  (when (or (not org-refile-history)
 		    (not (eq old-hist org-refile-history))
-		    (not (equal (car pa) last-refile-loc-path)))
+		    (not (equal (car pa) last-refile-loc)))
 	    (setq org-refile-history
 		  (cons (car pa) (if (assoc last-refile-loc tbl)
 				   (cdr org-refile-history))))
-	    (when (or (equal last-refile-loc-path (nth 1 org-refile-history))
-		      (equal last-refile-loc (nth 1 org-refile-history)))
+	    (when (equal last-refile-loc (nth 1 org-refile-history))
 	      (pop org-refile-history)))
       (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)

  reply	other threads:[~2021-05-23 18:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 18:04 Bhavin Gandhi
2021-05-23 18:05 ` Bhavin Gandhi [this message]
2021-05-23 18:23   ` Timothy
2021-05-23 18:58   ` Gustavo Barros
2021-05-24 16:34     ` Bhavin Gandhi
2021-05-24 16:58       ` Gustavo Barros
2021-05-25 17:52         ` [PATCH] org-refile: Fix double slashes in the refile targets Bhavin Gandhi
  -- strict thread matches above, loose matches on Subject: below --
2020-09-21 18:34 Bug: Double trailing slash for default candidate in org-refile-get-target [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)] Gustavo Barros
2020-09-23 14:17 ` stardiviner
2020-09-23 14:49   ` Gustavo Barros
2021-02-14 12:55 ` Gustavo Barros
2021-05-04  6:27 ` Bastien

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:

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAOn=hbe4q7Ym2ApNH5zKd1E3MBNHHY8yr-33mi0xqQEWdnJ+_A@mail.gmail.com' \
    --to=bhavin7392@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gusbrs.2016@gmail.com \
    --subject='Re: Bug: Double trailing slash for default candidate in org-refile-get-target [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).