Subject: bug#15200: isearch-other-meta-char and shift

From: Juri Linkov <[email-masked]>
Date: Tue, 27 Aug 2013 19:45:51 +0300

Another problem is that shifted cursor motion keys
don't activate the region.  Test case:
`C-s S-right' exits isearch (OK),
moves cursor to the right (OK),
but doesn't activate the region (BUG).

The same bug is for other shift-selection keys:
`C-s S-C-right', `C-s S-C-f', `C-s S-M-f' don't activate
the region like they do outside of isearch.

I see that the shift key is swallowed by `read-key-sequence'
in `isearch-reread-key-sequence-naturally' called from
`isearch-other-meta-char'.

However, when the argument DONT-DOWNCASE-LAST of `read-key-sequence'
is non-nil, it doesn't translate shifted keys and leaves
shift-modifiers with them in `unread-command-events':

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-07-05 20:15:32 +0000
+++ lisp/isearch.el	2013-08-27 16:38:41 +0000
@@ -2502,7 +2556,9 @@ (defun isearch-reread-key-sequence-natur
 Return the key sequence as a string/vector."
   (isearch-unread-key-sequence keylist)
   (let (overriding-terminal-local-map)
-    (read-key-sequence nil)))  ; This will go through function-key-map, if nec.
+    ;; This will go through function-key-map, if nec.
+    ;; The arg DONT-DOWNCASE-LAST prevents premature shift-translation.
+    (read-key-sequence nil nil t)))
 
 (defalias 'isearch-other-control-char 'isearch-other-meta-char)