leoliu pushed a commit to branch master in repository elpa. commit 6c18c835e2a8da3e9b457fd13eb2b6c89f4e853e Author: Leo Liu <sdl....@gmail.com> Date: Fri Oct 11 07:36:31 2013 +0800
Make easy-kill-backward-up work better when in strings --- easy-kill.el | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git a/easy-kill.el b/easy-kill.el index d92a64b..9b8a658 100644 --- a/easy-kill.el +++ b/easy-kill.el @@ -118,18 +118,18 @@ candidate property instead." (funcall interprogram-cut-function (easy-kill-candidate)))) (defun easy-kill-save-candidate () - ;; Do not modify the clipboard here because it may be called in - ;; `pre-command-hook' and will confuse `yank' if it is the next - ;; command. Also `easy-kill-adjust-candidate' already did the work. - (let ((interprogram-cut-function nil) - (interprogram-paste-function nil)) - (unless (string= (easy-kill-candidate) "") + (unless (string= (easy-kill-candidate) "") + ;; Do not modify the clipboard here because this may be called in + ;; `pre-command-hook' and will confuse `yank' if it is the next + ;; command. Also `easy-kill-adjust-candidate' already did the + ;; work. + (let ((interprogram-cut-function nil) + (interprogram-paste-function nil)) (kill-new (if easy-kill-append - (concat (car kill-ring) "\n" - (easy-kill-candidate)) + (concat (car kill-ring) "\n" (easy-kill-candidate)) (easy-kill-candidate)) - easy-kill-append) - t))) + easy-kill-append)) + t)) (defun easy-kill-destroy-candidate () (let ((hook (make-symbol "easy-kill-destroy-candidate"))) @@ -313,10 +313,14 @@ inspected." (return url))))))) (defun easy-kill-backward-up () - (condition-case nil - (up-list -1) - (scan-error (let ((ppss (syntax-ppss))) - (and (nth 3 ppss) (goto-char (nth 8 ppss))))))) + (let ((ppss (syntax-ppss))) + (condition-case nil + (progn + (up-list -1) + ;; `up-list' may jump to another string. + (when (and (nth 3 ppss) (< (point) (nth 8 ppss))) + (goto-char (nth 8 ppss)))) + (scan-error (and (nth 3 ppss) (goto-char (nth 8 ppss))))))) (defun easy-kill-backward-down (point &optional bound) (condition-case nil