all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* hydra: Have hint shown immediately
@ 2015-04-29  8:02 Florian Lindner
  2015-04-30  0:06 ` John Mastro
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Lindner @ 2015-04-29  8:02 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I wonder if anyone is familiar with the hydra package: 
https://github.com/abo-abo/hydra

I have an hydra to call search engines:

(defhydra hydra-google (global-map "C-c /" :color blue)
  "Search Engines"
  ("c" (lambda ()
         (interactive)
         (flo/start-search 
"http://en.cppreference.com/mwiki/index.php?title=Special:Search&search=%s"))
   "C++ Reference")
  ("g" (lambda ()
         (interactive)
         (flo/start-search "https://google.de/#q=%s"))
   "Google")
  )

flo/start-search looks like that:

(defun flo/start-search (url)
  (interactive)
  (browse-url (replace-regexp-in-string
               (regexp-quote "%s")
               (if (region-active-p)
                   (buffer-substring (region-beginning) (region-end))
                 (read-string "Search for: " (thing-at-point 'symbol) 
"searches" nil t)
                 )
               url)
              )
  )


interactive is just for testing, it will vanish probably. Since this is my 
first elisp "program" please criticise!


My question: How can I make the hydra menu to be shown as soon as I press C-
c /? Becaue I exit the hydra after pressing the key I'll never see the menu 
and forget option when more search engines are aded.

Thanks,
Florian




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-03 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1882.1430294575.904.help-gnu-emacs@gnu.org>
2015-05-03 19:52 ` hydra: Have hint shown immediately Joost Kremers
2015-04-29  8:02 Florian Lindner
2015-04-30  0:06 ` John Mastro

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.