From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gustavo Barros Subject: Re: Bug: org-refile-get-target offers default candidate in duplicity [9.2.6 (9.2.6-4-ge30905-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20191007/)] Date: Fri, 14 Feb 2020 12:33:11 -0300 Message-ID: <871rqxyyiw.fsf@gmail.com> References: <87lftw1k2n.fsf@gmail.com> <875zgb7520.fsf@gnu.org> <87sgjfgsoy.fsf@gmail.com> <87a75nexqy.fsf@gnu.org> <877e0qw14d.fsf@gmail.com> <87h7zttrjo.fsf@bzg.fr> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:50118) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2cxx-0007YV-AG for emacs-orgmode@gnu.org; Fri, 14 Feb 2020 10:33:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2cxw-0004py-3n for emacs-orgmode@gnu.org; Fri, 14 Feb 2020 10:33:17 -0500 In-reply-to: <87h7zttrjo.fsf@bzg.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: Bastien Cc: emacs-orgmode@gnu.org Hi Bastien, On Fri, Feb 14 2020, Bastien wrote: > I've revisited org-refile-get-location given your new information on > ivy-completing-read but I'm not able to see something wrong in the > current implementation of org-refile-get-location. At the same time, > I don't see why ivy-completing-read would handle arguments differently > than completing-read-default, so _perhaps_ org-refile-get-location > still does something wrong. > > If you - or other ivy users - have time to investigate and report, > please do so. As I said before, there is much that eludes me in 'org-refile-get-location', but I'm trying to pin this down further by getting some inspection points and trying at least to grasp where it happens. In particular, I set one inspection point exactly after the completing-read function is called to store the value of local variable "answ" which is the return value of the completing-read function. That is, right after: #+begin_src emacs-lisp (setq answ (funcall cfunc prompt tbl nil (not new-nodes) nil 'org-refile-history (or cdef (concat (car org-refile-history) extra)))) #+end_src The value of "answ" right after this step is then: - with 'ivy-mode' off, that is with 'completing-read-default' as 'completing-read-function': "test.org/Top heading 1//" (that is with a *double trailing slash*). - with 'ivy-mode' on, that is with 'ivy-completing-read' as 'completing-read-function': "test.org/Top heading 2/" In both cases the last trailing slash seems (as far as I understand it) to be then trimmed off by 'org-refile--get-location' with: #+begin_src emacs-lisp (replace-regexp-in-string "/$" "" refloc) #+end_src Why 'ivy-completing-read' does not return the end double slash while 'completing-read-default' does, I have no idea. But the fact that 'completing-read-default' returns the refile location with a double trailing slash makes me think there is still something to be fixed in 'org-refile-get-location'. Best, Gustavo.