emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bhavin Gandhi <bhavin7392@gmail.com>
To: Gustavo Barros <gusbrs.2016@gmail.com>, tecosaur@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: Mon, 24 May 2021 22:04:35 +0530	[thread overview]
Message-ID: <CAOn=hbcWyR8nt5WHKsMU_wFYOORsVMiY8eCbcXyaj-a3ghJCYg@mail.gmail.com> (raw)
In-Reply-To: <87sg2ds2e0.fsf@gmail.com>


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

On Sun, 23 May 2021 at 23:53, Timothy wrote:
>
> Hi Bhavin! Great to see you on the mailing list :)
>
> Thank you so much for looking at the bugs, investigating one, /and/
> working out a fix. That's absolutely fantastic of you!

Thank you for a welcoming message! :)


On Mon, 24 May 2021 at 00:28, Gustavo Barros wrote:
>
> The patch looks good to me, and corresponds to my analysis of the
> problem and suggested fix.  I have only one minor nitpick: you could go
> with a simple `let' there, instead of a `let*', since we only have one
> let-bound variable there anyway.

Yes, I have attached an updated patch.

> > [...] it has other details as well.
>
> As far as I could see, we are very much aligned on the problem and fix.
> But perhaps I'm missing something, could you elaborate on that?

We are indeed aligned. The only additional thing I discovered was
the reason `org-refile--get-location' works despite having double
slashes. That was new for me.

Just experimenting with Woof!
X-Woof-Patch: confirmed

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

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

From e069c35ff6011a7f9efe372e675a0bc43ba1fa80 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.

TINYCHANGE
---
 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..678759e10 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)
 				     org-refile-history
 				   (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)))
 	  pa)
       (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
-- 
2.31.1


  reply	other threads:[~2021-05-24 16:37 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
2021-05-23 18:23   ` Timothy
2021-05-23 18:58   ` Gustavo Barros
2021-05-24 16:34     ` Bhavin Gandhi [this message]
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=hbcWyR8nt5WHKsMU_wFYOORsVMiY8eCbcXyaj-a3ghJCYg@mail.gmail.com' \
    --to=bhavin7392@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gusbrs.2016@gmail.com \
    --cc=tecosaur@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/)]' \
    /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

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

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).