diff options
author | Thierry Volpiatto <thievol@posteo.net> | 2021-12-23 18:43:44 +0100 |
---|---|---|
committer | Thierry Volpiatto <thievol@posteo.net> | 2021-12-23 18:43:44 +0100 |
commit | a46675d3c168114970a3b5f81b9306c496ca831a (patch) | |
tree | c6b24ec20c9f75dc1c6217a16c6ead467d3bc183 /helm-files.el | |
parent | e419f5452d9e81588de5f4a28b07fbe6e79e651a (diff) |
Revert "Allow matching library at toplevel when point is not in first line of"
This reverts commit e419f5452d9e81588de5f4a28b07fbe6e79e651a.
Diffstat (limited to 'helm-files.el')
-rw-r--r-- | helm-files.el | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/helm-files.el b/helm-files.el index 1f75316f..85769459 100644 --- a/helm-files.el +++ b/helm-files.el @@ -5256,23 +5256,22 @@ source is `helm-source-find-files'." "Try to find library path at point. Find inside `require' and `declare-function' sexp." (require 'find-func) - (let* ((beg-sexp (save-excursion (or (search-backward "(" (point-at-bol) t) - (and (beginning-of-defun) (point))))) + (let* ((beg-sexp (save-excursion (search-backward "(" (point-at-bol) t))) (end-sexp (save-excursion (end-of-defun) (point))) (sexp (and beg-sexp end-sexp (buffer-substring-no-properties (1+ beg-sexp) (1- end-sexp))))) (ignore-errors - (cond ((and sexp (string-match "use-package +\\([^) \n]*\\)" sexp)) - (find-library-name (match-string 1 sexp))) - ((and sexp (string-match "require +'\\([^) ]*\\)" sexp)) - (find-library-name (match-string 1 sexp))) - ((and sexp - (string-match - "declare-function +\\([^) ]*\\) \"\\(ext:\\)*\\([^\"]*\\)" - sexp)) - (find-library-name (match-string 3 sexp))) + (cond ((and sexp (string-match "use-package +\\([^ )]+\\)" sexp)) + (find-library-name (car (split-string (match-string 1 sexp))))) + ((and sexp (string-match "require +[']\\([^ )]+\\)" sexp)) + ;; If require use third arg, ignore it, + ;; always use library path found in `load-path'. + (find-library-name (car (split-string (match-string 1 sexp))))) + ((and sexp (string-match "declare-function .+? \"\\(?:ext:\\)?\\([^ )]+\\)\"" sexp)) + (find-library-name (car (split-string (match-string 1 sexp))))) (t nil))))) + ;;; Handle copy, rename, symlink, relsymlink and hardlink from helm. ;; |