[Top][All Lists]

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

bug#8996: Set PRIMARY from last selection, not last selected window

From: Chong Yidong
Subject: bug#8996: Set PRIMARY from last selection, not last selected window
Date: Sat, 24 Mar 2012 19:10:53 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Hmm. bug #6872 was addressed by trunk r101176, which suppresses the
>> primary update on handle_switch_frame, but, well, that only covers
>> that immediate frame switch case.  Kinda need to address switching
>> between individual windows too (or actually instead since
>> handle_switch_frame will always wind up calling select_window itself,
>> I think).  However, select-window itself is not a command afaiui, and
>> enumerating all potential window-switching commands is probably not
>> viable.  I can't say I like the attached solution (modelled on the
>> deactivate-mark variable) very much, though nor did I have any
>> especially better ideas.
> I think this approach isn't as terrible as it sounds (tho I don't much
> like the name you chose, sorry).  We'd want to let-bind that new var
> in things like save-selected-window, with-selected-window, ... which
> is kind of ugly.
> Maybe a better approach is to record the selected window before
> running a command, and only do the select-active-regions dance if the
> command did not change the selected window.

Why not just extend the Bug#6872 approach to handle-select-window too?

=== modified file 'src/keyboard.c'
*** src/keyboard.c      2012-02-24 08:34:09 +0000
--- src/keyboard.c      2012-03-24 11:09:56 +0000
*** 241,246 ****
--- 241,247 ----
  Time last_event_timestamp;
  static Lisp_Object Qx_set_selection, Qhandle_switch_frame;
+ static Lisp_Object Qhandle_select_window;
  Lisp_Object QPRIMARY;
  static Lisp_Object Qself_insert_command;
*** 1647,1653 ****
                      ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
                      : (!NILP (Vselect_active_regions)
                         && !NILP (Vtransient_mark_mode)))
!                 && !EQ (Vthis_command, Qhandle_switch_frame))
                  EMACS_INT beg =
                    XINT (Fmarker_position (BVAR (current_buffer, mark)));
--- 1648,1655 ----
                      ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
                      : (!NILP (Vselect_active_regions)
                         && !NILP (Vtransient_mark_mode)))
!                 && !EQ (Vthis_command, Qhandle_switch_frame)
!                 && !EQ (Vthis_command, Qhandle_select_window))
                  EMACS_INT beg =
                    XINT (Fmarker_position (BVAR (current_buffer, mark)));
*** 11649,11654 ****
--- 11651,11657 ----
    DEFSYM (Qx_set_selection, "x-set-selection");
    DEFSYM (Qhandle_switch_frame, "handle-switch-frame");
+   DEFSYM (Qhandle_select_window, "handle-select-window");
    DEFSYM (Qinput_method_function, "input-method-function");
    DEFSYM (Qinput_method_exit_on_first_char, 

reply via email to

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