[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/engine-mode 70bbde97bf 12/71: define a prefix key (which d
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/engine-mode 70bbde97bf 12/71: define a prefix key (which defaults to "C-c /") |
Date: |
Wed, 21 Dec 2022 09:59:01 -0500 (EST) |
branch: elpa/engine-mode
commit 70bbde97bf39f5453ad93a5f6f1601d6bfccbb02
Author: Harry Schwartz <harry@thoughtbot.com>
Commit: Harry Schwartz <harry@thoughtbot.com>
define a prefix key (which defaults to "C-c /")
---
README.md | 11 ++++++-----
engine-mode.el | 24 ++++++++++++++++++------
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 553dc818d2..020d3383d1 100644
--- a/README.md
+++ b/README.md
@@ -16,12 +16,13 @@ executed it will take the selected region (or prompt for
input, if no
region is selected) and search GitHub for it, displaying the results
in your default browser.
-The `defengine` macro can also take an optional key combination:
+The `defengine` macro can also take an optional key combination,
+prefixed with `engine/keymap-prefix' (which defaults to "C-c /"):
```emacs
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
- "C-c / d")
+ "d")
```
`C-c / d` is now bound to the new function `engine/search-duckduckgo`!
@@ -47,14 +48,14 @@ load path and globally enabling it:
(defengine duckduckgo
"https://duckduckgo.com/?q=%s"
- "C-c / d")
+ "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"
- "C-c / g")
+ "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")
@@ -76,7 +77,7 @@ load path and globally enabling it:
(defengine wikipedia
"http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=%s"
- "C-c / w")
+ "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 7f9bb88f04..c8a565d32c 100644
--- a/engine-mode.el
+++ b/engine-mode.el
@@ -1,8 +1,8 @@
;;; engine-mode.el --- Define and query search engines from within Emacs.
;; Author: Harry R. Schwartz <hello@harryrschwartz.com>
-;; Version: 2014.05.06
-;; URL: https://github.com/hrs/engine-mode/engine.el
+;; Version: 2014.05.12
+;; URL: https://github.com/hrs/engine-mode/engine-mode.el
;; This file is NOT part of GNU Emacs.
@@ -22,11 +22,12 @@
;; no region is selected) and search GitHub for it, displaying the
;; results in your default browser.
-;; The `defengine' macro can also take an optional key combination:
+;; The `defengine' macro can also take an optional key combination,
+;; prefixed with `engine/keymap-prefix' (which defaults to "C-c /"):
;; (defengine duckduckgo
;; "https://duckduckgo.com/?q=%s"
-;; "C-c / d")
+;; "d")
;; `C-c / d' is now bound to the new function
;; engine/search-duckduckgo'! Nifty.
@@ -54,6 +55,11 @@
:global t
:keymap (make-sparse-keymap))
+(defcustom engine/keymap-prefix (kbd "C-c /")
+ "Engine-mode keymap prefix."
+ :group 'engine-mode
+ :type 'string)
+
(defun engine/search-prompt (engine-name)
(concat "Search " (capitalize engine-name) ": "))
@@ -81,9 +87,12 @@
(capitalize (symbol-name engine-name))
" for the selected text. Prompt for input if none is selected."))
+(defun engine/scope-keybinding (keybinding)
+ (concat engine/keymap-prefix " " keybinding))
+
(defun engine/bind-key (engine-name keybinding)
(when keybinding
- `(define-key engine-mode-map (kbd ,keybinding)
+ `(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)
@@ -95,11 +104,14 @@ standing in for the search term.
The optional value `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 /'.
+
For example, to search Wikipedia, use:
(defengine wikipedia
\"http://www.wikipedia.org/search-redirect.php?language=en&go=Go&search=%s\"
- \"C-c / w\")
+ \"w\")
Hitting \"C-c / w\" will be bound to the newly-defined
`engine/search-wikipedia' function."
- [nongnu] elpa/engine-mode 243d046914 35/71: make engine-mode keybinding prefix customizable, (continued)
- [nongnu] elpa/engine-mode 243d046914 35/71: make engine-mode keybinding prefix customizable, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 2c327f1785 24/71: Set engine-specific browsers, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 244610231f 34/71: Include a MELPA badge on the README, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 59f1d463fa 39/71: Fix rebind key conflict., ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 224919b648 29/71: Corrected Project Gutenberg URL., ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode eff5f26894 25/71: Add a custom variable to set the default browser, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 282f5d5910 62/71: Fix link to MELPA Stable status badge, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f955a5b889 67/71: Fix issues found by package-lint, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode fac252e11d 19/71: Add documentation for redefining the keymap prefix, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 4fa7ee6c06 14/71: Add documentation for changing the default browser, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 70bbde97bf 12/71: define a prefix key (which defaults to "C-c /"),
ELPA Syncer <=
- [nongnu] elpa/engine-mode 65e9a37fd0 44/71: Minimise side-effects when loading, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 50b0d436e8 42/71: Define prefixed map as an actual prefix command, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 1bfcc961c5 46/71: Set URL to the bare GitHub repo, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 20608906f8 61/71: Document installation with use-package, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode f36d8bf785 69/71: Prefer HTTPS to HTTP, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode e0910f141f 58/71: Don't quote term-transformation-hook value, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 278d4d9e9c 66/71: Allow nil value for engine/keybinding-prefix, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode 408932727b 49/71: display the default word in prompt if available, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode a978c58675 68/71: Add .elpaignore for NonGNU ELPA, ELPA Syncer, 2022/12/21
- [nongnu] elpa/engine-mode fd5a235b2c 51/71: Format with the same search-term many times in a search-engine-url, ELPA Syncer, 2022/12/21