浏览代码

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.
Carsten Dominik 15 年之前
父节点
当前提交
09cccb22b3
共有 3 个文件被更改,包括 17 次插入6 次删除
  1. 3 3
      doc/org.texi
  2. 5 0
      lisp/ChangeLog
  3. 9 3
      lisp/org-table.el

+ 3 - 3
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

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-07-31  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-table.el (org-table-cut-region, org-table-copy-region): Work
+	on single field if no active region.
+
 2009-07-27  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-latex.el (org-export-latex-make-header): Only insert title

+ 9 - 3
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)))