[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 14/16: Fix easy-kill-org-up-element
From: |
Leo Liu |
Subject: |
[elpa] 14/16: Fix easy-kill-org-up-element |
Date: |
Tue, 22 Apr 2014 00:33:40 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 20ed0d595e5893e2c57a634a3137ef87b1714f17
Author: Leo Liu <address@hidden>
Date: Mon Apr 21 22:22:52 2014 +0800
Fix easy-kill-org-up-element
---
easy-kill.el | 14 +++++++++-----
test.el | 5 +++++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/easy-kill.el b/easy-kill.el
index c55f482..5db6823 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -645,7 +645,7 @@ inspected."
(defun easy-kill-thing-forward-defun (&optional n)
(pcase (or n 1)
((pred cl-minusp) (beginning-of-defun (- n)))
- (_ (end-of-defun n))))
+ (n (end-of-defun n))))
;;; Handler for `sexp' and `list'.
@@ -753,7 +753,7 @@ inspected."
(defun easy-kill-thing-forward-list:org (&optional n)
(pcase (or n 1)
(`0 nil)
- (_ (dotimes (_ (abs n))
+ (n (dotimes (_ (abs n))
(condition-case nil
(if (cl-minusp n)
(org-backward-element)
@@ -766,9 +766,13 @@ inspected."
;; Make `org-up-element' more like `up-list'.
(pcase (or n 1)
(`0 nil)
- (_ (ignore-errors (dotimes (_ (abs n)) (org-up-element)))
- (goto-char (funcall (if (cl-minusp n) #'car #'cdr)
- (easy-kill-bounds-of-thing-at-point 'list))))))
+ (n (ignore-errors
+ (dotimes (_ (abs n))
+ (pcase (list (point) (easy-kill-bounds-of-thing-at-point 'list))
+ (`(,_beg (,_beg . ,_)) (org-up-element))
+ (`(,_ (,beg . ,_)) (goto-char beg)))))
+ (when (cl-plusp n)
+ (goto-char (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 11aa533..3c021d3 100644
--- a/test.el
+++ b/test.el
@@ -280,6 +280,11 @@ This is an example of org document.
(easy-kill-thing 'sexp)
(easy-kill-expand)
(should (string= "#+title: This is a title\n" (easy-kill-candidate)))
+ (search-forward "Fruits")
+ (call-interactively 'easy-kill)
+ (easy-kill-thing 'sexp)
+ (easy-kill-expand)
+ (should (string-prefix-p "*** Fruits" (easy-kill-candidate)))
(search-forward "Ferrari")
(call-interactively 'easy-kill)
(easy-kill-thing 'list)
- [elpa] branch master updated (a1fe7f0 -> 6e73bbb), Leo Liu, 2014/04/21
- [elpa] 01/16: New command easy-kill-help, Leo Liu, 2014/04/21
- [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 <=
- [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, 2014/04/21
- [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