diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-05-04 07:57:38 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2015-05-04 07:57:38 +0200 |
commit | 4d6d8b0eb8824f0c1b7614c33325675ab9c1675d (patch) | |
tree | 95fda024e095fbdd77f0ede78b217cefe4d9ed94 /helm-dabbrev.el | |
parent | b851af7d5b5a7a3fc0a62fba78b6b8e47c790ad1 (diff) |
Remove false matches.
* helm-dabbrev.el (helm-dabbrev--regexp): Simplify.
(helm-dabbrev--collect): Replace unwanted char at end of match.
Diffstat (limited to 'helm-dabbrev.el')
-rw-r--r-- | helm-dabbrev.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/helm-dabbrev.el b/helm-dabbrev.el index d71f9a70..57c80b9d 100644 --- a/helm-dabbrev.el +++ b/helm-dabbrev.el @@ -106,7 +106,7 @@ but the initial search for all candidates in buffer(s)." (defvar helm-dabbrev--exclude-current-buffer-flag nil) (defvar helm-dabbrev--cache nil) (defvar helm-dabbrev--data nil) -(defvar helm-dabbrev--regexp "\\s-\\|\t\\|[(\[\{\"'`=<$;]\\|\\s\\\\|^\\|\\.") +(defvar helm-dabbrev--regexp "\\s-\\|\t\\|[(\[\{\"'`=<$;.]\\|\\s\\\\|^") (cl-defstruct helm-dabbrev-info dabbrev limits iterator) @@ -175,7 +175,8 @@ but the initial search for all candidates in buffer(s)." (point)))) (setq pos-before pos) (search-backward pattern pos t)))) - (let* ((match-1 (helm-aif (thing-at-point 'symbol) + (let* ((replace-regexp (concat "\\(" helm-dabbrev--regexp "\\)\\'")) + (match-1 (helm-aif (thing-at-point 'symbol) ;; `thing-at-point' returns ;; the quote outside of e-lisp mode, ;; e.g in message mode, @@ -184,11 +185,13 @@ but the initial search for all candidates in buffer(s)." ;; `foo' => foo ;; so remove it [1]. (replace-regexp-in-string - "[']\\'" "" (substring-no-properties it)))) + replace-regexp + "" (substring-no-properties it)))) (match-2 (helm-aif (thing-at-point 'filename) ;; Same as in [1]. (replace-regexp-in-string - "[']\\'" "" (substring-no-properties it)))) + replace-regexp + "" (substring-no-properties it)))) (lst (if (string= match-1 match-2) (list match-1) (list match-1 match-2)))) |