From e2371c542b5e18aee970f22aa776e8b1937f18fe Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 21 Jan 2009 13:14:07 +0100 Subject: [PATCH] Tables: Document use of C-c RET add hline and then move below it. --- doc/ChangeLog | 6 ++++++ doc/org.texi | 8 +++++++- doc/orgcard.tex | 1 + lisp/org-macs.el | 3 +++ lisp/org-table.el | 3 +++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 8a4cdd6be..0ebe51b10 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2009-01-21 Carsten Dominik + + * orgcard.tex: Document `C-c RET' in tables. + + * org.texi (Built-in table editor): Document `C-c RET' in tables. + 2009-01-20 Carsten Dominik * org.texi (Math symbols, Quoting LaTeX code): Mention that simple diff --git a/doc/org.texi b/doc/org.texi index 4d0a6404a..807783299 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -1537,7 +1537,8 @@ create the above table, you would only type @end example @noindent and then press @key{TAB} to align the table and start filling in -fields. +fields. Even faster would be to type @code{|Name|Phone|Age} followed by +@kbd{C-c @key{RET}}. When typing text into a field, Org treats @key{DEL}, @key{Backspace}, and all character keys in a special way, so that @@ -1619,6 +1620,11 @@ created below the current one. Insert a horizontal line below current row. With a prefix argument, the line is created above the current line. @c +@kindex C-c @key{RET} +@item C-c @key{RET} +Insert a horizontal line below current row. and mode the cursor into the row +below that line. +@c @kindex C-c ^ @item C-c ^ Sort the table lines in the region. The position of point indicates the diff --git a/doc/orgcard.tex b/doc/orgcard.tex index d05c25b0b..2f82bc0ef 100644 --- a/doc/orgcard.tex +++ b/doc/orgcard.tex @@ -375,6 +375,7 @@ Outside of tables, the same keys may have other functionality. \key{kill the current row or horizontal line}{M-S-UP} \key{insert new row above the current row}{M-S-DOWN} \key{insert hline below (\kbd{C-u} : above) current row}{C-c -} +\key{insert hline and move to line below it}{C-c RET} \key{sort lines in region}{C-c \^{}} {\bf Regions} diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 9e36315cb..f457f8cad 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -195,6 +195,9 @@ we turn off invisibility temporarily. Use this in a `let' form." ;; works also in narrowed buffer, because we start at 1, not point-min (+ (if (bolp) 1 0) (count-lines 1 (point))))) +(defsubst org-current-line-string (&optional to-here) + (buffer-substring (point-at-bol) (if to-here (point) (point-at-eol)))) + (defsubst org-pos-in-match-range (pos n) (and (match-beginning n) (<= (match-beginning n) pos) diff --git a/lisp/org-table.el b/lisp/org-table.el index 7fff77e80..3a72fb5d9 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1222,6 +1222,9 @@ With prefix ABOVE, insert above the current line." (interactive "P") (if (not (org-at-table-p)) (error "Not at a table")) + (when (eobp) (insert "\n") (backward-character 1)) + (if (not (string-match "|[ \t]*$" (org-current-line-string))) + (org-table-align)) (let ((line (org-table-clean-line (buffer-substring (point-at-bol) (point-at-eol)))) (col (current-column))) -- 2.11.4.GIT