readme: improve code examples
the way the key bindings were overriden in these examples didn't update the winum-keymap variable itself, leading to problems such as not being able to use define-key on winum-keymap afterwards
This commit is contained in:
parent
ebb05b84ae
commit
3a10d3934f
14
README.org
14
README.org
|
@ -139,9 +139,7 @@ If you prefer no to use a prefix and have even shorter bindings, you can also
|
||||||
override =winum-keymap= in the minor mode bindings table:
|
override =winum-keymap= in the minor mode bindings table:
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(require 'winum)
|
(setq winum-keymap
|
||||||
|
|
||||||
(setcdr (assoc 'winum-mode minor-mode-map-alist)
|
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map (kbd "C-`") 'winum-select-window-by-number)
|
(define-key map (kbd "C-`") 'winum-select-window-by-number)
|
||||||
(define-key map (kbd "C-²") 'winum-select-window-by-number)
|
(define-key map (kbd "C-²") 'winum-select-window-by-number)
|
||||||
|
@ -156,9 +154,13 @@ override =winum-keymap= in the minor mode bindings table:
|
||||||
(define-key map (kbd "M-8") 'winum-select-window-8)
|
(define-key map (kbd "M-8") 'winum-select-window-8)
|
||||||
map))
|
map))
|
||||||
|
|
||||||
|
(require 'winum)
|
||||||
|
|
||||||
(winum-mode)
|
(winum-mode)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
Note that it is important to set =winum-keymap= /before/ the =require=.
|
||||||
|
|
||||||
You can also use the more conventional =define-key= on =winum-keymap=:
|
You can also use the more conventional =define-key= on =winum-keymap=:
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
@ -249,9 +251,7 @@ Here is an example that you could put in your =.emacs=, which includes all
|
||||||
available winum options.
|
available winum options.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(require 'winum)
|
(setq winum-keymap
|
||||||
|
|
||||||
(setcdr (assoc 'winum-mode minor-mode-map-alist)
|
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(define-key map (kbd "C-`") 'winum-select-window-by-number)
|
(define-key map (kbd "C-`") 'winum-select-window-by-number)
|
||||||
(define-key map (kbd "C-²") 'winum-select-window-by-number)
|
(define-key map (kbd "C-²") 'winum-select-window-by-number)
|
||||||
|
@ -266,6 +266,8 @@ available winum options.
|
||||||
(define-key map (kbd "M-8") 'winum-select-window-8)
|
(define-key map (kbd "M-8") 'winum-select-window-8)
|
||||||
map))
|
map))
|
||||||
|
|
||||||
|
(require 'winum)
|
||||||
|
|
||||||
(defun my-winum-assign-func ()
|
(defun my-winum-assign-func ()
|
||||||
(cond
|
(cond
|
||||||
((equal (buffer-name) "*Calculator*")
|
((equal (buffer-name) "*Calculator*")
|
||||||
|
|
Loading…
Reference in a new issue