Skip to content

Support case insensitive search #101

Closed
wants to merge 3 commits into from

2 participants

@MarSik
MarSik commented Apr 17, 2013

Adds a eclim-java-find-generic-i which searches with case
sensitivity turned off and modify eclim-java-find-type so
it uses the new function when the pattern is all lowercase.

Fixes: #100

Signed-off-by: Martin Sivak msivak@redhat.com

Martin Sivak added some commits Apr 17, 2013
Martin Sivak Support case insensitive searches
Adds a eclim-java-find-generic-i which searches with case
sensitivity turned off and modify eclim-java-find-type so
it uses the new function when the pattern is all lowercase.

Signed-off-by: Martin Sivak <msivak@redhat.com>
dab10be
Martin Sivak Add eclim-java-find-simple search function 4b1cbfe
Martin Sivak Eclipse returns documentation in the info field, strip it when doing …
…inline completion
150bd82
@fred-o
Collaborator
fred-o commented May 21, 2013

Hi, and thanks for the contribution. I've been thinking about this a bit, and it seems like a lot of work just to get case insensitive search going.

I experimented a bit with eclim--expand-args (it's been a while since I wrote it), and realized that the arguments are indeed eval:ed, so we can just tack on (if case-insensitive '("-i" "")) to the argument list and don't need to add a separate function.

I was thinking about tieing the case-sensitive switch to the prefix argument, so with the following modified functions the way to do a case insensitive search would be C-u M-x eclim-java-find-type

(defun eclim-java-find-type (type-name &optional case-insensitive)
  "Searches the project for a given class. The TYPE-NAME is the pattern, which will be used for the search."
  (interactive (list (read-string "Name: " (let ((case-fold-search nil)
                                                 (current-symbol (symbol-name (symbol-at-point))))
                                             (if (string-match-p "^[A-Z]" current-symbol)
                                                 current-symbol
                                               (eclim--java-current-type-name))))
                     current-prefix-arg))
  (eclim-java-find-generic "workspace" "declarations" "type" type-name case-insensitive t))

(defun eclim-java-find-generic (scope context type pattern &optional case-insensitive open-single-file)
  (interactive (list (eclim--completing-read "Scope: " eclim--java-search-scopes)
                     (eclim--completing-read "Context: " eclim--java-search-contexts)
                     (eclim--completing-read "Type: " eclim--java-search-types)
                     (read-string "Pattern: ")
                     current-prefix-arg))
  (message "case-insensitive: %s" case-insensitive)
  (eclim/with-results hits ("java_search" ("-p" pattern) ("-t" type) ("-x" context) ("-s" scope) (if case-insensitive '("-i" "")))
    (eclim--find-display-results pattern hits open-single-file)))

Thoughts?

@fred-o
Collaborator
fred-o commented May 21, 2013

I can't work out what eclim-java-find-simple does. It looks terribly similar to eclim-java-find-type?

@MarSik
MarSik commented May 21, 2013

Well only the first patch was meant to be exported to the bug.. the other two are just my tweaks to make it behave my way :) So yes it is almost the same except it accepts only one argument and I was able to bind it to a keystroke directly.

@MarSik
MarSik commented May 21, 2013

The ("-i" "") in your patch actually does something not really nice.. it passes one extra empty string argument to eclim. That is why my patch added the simple-args logic.

@fred-o
Collaborator
fred-o commented Jul 16, 2013

Gotcha. I've altered eclim--make-command to accept arguments with a nil value as well; I felt that was a more general solution. Please have a look at my WIP:

https://github.com/fred-o/emacs-eclim/tree/case-insensitive-search

eclim-java-find-type and eclim-java-find-generic can now be called with a prefix argument (C-u), which causes the search to be case insensitive.

@fred-o
Collaborator
fred-o commented Jan 8, 2014

Sorry for the long delay; time and energy has been in short supply. Anyway, I've now merged my solution allowing for case insensitive search when prefixed with the universal argument (C-u). I'd like to thank you for the time and effort you put into it. Cheers!

@fred-o fred-o closed this Jan 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.