diff options
| author | Stefan Monnier | 2009-03-26 17:07:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-03-26 17:07:54 +0000 |
| commit | 84db11d602adda080d7062ef8ab57d35442fbe59 (patch) | |
| tree | ef9821817dfd79845a64deb457ce5c365605df47 | |
| parent | 6c01cfb68373280db726a5fc157f00826132f159 (diff) | |
| download | emacs-84db11d602adda080d7062ef8ab57d35442fbe59.tar.gz emacs-84db11d602adda080d7062ef8ab57d35442fbe59.zip | |
* callint.c (Fcall_interactively): For '^' just delegate the work to
handle-shift-selection.
(syms_of_callint): Move declaration of shift-select-mode to simple.el.
* simple.el (shift-select-mode): Move declaration from callint.c.
(handle-shift-selection): Remove `deactivate' arg and check
shift-select-mode instead.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/simple.el | 43 | ||||
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/callint.c | 25 |
4 files changed, 41 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4731bceadc6..bae35e3974c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-03-26 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * simple.el (shift-select-mode): Move declaration from callint.c. | ||
| 4 | (handle-shift-selection): Remove `deactivate' arg and check | ||
| 5 | shift-select-mode instead. | ||
| 6 | |||
| 1 | 2009-03-26 Juanma Barranquero <lekktu@gmail.com> | 7 | 2009-03-26 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | * align.el (align-large-region, align-perl-modes, align-rules-list) | 9 | * align.el (align-large-region, align-perl-modes, align-rules-list) |
diff --git a/lisp/simple.el b/lisp/simple.el index dba3cf37dc2..8664634196e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3746,33 +3746,44 @@ mode temporarily." | |||
| 3746 | (t (activate-mark))) | 3746 | (t (activate-mark))) |
| 3747 | nil)) | 3747 | nil)) |
| 3748 | 3748 | ||
| 3749 | (defun handle-shift-selection (&optional deactivate) | 3749 | (defvar shift-select-mode t |
| 3750 | "When non-nil, shifted motion keys activate the mark momentarily. | ||
| 3751 | |||
| 3752 | While the mark is activated in this way, any shift-translated point | ||
| 3753 | motion key extends the region, and if Transient Mark mode was off, it | ||
| 3754 | is temporarily turned on. Furthermore, the mark will be deactivated | ||
| 3755 | by any subsequent point motion key that was not shift-translated, or | ||
| 3756 | by any action that normally deactivates the mark in Transient Mark mode. | ||
| 3757 | |||
| 3758 | See `this-command-keys-shift-translated' for the meaning of | ||
| 3759 | shift-translation.") | ||
| 3760 | |||
| 3761 | (defun handle-shift-selection () | ||
| 3750 | "Activate/deactivate mark depending on invocation thru ``shift translation.'' | 3762 | "Activate/deactivate mark depending on invocation thru ``shift translation.'' |
| 3751 | 3763 | ||
| 3752 | \(See `this-command-keys-shift-translated' for the meaning of | 3764 | \(See `this-command-keys-shift-translated' for the meaning of |
| 3753 | shift translation.) | 3765 | shift translation.) |
| 3754 | 3766 | ||
| 3755 | This is called whenever a command with a `^' character in its | 3767 | This is called whenever a command with a `^' character in its |
| 3756 | `interactive' spec is invoked while `shift-select-mode' is | 3768 | `interactive' spec is invoked. |
| 3757 | non-nil. | 3769 | Its behavior is controlled by `shift-select-mode'. |
| 3758 | 3770 | ||
| 3759 | If the command was invoked through shift translation, set the | 3771 | If the command was invoked through shift translation, set the |
| 3760 | mark and activate the region temporarily, unless it was already | 3772 | mark and activate the region temporarily, unless it was already |
| 3761 | set in this way. If the command was invoked without shift | 3773 | set in this way. If the command was invoked without shift |
| 3762 | translation, or if the optional argument DEACTIVATE is non-nil, | 3774 | translation, or if the region was activated by the mouse, |
| 3763 | deactivate the mark if the region is temporarily active." | 3775 | deactivate the mark if the region is temporarily active." |
| 3764 | (cond ((and this-command-keys-shift-translated | 3776 | (cond ((and shift-select-mode this-command-keys-shift-translated) |
| 3765 | (null deactivate)) | 3777 | (unless (and mark-active |
| 3766 | (unless (and mark-active | 3778 | (eq (car-safe transient-mark-mode) 'only)) |
| 3767 | (eq (car-safe transient-mark-mode) 'only)) | 3779 | (setq transient-mark-mode |
| 3768 | (setq transient-mark-mode | 3780 | (cons 'only |
| 3769 | (cons 'only | 3781 | (unless (eq transient-mark-mode 'lambda) |
| 3770 | (unless (eq transient-mark-mode 'lambda) | 3782 | transient-mark-mode))) |
| 3771 | transient-mark-mode))) | 3783 | (push-mark nil nil t))) |
| 3772 | (push-mark nil nil t))) | 3784 | ((eq (car-safe transient-mark-mode) 'only) |
| 3773 | ((eq (car-safe transient-mark-mode) 'only) | 3785 | (setq transient-mark-mode (cdr transient-mark-mode)) |
| 3774 | (setq transient-mark-mode (cdr transient-mark-mode)) | 3786 | (deactivate-mark)))) |
| 3775 | (deactivate-mark)))) | ||
| 3776 | 3787 | ||
| 3777 | (define-minor-mode transient-mark-mode | 3788 | (define-minor-mode transient-mark-mode |
| 3778 | "Toggle Transient Mark mode. | 3789 | "Toggle Transient Mark mode. |
diff --git a/src/ChangeLog b/src/ChangeLog index 244b1f6a158..e0a02b39dc0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-03-26 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * callint.c (Fcall_interactively): For '^' just delegate the work to | ||
| 4 | handle-shift-selection. | ||
| 5 | (syms_of_callint): Move declaration of shift-select-mode to simple.el. | ||
| 6 | |||
| 1 | 2009-03-24 Chong Yidong <cyd@stupidchicken.com> | 7 | 2009-03-24 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 8 | ||
| 3 | * editfns.c (Ffloat_time): Doc fix (Bug#2768). | 9 | * editfns.c (Ffloat_time): Doc fix (Bug#2768). |
diff --git a/src/callint.c b/src/callint.c index 10f5f63c864..3641fbc5b77 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -51,7 +51,7 @@ extern Lisp_Object Qface, Qminibuffer_prompt; | |||
| 51 | even if mark_active is 0. */ | 51 | even if mark_active is 0. */ |
| 52 | Lisp_Object Vmark_even_if_inactive; | 52 | Lisp_Object Vmark_even_if_inactive; |
| 53 | 53 | ||
| 54 | Lisp_Object Vshift_select_mode, Qhandle_shift_selection; | 54 | Lisp_Object Qhandle_shift_selection; |
| 55 | 55 | ||
| 56 | Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook; | 56 | Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook; |
| 57 | 57 | ||
| @@ -454,14 +454,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 454 | } | 454 | } |
| 455 | else if (*string == '^') | 455 | else if (*string == '^') |
| 456 | { | 456 | { |
| 457 | if (! NILP (Vshift_select_mode)) | 457 | call0 (Qhandle_shift_selection); |
| 458 | call1 (Qhandle_shift_selection, Qnil); | ||
| 459 | /* Even if shift-select-mode is off, temporarily active | ||
| 460 | regions could be set using the mouse, and should be | ||
| 461 | deactivated. */ | ||
| 462 | else if (CONSP (Vtransient_mark_mode) | ||
| 463 | && EQ (XCAR (Vtransient_mark_mode), Qonly)) | ||
| 464 | call1 (Qhandle_shift_selection, Qt); | ||
| 465 | string++; | 458 | string++; |
| 466 | } | 459 | } |
| 467 | else break; | 460 | else break; |
| @@ -994,20 +987,6 @@ turns off region highlighting, but commands that use the mark | |||
| 994 | behave as if the mark were still active. */); | 987 | behave as if the mark were still active. */); |
| 995 | Vmark_even_if_inactive = Qt; | 988 | Vmark_even_if_inactive = Qt; |
| 996 | 989 | ||
| 997 | DEFVAR_LISP ("shift-select-mode", &Vshift_select_mode, | ||
| 998 | doc: /* When non-nil, shifted motion keys activate the mark momentarily. | ||
| 999 | |||
| 1000 | While the mark is activated in this way, any shift-translated point | ||
| 1001 | motion key extends the region, and if Transient Mark mode was off, it | ||
| 1002 | is temporarily turned on. Furthermore, the mark will be deactivated | ||
| 1003 | by any subsequent point motion key that was not shift-translated, or | ||
| 1004 | by any action that normally deactivates the mark in Transient Mark | ||
| 1005 | mode. | ||
| 1006 | |||
| 1007 | See `this-command-keys-shift-translated' for the meaning of | ||
| 1008 | shift-translation. */); | ||
| 1009 | Vshift_select_mode = Qt; | ||
| 1010 | |||
| 1011 | DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook, | 990 | DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook, |
| 1012 | doc: /* Hook to run when about to switch windows with a mouse command. | 991 | doc: /* Hook to run when about to switch windows with a mouse command. |
| 1013 | Its purpose is to give temporary modes such as Isearch mode | 992 | Its purpose is to give temporary modes such as Isearch mode |