dash-docs-el / helm-dash

Browse Dash docsets inside emacs
511 stars 59 forks source link

Make search case insensitive #141

Closed tobimensch closed 8 years ago

tobimensch commented 8 years ago

Example (for Qt5 docset):

With the search terms "QWidget policy"

helm-dash will not find

Qt QWidget::sizePolicy (Function) etc.

with the same search term in capital letters "QWidget Policy"

helm-dash will find

Qt QWidget::sizePolicy (Function) Qt QWidget::sizePolicy (Property)

and so forth.

kidd commented 8 years ago

We could try to use COLLATE NOCASE in sqlite searches if all the query is downcase, and make it case sensitive otherwise....

tobimensch commented 8 years ago

@kidd:

I'd prefer it to be case insensitive no matter what. (Maybe this could be an option?) In this example the "QWidget" string came from a helm-dash-at-point command. I don't want to hit backspace n times just to write qwidget in lower case, only so I can have a case insensitive search in functions/methods/properties and the like. :-)

tobimensch commented 8 years ago

@kidd: It is already the case that the search is case insensitive if the complete query is in lower case. But my problem is that class names in the code start with a capital letter, and I'm using helm-dash-at-point.

As a workaround I'm now using the following:

;;;;###autoload
(defun helm-dash-at-point-downcase ()
  "Bring up a `helm-dash' search interface with symbol at point."
  (interactive)
  (helm-dash-initialize-debugging-buffer)
  (helm-dash-create-common-connections)
  (helm-dash-create-buffer-connections)
  (helm :sources (helm-dash-sources--narrowed-docsets)
        :buffer "*helm-dash*"
        :prompt "Doc for: "
        :history 'helm-dash-history-input
        :input (downcase (thing-at-point 'symbol))
        :helm-candidate-number-limit 1000))

There are multiple problems with it: 1) I don't know how to put it in my emacs config. It says (helm-dash-initialize-debugging-buffer) is undefined etc. So I just put it into helm-dash.el. 2) It is still not case insensitive as soon as I type one upper case letter. But I want it never to be case sensitive. 3) ugly duplication of code

kidd commented 8 years ago

Try to set `helm-case-fold-search' to t . I think that should solve it :)

tobimensch commented 8 years ago

@kidd

That helped indeed.