[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 13/16: Some tests and bug fixes for org
From: |
Leo Liu |
Subject: |
[elpa] 13/16: Some tests and bug fixes for org |
Date: |
Tue, 22 Apr 2014 00:33:40 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 302cbb25ffbbdbf2b13bd04f0314390ff10f4116
Author: Leo Liu <address@hidden>
Date: Mon Apr 21 17:37:05 2014 +0800
Some tests and bug fixes for org
---
easy-kill.el | 4 ++--
test.el | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/easy-kill.el b/easy-kill.el
index 4b9970c..c55f482 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -767,8 +767,8 @@ inspected."
(pcase (or n 1)
(`0 nil)
(_ (ignore-errors (dotimes (_ (abs n)) (org-up-element)))
- (when (cl-plusp n)
- (goto-char (cdr (easy-kill-bounds-of-thing-at-point 'list)))))))
+ (goto-char (funcall (if (cl-minusp n) #'car #'cdr)
+ (easy-kill-bounds-of-thing-at-point 'list))))))
(defun easy-kill-on-list:org (n)
(pcase n
diff --git a/test.el b/test.el
index 2c82268..11aa533 100644
--- a/test.el
+++ b/test.el
@@ -253,6 +253,51 @@
(should (string= "<author>Gambardella, Matthew</author>"
(easy-kill-candidate))))))
+(ert-deftest test-org-mode ()
+ (let ((org "#+title: This is a title
+#+author: Leo Liu
+
+This is an example of org document.
+
+* Life
+ One two three ....
+*** Fruits
+ 1. apple
+ 2. orange
+ 3. mango
+
+* Sports cars
+ + Lamborghini
+ + Ferrari
+ + Porsche
+"))
+ (with-temp-buffer
+ (org-mode)
+ (insert org)
+ (goto-char (point-min))
+ (search-forward "This is")
+ (call-interactively 'easy-kill)
+ (easy-kill-thing 'sexp)
+ (easy-kill-expand)
+ (should (string= "#+title: This is a title\n" (easy-kill-candidate)))
+ (search-forward "Ferrari")
+ (call-interactively 'easy-kill)
+ (easy-kill-thing 'list)
+ (should (string= "Ferrari\n" (easy-kill-candidate)))
+ (easy-kill-expand)
+ (should (string= " + Ferrari\n" (easy-kill-candidate)))
+ ;; org quirks
+ (search-backward "Lamborghini")
+ (call-interactively 'easy-kill)
+ (easy-kill-thing 'list)
+ ;; You get the whole plainlist here; see `org-element-at-point'.
+ (easy-kill-expand)
+ (should (string= " + Lamborghini\n + Ferrari\n + Porsche\n"
+ (easy-kill-candidate)))
+ (easy-kill-expand)
+ (should (string= "* Sports cars\n + Lamborghini\n + Ferrari\n +
Porsche\n"
+ (easy-kill-candidate))))))
+
(ert-deftest test-elisp-mode ()
(let ((el "(defun set-hard-newline-properties (from to)
(let ((sticky (get-text-property from 'rear-nonsticky)))
- [elpa] 02/16: Teach easy-kill-help to handle old format of easy-kill-alist, (continued)
- [elpa] 02/16: Teach easy-kill-help to handle old format of easy-kill-alist, Leo Liu, 2014/04/21
- [elpa] 05/16: Stricter check on bounds of list in strings, Leo Liu, 2014/04/21
- [elpa] 06/16: New command easy-kill-exchange-point-and-mark, Leo Liu, 2014/04/21
- [elpa] 03/16: For #14: Treat strings like lists, Leo Liu, 2014/04/21
- [elpa] 07/16: Fix #15: Make `M-w l' in strings save to clipboard, Leo Liu, 2014/04/21
- [elpa] 04/16: Improve last change for easy-kill-thing-forward, Leo Liu, 2014/04/21
- [elpa] 09/16: Make digit key 0 shrink selection to its initial size, Leo Liu, 2014/04/21
- [elpa] 14/16: Fix easy-kill-org-up-element, Leo Liu, 2014/04/21
- [elpa] 08/16: Add wrappers for thingatpt.el for better code organisation, Leo Liu, 2014/04/21
- [elpa] 16/16: Merge branch 'master' of https://github.com/leoliu/easy-kill, Leo Liu, 2014/04/21
- [elpa] 13/16: Some tests and bug fixes for org,
Leo Liu <=
- [elpa] 12/16: Localize two global states using overlay properties, Leo Liu, 2014/04/21
- [elpa] 11/16: Add tests and enable travis-ci, Leo Liu, 2014/04/21
- [elpa] 15/16: Fix emacs-snapshot in travis-ci and use svg badge, Leo Liu, 2014/04/21
- [elpa] 10/16: Support Org mode with list-wise +/- and sexp selection, Leo Liu, 2014/04/21