Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package avy Updating the avy package is needed to fix compatibility issues of the zzz-to-char package (see, #925945). Changes in the avy package are significant, but as far as I can tell they do not break stuff, rather fixing issues with Emacs 26.1. unblock avy/0.4.0+git20190328.85b5d574-1 With regards, Lev Lamberov -- System Information: Debian Release: buster/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.19.0-2-amd64 (SMP w/4 CPU cores) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8), LANGUAGE=ru_RU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
diff -Nru avy-0.4.0+git20180322.2d613eb0/avy.el avy-0.4.0+git20190328.85b5d574/avy.el --- avy-0.4.0+git20180322.2d613eb0/avy.el 2018-03-23 01:33:23.000000000 +0500 +++ avy-0.4.0+git20190328.85b5d574/avy.el 2019-03-28 21:17:29.000000000 +0500 @@ -78,29 +78,39 @@ (character :tag "char") (symbol :tag "non-printing key")))) +(defconst avy--key-type + '(choice :tag "Command" + (const avy-goto-char) + (const avy-goto-char-2) + (const avy-isearch) + (const avy-goto-line) + (const avy-goto-subword-0) + (const avy-goto-subword-1) + (const avy-goto-word-0) + (const avy-goto-word-1) + (const avy-copy-line) + (const avy-copy-region) + (const avy-move-line) + (const avy-move-region) + (const avy-kill-whole-line) + (const avy-kill-region) + (const avy-kill-ring-save-whole-line) + (const avy-kill-ring-save-region) + (function :tag "Other command"))) + (defcustom avy-keys-alist nil "Alist of avy-jump commands to `avy-keys' overriding the default `avy-keys'." - :type '(alist - :key-type (choice :tag "Command" - (const avy-goto-char) - (const avy-goto-char-2) - (const avy-isearch) - (const avy-goto-line) - (const avy-goto-subword-0) - (const avy-goto-subword-1) - (const avy-goto-word-0) - (const avy-goto-word-1) - (const avy-copy-line) - (const avy-copy-region) - (const avy-move-line) - (const avy-move-region) - (const avy-kill-whole-line) - (const avy-kill-region) - (const avy-kill-ring-save-whole-line) - (const avy-kill-ring-save-region) - (function :tag "Other command")) + :type `(alist + :key-type ,avy--key-type :value-type (repeat :tag "Keys" character))) +(defcustom avy-orders-alist '((avy-goto-char . avy-order-closest)) + "Alist of candidate ordering functions. +Usually, candidates appear in their point position order." + :type `(alist + :key-type ,avy--key-type + :value-type function)) + (defcustom avy-words '("am" "by" "if" "is" "it" "my" "ox" "up" "ace" "act" "add" "age" "ago" "aim" "air" "ale" "all" "and" "ant" "any" @@ -234,6 +244,16 @@ Typically, these modes don't use the text representation." :type 'list) +(defcustom avy-single-candidate-jump t + "In case there is only one candidate jumps directly to it." + :type 'boolean) + +(defcustom avy-del-last-char-by '(8 127) + "List of event types, i.e. key presses, that delete the last +character read. The default represents `C-h' and `DEL'. See +`event-convert-list'." + :type 'list) + (defvar avy-ring (make-ring 20) "Hold the window and point history.") @@ -362,11 +382,22 @@ lst (cdr lst)))))) (nreverse path-alist))) +(defun avy-order-closest (x) + (abs (- (caar x) (point)))) + +(defvar avy-command nil + "Store the current command symbol. +E.g. 'avy-goto-line or 'avy-goto-char.") + (defun avy-tree (lst keys) "Coerce LST into a balanced tree. The degree of the tree is the length of KEYS. KEYS are placed appropriately on internal nodes." - (let ((len (length keys))) + (let* ((len (length keys)) + (order-fn (cdr (assq avy-command avy-orders-alist))) + (lst (if order-fn + (cl-sort lst #'< :key order-fn) + lst))) (cl-labels ((rd (ls) (let ((ln (length ls))) @@ -425,12 +456,27 @@ ((memq char '(27 ?\C-g)) ;; exit silently (throw 'done 'exit)) + ((eq char ??) + (avy-show-dispatch-help) + (throw 'done 'restart)) ((mouse-event-p char) (signal 'user-error (list "Mouse event not handled" char))) (t - (signal 'user-error (list "No such candidate" - (if (characterp char) (string char) char))) - (throw 'done nil))))) + (message "No such candidate: %s, hit `C-g' to quit." + (if (characterp char) (string char) char)))))) + +(defun avy-show-dispatch-help () + "Display action shortucts in echo area." + (let ((len (length "avy-action-"))) + (message "%s" (mapconcat + (lambda (x) + (format "%s: %s" + (propertize + (char-to-string (car x)) + 'face 'aw-key-face) + (substring (symbol-name (cdr x)) len))) + avy-dispatch-alist + " ")))) (defvar avy-handler-function 'avy-handler-default "A function to call for a bad `read-key' in `avy-read'.") @@ -449,7 +495,7 @@ (t (selected-window))))) (defun avy-read (tree display-fn cleanup-fn) - "Select a leaf from TREE using consecutive `read-char'. + "Select a leaf from TREE using consecutive `read-key'. DISPLAY-FN should take CHAR and LEAF and signify that LEAFs associated with CHAR will be selected if CHAR is pressed. This is @@ -605,10 +651,6 @@ Commands using `avy-with' macro can be resumed." (interactive)) -(defvar avy-command nil - "Store the current command symbol. -E.g. 'avy-goto-line or 'avy-goto-char.") - (defmacro avy-with (command &rest body) "Set `avy-keys' according to COMMAND and execute BODY. Set `avy-style' according to COMMMAND as well." @@ -691,8 +733,8 @@ (defun avy-action-zap-to-char (pt) "Kill from point up to PT." (if (> pt (point)) - (kill-region (point) (1+ pt)) - (kill-region pt (1+ (point))))) + (kill-region (point) pt) + (kill-region pt (point)))) (defun avy-action-teleport (pt) "Kill sexp starting on PT and yank into the current location." @@ -725,55 +767,110 @@ (when (looking-at-p "\\b") (ispell-word))))))) -(defun avy--process (candidates overlay-fn) +(defvar avy-pre-action #'avy-pre-action-default + "Function to call before `avy-action' is called.") + +(defun avy-pre-action-default (res) + (avy-push-mark) + (when (and (consp res) + (windowp (cdr res))) + (let* ((window (cdr res)) + (frame (window-frame window))) + (unless (equal frame (selected-frame)) + (select-frame-set-input-focus frame)) + (select-window window)))) + +(defun avy--process-1 (candidates overlay-fn &optional cleanup-fn) + (let ((len (length candidates))) + (cond ((= len 0) + nil) + ((and (= len 1) avy-single-candidate-jump) + (car candidates)) + (t + (unwind-protect + (progn + (avy--make-backgrounds + (avy-window-list)) + (cond ((eq avy-style 'de-bruijn) + (avy-read-de-bruijn + candidates avy-keys)) + ((eq avy-style 'words) + (avy-read-words + candidates avy-words)) + (t + (avy-read (avy-tree candidates avy-keys) + overlay-fn + (or cleanup-fn #'avy--remove-leading-chars))))) + (avy--done)))))) + +(defvar avy-last-candidates nil + "Store the last candidate list.") + +(defun avy--last-candidates-cycle (advancer) + (let* ((avy-last-candidates + (cl-remove-if-not + (lambda (x) (equal (cdr x) (selected-window))) + avy-last-candidates)) + (min-dist + (apply #'min + (mapcar (lambda (x) (abs (- (caar x) (point)))) avy-last-candidates))) + (pos + (cl-position-if + (lambda (x) + (= (- (caar x) (point)) min-dist)) + avy-last-candidates))) + (funcall advancer pos avy-last-candidates))) + +(defun avy-prev () + "Go to the previous candidate of the last `avy-read'." + (interactive) + (avy--last-candidates-cycle + (lambda (pos lst) + (when (> pos 0) + (goto-char (caar (nth (1- pos) lst))))))) + +(defun avy-next () + "Go to the next candidate of the last `avy-read'." + (interactive) + (avy--last-candidates-cycle + (lambda (pos lst) + (when (< pos (1- (length lst))) + (goto-char (caar (nth (1+ pos) lst))))))) + +(defun avy-process (candidates &optional overlay-fn cleanup-fn) "Select one of CANDIDATES using `avy-read'. -Use OVERLAY-FN to visualize the decision overlay." +Use OVERLAY-FN to visualize the decision overlay. +CLEANUP-FN should take no arguments and remove the effects of +multiple OVERLAY-FN invocations." + (setq overlay-fn (or overlay-fn (avy--style-fn avy-style))) + (setq cleanup-fn (or cleanup-fn #'avy--remove-leading-chars)) (unless (and (consp (car candidates)) (windowp (cdar candidates))) (setq candidates (mapcar (lambda (x) (cons x (selected-window))) candidates))) - (let ((len (length candidates)) - (cands (copy-sequence candidates)) - res) - (if (= len 0) - (message "zero candidates") - (if (= len 1) - (setq res (car candidates)) - (unwind-protect - (progn - (avy--make-backgrounds - (avy-window-list)) - (setq res (cond ((eq avy-style 'de-bruijn) - (avy-read-de-bruijn - candidates avy-keys)) - ((eq avy-style 'words) - (avy-read-words - candidates avy-words)) - (t - (avy-read (avy-tree candidates avy-keys) - overlay-fn - #'avy--remove-leading-chars))))) - (avy--done))) - (cond ((eq res 'restart) - (avy--process cands overlay-fn)) - ;; ignore exit from `avy-handler-function' - ((eq res 'exit)) - (t - (avy-push-mark) - (when (and (consp res) - (windowp (cdr res))) - (let* ((window (cdr res)) - (frame (window-frame window))) - (unless (equal frame (selected-frame)) - (select-frame-set-input-focus frame)) - (select-window window)) - (setq res (car res))) - - (funcall (or avy-action 'avy-action-goto) - (if (consp res) - (car res) - res))))))) + (setq avy-last-candidates (copy-sequence candidates)) + (let ((original-cands (copy-sequence candidates)) + (res (avy--process-1 candidates overlay-fn cleanup-fn))) + (cond + ((null res) + (message "zero candidates") + t) + ((eq res 'restart) + (avy-process original-cands overlay-fn cleanup-fn)) + ;; ignore exit from `avy-handler-function' + ((eq res 'exit)) + (t + (funcall avy-pre-action res) + (setq res (car res)) + (funcall (or avy-action 'avy-action-goto) + (if (consp res) + (car res) + res)) + res)))) + +(define-obsolete-function-alias 'avy--process 'avy-process + "0.4.0") (defvar avy--overlays-back nil "Hold overlays for when `avy-background' is t.") @@ -798,18 +895,24 @@ (setq avy--overlays-back nil) (avy--remove-leading-chars)) +(defun avy--visible-p (s) + (let ((invisible (get-char-property s 'invisible))) + (or (null invisible) + (eq t buffer-invisibility-spec) + (null (assoc invisible buffer-invisibility-spec))))) + (defun avy--next-visible-point () "Return the next closest point without 'invisible property." (let ((s (point))) (while (and (not (= (point-max) (setq s (next-char-property-change s)))) - (get-char-property s 'invisible))) + (not (avy--visible-p s)))) s)) (defun avy--next-invisible-point () "Return the next closest point with 'invisible property." (let ((s (point))) (while (and (not (= (point-max) (setq s (next-char-property-change s)))) - (not (get-char-property s 'invisible)))) + (avy--visible-p s))) s)) (defun avy--find-visible-regions (rbeg rend) @@ -844,7 +947,7 @@ (save-excursion (goto-char (car pair)) (while (re-search-forward regex (cdr pair) t) - (unless (get-char-property (1- (point)) 'invisible) + (when (avy--visible-p (1- (point))) (when (or (null pred) (funcall pred)) (push (cons (cons (match-beginning group) @@ -1117,21 +1220,36 @@ (post #'avy--overlay-post) (de-bruijn #'avy--overlay-at-full) (words #'avy--overlay-at-full) + (ignore #'ignore) (t (error "Unexpected style %S" style)))) -(defun avy--generic-jump (regex window-flip style &optional beg end) +(cl-defun avy-jump (regex &key window-flip beg end action pred) + "Jump to REGEX. +The window scope is determined by `avy-all-windows'. +When WINDOW-FLIP is non-nil, do the opposite of `avy-all-windows'. +BEG and END narrow the scope where candidates are searched. +ACTION is a function that takes point position as an argument. +When PRED is non-nil, it's a filter for matching point positions." + (setq avy-action (or action avy-action)) + (let ((avy-all-windows + (if window-flip + (not avy-all-windows) + avy-all-windows))) + (avy-process + (avy--regex-candidates regex beg end pred)))) + +(defun avy--generic-jump (regex window-flip &optional beg end) "Jump to REGEX. The window scope is determined by `avy-all-windows'. When WINDOW-FLIP is non-nil, do the opposite of `avy-all-windows'. -STYLE determines the leading char overlay style. BEG and END narrow the scope where candidates are searched." + (declare (obsolete avy-jump "0.4.0")) (let ((avy-all-windows (if window-flip (not avy-all-windows) avy-all-windows))) - (avy--process - (avy--regex-candidates regex beg end) - (avy--style-fn style)))) + (avy-process + (avy--regex-candidates regex beg end)))) ;;* Commands ;;;###autoload @@ -1141,24 +1259,21 @@ (interactive (list (read-char "char: " t) current-prefix-arg)) (avy-with avy-goto-char - (avy--generic-jump + (avy-jump (if (= 13 char) "\n" (regexp-quote (string char))) - arg - avy-style))) + :window-flip arg))) ;;;###autoload (defun avy-goto-char-in-line (char) "Jump to the currently visible CHAR in the current line." (interactive (list (read-char "char: " t))) (avy-with avy-goto-char - (avy--generic-jump + (avy-jump (regexp-quote (string char)) - avy-all-windows - avy-style - (line-beginning-position) - (line-end-position)))) + :beg (line-beginning-position) + :end (line-end-position)))) ;;;###autoload (defun avy-goto-char-2 (char1 char2 &optional arg beg end) @@ -1175,11 +1290,11 @@ (when (eq char2 ? ) (setq char2 ?\n)) (avy-with avy-goto-char-2 - (avy--generic-jump + (avy-jump (regexp-quote (string char1 char2)) - arg - avy-style - beg end))) + :window-flip arg + :beg beg + :end end))) ;;;###autoload (defun avy-goto-char-2-above (char1 char2 &optional arg) @@ -1217,11 +1332,10 @@ (interactive) (avy-with avy-isearch (let ((avy-background nil)) - (avy--process + (avy-process (avy--regex-candidates (if isearch-regexp isearch-string - (regexp-quote isearch-string))) - (avy--style-fn avy-style)) + (regexp-quote isearch-string)))) (isearch-done)))) ;;;###autoload @@ -1232,7 +1346,10 @@ BEG and END narrow the scope where candidates are searched." (interactive "P") (avy-with avy-goto-word-0 - (avy--generic-jump avy-goto-word-0-regexp arg avy-style beg end))) + (avy-jump avy-goto-word-0-regexp + :window-flip arg + :beg beg + :end end))) (defun avy-goto-word-0-above (arg) "Jump to a word start between window start and point. @@ -1272,7 +1389,10 @@ (concat (if symbol "\\_<" "\\b") str))))) - (avy--generic-jump regex arg avy-style beg end)))) + (avy-jump regex + :window-flip arg + :beg beg + :end end)))) ;;;###autoload (defun avy-goto-word-1-above (char &optional arg) @@ -1341,13 +1461,14 @@ :type '(repeat character)) ;;;###autoload -(defun avy-goto-subword-0 (&optional arg predicate) +(defun avy-goto-subword-0 (&optional arg predicate beg end) "Jump to a word or subword start. - The window scope is determined by `avy-all-windows' (ARG negates it). When PREDICATE is non-nil it's a function of zero parameters that -should return true." +should return true. + +BEG and END narrow the scope where candidates are searched." (interactive "P") (require 'subword) (avy-with avy-goto-subword-0 @@ -1360,15 +1481,15 @@ (dolist (char avy-subword-extra-word-chars) (modify-syntax-entry char "w" syn-tbl)) (with-syntax-table syn-tbl - (let ((ws (window-start)) + (let ((ws (or beg (window-start))) window-cands) (save-excursion - (goto-char (window-end (selected-window) t)) + (goto-char (or end (window-end (selected-window) t))) (subword-backward) (while (> (point) ws) (when (or (null predicate) (and predicate (funcall predicate))) - (unless (get-char-property (point) 'invisible) + (unless (not (avy--visible-p (point))) (push (cons (point) (selected-window)) window-cands))) (subword-backward)) (and (= (point) ws) @@ -1377,7 +1498,7 @@ (not (get-char-property (point) 'invisible)) (push (cons (point) (selected-window)) window-cands))) (setq candidates (nconc candidates window-cands)))))) - (avy--process candidates (avy--style-fn avy-style))))) + (avy-process candidates)))) ;;;###autoload (defun avy-goto-subword-1 (char &optional arg) @@ -1404,11 +1525,16 @@ (defvar visual-line-mode) -(defun avy--line-cands (&optional arg beg end) +(defcustom avy-indent-line-overlay nil + "When non-nil, `avy-goto-line' will display the line overlay next to the first non-whitespace character of each line." + :type 'boolean) + +(defun avy--line-cands (&optional arg beg end bottom-up) "Get candidates for selecting a line. The window scope is determined by `avy-all-windows'. When ARG is non-nil, do the opposite of `avy-all-windows'. -BEG and END narrow the scope where candidates are searched." +BEG and END narrow the scope where candidates are searched. +When BOTTOM-UP is non-nil, display avy candidates from top to bottom" (let (candidates) (avy-dowindows arg (let ((ws (or beg (window-start)))) @@ -1422,14 +1548,19 @@ (push (cons (if (eq avy-style 'post) (line-end-position) - (point)) + (save-excursion + (when avy-indent-line-overlay + (skip-chars-forward " \t")) + (point))) (selected-window)) candidates)) (if visual-line-mode (progn (setq temporary-goal-column 0) (line-move-visual 1 t)) (forward-line 1))))))) - (nreverse candidates))) + (if bottom-up + candidates + (nreverse candidates)))) (defun avy--linum-strings () "Get strings for `avy-linum-mode'." @@ -1514,18 +1645,20 @@ (frame-char-width))))) (set-window-margins win width (cdr (window-margins win))))) -(defun avy--line (&optional arg beg end) +(defun avy--line (&optional arg beg end bottom-up) "Select a line. The window scope is determined by `avy-all-windows'. When ARG is non-nil, do the opposite of `avy-all-windows'. -BEG and END narrow the scope where candidates are searched." - (let ((avy-action #'identity)) - (avy--process - (avy--line-cands arg beg end) - (if avy-linum-mode - (progn (message "Goto line:") - 'ignore) - (avy--style-fn avy-style))))) +BEG and END narrow the scope where candidates are searched. +When BOTTOM-UP is non-nil, display avy candidates from top to bottom" + (let ((avy-action #'identity) + (avy-style (if avy-linum-mode + (progn + (message "Goto line:") + 'ignore) + avy-style))) + (avy-process + (avy--line-cands arg beg end bottom-up)))) ;;;###autoload (defun avy-goto-line (&optional arg) @@ -1565,23 +1698,35 @@ (avy-action-goto r)))))) ;;;###autoload -(defun avy-goto-line-above () - "Goto visible line above the cursor." +(defun avy-goto-line-above (&optional offset bottom-up) + "Goto visible line above the cursor. +OFFSET changes the distance between the closest key to the cursor and +the cursor +When BOTTOM-UP is non-nil, display avy candidates from top to bottom" (interactive) + (if offset + (setq offset (+ 2 (- offset)))) (let* ((avy-all-windows nil) (r (avy--line nil (window-start) - (line-beginning-position)))) + (line-beginning-position (or offset 1)) + bottom-up))) (unless (eq r t) (avy-action-goto r)))) ;;;###autoload -(defun avy-goto-line-below () - "Goto visible line below the cursor." +(defun avy-goto-line-below (&optional offset bottom-up) + "Goto visible line below the cursor. +OFFSET changes the distance between the closest key to the cursor and +the cursor +When BOTTOM-UP is non-nil, display avy candidates from top to bottom" (interactive) + (if offset + (setq offset (+ offset 1))) (let* ((avy-all-windows nil) (r (avy--line - nil (line-beginning-position 2) - (window-end (selected-window) t)))) + nil (line-beginning-position (or offset 2)) + (window-end (selected-window) t) + bottom-up))) (unless (eq r t) (avy-action-goto r)))) @@ -1592,6 +1737,13 @@ (const :tag "Below" below))) ;;;###autoload +(defun avy-goto-end-of-line (&optional arg) + "Call `avy-goto-line' and move to the end of the line." + (interactive "p") + (avy-goto-line arg) + (end-of-line)) + +;;;###autoload (defun avy-copy-line (arg) "Copy a selected line above the current line. ARG lines can be used." @@ -1823,8 +1975,9 @@ (defun avy--read-candidates (&optional re-builder) "Read as many chars as possible and return their occurrences. At least one char must be read, and then repeatedly one next char -may be read if it is entered before `avy-timeout-seconds'. `C-h' -or `DEL' deletes the last char entered, and `RET' exits with the +may be read if it is entered before `avy-timeout-seconds'. Any +key defined in `avy-del-last-char-by' (by default `C-h' and `DEL') +deletes the last char entered, and `RET' exits with the currently read string immediately instead of waiting for another char for `avy-timeout-seconds'. The format of the result is the same as that of `avy--regex-candidates'. @@ -1838,9 +1991,12 @@ char break overlays regex) (unwind-protect (progn + (avy--make-backgrounds + (avy-window-list)) (while (and (not break) (setq char - (read-char (format "char%s: " + (read-char (format "%d char%s: " + (length overlays) (if (string= str "") str (format " (%s)" str))) @@ -1858,10 +2014,13 @@ (setq break t) (setq str (concat str (list ?\n))))) ;; Handle C-h, DEL - ((memq char '(8 127)) + ((memq char avy-del-last-char-by) (let ((l (length str))) (when (>= l 1) (setq str (substring str 0 (1- l)))))) + ;; Handle ESC + ((= char 27) + (keyboard-quit)) (t (setq str (concat str (list char))))) ;; Highlight @@ -1877,7 +2036,7 @@ (goto-char (car pair)) (setq regex (funcall re-builder str)) (while (re-search-forward regex (cdr pair) t) - (unless (get-char-property (1- (point)) 'invisible) + (unless (not (avy--visible-p (1- (point)))) (let* ((idx (if (= (length (match-data)) 4) 1 0)) (ov (make-overlay (match-beginning idx) (match-end idx)))) @@ -1895,7 +2054,8 @@ (overlay-get ov 'window))) overlays))) (dolist (ov overlays) - (delete-overlay ov))))) + (delete-overlay ov)) + (avy--done)))) ;;;###autoload (defun avy-goto-char-timer (&optional arg) @@ -1906,16 +2066,16 @@ (not avy-all-windows) avy-all-windows))) (avy-with avy-goto-char-timer - (avy--process - (avy--read-candidates) - (avy--style-fn avy-style))))) + (avy-process + (avy--read-candidates))))) (defun avy-push-mark () "Store the current point and window." - (ring-insert avy-ring - (cons (point) (selected-window))) - (unless (region-active-p) - (push-mark))) + (let ((inhibit-message t)) + (ring-insert avy-ring + (cons (point) (selected-window))) + (unless (region-active-p) + (push-mark)))) (defun avy-pop-mark () "Jump back to the last location of `avy-push-mark'." @@ -1939,22 +2099,30 @@ (defvar org-reverse-note-order) (declare-function org-refile "org") (declare-function org-back-to-heading "org") +(declare-function org-reveal "org") + +(defvar org-after-refile-insert-hook) (defun avy-org-refile-as-child () "Refile current heading as first child of heading selected with `avy.'" ;; Inspired by `org-teleport': http://kitchingroup.cheme.cmu.edu/blog/2016/03/18/Org-teleport-headlines/ (interactive) - (let ((rfloc (save-excursion - (let* ((org-reverse-note-order t) - (pos (avy-with avy-goto-line - (avy--generic-jump (rx bol (1+ "*") (1+ space)) - nil avy-style) - (point))) - (filename (buffer-file-name (or (buffer-base-buffer (current-buffer)) - (current-buffer))))) - (list nil filename nil pos))))) - ;; org-refile must be called outside of the excursion - (org-refile nil nil rfloc))) + (let* ((org-reverse-note-order t) + (marker (save-excursion + (avy-with avy-goto-line + (unless (eq 't (avy-jump (rx bol (1+ "*") (1+ space)))) + ;; `avy-jump' returns t when aborted with C-g. + (point-marker))))) + (filename (buffer-file-name (or (buffer-base-buffer (marker-buffer marker)) + (marker-buffer marker)))) + (rfloc (list nil filename nil marker)) + ;; Ensure the refiled heading is visible. + (org-after-refile-insert-hook (if (member 'org-reveal org-after-refile-insert-hook) + org-after-refile-insert-hook + (cons #'org-reveal org-after-refile-insert-hook)))) + (when marker + ;; Only attempt refile if avy session was not aborted. + (org-refile nil nil rfloc)))) (defun avy-org-goto-heading-timer (&optional arg) "Read one or many characters and jump to matching Org headings. @@ -1964,11 +2132,10 @@ (not avy-all-windows) avy-all-windows))) (avy-with avy-goto-char-timer - (avy--process + (avy-process (avy--read-candidates (lambda (input) - (format "^\\*+ .*\\(%s\\)" input))) - (avy--style-fn avy-style)) + (format "^\\*+ .*\\(%s\\)" input)))) (org-back-to-heading)))) (provide 'avy) diff -Nru avy-0.4.0+git20180322.2d613eb0/debian/changelog avy-0.4.0+git20190328.85b5d574/debian/changelog --- avy-0.4.0+git20180322.2d613eb0/debian/changelog 2018-06-06 16:21:10.000000000 +0500 +++ avy-0.4.0+git20190328.85b5d574/debian/changelog 2019-03-29 18:26:09.000000000 +0500 @@ -1,3 +1,9 @@ +avy (0.4.0+git20190328.85b5d574-1) unstable; urgency=medium + + * New upstream snapshot, incorporating bug fixes + + -- Lev Lamberov <dogs...@debian.org> Fri, 29 Mar 2019 18:26:09 +0500 + avy (0.4.0+git20180322.2d613eb0-1) unstable; urgency=medium * Team upload. diff -Nru avy-0.4.0+git20180322.2d613eb0/README.md avy-0.4.0+git20190328.85b5d574/README.md --- avy-0.4.0+git20180322.2d613eb0/README.md 2018-03-23 01:33:23.000000000 +0500 +++ avy-0.4.0+git20190328.85b5d574/README.md 2019-03-28 21:17:29.000000000 +0500 @@ -1,3 +1,6 @@ +[](https://melpa.org/#/avy) +[](https://stable.melpa.org/#/avy) + ## Introduction `avy` is a GNU Emacs package for jumping to visible text using a char-based decision tree. See also [ace-jump-mode](https://github.com/winterTTr/ace-jump-mode) and [vim-easymotion](https://github.com/Lokaltog/vim-easymotion) - `avy` uses the same idea. @@ -38,7 +41,8 @@ > Input an arbitrary amount of consecutive chars, jump to the first one with a > tree. -This is a more flexible version of `avy-goto-char-2`. First part works similarly to `isearch`: you type a query and it's highlighted dynamically on the screen. When you stop typing for `avy-timeout-seconds` (0.5s by default), you'll be able to select one of the candidates with `avy`. +This is a more flexible version of `avy-goto-char-2`. First part works similarly to `isearch`: you type a query and it's highlighted dynamically on the screen. When you stop typing for `avy-timeout-seconds` (0.5s by default), you'll be able to select one of the candidates with `avy`. As you're inputting characters, you can use `C-h` (backspace) or `DEL` (delete) to +forget the last typed character and `RET` to end the input sequence immediately and select a candidate. ### `avy-goto-line`