[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 03/16: For #14: Treat strings like lists
From: |
Leo Liu |
Subject: |
[elpa] 03/16: For #14: Treat strings like lists |
Date: |
Tue, 22 Apr 2014 00:33:38 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 843d81db4d226063e7115a20ff65fd974bd0fabd
Author: Leo Liu <address@hidden>
Date: Tue Apr 15 17:17:16 2014 +0800
For #14: Treat strings like lists
When inside a string and no enclosing list at point, treat the whole
string as the list.
---
easy-kill.el | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/easy-kill.el b/easy-kill.el
index 0eda453..0407a46 100644
--- a/easy-kill.el
+++ b/easy-kill.el
@@ -70,14 +70,13 @@
(add-hook 'pre-command-hook clearfunsym)
(push alist emulation-mode-map-alists))))))
-(defcustom easy-kill-alist
- '((?w word " ")
- (?s sexp "\n")
- (?l list "\n")
- (?f filename "\n")
- (?d defun "\n\n")
- (?e line "\n")
- (?b buffer-file-name))
+(defcustom easy-kill-alist '((?w word " ")
+ (?s sexp "\n")
+ (?l list "\n")
+ (?f filename "\n")
+ (?d defun "\n\n")
+ (?e line "\n")
+ (?b buffer-file-name))
"A list of (CHAR THING APPEND).
CHAR is used immediately following `easy-kill' to select THING.
APPEND is optional and if non-nil specifies the separator (a
@@ -646,7 +645,20 @@ inspected."
(pcase (easy-kill-bounds-of-list n)
(`(,beg . ,end)
(easy-kill-adjust-candidate 'list beg end))))
- (_ (easy-kill-thing 'list n t))))
+ (_ (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")))))))))
(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 <=
- [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, 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