From e7470401ee530900a4169af7c8356a1eb6d5168f Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 20 Feb 2016 13:05:59 +0100 Subject: [PATCH] update avy. --- bba.org | 2 +- elpa/avy-20160105.245/avy-pkg.el | 1 - .../avy-autoloads.el | 2 +- elpa/avy-20160202.2357/avy-pkg.el | 1 + .../avy.el | 109 ++++++++++-------- 5 files changed, 67 insertions(+), 48 deletions(-) delete mode 100644 elpa/avy-20160105.245/avy-pkg.el rename elpa/{avy-20160105.245 => avy-20160202.2357}/avy-autoloads.el (98%) create mode 100644 elpa/avy-20160202.2357/avy-pkg.el rename elpa/{avy-20160105.245 => avy-20160202.2357}/avy.el (95%) diff --git a/bba.org b/bba.org index 0dc427de..0fc6b448 100644 --- a/bba.org +++ b/bba.org @@ -614,7 +614,7 @@ Replaced the deprecated [[https://github.com/winterTTr/ace-jump-mode][ace-jump-m with [[help:avy-goto-line][avy-goto-line]]. #+BEGIN_SRC emacs-lisp - (add-to-list 'load-path "~/.emacs.d/elpa/avy-20160105.245") + (add-to-list 'load-path "~/.emacs.d/elpa/avy-20160202.2357") (require 'avy) (define-key global-map (kbd "C-c C-@") 'avy-goto-word-1) (define-key global-map (kbd "C-c C-SPC") 'avy-goto-word-1) diff --git a/elpa/avy-20160105.245/avy-pkg.el b/elpa/avy-20160105.245/avy-pkg.el deleted file mode 100644 index be59ebab..00000000 --- a/elpa/avy-20160105.245/avy-pkg.el +++ /dev/null @@ -1 +0,0 @@ -(define-package "avy" "20160105.245" "set-based completion" '((emacs "24.1") (cl-lib "0.5")) :url "https://github.com/abo-abo/avy" :keywords '("point" "location")) diff --git a/elpa/avy-20160105.245/avy-autoloads.el b/elpa/avy-20160202.2357/avy-autoloads.el similarity index 98% rename from elpa/avy-20160105.245/avy-autoloads.el rename to elpa/avy-20160202.2357/avy-autoloads.el index 0d2059cd..bd42f86d 100644 --- a/elpa/avy-20160105.245/avy-autoloads.el +++ b/elpa/avy-20160202.2357/avy-autoloads.el @@ -3,7 +3,7 @@ ;;; Code: (add-to-list 'load-path (or (file-name-directory #$) (car load-path))) -;;;### (autoloads nil "avy" "avy.el" (22156 4998 0 0)) +;;;### (autoloads nil "avy" "avy.el" (22215 9152 0 0)) ;;; Generated autoloads from avy.el (autoload 'avy-goto-char "avy" "\ diff --git a/elpa/avy-20160202.2357/avy-pkg.el b/elpa/avy-20160202.2357/avy-pkg.el new file mode 100644 index 00000000..9d5d4290 --- /dev/null +++ b/elpa/avy-20160202.2357/avy-pkg.el @@ -0,0 +1 @@ +(define-package "avy" "20160202.2357" "tree-based completion" '((emacs "24.1") (cl-lib "0.5")) :url "https://github.com/abo-abo/avy" :keywords '("point" "location")) diff --git a/elpa/avy-20160105.245/avy.el b/elpa/avy-20160202.2357/avy.el similarity index 95% rename from elpa/avy-20160105.245/avy.el rename to elpa/avy-20160202.2357/avy.el index c331e48e..ebbe9bad 100644 --- a/elpa/avy-20160105.245/avy.el +++ b/elpa/avy-20160202.2357/avy.el @@ -1,11 +1,11 @@ -;;; avy.el --- set-based completion -*- lexical-binding: t -*- +;;; avy.el --- tree-based completion -*- lexical-binding: t -*- ;; Copyright (C) 2015 Free Software Foundation, Inc. ;; Author: Oleh Krehel ;; URL: https://github.com/abo-abo/avy -;; Package-Version: 20160105.245 -;; Version: 0.3.0 +;; Package-Version: 20160202.2357 +;; Version: 0.4.0 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5")) ;; Keywords: point, location @@ -161,6 +161,9 @@ When nil, punctuation chars will not be matched. "List of modes to ignore when searching for candidates. Typically, these modes don't use the text representation.") +(defvar avy-ring (make-ring 20) + "Hold the window and point history.") + (defvar avy-translate-char-function #'identity "Function to translate user input key into another key. For example, to make SPC do the same as ?a, use @@ -481,7 +484,12 @@ Set `avy-style' according to COMMMAND as well." (forward-sexp) (setq str (buffer-substring pt (point))) (kill-new str) - (message "Copied: %s" str)))) + (message "Copied: %s" str))) + (let ((dat (ring-ref avy-ring 0))) + (select-frame-set-input-focus + (window-frame (cdr dat))) + (select-window (cdr dat)) + (goto-char (car dat)))) (defun avy-action-kill (pt) "Kill sexp at PT." @@ -641,11 +649,18 @@ COMPOSE-FN is a lambda that concatenates the old string at BEG with STR." (ol (make-overlay beg (or end (1+ beg)) (window-buffer wnd))) (old-str (if (eq beg eob) "" (avy--old-str beg wnd))) (os-line-prefix (get-text-property 0 'line-prefix old-str)) - (os-wrap-prefix (get-text-property 0 'wrap-prefix old-str))) + (os-wrap-prefix (get-text-property 0 'wrap-prefix old-str)) + other-ol) (when os-line-prefix (add-text-properties 0 1 `(line-prefix ,os-line-prefix) str)) (when os-wrap-prefix (add-text-properties 0 1 `(wrap-prefix ,os-wrap-prefix) str)) + (when (setq other-ol (cl-find-if + (lambda (o) (overlay-get o 'goto-address)) + (overlays-at beg))) + (add-text-properties + 0 (length old-str) + `(face ,(overlay-get other-ol 'face)) old-str)) (overlay-put ol 'window wnd) (overlay-put ol 'category 'avy) (overlay-put ol (if (eq beg eob) @@ -772,7 +787,8 @@ LEAF is normally ((BEG . END) . WND)." len)) lep))) (when (and (bound-and-true-p visual-line-mode) - (> len (- end beg))) + (> len (- end beg)) + (not (eq lep beg))) (setq len (- end beg)) (let ((old-str (apply #'string (reverse path)))) (setq str @@ -1117,47 +1133,51 @@ Otherwise, forward to `goto-line' with ARG." "Copy a selected line above the current line. ARG lines can be used." (interactive "p") - (avy-with avy-copy-line - (let* ((start (avy--line)) - (str (buffer-substring-no-properties - start - (save-excursion - (goto-char start) - (move-end-of-line arg) - (point))))) - (cond ((eq avy-line-insert-style 'above) - (beginning-of-line) - (save-excursion - (insert str "\n"))) - ((eq avy-line-insert-style 'below) - (end-of-line) - (insert "\n" str) - (beginning-of-line)) - (t - (user-error "Unexpected `avy-line-insert-style'")))))) + (let ((initial-window (selected-window))) + (avy-with avy-copy-line + (let* ((start (avy--line)) + (str (buffer-substring-no-properties + start + (save-excursion + (goto-char start) + (move-end-of-line arg) + (point))))) + (select-window initial-window) + (cond ((eq avy-line-insert-style 'above) + (beginning-of-line) + (save-excursion + (insert str "\n"))) + ((eq avy-line-insert-style 'below) + (end-of-line) + (insert "\n" str) + (beginning-of-line)) + (t + (user-error "Unexpected `avy-line-insert-style'"))))))) ;;;###autoload (defun avy-move-line (arg) "Move a selected line above the current line. ARG lines can be used." (interactive "p") - (avy-with avy-move-line - (let ((start (avy--line))) - (save-excursion - (goto-char start) - (kill-whole-line arg)) - (cond ((eq avy-line-insert-style 'above) - (beginning-of-line) - (save-excursion - (insert - (current-kill 0)))) - ((eq avy-line-insert-style 'below) - (end-of-line) - (newline) - (save-excursion - (insert (substring (current-kill 0) 0 -1)))) - (t - (user-error "Unexpected `avy-line-insert-style'")))))) + (let ((initial-window (selected-window))) + (avy-with avy-move-line + (let ((start (avy--line))) + (save-excursion + (goto-char start) + (kill-whole-line arg)) + (select-window initial-window) + (cond ((eq avy-line-insert-style 'above) + (beginning-of-line) + (save-excursion + (insert + (current-kill 0)))) + ((eq avy-line-insert-style 'below) + (end-of-line) + (newline) + (save-excursion + (insert (substring (current-kill 0) 0 -1)))) + (t + (user-error "Unexpected `avy-line-insert-style'"))))))) ;;;###autoload (defun avy-copy-region (arg) @@ -1236,7 +1256,9 @@ This function obeys `avy-all-windows' setting." (setq str (concat str (list char))))) ;; Highlight (when (>= (length str) 1) - (let (found) + (let ((case-fold-search + (or avy-case-fold-search (string= str (downcase str)))) + found) (avy-dowindows current-prefix-arg (dolist (pair (avy--find-visible-regions (window-start) @@ -1276,9 +1298,6 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." (avy--read-candidates) (avy--style-fn avy-style))))) -(defvar avy-ring (make-ring 20) - "Hold the window and point history.") - (defun avy-push-mark () "Store the current point and window." (ring-insert avy-ring -- 2.47.3