emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] error with org-refile and ido-completion-help
@ 2016-05-30 21:40 Matt Lundin
  2016-05-31 19:44 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2016-05-30 21:40 UTC (permalink / raw)
  To: Org Mode

When calling org-refile with org-completion-use-ido set to t, pressing
TAB in ido-mode results in an error. This is because ido-completion-help
expects a list of strings. However, org-refile sends ido-completing-read
a list of lists.

To replicate:

1. /usr/bin/emacs -Q -l ~/.minimal.el

--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path "~/org-mode/lisp")
(add-to-list 'load-path "~/org-mode/contrib/lisp")
(ido-mode)
(setq org-completion-use-ido 1)
--8<---------------cut here---------------end--------------->8---

Go to an org file with headlines:

--8<---------------cut here---------------start------------->8---
* One
* Two
* Three
--8<---------------cut here---------------end--------------->8---

2. Call org-refile on the first headline.

3. Press TAB within the ido minibuffer. (See the backtrace at the bottom
of this post).

A git bisect revealed that the change was introduced in 2015 with the
following commit:

,----
| commit 50ba0a5ed609f3600f2590f3ba22b8ab3ff3331c
| Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
| Date:   Sun Jun 7 00:38:58 2015 +0200
| 
|     Fix 1a7364177046b8a57ade0aeb9f52bacfc0b8b088
|     
|     * lisp/org.el (org-icompleting-read): Let `completing-read' or
|       equivalent sort out type of completion.
|     (org-olpath-completing-read): Revert partially
|     1a7364177046b8a57ade0aeb9f52bacfc0b8b088.
`----

It looks like this commit removed some functionality from the now
obsolete org-icompleting-read that made sure that the items in the
completion list passed to the completing read function were strings.


Matt

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument arrayp (#("Three" 0 5 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Three\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 14))
  ido-no-final-slash((#("Three" 0 5 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Three\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 14))
  ido-file-lessp((#("Three" 0 5 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Three\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 14) (#("Two" 0 3 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Two\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 8))
  sort(((#("Two" 0 3 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Two\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 8)) ido-file-lessp)
  ido-completion-help()
  funcall-interactively(ido-completion-help)
  call-interactively(ido-completion-help)
  ido-complete()
  funcall-interactively(ido-complete)
  call-interactively(ido-complete nil nil)
  command-execute(ido-complete)
  read-from-minibuffer("Refile subtree \"One\" to: " nil (keymap keymap (4 . ido-magic-delete-char) (6 . ido-magic-forward-char) (2 . ido-magic-backward-char) (63 . ido-completion-help) (left . ido-prev-match) (right . ido-next-match) (0 . ido-restrict-to-matches) (27 keymap (32 . ido-take-first-match)) (67108896 . ido-restrict-to-matches) (26 . ido-undo-merge-work-directory) (20 . ido-toggle-regexp) (67108908 . ido-prev-match) (67108910 . ido-next-match) (19 . ido-next-match) (18 . ido-prev-match) (16 . ido-toggle-prefix) (13 . ido-exit-minibuffer) (10 . ido-select-text) (32 . ido-complete-space) (9 . ido-complete) (5 . ido-edit-input) (3 . ido-toggle-case) (1 . ido-toggle-ignore) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) nil org-refile-history)
  ido-read-internal(list "Refile subtree \"One\" to: " org-refile-history nil t nil)
  ido-completing-read("Refile subtree \"One\" to: " ((#("Two" 0 3 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Two\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 8) (#("Three" 0 5 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Three\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 14)) nil t nil org-refile-history nil)
  apply(ido-completing-read ("Refile subtree \"One\" to: " ((#("Two" 0 3 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Two\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 8) (#("Three" 0 5 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Three\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 14)) nil t nil org-refile-history nil))
  org-icompleting-read("Refile subtree \"One\" to: " ((#("Two" 0 3 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Two\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 8) (#("Three" 0 5 (face org-level-1 fontified t)) "/home/matt/test.org" "^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(?:\\[[0-9%/]+\\] *\\)*\\(Three\\)\\(?: *\\[[0-9%/]+\\]\\)*\\)\\(?:[ 	]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ 	]*$" 14)) nil t nil org-refile-history nil)
  org-refile-get-location("Refile subtree \"One\" to" nil nil nil)
  org-refile(nil)
  funcall-interactively(org-refile nil)
  call-interactively(org-refile record nil)
  command-execute(org-refile record)
  execute-extended-command(nil "org-refile" nil)
  funcall-interactively(execute-extended-command nil "org-refile" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] error with org-refile and ido-completion-help
  2016-05-30 21:40 [BUG] error with org-refile and ido-completion-help Matt Lundin
@ 2016-05-31 19:44 ` Nicolas Goaziou
  2016-05-31 21:49   ` Matt Lundin
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2016-05-31 19:44 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Hello,

Matt Lundin <mdl@imapmail.org> writes:

> When calling org-refile with org-completion-use-ido set to t, pressing
> TAB in ido-mode results in an error. This is because ido-completion-help
> expects a list of strings. However, org-refile sends ido-completing-read
> a list of lists.
>
> To replicate:
>
> 1. /usr/bin/emacs -Q -l ~/.minimal.el
>
> (add-to-list 'load-path "~/org-mode/lisp")
> (add-to-list 'load-path "~/org-mode/contrib/lisp")
> (ido-mode)
> (setq org-completion-use-ido 1)
>
> Go to an org file with headlines:
>
> * One * Two * Three
>
> 2. Call org-refile on the first headline.
>
> 3. Press TAB within the ido minibuffer. (See the backtrace at the bottom
> of this post).
>
> A git bisect revealed that the change was introduced in 2015 with the
> following commit:
>
> ,----
> | commit 50ba0a5ed609f3600f2590f3ba22b8ab3ff3331c
> | Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
> | Date:   Sun Jun 7 00:38:58 2015 +0200
> | 
> |     Fix 1a7364177046b8a57ade0aeb9f52bacfc0b8b088
> |     
> |     * lisp/org.el (org-icompleting-read): Let `completing-read' or
> |       equivalent sort out type of completion.
> |     (org-olpath-completing-read): Revert partially
> |     1a7364177046b8a57ade0aeb9f52bacfc0b8b088.
> `----
>
> It looks like this commit removed some functionality from the now
> obsolete org-icompleting-read that made sure that the items in the
> completion list passed to the completing read function were strings.

Actually, this is a bug in "ido.el", since `ido-completing-read' is not
a drop-in replacement for `completing-read'.  The latter accepts lists
of strings, but also alist, obarrays and hash tables. The former accepts
only list of strings.

I suggest to report the bug to "ido.el" maintainers since they probably
want to preserve compatibility between the completion functions.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] error with org-refile and ido-completion-help
  2016-05-31 19:44 ` Nicolas Goaziou
@ 2016-05-31 21:49   ` Matt Lundin
  2016-06-01 17:08     ` Matt Lundin
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2016-05-31 21:49 UTC (permalink / raw)
  To: Org Mode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> A git bisect revealed that the change was introduced in 2015 with the
>> following commit:
>>
>> ,----
>> | commit 50ba0a5ed609f3600f2590f3ba22b8ab3ff3331c
>> | Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
>> | Date:   Sun Jun 7 00:38:58 2015 +0200
>> | 
>> |     Fix 1a7364177046b8a57ade0aeb9f52bacfc0b8b088
>> |     
>> |     * lisp/org.el (org-icompleting-read): Let `completing-read' or
>> |       equivalent sort out type of completion.
>> |     (org-olpath-completing-read): Revert partially
>> |     1a7364177046b8a57ade0aeb9f52bacfc0b8b088.
>> `----
>>
>> It looks like this commit removed some functionality from the now
>> obsolete org-icompleting-read that made sure that the items in the
>> completion list passed to the completing read function were strings.
>
> Actually, this is a bug in "ido.el", since `ido-completing-read' is not
> a drop-in replacement for `completing-read'.  The latter accepts lists
> of strings, but also alist, obarrays and hash tables. The former accepts
> only list of strings.
>
> I suggest to report the bug to "ido.el" maintainers since they probably
> want to preserve compatibility between the completion functions.

OK. Thanks. I see that a bug report has been on the emacs list since
2013: 

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15430

For the time being, it's easy enough to write a custom wrapper around
ido-completing-read, so I think I'll do that.

It's worth nothing that the author of patch that originally added the
completing-read-function variable did not anticipate that
ido-completing-read would be a simple drop-in for completing-read:

http://thread.gmane.org/gmane.emacs.devel/134000

For a long time (since at least 2009), org-mode had built-in support for
ido-mode completion when refiling. So this does seem to be a deprecation
of longstanding org-mode functionality.

I'll see if we can add something to the docstrings to alert of the need
to write a wrapper around ido-completing-read.

Matt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] error with org-refile and ido-completion-help
  2016-05-31 21:49   ` Matt Lundin
@ 2016-06-01 17:08     ` Matt Lundin
  2016-06-01 17:32       ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2016-06-01 17:08 UTC (permalink / raw)
  To: Org Mode

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

Matt Lundin <mdl@imapmail.org> writes:

> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>>> A git bisect revealed that the change was introduced in 2015 with the
>>> following commit:
>>>
>>> ,----
>>> | commit 50ba0a5ed609f3600f2590f3ba22b8ab3ff3331c
>>> | Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
>>> | Date:   Sun Jun 7 00:38:58 2015 +0200
>>> | 
>>> |     Fix 1a7364177046b8a57ade0aeb9f52bacfc0b8b088
>>> |     
>>> |     * lisp/org.el (org-icompleting-read): Let `completing-read' or
>>> |       equivalent sort out type of completion.
>>> |     (org-olpath-completing-read): Revert partially
>>> |     1a7364177046b8a57ade0aeb9f52bacfc0b8b088.
>>> `----
>>>
>>> It looks like this commit removed some functionality from the now
>>> obsolete org-icompleting-read that made sure that the items in the
>>> completion list passed to the completing read function were strings.
>>
>> Actually, this is a bug in "ido.el", since `ido-completing-read' is not
>> a drop-in replacement for `completing-read'.  The latter accepts lists
>> of strings, but also alist, obarrays and hash tables. The former accepts
>> only list of strings.
>>
>> I suggest to report the bug to "ido.el" maintainers since they probably
>> want to preserve compatibility between the completion functions.
>
> OK. Thanks. I see that a bug report has been on the emacs list since
> 2013: 
>
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15430
>
> For the time being, it's easy enough to write a custom wrapper around
> ido-completing-read, so I think I'll do that.
>
> It's worth nothing that the author of patch that originally added the
> completing-read-function variable did not anticipate that
> ido-completing-read would be a simple drop-in for completing-read:
>
> http://thread.gmane.org/gmane.emacs.devel/134000
>
> For a long time (since at least 2009), org-mode had built-in support for
> ido-mode completion when refiling. So this does seem to be a deprecation
> of longstanding org-mode functionality.
>
> I'll see if we can add something to the docstrings to alert of the need
> to write a wrapper around ido-completing-read.

I think the simplest thing is just to remove the obsolete info in the
manual. Please see the attached patch.

Best,
Matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Remove-paragraph-about-obsolete-variables.patch --]
[-- Type: text/x-diff, Size: 1150 bytes --]

From d66e08b15ddb107135b5cbaa6582c9461347a3a4 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Wed, 1 Jun 2016 12:04:14 -0500
Subject: [PATCH] Remove paragraph about obsolete variables

* doc/org.texi: Remove paragraph documenting now obsolete variables
  org-completion-use-ido and org-completion-use-iswitchbp.
---
 doc/org.texi | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 88c506c..36ab999 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -16931,12 +16931,6 @@ emacs -Q --batch \
 @cindex tag completion
 @cindex link abbreviations, completion of
 
-Emacs would not be Emacs without completion, and Org mode uses it whenever it
-makes sense.  If you prefer an @i{iswitchb}- or @i{ido}-like interface for
-some of the completion prompts, you can specify your preference by setting at
-most one of the variables @code{org-completion-use-iswitchb}
-@code{org-completion-use-ido}.
-
 Org supports in-buffer completion.  This type of completion does
 not make use of the minibuffer.  You simply type a few letters into
 the buffer and use the key to complete text right there.
-- 
2.8.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [BUG] error with org-refile and ido-completion-help
  2016-06-01 17:08     ` Matt Lundin
@ 2016-06-01 17:32       ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2016-06-01 17:32 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Hello,

Matt Lundin <mdl@imapmail.org> writes:

>> For a long time (since at least 2009), org-mode had built-in support for
>> ido-mode completion when refiling. So this does seem to be a deprecation
>> of longstanding org-mode functionality.

Org mode didn't provide any completion functionality, but provided a fix
for ido. I think that task doesn't belong to Org, since the problem is
not specific to the package.

Besides, it is still possible to use ido for completion.

> I think the simplest thing is just to remove the obsolete info in the
> manual. Please see the attached patch.

Thank you. Applied.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-01 17:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-30 21:40 [BUG] error with org-refile and ido-completion-help Matt Lundin
2016-05-31 19:44 ` Nicolas Goaziou
2016-05-31 21:49   ` Matt Lundin
2016-06-01 17:08     ` Matt Lundin
2016-06-01 17:32       ` Nicolas Goaziou

Code repositories for project(s) associated with this public 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).