Explorar o código

Allow normal lists completion also when using ido.el

Gregory Grubbs writes:

> When exporting a table with ido-mode active, an error is
> raised in org-ido-completing-read.  I think
> ido-completing-read is being called with incorrect
> arguments, but the fix is beyond me.
>
> Steps to reproduce the error:
> Org-mode version: 6.28trans
> Emacs version: GNU Emacs 23.0.91.1 (i486-pc-linux-gnu, GTK+ Version
> 2.16.0) of 2009-04-05 on palmer, modified by Debian
>
>
> Turn on ido-mode: M-x ido-mode RET
> visit a file using C-x C-f /tmp/test.org RET
> Create a simple table:
> |column a|column b|
> |-
> |one|two|
> |three|four|
>
> Org-magic-tabelize it by hitting TAB somewhere in a column
>
> M-x org-table-export RET /tmp/test.csv
>
> Here's the backtrace I get:
>
> Debugger entered--Lisp error: (wrong-type-argument listp "orgtbl-to-tsv")

This error is due to the fact that org-ido-completing-read does
convert alists to flat lists for completion.  Now we check if the list
really is an alist before converting it.
Carsten Dominik %!s(int64=15) %!d(string=hai) anos
pai
achega
22cb84f74d
Modificáronse 2 ficheiros con 6 adicións e 1 borrados
  1. 3 0
      lisp/ChangeLog
  2. 3 1
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-08-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-ido-completing-read): Accept straight lists for
+	completion as well as alists.
+
 	* org-html.el (org-export-as-html): Fix parenthesis error in
 	footnore code.
 

+ 3 - 1
lisp/org.el

@@ -7637,7 +7637,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 	   (listp (second args)))
       (let ((ido-enter-matching-directory nil))
 	(apply 'ido-completing-read (concat (car args))
-	       (mapcar (lambda (x) (car x)) (nth 1 args))
+	       (if (consp (car (nth 1 args)))
+		   (mapcar (lambda (x) (car x)) (nth 1 args))
+		 (nth 1 args))
 	       (cddr args)))
     (apply 'completing-read args)))