unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11221: Shift-select-mode has no effect
@ 2012-04-11 16:02 Brian Tannahill
  2012-04-11 18:03 ` Glenn Morris
  2012-04-12 17:30 ` bug#11221: Shift-select-mode has no effect -- interaction with cua-mode Brian Tannahill
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Tannahill @ 2012-04-11 16:02 UTC (permalink / raw)
  To: 11221

[-- Attachment #1: Type: text/plain, Size: 4803 bytes --]

From: bjt1230@gmail.com
To: bug-gnu-emacs@gnu.org
Subject: 24.0.94; shift-select-mode has no effect
--text follows this line--
I'm experimenting with new bindings for basic movement in Emacs. Borrowing
from http://xahlee.org/emacs/emacs_useful_user_keybinding.html and
ErgoEmacs, this remapping works as expected:

(global-set-key (kbd "M-i")   'previous-line)
(global-set-key (kbd "M-k")   'next-line)
(global-set-key (kbd "M-j")   'backward-char)
(global-set-key (kbd "M-l")   'forward-char)

But defining a Shift-Alt combination gives an unwanted side-effect.

(global-set-key (kbd "M-I")   'cua-scroll-down)
(global-set-key (kbd "M-K")   'cua-scroll-up)
(global-set-key (kbd "M-J")   'backward-word)
(global-set-key (kbd "M-L")   'forward-word)

Running describe-key (C-h k) shows that the bindings were
successful. And these bindings move point as they should, but for some
reason it sets the mark at my original position, and gives me a
highlighted region as I move the point.

I tried setting shift-select-mode to nil.  This had no effect.

Also described at http://stackoverflow.com/questions/10106797.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/local/share/emacs/24.0.94/etc/DEBUG.


In GNU Emacs 24.0.94.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-04-04 on b-l
Windowing system distributor `The X.Org Foundation', version 11.0.11200000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Org

Minor modes in effect:
  ido-everywhere: t
  delete-selection-mode: t
  display-time-mode: t
  cua-mode: t
  bt-keys-minor-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Recent input:
C-8 M-k M-k M-k M-k M-k M-k M-k M-k M-k <return> M-i
* * SPC M-1 <return> <backspace> SPC 1 4 : 0 0 > SPC
SPC H a r i <backspace> <backspace> i r c u t C-x C-s
M-3 <down> <up> <M-next> <M-end> <help-echo> <help-echo>
<help-echo> M-x r e p o r t - e m a c s - b u g <r
eturn>

Recent messages:
Omitting...
Omitted 34 lines.
Omitting...
(Nothing to omit)
Omitting...
Omitted 1 line.
OVERVIEW
For information about GNU Emacs and the GNU system, type C-h C-a.
Saving file /home/brian/Org/projects.org...
Wrote /home/brian/Org/projects.org

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils cal-china lunar solar cal-dst cal-hebrew diary-lib
diary-loaddefs mule-util cal-move parse-time calfw-org calfw holidays
hol-loaddefs cl org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc
org-jsinfo org-infojs org-html format-spec org-exp ob-exp org-exp-blocks
org-agenda org-info org-gnus org-docview org-bibtex bibtex org-bbdb org
ob-emacs-lisp ob-tangle ob-ref ob-lob ob-table org-footnote org-src
ob-comint ob-keys ob ob-eval org-pcomplete pcomplete comint ansi-color
ring org-list org-faces org-compat org-entities org-macs noutline
outline cal-menu calendar cal-loaddefs byte-opt warnings bytecomp
byte-compile cconv macroexp advice help-fns advice-preload help-mode
view derived dired+ dired-x ediff-merg ediff-diff ediff-wind ediff-mult
ediff-help ediff-init ediff-util dired-aux dired regexp-opt easymenu ido
delsel time server cua-base easy-mmode edmacro kmacro time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer loaddefs button faces cus-face files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

[-- Attachment #2: Type: text/html, Size: 5683 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11221: Shift-select-mode has no effect
  2012-04-11 16:02 bug#11221: Shift-select-mode has no effect Brian Tannahill
@ 2012-04-11 18:03 ` Glenn Morris
  2012-04-11 20:18   ` Brian Tannahill
  2012-04-12 17:30 ` bug#11221: Shift-select-mode has no effect -- interaction with cua-mode Brian Tannahill
  1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2012-04-11 18:03 UTC (permalink / raw)
  To: Brian Tannahill; +Cc: 11221

Brian Tannahill wrote:

> (global-set-key (kbd "M-J")   'backward-word)
[...]
> Running describe-key (C-h k) shows that the bindings were
> successful. And these bindings move point as they should, but for some
> reason it sets the mark at my original position, and gives me a
> highlighted region as I move the point.

I'm unable to reproduce this; even with shift-select-mode on. Note that
this-command-keys-shift-translated says:

   Shift-translation occurs when there is no binding for the key sequence
   as entered [...]

Does this happen if you start from emacs -Q?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11221: Shift-select-mode has no effect
  2012-04-11 18:03 ` Glenn Morris
@ 2012-04-11 20:18   ` Brian Tannahill
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Tannahill @ 2012-04-11 20:18 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 11221

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

When I run emacs -Q and then do my custom keybindings, the problem does NOT
occur.

So apparently something in my init file is messing things up.  I'll work on
isolating it.

Thanks.



On Wed, Apr 11, 2012 at 1:03 PM, Glenn Morris <rgm@gnu.org> wrote:

> Brian Tannahill wrote:
>
> > (global-set-key (kbd "M-J")   'backward-word)
> [...]
> > Running describe-key (C-h k) shows that the bindings were
> > successful. And these bindings move point as they should, but for some
> > reason it sets the mark at my original position, and gives me a
> > highlighted region as I move the point.
>
> I'm unable to reproduce this; even with shift-select-mode on. Note that
> this-command-keys-shift-translated says:
>
>   Shift-translation occurs when there is no binding for the key sequence
>   as entered [...]
>
> Does this happen if you start from emacs -Q?
>

[-- Attachment #2: Type: text/html, Size: 1192 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11221: Shift-select-mode has no effect -- interaction with cua-mode
  2012-04-11 16:02 bug#11221: Shift-select-mode has no effect Brian Tannahill
  2012-04-11 18:03 ` Glenn Morris
@ 2012-04-12 17:30 ` Brian Tannahill
  2012-04-12 18:53   ` bug#11221: cua-mode activates the mark for shifted bindings Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Brian Tannahill @ 2012-04-12 17:30 UTC (permalink / raw)
  To: Glenn Morris, 11221

[-- Attachment #1: Type: text/plain, Size: 1264 bytes --]

After working through my .emacs file I found that this problem goes away
when I turn off cua-mode.

Not sure whether this is actually a bug or if it's the intended behavior.


---------- Forwarded message ----------
From: Brian Tannahill <bjt1230@gmail.com>
Date: Wed, Apr 11, 2012 at 3:18 PM
Subject: Re: bug#11221: Shift-select-mode has no effect
To: Glenn Morris <rgm@gnu.org>
Cc: 11221@debbugs.gnu.org


When I run emacs -Q and then do my custom keybindings, the problem does NOT
occur.

So apparently something in my init file is messing things up.  I'll work on
isolating it.

Thanks.



On Wed, Apr 11, 2012 at 1:03 PM, Glenn Morris <rgm@gnu.org> wrote:

> Brian Tannahill wrote:
>
> > (global-set-key (kbd "M-J")   'backward-word)
> [...]
> > Running describe-key (C-h k) shows that the bindings were
> > successful. And these bindings move point as they should, but for some
> > reason it sets the mark at my original position, and gives me a
> > highlighted region as I move the point.
>
> I'm unable to reproduce this; even with shift-select-mode on. Note that
> this-command-keys-shift-translated says:
>
>   Shift-translation occurs when there is no binding for the key sequence
>   as entered [...]
>
> Does this happen if you start from emacs -Q?
>

[-- Attachment #2: Type: text/html, Size: 1888 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11221: cua-mode activates the mark for shifted bindings
  2012-04-12 17:30 ` bug#11221: Shift-select-mode has no effect -- interaction with cua-mode Brian Tannahill
@ 2012-04-12 18:53   ` Stefan Monnier
  2012-04-12 21:28     ` Kim Storm
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2012-04-12 18:53 UTC (permalink / raw)
  To: Brian Tannahill; +Cc: 11221, Kim F. Storm

retitle 11221 cua-mode activates the mark for shifted bindings
thanks

> After working through my .emacs file I found that this problem goes away
> when I turn off cua-mode.

Indeed, I can reproduce it now with:

   emacs -Q
   M-: (global-set-key (kbd "M-J") 'backward-word) RET
   M-x cua-mode RET
 
after which M-J will not only move point but also activate the mark.

> Not sure whether this is actually a bug or if it's the intended behavior.

The shift-select-mode we added in Emacs-23 was careful to get this
right, so I think it's at least a misfeature of cua-mode.
The code in cua--pre-command-handler-1 does not try to catch
this situation, currently.

Kim, WDYT about the patch below, which makes cua-mode use the same
mechanism as shift-select-mode?


        Stefan


=== modified file 'lisp/emulation/cua-base.el'
--- lisp/emulation/cua-base.el	2012-03-10 08:26:45 +0000
+++ lisp/emulation/cua-base.el	2012-04-12 18:50:34 +0000
@@ -1246,22 +1246,7 @@
    ;;   (and region not started with C-SPC).
    ;; If rectangle is active, expand rectangle in specified direction and
    ;;   ignore the movement.
-   ((if window-system
-        ;; Shortcut for window-system, assuming that input-decode-map is empty.
-	(memq 'shift (event-modifiers
-		      (aref (this-single-command-raw-keys) 0)))
-      (or
-       ;; Check if the final key-sequence was shifted.
-       (memq 'shift (event-modifiers
-		     (aref (this-single-command-keys) 0)))
-       ;; If not, maybe the raw key-sequence was mapped by input-decode-map
-       ;; to a shifted key (and then mapped down to its unshifted form).
-       (let* ((keys (this-single-command-raw-keys))
-              (ev (lookup-key input-decode-map keys)))
-         (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0))))
-             ;; Or maybe, the raw key-sequence was not an escape sequence
-             ;; and was shifted (and then mapped down to its unshifted form).
-             (memq 'shift (event-modifiers (aref keys 0)))))))
+   (this-command-keys-shift-translated
     (unless mark-active
       (push-mark-command nil t))
     (setq cua--last-region-shifted t)






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11221: cua-mode activates the mark for shifted bindings
  2012-04-12 18:53   ` bug#11221: cua-mode activates the mark for shifted bindings Stefan Monnier
@ 2012-04-12 21:28     ` Kim Storm
  2012-04-13 13:35       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Kim Storm @ 2012-04-12 21:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 11221, Brian Tannahill


On 04/12/2012 08:53 PM, Stefan Monnier wrote:
>
> The shift-select-mode we added in Emacs-23 was careful to get this
> right, so I think it's at least a misfeature of cua-mode.
> The code in cua--pre-command-handler-1 does not try to catch
> this situation, currently.
>
> Kim, WDYT about the patch below, which makes cua-mode use the same
> mechanism as shift-select-mode?
>
>
>          Stefan
>
>
> +   (this-command-keys-shift-translated
>
Hi Stefan

This looks much cleaner indeed.
I haven't tried your patch thorughly, but it seems to work just fine, so 
let's go with it.

Thank you for working on cua bugs!

Kim







^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#11221: cua-mode activates the mark for shifted bindings
  2012-04-12 21:28     ` Kim Storm
@ 2012-04-13 13:35       ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2012-04-13 13:35 UTC (permalink / raw)
  To: Kim Storm; +Cc: 11221-done, Brian Tannahill

Version: 24.2

> I haven't tried your patch thorughly, but it seems to work just fine, so
> let's go with it.

Thanks, installed,


        Stefan





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-13 13:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 16:02 bug#11221: Shift-select-mode has no effect Brian Tannahill
2012-04-11 18:03 ` Glenn Morris
2012-04-11 20:18   ` Brian Tannahill
2012-04-12 17:30 ` bug#11221: Shift-select-mode has no effect -- interaction with cua-mode Brian Tannahill
2012-04-12 18:53   ` bug#11221: cua-mode activates the mark for shifted bindings Stefan Monnier
2012-04-12 21:28     ` Kim Storm
2012-04-13 13:35       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).