diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-31 05:59:14 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-31 06:01:12 +0200 |
commit | 506c76bc0e9b33ecd6c6d5f402825444625d4113 (patch) | |
tree | a1b629abd4771d93b4a6fb0c17de6268d5adbce6 /helm-semantic.el | |
parent | 9cfeacd937bedd39224fcb723b14ae622d4db453 (diff) |
Fix preselection in semantic
* helm-semantic.el (helm-semantic-or-imenu): If parent and current tag
are equal don't use a cons cell.
(helm-semantic): Same.
Diffstat (limited to 'helm-semantic.el')
-rw-r--r-- | helm-semantic.el | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/helm-semantic.el b/helm-semantic.el index 9f4720cb..410cd0db 100644 --- a/helm-semantic.el +++ b/helm-semantic.el @@ -160,10 +160,13 @@ you have completion on these functions with `C-M i' in the customize interface." "Preconfigured `helm' for `semantic'. If ARG is supplied, pre-select symbol at point instead of current" (interactive "P") - (let ((tag (helm-aif (semantic-current-tag-parent) - (cons (format "\\_<%s\\_>" (car it)) - (format "\\_<%s\\_>" (car (semantic-current-tag)))) - (format "\\_<%s\\_>" (car (semantic-current-tag)))))) + (let ((tag (helm-aif (car (semantic-current-tag-parent)) + (let ((curtag (car (semantic-current-tag)))) + (if (string= it curtag) + (format "\\_<%s\\_>" curtag) + (cons (format "\\_<%s\\_>" it) + (format "\\_<%s\\_>" curtag)))) + (format "\\_<%s\\_>" (car (semantic-current-tag)))))) (unless helm-source-semantic (setq helm-source-semantic (helm-make-source "Semantic Tags" 'helm-semantic-source @@ -202,9 +205,12 @@ Fill in the symbol at point by default." (helm-execute-action-at-once-if-one (and imenu-p helm-imenu-execute-action-at-once-if-one)) - (tag (helm-aif (semantic-current-tag-parent) - (cons (format "\\_<%s\\_>" (car it)) - (format "\\_<%s\\_>" (car (semantic-current-tag)))) + (tag (helm-aif (car (semantic-current-tag-parent)) + (let ((curtag (car (semantic-current-tag)))) + (if (string= it curtag) + (format "\\_<%s\\_>" curtag) + (cons (format "\\_<%s\\_>" it) + (format "\\_<%s\\_>" curtag)))) (format "\\_<%s\\_>" (car (semantic-current-tag)))))) (helm :sources source :candidate-number-limit 9999 |