[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 04/16: Improve last change for easy-kill-thing-forward
From: |
Leo Liu |
Subject: |
[elpa] 04/16: Improve last change for easy-kill-thing-forward |
Date: |
Tue, 22 Apr 2014 00:33:38 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 6e8a85357249227ce460072528963deeda04ca47
Author: Leo Liu <address@hidden>
Date: Tue Apr 15 18:17:43 2014 +0800
Improve last change for easy-kill-thing-forward
---
README.rst | 1 +
easy-kill.el | 34 +++++++++++++++++++++-------------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/README.rst b/README.rst
index bccccbb..c1153b9 100644
--- a/README.rst
+++ b/README.rst
@@ -91,6 +91,7 @@ NEWS
+++++
#. Key ``?`` in ``easy-kill`` or ``easy-mark`` prints help info.
+#. ``M-w l`` can select the enclosing string.
0.9.2
+++++
diff --git a/easy-kill.el b/easy-kill.el
index 0407a46..bc0d07b 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -374,7 +374,10 @@ candidate property instead."
(when (and (easy-kill-get thing) (/= n 0))
(let* ((step (if (cl-minusp n) -1 +1))
(thing (easy-kill-get thing))
- (bounds1 (or (easy-kill-pair-to-list (bounds-of-thing-at-point
thing))
+ (bounds1 (or (easy-kill-pair-to-list
+ (if (eq thing 'list)
+ (easy-kill-bounds-of-list-at-point)
+ (bounds-of-thing-at-point thing)))
(list (point) (point))))
(start (easy-kill-get start))
(end (easy-kill-get end))
@@ -639,6 +642,18 @@ inspected."
(_ (error "Unsupported argument `%s'" n)))
(bounds-of-thing-at-point 'sexp)))
+(defun easy-kill-bounds-of-list-at-point ()
+ (cl-labels ((bos () ;bounds of string
+ (and (nth 3 (syntax-ppss))
+ (save-excursion
+ (easy-kill-backward-up)
+ (bounds-of-thing-at-point 'sexp)))))
+ (pcase (cons (point)
+ (easy-kill-pair-to-list (bounds-of-thing-at-point 'list)))
+ (`(,beg ,beg ,end) (or (bos) (cons beg end)))
+ (`(,_ ,beg ,end) (cons beg end))
+ (_ (bos)))))
+
(defun easy-kill-on-list (n)
(pcase n
((or `+ `-)
@@ -647,18 +662,11 @@ inspected."
(easy-kill-adjust-candidate 'list beg end))))
(_ (pcase (easy-kill-get thing)
(`list (easy-kill-thing 'list n t))
- (_ (let ((bounds (bounds-of-thing-at-point 'list)))
- (cond ((and bounds (or (/= (car bounds) (point))
- (not (nth 3 (syntax-ppss)))))
- (setf (easy-kill-get thing) 'list
- (easy-kill-get bounds) bounds))
- ((nth 3 (syntax-ppss))
- (save-excursion
- (easy-kill-backward-up)
- (setf (easy-kill-get thing) 'list)
- (setf (easy-kill-get bounds)
- (bounds-of-thing-at-point 'sexp))))
- (t (easy-kill-echo "No `list' at point")))))))))
+ (_ (pcase (easy-kill-bounds-of-list-at-point)
+ (`(,beg . ,end)
+ (setf (easy-kill-get thing) 'list)
+ (setf (easy-kill-get bounds) (cons beg end)))
+ (`nil (easy-kill-echo "No `list' at point"))))))))
(defun easy-kill-on-sexp (n)
(pcase n
- [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 <=
- [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, 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