,@(mapcan (lambda (s) `("-o" "-name" ,s)) pat)
")"))))))
-(defvar grepflags)
-(defvar greppattern)
+(defvar semantic-symref-grep-flags)
(defvar semantic-symref-grep-expand-keywords
(condition-case nil
(let* ((kw (copy-alist grep-expand-keywords))
- (C (assoc "<C>" kw))
- (R (assoc "<R>" kw)))
- (setcdr C 'grepflags)
- (setcdr R 'greppattern)
- kw)
+ (C (assoc "<C>" kw)))
+ (setcdr C 'semantic-symref-grep-flags)
+ kw)
(error nil))
"Grep expand keywords used when expanding templates for symref.")
"Use the grep template expand feature to create a grep command.
ROOTDIR is the root location to run the `find' from.
FILEPATTERN is a string representing find flags for searching file patterns.
-GREPFLAGS are flags passed to grep, such as -n or -l.
-GREPPATTERN is the pattern used by grep."
+FLAGS are flags passed to Grep, such as -n or -l.
+PATTERN is the pattern used by Grep."
;; We have grep-compute-defaults. Let's use it.
(grep-compute-defaults)
- (let* ((grepflags flags)
- (greppattern pattern)
+ (let* ((semantic-symref-grep-flags flags)
(grep-expand-keywords semantic-symref-grep-expand-keywords)
(cmd (grep-expand-template
(if (memq system-type '(windows-nt ms-dos))
+ ;; FIXME: Is this still needed?
;; grep-find uses '--color=always' on MS-Windows
;; because it wants the colorized output, to show
;; it to the user. By contrast, here we don't show
(replace-regexp-in-string "--color=always" ""
grep-find-template t t)
grep-find-template)
- greppattern
+ pattern
filepattern
rootdir)))
;; http://debbugs.gnu.org/20719
(cl-defmethod semantic-symref-perform-search ((tool semantic-symref-tool-grep))
"Perform a search with Grep."
;; Grep doesn't support some types of searches.
- (let ((st (oref tool :searchtype)))
+ (let ((st (oref tool searchtype)))
(when (not (memq st '(symbol regexp)))
(error "Symref impl GREP does not support searchtype of %s" st))
)
(filepatterns (semantic-symref-derive-find-filepatterns))
(filepattern (mapconcat #'shell-quote-argument filepatterns " "))
;; Grep based flags.
- (grepflags (cond ((eq (oref tool :resulttype) 'file)
+ (grepflags (cond ((eq (oref tool resulttype) 'file)
"-l ")
- ((eq (oref tool :searchtype) 'regexp)
+ ((eq (oref tool searchtype) 'regexp)
"-nE ")
(t "-n ")))
- (greppat (shell-quote-argument
- (cond ((eq (oref tool :searchtype) 'regexp)
- (oref tool searchfor))
- (t
- ;; Can't use the word boundaries: Grep
- ;; doesn't always agrees with the language
- ;; syntax on those.
- (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)"
- (oref tool searchfor))))))
+ (greppat (cond ((eq (oref tool searchtype) 'regexp)
+ (oref tool searchfor))
+ (t
+ ;; Can't use the word boundaries: Grep
+ ;; doesn't always agrees with the language
+ ;; syntax on those.
+ (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)"
+ (oref tool searchfor)))))
;; Misc
(b (get-buffer-create "*Semantic SymRef*"))
(ans nil)
Moves cursor to end of the match."
(pcase-let
((`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist)))
- (cond ((eq (oref tool :resulttype) 'file)
+ (cond ((eq (oref tool resulttype) 'file)
;; Search for files
(when (re-search-forward "^\\([^\n]+\\)$" nil t)
(match-string 1)))
- ((eq (oref tool :resulttype) 'line-and-text)
+ ((eq (oref tool resulttype) 'line-and-text)
(when (re-search-forward grep-re nil t)
(list (string-to-number (match-string line-group))
(match-string file-group)