]> code.delx.au - gnu-emacs-elpa/commitdiff
Add `avi-word-punc-regexp` defcustom
authorKaushal Modi <kaushal.modi@gmail.com>
Tue, 5 May 2015 13:14:07 +0000 (09:14 -0400)
committerKaushal Modi <kaushal.modi@gmail.com>
Tue, 5 May 2015 13:14:07 +0000 (09:14 -0400)
- Setting this to nil will disable jumping to punctuation chars during
  `avi-goto-word-1`.
- Set this to a regexp of punctuation chars you want to match otherwise.
- "[!-/:-@[-`{-~]" will match all printable punctuation chars.

avy-jump.el

index c1c03abcb5ba07a2f2c309fa58889f155c955460..ed0554a065d22335078d3aa25c71149d427d0dcc 100644 (file)
   "When non-nil, a gray background will be added during the selection."
   :type 'boolean)
 
+(defcustom avi-word-punc-regexp "[!-/:-@[-`{-~]"
+  "Regexp of punctuation characters that should be matched when calling
+`avi-goto-word-1' command. When nil, punctuation chars will not be matched.
+
+\"[!-/:-@[-`{-~]\" will match all printable punctuation chars.")
+
 (defface avi-lead-face
   '((t (:foreground "white" :background "#e52b50")))
   "Face used for the leading chars.")
@@ -249,7 +255,8 @@ Read one char with which the word should start."
   (interactive)
   (let* ((str (string (read-char "char: ")))
          (candidates (avi--regex-candidates
-                      (if (string-match "[,.+-*/=]" str)
+                      (if (and avi-word-punc-regexp
+                               (string-match avi-word-punc-regexp str))
                           str
                         (concat
                          "\\b"