Created
August 10, 2013 19:15
-
-
Save ctanis/6201749 to your computer and use it in GitHub Desktop.
a dinky little elisp function for searching duckduckgo with (optionally) the region contents (optionally enclosed in quotes) with no active region, it just sends the minibuffer contents. with an active region, it concats the minibuffer contents with the region contents. with a prefix argument, the region contents are enclosed in quotes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ddg-search (prefix str) | |
(interactive "P\nMSearch term: ") | |
(let ((arg | |
(if (region-active-p) | |
(concat str (if prefix " \"" " ") | |
(buffer-substring (region-beginning) (region-end)) | |
(if prefix "\"")) | |
str))) | |
(browse-url (concat "https://duckduckgo.com/?q=" (url-hexify-string arg))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment