Reputation: 3831
So I created a separate minor-mode for moving the cursor efficiently, selecting text et cetera (very similar to Chris Done's god-mode). But somehow I can't get Emacs to select text when shift-pressing those alternative arrow keys. When I try, the cursor moves but nothing gets selected. Here are my bindings:
(define-key movecursor-keymap (kbd "i") 'previous-line)
(define-key movecursor-keymap (kbd "j") 'left-char)
(define-key movecursor-keymap (kbd "l") 'right-char)
(define-key movecursor-keymap (kbd "k") 'next-line)
(define-key movecursor-keymap (kbd "I") 'previous-line)
(define-key movecursor-keymap (kbd "J") 'left-char)
(define-key movecursor-keymap (kbd "L") 'right-char)
(define-key movecursor-keymap (kbd "K") 'next-line)
Of course I enabled:
(setq shift-select-mode t)
; and also
(transient-mark-mode 1)
What do I need to do to enable shift-selection with those keys?
Upvotes: 2
Views: 267
Reputation: 30708
Show your code. Describe what you expected to happen and what happens instead. (Always.)
A wild guess would be that you are not setting deactivate-mark
to nil
at the end of your command (or whatever code is followed by other code that expects the region to be active).
Put (setq deactivate-mark nil)
after you do whatever you do and before any code that expects the region to still be active. Remember that the command loop deactivates the mark after each command.
UPDATE
OK, so you want to use shift selection.
(global-set-key (kbd "i") (lambda (arg) (interactive "^p") (previous-line arg)))
and
(global-unset-key (kbd "I"))
etc. See:
(emacs) Shift Selection
(elisp) Using Interactive
The former tells you that you must unset I
if you expect shifted i
to select text.
Upvotes: 2