summaryrefslogtreecommitdiff
path: root/helm-tags.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2015-08-15 10:53:33 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2015-08-15 10:53:33 +0200
commitf50e974e320532a9274d96a30688500a037658cb (patch)
tree4b86aa725fd4425c4a9a71bfdab33ac5b32ec0a4 /helm-tags.el
parent922f1ea27edd653ff3987cff4f3386f1574ecb2d (diff)
Allow customizing which part of tag to match against (#1130).
* helm-tags.el (helm-etags-match-part-only): No more boolean, three different options. (helm-etags-build-source): Use it.
Diffstat (limited to 'helm-tags.el')
-rw-r--r--helm-tags.el27
1 files changed, 16 insertions, 11 deletions
diff --git a/helm-tags.el b/helm-tags.el
index 9284fa47..17c27d45 100644
--- a/helm-tags.el
+++ b/helm-tags.el
@@ -38,10 +38,17 @@ Don't search tag file deeply if outside this value."
:type 'number
:group 'helm-tags)
-(defcustom helm-etags-match-part-only t
- "Whether to match only the tag part of CANDIDATE in
-helm-source-etags-select."
- :type 'boolean
+(defcustom helm-etags-match-part-only 'tag
+ "Allow choosing the tag part of CANDIDATE in `helm-source-etags-select'.
+A tag looks like this:
+ filename: \(defun foo
+You can choose matching against only end part of tag (i.e \"foo\"),
+against only the tag part (i.e \"(defun foo\"),
+or against the whole candidate (i.e \"(filename: (defun foo\")."
+ :type '(choice
+ (const :tag "Match only tag" tag)
+ (const :tag "Match last part of tag" endtag)
+ (const :tag "Match all file+tag" all))
:group 'helm-tags)
(defcustom helm-etags-execute-action-at-once-if-one t
@@ -214,13 +221,11 @@ If no entry in cache, create one."
:match-part (lambda (candidate)
;; Match only the tag part of CANDIDATE
;; and not the filename.
- (if helm-etags-match-part-only
- ;; Ignore the first part of the tag
- ;; which is irrelevant
- ;;(e.g in "(cl-defun foo" search only if "foo" match)
- (cadr (split-string
- (cadr (helm-etags-split-line candidate))))
- candidate))
+ (cl-ecase helm-etags-match-part-only
+ (endtag (cadr (split-string
+ (cadr (helm-etags-split-line candidate)))))
+ (tag (cadr (helm-etags-split-line candidate)))
+ (all candidate)))
:help-message 'helm-etags-help-message
:keymap helm-etags-map
:action '(("Go to tag" . (lambda (c)