help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shift+left/right arrow cannot be bound in Emacs


From: Javier
Subject: Re: shift+left/right arrow cannot be bound in Emacs
Date: Mon, 14 Sep 2015 21:52:06 +0000 (UTC)
User-agent: tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (Linux/3.18.6-1-ARCH (x86_64))

>> In my Emacs 25.0.50.1 on Kubuntu 15.04 asking for the current binding
>> with C-h k shift+left shows
> 
>> <left> (translated from <S-left>) runs the command left-char (found in
>> ...
> 
> The same, I think I begin to understand, the reason is that shift+arrows
> is used for setting the mark (as in MS windows) so it might not be
> possible to bind these key combination.

I can bind them without problem

;;; Deactivate Shift+Arrow To Select Text
(setq shift-select-mode nil)
(global-set-key [S-left] 'my-function)
(global-set-key [S-right] 'my-function)

You can try to type S-left and use C-h l (view lossage) to check what key 
presses emacs detects.

Are you using emacs -nw in a terminal?  For xterm I use
;; XTERM THROUGH SSH
(define-key function-key-map "\e[1;2A" '[S-up])
(define-key function-key-map "\e[1;2B" '[S-down])
(define-key function-key-map "\e[1;2C" '[S-right])
(define-key function-key-map "\e[1;2D" '[S-left])


Are you using org-mode? shift+arrow have a different meaning in
org-mode that clashes with emacs defaults.

;;; Avoid redefining of keys by org-mode
(defun org-mode-keys ()
  "Keybindings for org-mode.  To be used as a hook."
  (local-set-key [S-left] 'my-function)
  (local-set-key [S-right] 'my-function)
  )
(add-hook 'org-mode-hook 'org-mode-keys)
            


reply via email to

[Prev in Thread] Current Thread [Next in Thread]