Skip to content

Commit

Permalink
improve elisp variable rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jacktasia committed Jan 18, 2016
1 parent fec3185 commit d91f538
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions dumb-jump.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

;; TODO: config variable for if it should be only for functions
;; TODO: add rules for declarations in method signatures
;; TODO: improve matching for exisiting rules with TODOs
;; TODO: complete README add gif etc.
;; TODO: melpa recipe
;; TODO: track (point) and use to go
Expand Down Expand Up @@ -66,11 +65,11 @@
'((:type "function" :language "elisp"
:regex "\\\(defun\\s+JJJ\\s*" :tests ("(defun test (blah)"))
(:type "variable" :language "elisp"
:regex "\\\(defvar\\b\\s*JJJ\\b\\s*" :tests ("(defvar test ")) ; TODO: "(defvar test\n" when long list..
:regex "\\\(defvar\\b\\s*JJJ\\b\\s?" :tests ("(defvar test " "(defvar test\n"))
(:type "variable" :language "elisp"
:regex "\\\(setq\\b\\s*JJJ\\b\\s*" :tests ("(setq test 123)"))
(:type "variable" :language "elisp"
:regex "\\\(JJJ\\b\\s*" :tests ("(let ((test 123)))")) ; TODO: just \\s+?
:regex "\\\(JJJ\\s+" :tests ("(let ((test 123)))"))

;; python
(:type "variable" :language "python"
Expand Down Expand Up @@ -434,7 +433,7 @@ If not found, then return dumb-jump-default-profile"
(lambda (r)
(format "'%s'" (plist-get r ':regex)))
rules)))
; (message-prin1 "%s %s %s %s" raw-rules ctx-rules rules regexes)
; (message-prin1 "raw:%s\n ctx-ruls:%s\n rules:%s\n regexes:%s\n" raw-rules ctx-rules rules regexes)
regexes))

(defun dumb-jump-generate-command (look-for proj regexes include-args exclude-args)
Expand Down
2 changes: 1 addition & 1 deletion test/dumb-jump-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

(ert-deftest dumb-jump-generate-command-no-ctx-test ()
(let ((regexes (dumb-jump-get-contextual-regexes "elisp" nil))
(expected "LANG=C grep -REn -e '\\(defun\\s+tester\\s*' -e '\\(defvar\\b\\s*tester\\b\\s*' -e '\\(setq\\b\\s*tester\\b\\s*' -e '\\(tester\\b\\s*' ."))
(expected "LANG=C grep -REn -e '\\(defun\\s+tester\\s*' -e '\\(defvar\\b\\s*tester\\b\\s?' -e '\\(setq\\b\\s*tester\\b\\s*' -e '\\(tester\\s+' ."))
(should (string= expected (dumb-jump-generate-command "tester" "." regexes "" "")))))

(ert-deftest dumb-jump-generate-command-with-ctx-test ()
Expand Down

0 comments on commit d91f538

Please sign in to comment.