diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-11-29 14:37:33 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-11-29 14:37:33 +0100 |
commit | acfb1ca4b894ac0f800b409f821686f4a75bceb4 (patch) | |
tree | 267f9dd44a4e2233ff72bd3152be5d63c568e8f0 | |
parent | 819b2a1a3d7d74787b45007929c2cd0e80be481e (diff) | |
parent | 12ea0f08f4acbdb534ae6928ab7a323b752d1f72 (diff) | |
download | org-mode-acfb1ca4b894ac0f800b409f821686f4a75bceb4.tar.gz |
Merge branch 'maint'
-rw-r--r-- | testing/lisp/test-org.el | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 4a307ef..fb9ed2f 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -90,86 +90,81 @@ (should (equal "# \nComment" (org-test-with-temp-text "Comment" - (progn (call-interactively 'comment-dwim) - (buffer-string))))) + (call-interactively #'org-comment-dwim) + (buffer-string)))) ;; No region selected, no comment on current line and line empty: ;; insert comment on this line. (should (equal "# \nParagraph" (org-test-with-temp-text "\nParagraph" - (progn (call-interactively 'comment-dwim) - (buffer-string))))) + (call-interactively #'org-comment-dwim) + (buffer-string)))) ;; No region selected, and a comment on this line: indent it. (should (equal "* Headline\n # Comment" - (org-test-with-temp-text "* Headline\n# Comment" - (progn (forward-line) - (let ((org-adapt-indentation t)) - (call-interactively 'comment-dwim)) - (buffer-string))))) + (org-test-with-temp-text "* Headline\n# <point>Comment" + (let ((org-adapt-indentation t)) + (call-interactively #'org-comment-dwim)) + (buffer-string)))) ;; Also recognize single # at column 0 as comments. (should (equal "# Comment" (org-test-with-temp-text "# Comment" - (progn (forward-line) - (call-interactively 'comment-dwim) - (buffer-string))))) + (call-interactively #'org-comment-dwim) + (buffer-string)))) ;; Region selected and only comments and blank lines within it: ;; un-comment all commented lines. (should (equal "Comment 1\n\nComment 2" (org-test-with-temp-text "# Comment 1\n\n# Comment 2" - (progn - (transient-mark-mode 1) - (push-mark (point) t t) - (goto-char (point-max)) - (call-interactively 'comment-dwim) - (buffer-string))))) + (transient-mark-mode 1) + (push-mark (point) t t) + (goto-char (point-max)) + (call-interactively #'org-comment-dwim) + (buffer-string)))) ;; Region selected without comments: comment all lines if ;; `comment-empty-lines' is non-nil, only non-blank lines otherwise. (should (equal "# Comment 1\n\n# Comment 2" (org-test-with-temp-text "Comment 1\n\nComment 2" - (progn - (transient-mark-mode 1) - (push-mark (point) t t) - (goto-char (point-max)) - (let ((comment-empty-lines nil)) - (call-interactively 'comment-dwim)) - (buffer-string))))) + (transient-mark-mode 1) + (push-mark (point) t t) + (goto-char (point-max)) + (let ((comment-empty-lines nil)) + (call-interactively #'org-comment-dwim)) + (buffer-string)))) (should (equal "# Comment 1\n# \n# Comment 2" (org-test-with-temp-text "Comment 1\n\nComment 2" - (progn - (transient-mark-mode 1) - (push-mark (point) t t) - (goto-char (point-max)) - (let ((comment-empty-lines t)) - (call-interactively 'comment-dwim)) - (buffer-string))))) + (transient-mark-mode 1) + (push-mark (point) t t) + (goto-char (point-max)) + (let ((comment-empty-lines t)) + (call-interactively #'org-comment-dwim)) + (buffer-string)))) ;; In front of a keyword without region, insert a new comment. (should (equal "# \n#+KEYWORD: value" (org-test-with-temp-text "#+KEYWORD: value" - (progn (call-interactively 'comment-dwim) - (buffer-string))))) + (call-interactively #'org-comment-dwim) + (buffer-string)))) ;; In a source block, use appropriate syntax. (should (equal " ;; " - (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n\n#+END_SRC" - (forward-line) + (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n<point>\n#+END_SRC" (let ((org-edit-src-content-indentation 2)) - (call-interactively 'comment-dwim)) - (buffer-substring-no-properties (line-beginning-position) (point))))) + (call-interactively #'org-comment-dwim)) + (buffer-substring-no-properties (line-beginning-position) + (point))))) (should (equal "#+BEGIN_SRC emacs-lisp\n ;; a\n ;; b\n#+END_SRC" - (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\na\nb\n#+END_SRC" - (forward-line) + (org-test-with-temp-text + "#+BEGIN_SRC emacs-lisp\n<point>a\nb\n#+END_SRC" (transient-mark-mode 1) (push-mark (point) t t) (forward-line 2) (let ((org-edit-src-content-indentation 2)) - (call-interactively 'comment-dwim)) + (call-interactively #'org-comment-dwim)) (buffer-string))))) |