Re: [O] orgtbl-insert-radio-table forbid blanks in the table name

2012-10-11 Thread Nicolas Goaziou
Hello,

Pascal Wittmann  writes:

> I noticed that its possible to enter a name containing blanks when
> calling orgtbl-insert-radio-table. I don't think that this is intended,
> because blanks are used as separators in the "#+ORGTBL" line.
>
> Entering a the name "first table" will result in the following error
> message:
>
>   "No such transformation function table"
>
> For me (as a novice) it was at first not obvious what I did wrong. My
> suggestion is to chose an other input method that forbids blanks.

Documentation uses table_name in order to describe the name of the
table, implying there shouldn't be any space in that name. Maybe it
could be made more explicit, with, i.e. a footnote somewhere.

> I fixed this locally with the attached patch, but I'm sure there are
> better solutions (I find it unintuitive that blanks terminate the
> input).

Another possibility is to return an error if the string read contains
any whitespace character.


Regards,

-- 
Nicolas Goaziou



[O] orgtbl-insert-radio-table forbid blanks in the table name

2012-10-09 Thread Pascal Wittmann
Hi,

I noticed that its possible to enter a name containing blanks when
calling orgtbl-insert-radio-table. I don't think that this is intended,
because blanks are used as separators in the "#+ORGTBL" line.

Entering a the name "first table" will result in the following error
message:

"No such transformation function table"

For me (as a novice) it was at first not obvious what I did wrong. My
suggestion is to chose an other input method that forbids blanks.

I fixed this locally with the attached patch, but I'm sure there are
better solutions (I find it unintuitive that blanks terminate the input).

Best Regards
Pascal
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 0555041..a8d2826 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4437,7 +4437,7 @@ First element has index 0, or I0 if given."
 	 (txt (nth 1 e))
 	 name pos)
 (unless e (error "No radio table setup defined for %s" major-mode))
-(setq name (read-string "Table name: "))
+(setq name (read-no-blanks-input "Table name: "))
 (while (string-match "%n" txt)
   (setq txt (replace-match name t t txt)))
 (or (bolp) (insert "\n"))


signature.asc
Description: OpenPGP digital signature