forked from mirrors/org-mode
Merge branch 'master' of code.orgmode.org:bzg/org-mode
This commit is contained in:
commit
26f54050b6
|
@ -448,7 +448,7 @@ for the duration of the command.")
|
|||
"Overlay the newline before the current line with the table title."
|
||||
(interactive)
|
||||
(let ((title "")
|
||||
(linum-offset (line-number-display-width 'columns))
|
||||
(linum-offset (org-line-number-display-width 'columns))
|
||||
(i 0))
|
||||
(dolist (column org-columns-current-fmt-compiled)
|
||||
(pcase column
|
||||
|
|
|
@ -61,6 +61,13 @@
|
|||
(defvar org-table-tab-recognizes-table.el)
|
||||
(defvar org-table1-hline-regexp)
|
||||
|
||||
|
||||
;;; Emacs < 26.1 compatibility
|
||||
|
||||
(if (fboundp 'line-number-display-width)
|
||||
(defalias 'org-line-number-display-width 'line-number-display-width)
|
||||
(defun org-line-number-display-width (&rest _) 0))
|
||||
|
||||
|
||||
;;; Emacs < 25.1 compatibility
|
||||
|
||||
|
|
|
@ -14182,7 +14182,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state."
|
|||
(let ((current
|
||||
;; Reverse the tags list so any new tag is appended to the
|
||||
;; current list of tags.
|
||||
(nreverse (org-get-tags)))
|
||||
(nreverse (org-get-tags nil t)))
|
||||
res)
|
||||
(pcase onoff
|
||||
(`off (setq current (delete tag current)))
|
||||
|
|
|
@ -327,11 +327,11 @@ the buffer."
|
|||
;; Test match filtering.
|
||||
(should
|
||||
(equal
|
||||
"| Headline | Time | |
|
||||
|------------+------+------|
|
||||
"| Headline | Time | |
|
||||
|--------------+--------+------|
|
||||
| *Total time* | *2:00* | |
|
||||
|------------+------+------|
|
||||
| H1 | | 2:00 |"
|
||||
|--------------+--------+------|
|
||||
| H1 | | 2:00 |"
|
||||
(org-test-with-temp-text "** H1\n\n*** H2 :tag:\n\n*** H3\n<point>"
|
||||
(insert (org-test-clock-create-clock ". 1:00" ". 2:00"))
|
||||
(goto-line 4)
|
||||
|
@ -343,11 +343,11 @@ the buffer."
|
|||
;; Test tags column.
|
||||
(should
|
||||
(equal
|
||||
"| Tags | Headline | Time | |
|
||||
|------+------------+------+------|
|
||||
"| Tags | Headline | Time | |
|
||||
|------+--------------+--------+------|
|
||||
| | *Total time* | *1:00* | |
|
||||
|------+------------+------+------|
|
||||
| tag | H1 | | 1:00 |"
|
||||
|------+--------------+--------+------|
|
||||
| tag | H1 | | 1:00 |"
|
||||
(org-test-with-temp-text "** H1 :tag:\n\n*** H2 \n<point>"
|
||||
(insert (org-test-clock-create-clock ". 1:00" ". 2:00"))
|
||||
(goto-line 4)
|
||||
|
|
|
@ -6280,6 +6280,76 @@ Paragraph<point>"
|
|||
(let ((org-tags-column 1)) (org-set-tags-command t))
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-org/toggle-tag ()
|
||||
"Test `org-toggle-tag' specifications."
|
||||
;; Insert missing tag.
|
||||
(should
|
||||
(equal "* H :tag:"
|
||||
(org-test-with-temp-text "* H"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "tag"))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "* H :tag1:tag2:"
|
||||
(org-test-with-temp-text "* H :tag1:"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "tag2"))
|
||||
(buffer-string))))
|
||||
;; Remove existing tag.
|
||||
(should
|
||||
(equal "* H"
|
||||
(org-test-with-temp-text "* H :tag:"
|
||||
(org-toggle-tag "tag")
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "* H :tag1:"
|
||||
(org-test-with-temp-text "* H :tag1:tag2:"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "tag2"))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "* H :tag2:"
|
||||
(org-test-with-temp-text "* H :tag1:tag2:"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "tag1"))
|
||||
(buffer-string))))
|
||||
;; With optional argument ONOFF set to `on', try to insert the tag,
|
||||
;; even if its already there.
|
||||
(should
|
||||
(equal "* H :tag:"
|
||||
(org-test-with-temp-text "* H"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "tag" 'on))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "* H :tag:"
|
||||
(org-test-with-temp-text "* H :tag:"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "tag" 'on))
|
||||
(buffer-string))))
|
||||
;; With optional argument ONOFF set to `off', try to remove the tag,
|
||||
;; even if its not there.
|
||||
(should
|
||||
(equal "* H"
|
||||
(org-test-with-temp-text "* H :tag:"
|
||||
(org-toggle-tag "tag" 'off)
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "* H :tag:"
|
||||
(org-test-with-temp-text "* H :tag:"
|
||||
(let ((org-tags-column 1)) (org-toggle-tag "foo" 'off))
|
||||
(buffer-string))))
|
||||
;; Special case: Handle properly tag inheritance. In particular, do
|
||||
;; not set inherited tags.
|
||||
(should
|
||||
(equal "* H1 :tag:\n** H2 :tag2:tag:"
|
||||
(org-test-with-temp-text "* H1 :tag:\n** <point>H2 :tag2:"
|
||||
(let ((org-use-tag-inheritance t)
|
||||
(org-tags-column 1))
|
||||
(org-toggle-tag "tag"))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal "* H1 :tag1:tag2:\n** H2 :foo:"
|
||||
(org-test-with-temp-text "* H1 :tag1:tag2:\n** <point>H2"
|
||||
(let ((org-use-tag-inheritance t)
|
||||
(org-tags-column 1))
|
||||
(org-toggle-tag "foo"))
|
||||
(buffer-string)))))
|
||||
|
||||
|
||||
|
||||
;;; TODO keywords
|
||||
|
|
Loading…
Reference in New Issue