Protect increment-by-copying in tables.

This commit is contained in:
Carsten Dominik 2008-09-08 20:18:18 +02:00
parent ccb0755c75
commit e862a5cd58
4 changed files with 19 additions and 8 deletions

View File

@ -32,6 +32,8 @@
** Details
*** Prefix arg 0 to S-RET disabled integer increment during copy
This was a request by Chris Randle.
*** Column view capture tables can have formulas and plotting instructions
If you attach formulas and plotting instructions to a table
capturing column view, these extra lines will now survive an

View File

@ -1541,12 +1541,12 @@ be inserted with @kbd{C-y}.
@c
@kindex S-@key{RET}
@item S-@key{RET}
When current field is empty, copy from first non-empty field above.
When not empty, copy current field down to next row and move cursor
along with it. Depending on the variable
@code{org-table-copy-increment}, integer field values will be
incremented during copy. This key is also used by CUA mode
(@pxref{Cooperation}).
When current field is empty, copy from first non-empty field above. When not
empty, copy current field down to next row and move cursor along with it.
Depending on the variable @code{org-table-copy-increment}, integer field
values will be incremented during copy. Integers that are too large will not
be incremented. Also, a @code{0} prefix argument temporarily dispables the
increment. This key is also used by CUA mode (@pxref{Cooperation}).
@tsubheading{Miscellaneous}
@kindex C-c `

View File

@ -1,3 +1,9 @@
2008-09-08 Carsten Dominik <dominik@science.uva.nl>
* org-table.el (org-table-copy-down): Avoid overflow during
increment. Use prefix argument 0 to temporarily disable the
increment.
2008-09-07 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-as-html): Do not turn on the major mode

View File

@ -865,6 +865,7 @@ in order to easily repeat the interval."
(field (org-table-get-field))
(non-empty (string-match "[^ \t]" field))
(beg (org-table-begin))
(orig-n n)
txt)
(org-table-check-inside-data-field)
(if non-empty
@ -881,12 +882,14 @@ in order to easily repeat the interval."
(org-table-goto-column colpos t)
(if (and (looking-at
"|[ \t]*\\([^| \t][^|]*?\\)[ \t]*|")
(= (setq n (1- n)) 0))
(<= (setq n (1- n)) 0))
(throw 'exit (match-string 1))))))))
(if txt
(progn
(if (and org-table-copy-increment
(string-match "^[0-9]+$" txt))
(not (equal orig-n 0))
(string-match "^[0-9]+$" txt)
(< (string-to-number txt) 100000000))
(setq txt (format "%d" (+ (string-to-number txt) 1))))
(insert txt)
(org-move-to-column col)