From 09cccb22b3ed61d612cfabc850a3cd31e22f14e2 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 31 Jul 2009 07:35:02 +0200 Subject: [PATCH] Tables: Cut or copy single fields if no active region is defined C-c C-x C-w and C-c C-x M-w now act on single table fields if there is no active region defined. --- doc/org.texi | 6 +++--- lisp/ChangeLog | 5 +++++ lisp/org-table.el | 12 +++++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index a83cf4c21..2974ca3e9 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -1798,9 +1798,9 @@ argument, alphabetic sorting will be case-sensitive. @tsubheading{Regions} @kindex C-c C-x M-w @item C-c C-x M-w -Copy a rectangular region from a table to a special clipboard. Point -and mark determine edge fields of the rectangle. The process ignores -horizontal separator lines. +Copy a rectangular region from a table to a special clipboard. Point and +mark determine edge fields of the rectangle. If there is no active region, +copy just the current field. The process ignores horizontal separator lines. @c @kindex C-c C-x C-w @item C-c C-x C-w diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a7983ee7f..0304aa34d 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-07-31 Carsten Dominik + + * org-table.el (org-table-cut-region, org-table-copy-region): Work + on single field if no active region. + 2009-07-27 Carsten Dominik * org-latex.el (org-export-latex-make-header): Only insert title diff --git a/lisp/org-table.el b/lisp/org-table.el index 410f72164..91a92dbf7 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1403,15 +1403,21 @@ should be done in reverse order." (defun org-table-cut-region (beg end) - "Copy region in table to the clipboard and blank all relevant fields." - (interactive "r") + "Copy region in table to the clipboard and blank all relevant fields. +If there is no active region, use just the field at point." + (interactive (list + (if (org-region-active-p) (region-beginning) (point)) + (if (org-region-active-p) (region-end) (point)))) (org-table-copy-region beg end 'cut)) (defun org-table-copy-region (beg end &optional cut) "Copy rectangular region in table to clipboard. A special clipboard is used which can only be accessed with `org-table-paste-rectangle'." - (interactive "rP") + (interactive (list + (if (org-region-active-p) (region-beginning) (point)) + (if (org-region-active-p) (region-end) (point)) + current-prefix-arg)) (let* (l01 c01 l02 c02 l1 c1 l2 c2 ic1 ic2 region cols (rpl (if cut " " nil))) -- 2.11.4.GIT