Useful human computer interaction comes down to finding the information you want when you need it.

We use programs to store information, in emacs, for example, both 'org-capture' and 'org-roam' are popular packages for storing information.

Once information is stored, there are a lot of programs you can use to find it when you need it.

I've put together a hydra that helps me do just that, and if you're a hydra person, I recommend you do the same.

Below is my search hydra. The text following the singled letters in quotations are the names of the program functions.

We will look at a few of those functions and their packages in the next few posts.

Search Hydra


(setq search-key (with-octicon "search" "Bookmarked Directories") )

(setq find-files-title (with-octicon "search" "Search Files And Text With The Silver Searcher"))
;generate hydra
(pretty-hydra-define Search-Files (:title find-files-title :quit-key "q" :color teal )
(
"A"

(
;   
    ("i" counsel-ibuffer "Counsel iBuffer (no manage)")
    ("I" ibuffer "Edit buffer list (manage)")
    ("c" counsel-org-capture "Counsel Capture (C-o t follow)" )
    ("o" counsel-org-goto "Search Org *s Buffer")
    ("b" counsel-bookmark "Search Bookmarks C-c f")
    ("d" counsel-bookmarked-directory  "Search Bookmarked dirs C-c d")
    ("r" counsel-buffer-or-recentf "Search Recent Files and buffers" )
;    ("R" counsel-buffer-or-recentf "Search Recent Files" )
    ("H" counsel-imenu "Search Org Headings")
    ("O" counsel-org-goto-all "Search Open Org *")
    ("A" counsel-org-agenda-headlines "Search Org Agenda *")
    ("j" poseidon/bm-counsel-find-bookmark  "Counsel Bkmark C-c j")
;    ("o" ag-kill-other-buffers "Delete Other Ag Buffers")
    
);end theme

"B"

(
    
    ("s" isearch-forward "isearch forward" )
    ("J" counsel-file-jump "Search Subdirectories For File")
    ("L" pos-counsel-locate "Locate Everything" )
    ("@" ag "Search With Ag")
    ("|" ag-file "Ag Search Text in Files")
;    ("p" ag-project "Ag Search Text In Projects")
;    ("P" counsel-projectile-ag "Counsel Search Project Ag")
    ("0" helm-org-rifle  "Helm Org Rifle Orgs")
;    ("1" ag-project-regexp "Search Regex In Projects")
    ("2" ag-regexp "Regex  Ag Search")
    ("3" helm-org-rifle-current-buffer "Helm Org Rifle Buffer")
    ("4" helm-org-rifle-agenda-files "Rifle agenda files")
    ("5" helm-org-rifle-directories "Helm Org Rifle Buffer")
);end specific

"C"
(
    ("l" counsel-find-library "Counsel Find Library")
    ("f" counsel-describe-function "Counsel Describe Function C-h f" )
    ("x" counsel-M-x "Search and Call Functions" )
    ("v" counsel-describe-variable "Counsel Describe Variable C-h v" )
    ("M" helpful-macro "Helpful Describe Macro" :color amaranth)
    ("K" helpful-macro "Helpful Describe Key" :color amaranth)
    ("#" counsel-descbinds "Counsel Describe Bindings" )
    ("B" describe-personal-key-bindings "Describe Personal Bindings" )
    ("F" counsel-describe-face "Counsel Describe Face" :color amaranth)
    ("D" list-faces-display "List Faces Display")
;    ("<F1>" ivy-mode "Ivy Mode" :color amaranth)
;    ("<F2>" ivy-rich-mode "Ivy Rich Mode" :color amaranth)
;    ("<F3>" counsel-mode "Counsel Mode" :color amaranth)
;    ("<F4>" helm-mode "Helm Mode" :color amaranth)
    ("h" hydra-helm/body "Return To Helm" :color blue )
    ("<SPC>" nil "Quit" :color blue )
);end library searches
);end hydra body
);end pretty-hydra-find-files
(bind-key "<C-m> s" 'Search-Files/body)




Notes

Awhile back I switched from the emacs Helm interface to the Counsel interface. I'll include the code I use to initialize Counsel and Ivy Rich (a Counsel complementary package) in the next post.

In the meantime, look into them.

I also continue to use Helm for the helm-org-rifle functions.

Helm-org-rifle is a programmatic method used to search through designated repositories (folders) for org-files and their contents.

You can find the helm initialization code I use via the search function on reading world magazine's search page.

I typically use my windows machine, so I've installed some programs just for windows. Those follow here.

Windows Default Find Program


(setq git-find-p "C:/ProgramData/relocatedPrograms/find.exe")
(setq find-program git-find-p)

Notes

Git comes with a find program, I moved that program to a folder with a path I liked and set it as the emacs default

Everything

There is a third-party program called "Everything" that I find more useful than windows search (particularly because I turn off search indexing on windows).

You can install "Everything" through the chocolatey package manager (which will add it automatically to your path) and integrate it with Emacs, which is cool.

I recommend installing that as it's easy to use and I've already written the post where that code will be shared (most of my emacs posts are programmatically written already, I just fill in or edit some text before the scheduled posting date.)

Silver Searcher


(setq ag-executable-p "C:\\ProgramData\\chocolatey\\bin\\ag.exe")


;find expressions in files in directories using ag
(use-package ag
:commands (ag-files ag-regexp ag-project ag-project-files ag-project-regexp)
:config
(setq ag-executable ag-executable-p)
;(next-error-follow-minor-mode t)
;(automatically-display-search-results-at-point t)
(setq ag-highlight-search t)
(setq ag-reuse-buffers t)
(setq ag-reuse-window t)
;:bind
;("M-s a" . ag-project)
);end ag



I use the Silver Searcher program ag.exe, which I installed through chocolatey.

I recommend installing that as well, and including some variation of the Emacs ag package configuration code I've listed above.

Come back for search hydra init code details later.

That’s All For This Post

comments powered by Disqus