2

Say I have beginning-of-line bound to M-a. At least for me, holding shift gives: M-S-a translates to M-A translates to M-a and emacs doesn't do any shift selection.

It's the same when binding keys -- I gotta bind M-A, binding M-S-a doesn't work. Why is this? Is there any way around it?

yafov
  • 314
  • 1
  • 9

2 Answers2

1

The following code works for me:

(bind-key "M-a" (lambda ()
                  "Move point to the first non-whitespace character on this line. If point was already at that position, move point to beginning of line."
                  (interactive "^")
                  (let ((oldpos (point))) (back-to-indentation) (and (= oldpos (point)) (beginning-of-line)))))

Note: "^" is required to support shift selection.

AhLeung
  • 1,083
  • 5
  • 14
0

If option shift-select-mode is nil then shift-selection does not work (it is turned off).

If it is not working for you even with a non-nil value, starting from emacs -Q, then consider filing a bug report: M-x report-emacs-bug.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • so you can bind M-S-a? tried it? – Benjamin Lindqvist Nov 16 '17 at 23:32
  • @BenjaminLindqvist: I don't understand your question. Yes, at least on a graphic display (GUI) you can bind `M-S-a` (aka `M-A`). – Drew Nov 17 '17 at 00:03
  • Actually it doesn't seem to be a problem with shift base navigation at all, it is just that certain navigation commands does not respect shift selection. I guess I will open a new question then – yafov Nov 17 '17 at 08:12
  • It works for me, with that navigation command. It should work for you, I think. Again, if it doesn't, consider filing a bug report. – Drew Nov 17 '17 at 16:26
  • So let me ask, does (global-set-key ("M-S-a") ...) work for you? If it does, maybe it's some aliasing thing specific to my keyboard/xmodmap. – Benjamin Lindqvist Nov 17 '17 at 18:19
  • @BenjaminLindqvist: I already answered that question, in my first comment: Yes, it works for me, on a graphic display. – Drew Nov 17 '17 at 20:30