[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shift selection using interactive spec
From: |
Stefan Monnier |
Subject: |
Re: Shift selection using interactive spec |
Date: |
Sun, 16 Mar 2008 22:40:46 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
> --- 1758,1765 ----
> }
> else
> {
> ! if (NILP (current_kboard->Vprefix_arg)
> ! && NILP (Vthis_command_keys_shift_translated))
> {
> /* In case we jump to directly_done. */
> Vcurrent_prefix_arg = current_kboard->Vprefix_arg;
> ***************
> *** 1801,1807 ****
> direct_output_forward_char (1);
> goto directly_done;
> }
> ! else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV)
> {
> struct Lisp_Char_Table *dp
> = window_display_table (XWINDOW (selected_window));
> --- 1806,1813 ----
> direct_output_forward_char (1);
> goto directly_done;
> }
> ! else if (EQ (Vthis_command, Qbackward_char) && PT > BEGV
> ! && NILP (Vthis_command_keys_shift_translated))
> {
> struct Lisp_Char_Table *dp
> = window_display_table (XWINDOW (selected_window));
Shouldn't we just get rid of those special cases "to speed up the cases
that are plenty fast anyway"?
> ***************
> *** 1964,1972 ****
> /* Setting transient-mark-mode to `only' is a way of
> turning it on for just one command. */
> ! if (EQ (Vtransient_mark_mode, Qidentity))
> Vtransient_mark_mode = Qnil;
> ! if (EQ (Vtransient_mark_mode, Qonly))
> Vtransient_mark_mode = Qidentity;
> if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode))
> --- 1970,1989 ----
> /* Setting transient-mark-mode to `only' is a way of
> turning it on for just one command. */
> ! if (CONSP (Vtransient_mark_mode))
> ! {
> ! if (EQ (XCAR (Vtransient_mark_mode), Qidentity))
> ! {
> ! Vtransient_mark_mode = XCDR (Vtransient_mark_mode);
> ! if (! NILP (Vtransient_mark_mode))
> ! Vdeactivate_mark = Qt;
> ! }
> ! else if (EQ (XCAR (Vtransient_mark_mode), Qonly))
> ! XSETCAR (Vtransient_mark_mode, Qidentity);
> ! }
> ! else if (EQ (Vtransient_mark_mode, Qidentity))
> Vtransient_mark_mode = Qnil;
> ! else if (EQ (Vtransient_mark_mode, Qonly))
> Vtransient_mark_mode = Qidentity;
It is ugly right now and this makes it worse. How 'bout just
if (CONSP (Vtransient_mark_mode))
Vtransient_mark_mode = XCDR (Vtransient_mark_mode);
and then replace `identity' with (t . nil) and `only' with (t . (t . nil)).
Or something like that?
> + (defun handle-shift-selection ()
> + (when this-command-keys-shift-translated
> + (temporary-region-highlight)))
> +
> + (defun temporary-region-highlight ()
> + (if (consp transient-mark-mode)
> + (progn (unless (eq (car transient-mark-mode) 'identity)
> + (push-mark nil nil t))
> + (setcar transient-mark-mode 'only))
> + (unless (eq transient-mark-mode 'identity)
> + (push-mark nil nil t))
> + (setq transient-mark-mode (cons 'only transient-mark-mode))))
Any reason to use `only' rather than to explicitly deactivate the mark
in handle-shift-selection when this-command-keys-shift-translated is
(and the region was selected with this-command-keys-shift-translated)?
Apparently that is the approach that is used in pc-selection-mode and in
cua-selection-mode, so it seems to work well enough. The `only' form of
transient-mark-mode is a bit brittle for my taste (gets broken by
switch-frame events and things like that), so I'd rather only use it if
really necessary.
Stefan
- Re: Shift selection using interactive spec, (continued)
- Re: Shift selection using interactive spec, Stefan Monnier, 2008/03/16
- what's the point (re shift selection), Thomas Lord, 2008/03/16
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/16
- Re: Shift selection using interactive spec, Lennart Borgman (gmail), 2008/03/16
- Re: Shift selection using interactive spec, Thomas Lord, 2008/03/16
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/16
- Re: Shift selection using interactive spec,
Stefan Monnier <=
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/16
- Re: Shift selection using interactive spec, Stefan Monnier, 2008/03/17
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/17
- Re: Shift selection using interactive spec, Lennart Borgman (gmail), 2008/03/17
- Re: Shift selection using interactive spec, Stefan Monnier, 2008/03/17
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/17
- RE: Shift selection using interactive spec, Drew Adams, 2008/03/17
- Re: Shift selection using interactive spec, Kim F. Storm, 2008/03/18
- Re: Shift selection using interactive spec, Chong Yidong, 2008/03/18
- Re: Shift selection using interactive spec, Kim F. Storm, 2008/03/18