[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7ea8159 16/42: Define diff-hl-command-map without destroyi
From: |
Dmitry Gutov |
Subject: |
[elpa] master 7ea8159 16/42: Define diff-hl-command-map without destroying existing bindings |
Date: |
Wed, 09 Sep 2015 19:03:33 +0000 |
branch: master
commit 7ea8159acb41adb743342bcab9d8a2efa50868b9
Author: Jonas Bernoulli <address@hidden>
Commit: Jonas Bernoulli <address@hidden>
Define diff-hl-command-map without destroying existing bindings
Keymaps are usually defined using `defvar' which has the advantage that
it only sets a variables value if that is not defined yet. As a result
re-evaluating (i.e. during development) a buffer that contains such a
definition does not reset the value, which would lose all user
customization.
Unfortunately `define-prefix-command' does not do that. So use `defvar'
to define the variable and then also store the in the function cell
using `fset'.
---
diff-hl.el | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/diff-hl.el b/diff-hl.el
index 8f2221a..18b92c7 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -437,13 +437,13 @@ in the source file, or the last line of the hunk above
it."
(interactive)
(diff-hl-next-hunk t))
-(define-prefix-command 'diff-hl-command-map)
-
-(let ((map diff-hl-command-map))
- (define-key map "n" 'diff-hl-revert-hunk)
- (define-key map "[" 'diff-hl-previous-hunk)
- (define-key map "]" 'diff-hl-next-hunk)
- map)
+(defvar diff-hl-command-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "n" 'diff-hl-revert-hunk)
+ (define-key map "[" 'diff-hl-previous-hunk)
+ (define-key map "]" 'diff-hl-next-hunk)
+ map))
+(fset 'diff-hl-command-map diff-hl-command-map)
;;;###autoload
(define-minor-mode diff-hl-mode
- [elpa] master 1743a80 07/42: Merge pull request #42 from tarsius/silentio, (continued)
- [elpa] master 1743a80 07/42: Merge pull request #42 from tarsius/silentio, Dmitry Gutov, 2015/09/09
- [elpa] master eb92f0e 04/42: Merge pull request #39 from jamessan/diff-hl-margin-load-error, Dmitry Gutov, 2015/09/09
- [elpa] master d188525 02/42: Merge pull request #37 from holocronweaver/documentation, Dmitry Gutov, 2015/09/09
- [elpa] master 4959c6e 10/42: Autoload diff-hl-dired-mode-unless-remote, Dmitry Gutov, 2015/09/09
- [elpa] master d6b7d82 05/42: Support the "next" Magit version, Dmitry Gutov, 2015/09/09
- [elpa] master 934fef0 11/42: Promote diff-hl-margin-side to diff-hl-side, Dmitry Gutov, 2015/09/09
- [elpa] master 28263c7 12/42: Handle narrowing (fixes #48), Dmitry Gutov, 2015/09/09
- [elpa] master 84d5110 09/42: Bump the copyright years, Dmitry Gutov, 2015/09/09
- [elpa] master 12def16 14/42: Allow bitmap width only up to 16 (#49), Dmitry Gutov, 2015/09/09
- [elpa] master bf27c41 15/42: vc-disable-async-diff: Don't bind when it's undefined, Dmitry Gutov, 2015/09/09
- [elpa] master 7ea8159 16/42: Define diff-hl-command-map without destroying existing bindings,
Dmitry Gutov <=
- [elpa] master 733ad33 06/42: silence byte-compiler, Dmitry Gutov, 2015/09/09
- [elpa] master 028b2bf 17/42: Merge pull request #51 from tarsius/keep-bindings, Dmitry Gutov, 2015/09/09
- [elpa] master 327e01c 20/42: Add commentary to diff-hl-flydiff, Dmitry Gutov, 2015/09/09
- [elpa] master 75d4bdc 08/42: Remove CR characters, Dmitry Gutov, 2015/09/09
- [elpa] master 0db7160 21/42: Change version predicate for vc-git polyfilling, Dmitry Gutov, 2015/09/09
- [elpa] master c79dc5b 13/42: Allow diffing on-the-fly, Dmitry Gutov, 2015/09/09
- [elpa] master 3e64ed5 22/42: #'diff-hl-flydiff/overlay-modified → #'ignored, Dmitry Gutov, 2015/09/09
- [elpa] master e0f8fe1 23/42: Require nadvice at toplevel, Dmitry Gutov, 2015/09/09
- [elpa] master 34d2802 24/42: No need to remove diff-hl-edit from hooks, Dmitry Gutov, 2015/09/09
- [elpa] master 45ac71d 18/42: Revert "Allow diffing on-the-fly", Dmitry Gutov, 2015/09/09