@@ -291,16 +291,61 @@ or most optimal searcher."
291
291
292
292
; ; common lisp
293
293
(:type " function" :supports (" ag" " grep" " rg" " git-grep" ) :language " commonlisp"
294
- :regex " \\ \( defun \\ s+JJJ\\ j"
294
+ :regex " \\ \( def(un|macro|generic|method|setf) \\ s+JJJ\\ j"
295
295
; ; \\ j usage see `dumb-jump-ag-word-boundary`
296
- :tests (" (defun test (blah)" " (defun test\n " )
296
+ :tests (" (defun test (blah)" " (defun test\n "
297
+ " (defmacro test (blah)" " (defmacro test\n "
298
+ " (defgeneric test (blah)" " (defgeneric test\n "
299
+ " (defmethod test (blah)" " (defmethod test\n "
300
+ " (defsetf test (blah)" " (defsetf test\n " )
297
301
:not (" (defun test-asdf (blah)" " (defun test-blah\n "
298
- " (defun tester (blah)" " (defun test? (blah)" " (defun test- (blah)" ))
302
+ " (defun tester (blah)" " (defun test? (blah)" " (defun test- (blah)"
303
+ " (defmacro test-asdf (blah)" " (defmacro test-blah\n "
304
+ " (defmacro tester (blah)" " (defmacro test? (blah)" " (defmacro test- (blah)"
305
+ " (defgeneric test-asdf (blah)" " (defgeneric test-blah\n "
306
+ " (defgeneric tester (blah)" " (defgeneric test? (blah)" " (defun test- (blah)"
307
+ " (defmethod test-asdf (blah)" " (defmethod test-blah\n "
308
+ " (defmethod tester (blah)" " (defmethod test? (blah)" " (defun test- (blah)"
309
+ " (defsetf test-asdf (blah)" " (defsetf test-blah\n "
310
+ " (defsetf tester (blah)" " (defsetf test? (blah)" " (defun test- (blah)" ))
311
+
312
+ (:type " function" :supports (" ag" " grep" " rg" " git-grep" ) :language " commonlisp"
313
+ :regex " \\ \( define-(modify-macro|compiler-macro|setf-expander)\\ s+JJJ\\ j"
314
+ ; ; \\ j usage see `dumb-jump-ag-word-boundary`
315
+ :tests (" (define-modify-macro test (blah)" " (define-modify-macro test\n "
316
+ " (define-compiler-macro test (blah)" " (define-compiler-macro test\n " )
317
+ :not (" (define-modify-macro test-asdf (blah)" " (define-modify-macro test-blah\n "
318
+ " (define-modify-macro tester (blah)" " (define-modify-macro test? (blah)" " (define-modify-macro test- (blah)"
319
+ " (define-compiler-macro test-asdf (blah)" " (define-compiler-macro test-blah\n "
320
+ " (define-compiler-macro tester (blah)" " (define-compiler-macro test? (blah)" " (define-compiler-macro test- (blah)" ))
321
+
322
+ (:type " variable" :supports (" ag" " grep" " rg" " git-grep" ) :language " commonlisp"
323
+ :regex " \\ \( def(var|parameter|constant)\\ b\\ s*JJJ\\ j"
324
+ :tests (" (defvar test " " (defvar test\n "
325
+ " (defparameter test " " (defparameter test\n "
326
+ " (defconstant test " " (defconstant test\n " )
327
+ :not (" (defvar tester" " (defvar test?" " (defvar test-"
328
+ " (defparameter tester" " (defparameter test?" " (defparameter test-"
329
+ " (defconstant tester" " (defconstant test?" " (defconstant test-" ))
299
330
300
331
(:type " variable" :supports (" ag" " grep" " rg" " git-grep" ) :language " commonlisp"
301
- :regex " \\ \( defparameter\\ b\\ s*JJJ\\ j"
302
- :tests (" (defparameter test " " (defparameter test\n " )
303
- :not (" (defparameter tester" " (defparameter test?" " (defparameter test-" ))
332
+ :regex " \\ \( define-symbol-macro\\ b\\ s*JJJ\\ j"
333
+ :tests (" (define-symbol-macro test " " (define-symbol-macro test\n " )
334
+ :not (" (define-symbol-macro tester" " (define-symbol-macro test?" " (define-symbol-macro test-" ))
335
+
336
+ (:type " type" :supports (" ag" " grep" " rg" " git-grep" ) :language " commonlisp"
337
+ :regex " \\ \( def(class|struct|type)\\ b\\ s*JJJ\\ j"
338
+ :tests (" (defclass test " " (defclass test\n "
339
+ " (defstruct test " " (defstruct test\n "
340
+ " (deftype test " " (deftype test\n " )
341
+ :not (" (defclass tester" " (defclass test?" " (defclass test-"
342
+ " (defstruct tester" " (defstruct test?" " (defstruct test-"
343
+ " (deftype tester" " (deftype test?" " (deftype test-" ))
344
+
345
+ (:type " type" :supports (" ag" " grep" " rg" " git-grep" ) :language " commonlisp"
346
+ :regex " \\ \( define-condition\\ b\\ s*JJJ\\ j"
347
+ :tests (" (define-condition test " " (define-condition test\n " )
348
+ :not (" (define-condition tester" " (define-condition test?" " (define-condition test-" ))
304
349
305
350
; ; racket
306
351
(:type " function" :supports (" ag" " grep" " rg" " git-grep" ) :language " racket"
@@ -2169,6 +2214,8 @@ to keep looking for another root."
2169
2214
(defun dumb-jump-process-symbol-by-lang (lang look-for )
2170
2215
" Process LANG's LOOK-FOR. For instance, clojure needs namespace part removed."
2171
2216
(cond
2217
+ ((and (string= lang " commonlisp" ) (s-contains? " :" look-for) (not (s-starts-with? " :" look-for)))
2218
+ (nth 1 (s-split " :" look-for 'omit-nulls )))
2172
2219
((and (string= lang " clojure" ) (s-contains? " /" look-for))
2173
2220
(nth 1 (s-split " /" look-for)))
2174
2221
((and (string= lang " fennel" ) (s-contains? " ." look-for))
@@ -2722,6 +2769,9 @@ searcher symbol."
2722
2769
(t
2723
2770
shell-command-switch))))
2724
2771
2772
+ (defconst dumb-jump--case-insensitive-languages
2773
+ '(" commonlisp" ))
2774
+
2725
2775
; ; TODO: rename dumb-jump-run-definition-command
2726
2776
(defun dumb-jump-run-command
2727
2777
(look-for proj regexes lang exclude-args cur-file line-num parse-fn generate-fn)
@@ -2741,8 +2791,9 @@ searcher symbol."
2741
2791
(setq rawresults (shell-command-to-string cmd))
2742
2792
(dumb-jump-debug-message cmd rawresults))
2743
2793
(unless (s-blank? cmd)
2744
- (let ((results (funcall parse-fn rawresults cur-file line-num)))
2745
- (--filter (s-contains? look-for (plist-get it :context )) results)))))
2794
+ (let ((results (funcall parse-fn rawresults cur-file line-num))
2795
+ (ignore-case (member lang dumb-jump--case-insensitive-languages)))
2796
+ (--filter (s-contains? look-for (plist-get it :context ) ignore-case) results)))))
2746
2797
2747
2798
(defun dumb-jump-parse-response-line (resp-line cur-file )
2748
2799
" Parse a search program's single RESP-LINE for CUR-FILE into a list of (path line context)."
@@ -2890,6 +2941,9 @@ searcher symbol."
2890
2941
; ; TODO: --search-zip always? in case the include is the in gz area like emacs lisp code.
2891
2942
(cmd (concat dumb-jump-ag-cmd
2892
2943
" --nocolor --nogroup"
2944
+ (if (member lang dumb-jump--case-insensitive-languages)
2945
+ " --ignore-case"
2946
+ " " )
2893
2947
(if (s-ends-with? " .gz" cur-file)
2894
2948
" --search-zip"
2895
2949
" " )
@@ -2929,14 +2983,17 @@ searcher symbol."
2929
2983
proj-root))
2930
2984
2931
2985
; ; git-grep plus ag only recommended for huge repos like the linux kernel
2932
- (defun dumb-jump-generate-git-grep-plus-ag-command (look-for cur-file proj regexes _lang exclude-paths )
2986
+ (defun dumb-jump-generate-git-grep-plus-ag-command (look-for cur-file proj regexes lang exclude-paths )
2933
2987
" Generate the ag response based on the needle LOOK-FOR in the directory PROJ.
2934
2988
Using ag to search only the files found via git-grep literal symbol search."
2935
2989
(let* ((filled-regexes (dumb-jump-populate-regexes look-for regexes 'ag ))
2936
2990
(proj-dir (file-name-as-directory proj))
2937
2991
(ag-files-arg (dumb-jump-get-git-grep-files-matching-symbol-as-ag-arg look-for proj-dir))
2938
2992
(cmd (concat dumb-jump-ag-cmd
2939
2993
" --nocolor --nogroup"
2994
+ (if (member lang dumb-jump--case-insensitive-languages)
2995
+ " --ignore-case"
2996
+ " " )
2940
2997
(if (s-ends-with? " .gz" cur-file)
2941
2998
" --search-zip"
2942
2999
" " )
@@ -2956,6 +3013,9 @@ Using ag to search only the files found via git-grep literal symbol search."
2956
3013
(proj-dir (file-name-as-directory proj))
2957
3014
(cmd (concat dumb-jump-rg-cmd
2958
3015
" --color never --no-heading --line-number -U"
3016
+ (if (member lang dumb-jump--case-insensitive-languages)
3017
+ " --ignore-case"
3018
+ " " )
2959
3019
(when (not (s-blank? dumb-jump-rg-search-args))
2960
3020
(concat " " dumb-jump-rg-search-args))
2961
3021
(s-join " " (--map (format " --type %s " it) rgtypes))))
@@ -2972,6 +3032,9 @@ Using ag to search only the files found via git-grep literal symbol search."
2972
3032
(ggtypes (when (file-name-extension cur-file) (dumb-jump-get-git-grep-type-by-language lang)))
2973
3033
(cmd (concat dumb-jump-git-grep-cmd
2974
3034
" --color=never --line-number"
3035
+ (if (member lang dumb-jump--case-insensitive-languages)
3036
+ " --ignore-case"
3037
+ " " )
2975
3038
(when dumb-jump-git-grep-search-untracked
2976
3039
" --untracked" )
2977
3040
(when (not (s-blank? dumb-jump-git-grep-search-args))
@@ -2994,28 +3057,34 @@ Using ag to search only the files found via git-grep literal symbol search."
2994
3057
(if (s-ends-with? " .gz" cur-file)
2995
3058
dumb-jump-zgrep-cmd
2996
3059
dumb-jump-grep-cmd)))
3060
+ (case-args (if (member lang dumb-jump--case-insensitive-languages)
3061
+ " --ignore-case"
3062
+ " " ))
2997
3063
(exclude-args (dumb-jump-arg-joiner " --exclude-dir" exclude-paths))
2998
3064
(include-args (dumb-jump-get-ext-includes lang))
2999
3065
(regex-args (dumb-jump-arg-joiner " -e" filled-regexes)))
3000
3066
(if (= (length regexes) 0 )
3001
3067
" "
3002
- (dumb-jump-concat-command cmd dumb-jump-grep-args exclude-args include-args regex-args proj))))
3068
+ (dumb-jump-concat-command cmd dumb-jump-grep-args case-args exclude-args include-args regex-args proj))))
3003
3069
3004
- (defun dumb-jump-generate-gnu-grep-command (look-for cur-file proj regexes _lang _exclude-paths )
3070
+ (defun dumb-jump-generate-gnu-grep-command (look-for cur-file proj regexes lang _exclude-paths )
3005
3071
" Find LOOK-FOR's CUR-FILE in the PROJ with REGEXES for the LANG but not in EXCLUDE-PATHS."
3006
3072
(let* ((filled-regexes (--map (shell-quote-argument it)
3007
3073
(dumb-jump-populate-regexes look-for regexes 'gnu-grep )))
3008
3074
(cmd (concat (if (eq system-type 'windows-nt ) " " (concat dumb-jump-grep-prefix " " ))
3009
3075
(if (s-ends-with? " .gz" cur-file)
3010
3076
dumb-jump-zgrep-cmd
3011
3077
dumb-jump-grep-cmd)))
3078
+ (case-args (if (member lang dumb-jump--case-insensitive-languages)
3079
+ " --ignore-case"
3080
+ " " ))
3012
3081
; ; TODO: GNU grep doesn't support these, so skip them
3013
3082
(exclude-args " " )
3014
3083
(include-args " " )
3015
3084
(regex-args (dumb-jump-arg-joiner " -e" filled-regexes)))
3016
3085
(if (= (length regexes) 0 )
3017
3086
" "
3018
- (dumb-jump-concat-command cmd dumb-jump-gnu-grep-args exclude-args include-args regex-args proj))))
3087
+ (dumb-jump-concat-command cmd dumb-jump-gnu-grep-args case-args exclude-args include-args regex-args proj))))
3019
3088
3020
3089
(defun dumb-jump-concat-command (&rest parts )
3021
3090
" Concat the PARTS of a command if each part has a length."
0 commit comments