[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/engine-mode 2ddc5ec627 20/71: Switch engine keybinding to
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/engine-mode 2ddc5ec627 20/71: Switch engine keybinding to be a keyword argument |
Date: |
Wed, 21 Dec 2022 09:59:06 -0500 (EST) |
branch: elpa/engine-mode
commit 2ddc5ec62726e446c15197628e0f8e5cdf8016f1
Author: Harry Schwartz <hello@harryrschwartz.com>
Commit: Harry Schwartz <hello@harryrschwartz.com>
Switch engine keybinding to be a keyword argument
Previously, the key to which an engine was bound was an *optional*
argument, so we'd say something like:
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
"d")
This commit makes it a *keyword* argument. We'll now have to say:
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
:keybinding "d")
BE FOREWARNED: This is a breaking change! However, we're now able to add
additional optional keyword arguments to defengine. We've had requests
for features like:
* Specifying engine-specific browsers
* Override docstrings on a per-engine basis
* Specify character encoding for a particular engine
This should make adding per-engine features much easier.
---
README.md | 13 ++++++++-----
engine-mode.el | 12 ++++++------
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 8876e33ebc..6867c4e7ba 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ prefixed with `engine/keymap-prefix` (which defaults to "C-c
/"):
```emacs
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
- "d")
+ :keybinding "d")
```
`C-c / d` is now bound to the new function `engine/search-duckduckgo`!
@@ -80,7 +80,10 @@ Since many browsers save keyword searches using the same
format as
engine-mode (that is, by using `%s` in a url to indicate a search
term), it's not too hard to import them into Emacs.
-@sshaw has written a script to [import from Chrome on OS X].
+@sshaw has written a script to [import from Chrome on OS X], but it's
+based on an older version of `engine-mode`, so the resulting file may
+need a bit of manual cleaning-up (specifically, you may need to add
+the `:keybinding` keyword to the generated engine definitions).
## Engine examples
@@ -90,14 +93,14 @@ term), it's not too hard to import them into Emacs.
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
- "d")
+ :keybinding "d")
(defengine github
"https://github.com/search?ref=simplesearch&q=%s")
(defengine google
"http://www.google.com/search?ie=utf-8&oe=utf-8&q=%s"
- "g")
+ :keybinding "g")
(defengine google-images
"http://www.google.com/images?hl=en&source=hp&biw=1440&bih=795&gbv=2&aq=f&aqi=&aql=&oq=&q=%s")
@@ -119,7 +122,7 @@ term), it's not too hard to import them into Emacs.
(defengine wikipedia
"http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=%s"
- "w")
+ :keybinding "w")
(defengine wiktionary
"https://www.wikipedia.org/search-redirect.php?family=wiktionary&language=en&go=Go&search=%s")
diff --git a/engine-mode.el b/engine-mode.el
index 99d6b31e98..0c753e598f 100644
--- a/engine-mode.el
+++ b/engine-mode.el
@@ -1,7 +1,7 @@
;;; engine-mode.el --- Define and query search engines from within Emacs.
;; Author: Harry R. Schwartz <hello@harryrschwartz.com>
-;; Version: 2015.02.07
+;; Version: 2015.05.02
;; URL: https://github.com/hrs/engine-mode/engine-mode.el
;; This file is NOT part of GNU Emacs.
@@ -27,7 +27,7 @@
;; (defengine duckduckgo
;; "https://duckduckgo.com/?q=%s"
-;; "d")
+;; :keybinding "d")
;; `C-c / d' is now bound to the new function
;; engine/search-duckduckgo'! Nifty.
@@ -97,14 +97,14 @@
`(define-key engine-mode-map (kbd ,(engine/scope-keybinding keybinding))
(quote ,(engine/function-name engine-name)))))
-(defmacro defengine (engine-name search-engine-url &optional keybinding)
+(cl-defmacro defengine (engine-name search-engine-url &key keybinding)
"Define a custom search engine.
`engine-name' is a symbol naming the engine.
`search-engine-url' is the url to be queried, with a \"%s\"
standing in for the search term.
-The optional value `keybinding' is a string describing the key to
-bind the new function.
+The keyword argument `keybinding' is a string describing the key
+to bind the new function.
Keybindings are prefixed by the `engine/keymap-prefix', which
defaults to `C-c /'.
@@ -113,7 +113,7 @@ For example, to search Wikipedia, use:
(defengine wikipedia
\"http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=%s\"
- \"w\")
+ :keybinding \"w\")
Hitting \"C-c / w\" will be bound to the newly-defined
`engine/search-wikipedia' function."
- [nongnu] branch elpa/engine-mode created (now 30a361b27f), ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode c3f2de1a8a 01/71: initial commit, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f8540c9982 05/71: get search term through interactive, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode e20ec930b2 08/71: Merge pull request #2 from lgatto/master, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode da00833130 09/71: we're on MELPA! :D, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode baa5151552 32/71: Reformat README to use 80-character lines, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 9e8b10b029 27/71: Release version 1.0.0, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 9a1271b005 38/71: Update documentation to change to `C-x /` prefix, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 2ddc5ec627 20/71: Switch engine keybinding to be a keyword argument,
ELPA Syncer <=
- [nongnu] elpa/engine-mode 615e55a806 31/71: Add GPLv3 badge to README, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 2935da0bc8 15/71: Link to @sshaw's script to import from Chrome/OSX, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 7b0872e297 23/71: Provide a hook to transform the search term, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f7b5aadafa 47/71: Fix cl/-lib usage, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 5d99c1d49d 41/71: Add autoload cookie for lazy loading, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 2c92e76819 56/71: Bump version to 2.1.2, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 3d4870c337 50/71: Fall back to the browse-url-browser-function, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f12a4e5ed1 03/71: rename engine -> engine-mode for consistency, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 8851758d4d 21/71: Allow defengine to assign custom docstrings, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 4e1d462a30 18/71: Add link to the EmacsNYC presentation, ELPA Syncer, 2022/12/21