Skip to content

Latest commit

 

History

History
93 lines (73 loc) · 3.41 KB

README.org

File metadata and controls

93 lines (73 loc) · 3.41 KB

http://img.shields.io/badge/license-GNU%20GPLv3-blue.svg http://stable.melpa.org/packages/helm-recoll-badge.svg http://melpa.org/packages/helm-recoll-badge.svg

Helm interface for the recoll desktop search tool.

Create recoll indexes

First you have to create an index for each directory you want to index, for this create some directories like “~/.recoll-<your-directory-name>” then create “recoll.conf” config files in each directory containing topdirs = <full/path/to/your/directory> then run recollindex -c ~/.recoll-<your-directory-name> to create index for each directory. See https://bitbucket.org/medoc/recoll/wiki/MultipleIndexes for more infos.

You can also create recoll index directories from helm-find-files by adding following code to your config:

(defun helm-ff-recoll-index-directory (directory)
  "Create a recoll index directory from DIRECTORY.
Add the new created directory to `helm-recoll-directories' using the
basename of DIRECTORY as name.
By using `customize-set-variable', a new source is created for this
new directory."
  (cl-assert (boundp 'helm-recoll-directories) nil
             "Package helm-recoll not installed or configured")
  (let* ((bn (helm-basename (expand-file-name directory)))
         (index-dir (format "~/.recoll-%s" bn))
         (conf-file (expand-file-name "recoll.conf" index-dir))) 
    (mkdir index-dir)
    (with-current-buffer (find-file-noselect conf-file)
      (insert (format "topdirs = %s" (expand-file-name directory)))
      (save-buffer)
      (kill-buffer))
    (customize-set-variable 'helm-recoll-directories
                            (append `((,bn . ,index-dir)) helm-recoll-directories))
    (message "Don't forget to index config directory with 'recollindex -c %s'" index-dir)))

(defmethod helm-setup-user-source ((source helm-source-ffiles))
  (helm-source-add-action-to-source-if
   "Recoll index directory"
   'helm-ff-recoll-index-directory
   source
   'file-directory-p
   3))

You will just need to index recoll directory with same recollindex command as described above.

Configure

Then you need to create some helm-recoll sources before you can use them. You can create sources by customizing helm-recoll-directories (NOT setq).

Then just call M-x helm-recoll will build a specific command for each directory and the specific sources for these directories.

Installation

After customizing helm-recoll-directories (see above) just require helm-recoll or even better autoload the helm-recoll function. If you use use-package you can use e.g.

(use-package helm-recoll
    :commands helm-recoll
    :init (setq helm-recoll-directories
                '(("confdir" . "~/.recoll-.emacs.d")
                  ("lisp sources" . "~/.recoll-elisp")
                  ("work" . "~/.recoll-work"))))

Otherwise add a require statement for the library:

(require 'helm-recoll)

to your init file and setup helm-recoll-directories using customize-set-variable (not setq).