mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-13 13:33:03 +00:00
Customize extra chars for avy-goto-subword-1
* avy.el (avy-subword-extra-word-chars): New defcustom. (avy-goto-subword-0): Modify the syntax table temporarily using `avy-subword-extra-word-chars'. Fixes #116
This commit is contained in:
parent
fa6d1e1242
commit
b1a1953e1c
33
avy.el
33
avy.el
@ -955,6 +955,11 @@ The window scope is determined by `avy-all-windows' (ARG negates it)."
|
|||||||
(declare-function subword-backward "subword")
|
(declare-function subword-backward "subword")
|
||||||
(defvar subword-backward-regexp)
|
(defvar subword-backward-regexp)
|
||||||
|
|
||||||
|
(defcustom avy-subword-extra-word-chars '(?{ ?= ?} ?* ?: ?> ?<)
|
||||||
|
"A list of characters that should temporarily match \"\\w\".
|
||||||
|
This variable is used by `avy-goto-subword-0' and `avy-goto-subword-1'."
|
||||||
|
:type '(repeat character))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun avy-goto-subword-0 (&optional arg predicate)
|
(defun avy-goto-subword-0 (&optional arg predicate)
|
||||||
"Jump to a word or subword start.
|
"Jump to a word or subword start.
|
||||||
@ -971,18 +976,22 @@ should return true."
|
|||||||
"\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([!-/:@`~[:upper:]]+\\W*\\)\\|\\W\\w+\\)")
|
"\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([!-/:@`~[:upper:]]+\\W*\\)\\|\\W\\w+\\)")
|
||||||
candidates)
|
candidates)
|
||||||
(avy-dowindows arg
|
(avy-dowindows arg
|
||||||
(let ((ws (window-start))
|
(let ((syn-tbl (copy-syntax-table)))
|
||||||
window-cands)
|
(dolist (char avy-subword-extra-word-chars)
|
||||||
(save-excursion
|
(modify-syntax-entry char "w" syn-tbl))
|
||||||
(goto-char (window-end (selected-window) t))
|
(with-syntax-table syn-tbl
|
||||||
(subword-backward)
|
(let ((ws (window-start))
|
||||||
(while (> (point) ws)
|
window-cands)
|
||||||
(when (or (null predicate)
|
(save-excursion
|
||||||
(and predicate (funcall predicate)))
|
(goto-char (window-end (selected-window) t))
|
||||||
(unless (get-char-property (point) 'invisible)
|
(subword-backward)
|
||||||
(push (cons (point) (selected-window)) window-cands)))
|
(while (> (point) ws)
|
||||||
(subword-backward)))
|
(when (or (null predicate)
|
||||||
(setq candidates (nconc candidates window-cands))))
|
(and predicate (funcall predicate)))
|
||||||
|
(unless (get-char-property (point) 'invisible)
|
||||||
|
(push (cons (point) (selected-window)) window-cands)))
|
||||||
|
(subword-backward)))
|
||||||
|
(setq candidates (nconc candidates window-cands))))))
|
||||||
(avy--process candidates (avy--style-fn avy-style)))))
|
(avy--process candidates (avy--style-fn avy-style)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
Loading…
x
Reference in New Issue
Block a user