emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Table conversion problem
@ 2008-01-03 17:02 Bernt Hansen
  2008-01-03 17:44 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Bernt Hansen @ 2008-01-03 17:02 UTC (permalink / raw)
  To: emacs-orgmode

Hi Carsten,

I needed to convert a bunch of tab delimited data into a table today for
an email and I knew there was a function to do this so I went to the PDF
documentation for Org-mode version 5.17a

It says I can select the region to be converted into a table and then
hit C-c | to convert it to a table but I get this error instead of the
expected behaviour:

orgtbl-error: This key is has no function outside tables

Now I'm actually trying to do this outside of regular org-mode - when
composing a mail message using orgstruct-mode and orgtbl-mode as minor
modes.  In my *.org buffers C-c | works great.

Is there a way to do this without converting the data to a table in org
mode and then cutting and pasting it back to the email I'm composing?

Bernt

PS - here's a patch for the error message text above:

---

diff --git a/org.el b/org.el
index 9d99e98..4e2e4f9 100644
--- a/org.el
+++ b/org.el
@@ -7476,7 +7476,7 @@ off orgstruct-mode will *not* remove these additonal settings."
 (defun orgstruct-error ()
   "Error when there is no default binding for a structure key."
   (interactive)
-  (error "This key is has no function outside structure elements"))
+  (error "This key has no function outside structure elements"))
 
 (defun orgstruct-setup ()
   "Setup orgstruct keymaps."
@@ -11064,7 +11064,7 @@ to execute outside of tables."
 (defun orgtbl-error ()
   "Error when there is no default binding for a table key."
   (interactive)
-  (error "This key is has no function outside tables"))
+  (error "This key has no function outside tables"))
 
 (defun orgtbl-setup ()
   "Setup orgtbl keymaps."
diff --git a/org_xemacs.el b/org_xemacs.el
index ceb6eb4..67ddc00 100644
--- a/org_xemacs.el
+++ b/org_xemacs.el
@@ -9338,7 +9338,7 @@ to execute outside of tables."
 (defun orgtbl-error ()
   "Error when there is no default binding for a table key."
   (interactive)
-  (error "This key is has no function outside tables"))
+  (error "This key has no function outside tables"))
 
 (defun orgtbl-setup ()
   "Setup orgtbl keymaps."

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

* Re: Table conversion problem
  2008-01-03 17:02 Table conversion problem Bernt Hansen
@ 2008-01-03 17:44 ` Carsten Dominik
  2008-01-03 17:58   ` Bernt Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2008-01-03 17:44 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Hi Bernt,

On Jan 3, 2008, at 6:02 PM, Bernt Hansen wrote:

> Hi Carsten,
>
> I needed to convert a bunch of tab delimited data into a table today  
> for
> an email and I knew there was a function to do this so I went to the  
> PDF
> documentation for Org-mode version 5.17a
>
> It says I can select the region to be converted into a table and then
> hit C-c | to convert it to a table but I get this error instead of the
> expected behaviour:
>
> orgtbl-error: This key is has no function outside tables
>
> Now I'm actually trying to do this outside of regular org-mode - when
> composing a mail message using orgstruct-mode and orgtbl-mode as minor
> modes.  In my *.org buffers C-c | works great.
>
> Is there a way to do this without converting the data to a table in  
> org
> mode and then cutting and pasting it back to the email I'm composing?

orgtbl-mode commands only work if there is already a table context,
and this is not the case for your application.  However, you can bind
the command `org-table-convert-region' to a key and use it directly.

If this is your only use of C-c | in orgtbl-mode, you can use to
orgtbl-mode hook and overwrite the standard (context-sensitive) binding:

(add-hook 'orgtbl-mode-hook
   (lambda ()
     (define-key orgtbl-mode-map 'org-table-convert-region "\C-c|")))

Thanks for the patch, I have applied it.

- Carsten

>
>
> Bernt
>
> PS - here's a patch for the error message text above:
>
> ---
>
> diff --git a/org.el b/org.el
> index 9d99e98..4e2e4f9 100644
> --- a/org.el
> +++ b/org.el
> @@ -7476,7 +7476,7 @@ off orgstruct-mode will *not* remove these  
> additonal settings."
> (defun orgstruct-error ()
>   "Error when there is no default binding for a structure key."
>   (interactive)
> -  (error "This key is has no function outside structure elements"))
> +  (error "This key has no function outside structure elements"))
>
> (defun orgstruct-setup ()
>   "Setup orgstruct keymaps."
> @@ -11064,7 +11064,7 @@ to execute outside of tables."
> (defun orgtbl-error ()
>   "Error when there is no default binding for a table key."
>   (interactive)
> -  (error "This key is has no function outside tables"))
> +  (error "This key has no function outside tables"))
>
> (defun orgtbl-setup ()
>   "Setup orgtbl keymaps."
> diff --git a/org_xemacs.el b/org_xemacs.el
> index ceb6eb4..67ddc00 100644
> --- a/org_xemacs.el
> +++ b/org_xemacs.el
> @@ -9338,7 +9338,7 @@ to execute outside of tables."
> (defun orgtbl-error ()
>   "Error when there is no default binding for a table key."
>   (interactive)
> -  (error "This key is has no function outside tables"))
> +  (error "This key has no function outside tables"))
>
> (defun orgtbl-setup ()
>   "Setup orgtbl keymaps."
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Table conversion problem
  2008-01-03 17:44 ` Carsten Dominik
@ 2008-01-03 17:58   ` Bernt Hansen
  0 siblings, 0 replies; 3+ messages in thread
From: Bernt Hansen @ 2008-01-03 17:58 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> orgtbl-mode commands only work if there is already a table context,
> and this is not the case for your application.  However, you can bind
> the command `org-table-convert-region' to a key and use it directly.
>
> If this is your only use of C-c | in orgtbl-mode, you can use to
> orgtbl-mode hook and overwrite the standard (context-sensitive) binding:
>
> (add-hook 'orgtbl-mode-hook
>   (lambda ()
>     (define-key orgtbl-mode-map 'org-table-convert-region "\C-c|")))
>

Thanks!  I tried finding the org-table-convert-region function but I
failed miserably when looking for orgtbl-* functions :) doh!

org-table-convert-region works great.  I rarely need this function (so
far) outside of org-mode so I'll just call it directly the next time I
need it.

Thanks again for all your great work!

Bernt

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

end of thread, other threads:[~2008-01-03 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-03 17:02 Table conversion problem Bernt Hansen
2008-01-03 17:44 ` Carsten Dominik
2008-01-03 17:58   ` Bernt Hansen

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).