Merge branch 'maint'

This commit is contained in:
Marco Wahl 2020-04-18 16:17:12 +02:00
commit 6f38fe24a3
3 changed files with 44 additions and 1 deletions

View File

@ -833,6 +833,11 @@ I.e. treat the whole file as if it was a subtree.
Before, the new column was inserted to the right of the column at
point position.
*** Table column deletion now consistent with row deletion
Point stays in the column at deletion, except when deleting the
rightmost column.
* Version 9.2
** Incompatible changes
*** Removal of OrgStruct mode mode and radio lists

View File

@ -1488,6 +1488,7 @@ Swap with anything in target cell."
(interactive)
(unless (org-at-table-p) (user-error "Not at a table"))
(org-table-find-dataline)
(and (eolp) (looking-back "|" 1) (backward-char)) ; Snap into last column.
(org-table-check-inside-data-field nil t)
(let* ((col (org-table-current-column))
(beg (org-table-begin))
@ -1503,7 +1504,6 @@ Swap with anything in target cell."
(and (looking-at "|[^|\n]+|")
(replace-match "|")))
(forward-line)))
(org-table-goto-column (max 1 (1- col)))
(org-table-align)
;; Shift appropriately stored shrunk column numbers, then hide the
;; columns again.

View File

@ -2340,6 +2340,44 @@ See also `test-org-table/copy-field'."
(ignore-errors (org-table-previous-field))
(char-after)))))
;;; Deleting columns
(ert-deftest test-org-table/delete-column ()
"Test `org-table-delete-column'."
;; Error when outside a table.
(should-error
(org-test-with-temp-text "Paragraph"
(org-table-delete-column)))
;; Delete first column.
(should
(equal "| a |\n"
(org-test-with-temp-text
"| <point> | a |\n"
(org-table-delete-column)
(buffer-string))))
;; Delete column and check location of point.
(should
(= 2
(org-test-with-temp-text
"| a | <point>b | c |"
(org-table-delete-column)
(org-table-current-column))))
;; Delete column when at end of line and immediately after a "|".
(should
(equal "| a |\n"
(org-test-with-temp-text
"| a | b |<point>\n"
(org-table-delete-column)
(buffer-string))))
;; Delete two columns starting with the last column.
(should
(equal "| a |\n"
(org-test-with-temp-text
"| a | b | c<point> |"
(org-table-delete-column)
(org-table-delete-column)
(buffer-string)))))
;;; Inserting rows, inserting columns