Mercurial > emacs
changeset 109829:37af1f06dafa
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Mon, 16 Aug 2010 22:43:52 +0000 |
parents | dd8cc323f7a3 (current diff) e4d8eb8030c0 (diff) |
children | 46f382b913d6 |
files | |
diffstat | 12 files changed, 141 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS Sun Aug 15 23:36:33 2010 +0000 +++ b/etc/NEWS Mon Aug 16 22:43:52 2010 +0000 @@ -191,23 +191,26 @@ ** Selection changes. -The way Emacs interacts with the clipboard and primary selection, by -default, is now similar to other X applications. In particular, kill -and yank use the clipboard, in addition to the primary selection. +The default handling of clipboard and primary selections has been +changed to conform with other X applications. + +*** `select-active-regions' now defaults to t, so active regions set +the primary selection. -*** `select-active-regions' now defaults to `lazy'. -This means that any active region made with shift-selection or mouse -dragging, or acted on by Emacs (e.g. with M-w or C-w), is -automatically added to the primary window selection. +It also accepts a new value, `lazy', which means to only set the +primary selection for temporarily active regions (usually made by +mouse-dragging or shift-selection). + +*** `mouse-2' is now bound to `mouse-yank-primary'. *** `x-select-enable-clipboard' now defaults to t. +Thus, killing and yanking now use the clipboard (in addition to the +kill ring). *** `x-select-enable-primary' now defaults to nil. *** `mouse-drag-copy-region' now defaults to nil. -*** `mouse-2' is now bound to `mouse-yank-primary'. - * Changes in Specialized Modes and Packages in Emacs 24.1
--- a/lisp/ChangeLog Sun Aug 15 23:36:33 2010 +0000 +++ b/lisp/ChangeLog Mon Aug 16 22:43:52 2010 +0000 @@ -1,3 +1,25 @@ +2010-08-16 Deniz Dogan <deniz.a.m.dogan@gmail.com> + + * net/rcirc.el (rcirc-log-process-buffers): New option. + (rcirc-print): Use it. + (rcirc-generate-log-filename): New function. + (rcirc-log-filename-function): Change default to + rcirc-generate-log-filename (Bug#6828). + +2010-08-16 Chong Yidong <cyd@stupidchicken.com> + + * simple.el (deactivate-mark): If select-active-regions is `only', + only set selection for temporarily active regions. + + * cus-start.el: Change defcustom for select-active-regions. + +2010-08-15 Chong Yidong <cyd@stupidchicken.com> + + * mouse.el (mouse--drag-set-mark-and-point): New function. + (mouse-drag-track): Use LOCATION arg to push-mark. Use + mouse--drag-set-mark-and-point to take click-count into + consideration when updating point and mark (Bug#6840). + 2010-08-15 Chong Yidong <cyd@stupidchicken.com> * progmodes/compile.el (compilation-error-regexp-alist-alist):
--- a/lisp/cus-start.el Sun Aug 15 23:36:33 2010 +0000 +++ b/lisp/cus-start.el Mon Aug 16 22:43:52 2010 +0000 @@ -198,8 +198,8 @@ (help-event-list keyboard (repeat (sexp :format "%v"))) (menu-prompting menu boolean) (select-active-regions killing - (choice (const :tag "lazy" lazy) - (const :tag "always" t) + (choice (const :tag "always" t) + (const :tag "only shift-selection or mouse-drag" only) (const :tag "off" nil)) "24.1") (suggest-key-bindings keyboard (choice (const :tag "off" nil)
--- a/lisp/mouse.el Sun Aug 15 23:36:33 2010 +0000 +++ b/lisp/mouse.el Mon Aug 16 22:43:52 2010 +0000 @@ -954,8 +954,7 @@ '(only) (cons 'only transient-mark-mode))) (let ((range (mouse-start-end start-point start-point click-count))) - (goto-char (nth 0 range)) - (push-mark nil t t) + (push-mark (nth 0 range) t t) (goto-char (nth 1 range))) ;; Track the mouse until we get a non-movement event. @@ -974,14 +973,8 @@ end-point (posn-point end)) (if (and (eq (posn-window end) start-window) (integer-or-marker-p end-point)) - ;; If moving in the original window, move point by going - ;; to start first, so that if end is in intangible text, - ;; point jumps away from start. Don't do it if - ;; start=end, or a single click would select a region if - ;; it's on intangible text. - (unless (= start-point end-point) - (goto-char start-point) - (goto-char end-point)) + (mouse--drag-set-mark-and-point start-point + end-point click-count) (let ((mouse-row (cdr (cdr (mouse-position))))) (cond ((null mouse-row)) @@ -999,8 +992,9 @@ (eq (posn-window end) start-window) (integer-or-marker-p end-point) (/= start-point end-point)) - (goto-char start-point) - (goto-char end-point)) + (mouse--drag-set-mark-and-point start-point + end-point click-count)) + ;; Find its binding. (let* ((fun (key-binding (vector (car event)))) (do-multi-click (and (> (event-click-count event) 0) @@ -1051,6 +1045,21 @@ (put 'mouse-2 'event-kind 'mouse-click))) (push event unread-command-events))))))) +(defun mouse--drag-set-mark-and-point (start click click-count) + (let* ((range (mouse-start-end start click click-count)) + (beg (nth 0 range)) + (end (nth 1 range))) + (cond ((eq (mark) beg) + (goto-char end)) + ((eq (mark) end) + (goto-char beg)) + ((< click (mark)) + (set-mark end) + (goto-char beg)) + (t + (set-mark beg) + (goto-char end))))) + (defun mouse--remap-link-click-p (start-event end-event) (or (and (eq mouse-1-click-follows-link 'double) (= (event-click-count start-event) 2)) @@ -1166,8 +1175,7 @@ ((= mode 2) (list (save-excursion (goto-char start) - (beginning-of-line 1) - (point)) + (line-beginning-position 1)) (save-excursion (goto-char end) (forward-line 1)
--- a/lisp/net/rcirc.el Sun Aug 15 23:36:33 2010 +0000 +++ b/lisp/net/rcirc.el Mon Aug 16 22:43:52 2010 +0000 @@ -1342,6 +1342,12 @@ :type 'integer :group 'rcirc) +(defcustom rcirc-log-process-buffers nil + "Non-nil if rcirc process buffers should be logged to disk." + :group 'rcirc + :type 'boolean + :version "24.1") + (defun rcirc-last-quit-line (process nick target) "Return the line number where NICK left TARGET. Returns nil if the information is not recorded." @@ -1507,14 +1513,21 @@ (when (not (rcirc-channel-p rcirc-target)) 'nick))) - (when rcirc-log-flag + (when (and rcirc-log-flag + (or target + rcirc-log-process-buffers)) (rcirc-log process sender response target text)) (sit-for 0) ; displayed text before hook (run-hook-with-args 'rcirc-print-hooks process sender response target text))))) -(defcustom rcirc-log-filename-function 'rcirc-generate-new-buffer-name +(defun rcirc-generate-log-filename (process target) + (if target + (rcirc-generate-new-buffer-name process target) + (process-name process))) + +(defcustom rcirc-log-filename-function 'rcirc-generate-log-filename "A function to generate the filename used by rcirc's logging facility. It is called with two arguments, PROCESS and TARGET (see
--- a/lisp/simple.el Sun Aug 15 23:36:33 2010 +0000 +++ b/lisp/simple.el Mon Aug 16 22:43:52 2010 +0000 @@ -3674,7 +3674,9 @@ Mark mode is disabled. This function also runs `deactivate-mark-hook'." (when (or transient-mark-mode force) - (when (and select-active-regions + (when (and (if (eq select-active-regions 'only) + (eq (car-safe transient-mark-mode) 'only) + select-active-regions) (region-active-p) (display-selections-p)) ;; The var `saved-region-selection', if non-nil, is the text in
--- a/src/ChangeLog Sun Aug 15 23:36:33 2010 +0000 +++ b/src/ChangeLog Mon Aug 16 22:43:52 2010 +0000 @@ -1,3 +1,24 @@ +2010-08-16 Jan Djärv <jan.h.d@swipnet.se> + + * nsselect.m: include keyboard.h for QPRIMARY, remove its + declaration (Bug#6863). + (syms_of_nsselect): Don't intern QPRIMARY. + + * xselect.c: Remove declaration of QPRIMARY (Bug#6864). + + * keyboard.h (QPRIMARY): Declare (Bug#6864). + +2010-08-16 Chong Yidong <cyd@stupidchicken.com> + + * keyboard.c (command_loop_1): Avoid setting selection twice, + since it's done in deactivate-mark as well. + (Vselect_active_regions): Change default to t. Replace `lazy' + with non-default value `only', meaning only set PRIMARY for + temporarily active regions. + + * insdel.c (prepare_to_modify_buffer): Handle `only' value of + select-active-regions. + 2010-08-15 Jan Djärv <jan.h.d@swipnet.se> * keyboard.c (parse_tool_bar_item): Put in a bad label if :label
--- a/src/insdel.c Sun Aug 15 23:36:33 2010 +0000 +++ b/src/insdel.c Mon Aug 16 22:43:52 2010 +0000 @@ -74,7 +74,7 @@ Lisp_Object Qinhibit_modification_hooks; -extern Lisp_Object Vselect_active_regions, Vsaved_region_selection; +extern Lisp_Object Vselect_active_regions, Vsaved_region_selection, Qonly; /* Check all markers in the current buffer, looking for something invalid. */ @@ -2050,10 +2050,12 @@ #endif /* not CLASH_DETECTION */ /* If `select-active-regions' is non-nil, save the region text. */ - if (!NILP (Vselect_active_regions) - && !NILP (current_buffer->mark_active) - && !NILP (Vtransient_mark_mode) - && NILP (Vsaved_region_selection)) + if (!NILP (current_buffer->mark_active) + && NILP (Vsaved_region_selection) + && (EQ (Vselect_active_regions, Qonly) + ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) + : (!NILP (Vselect_active_regions) + && !NILP (Vtransient_mark_mode)))) { int b = XINT (Fmarker_position (current_buffer->mark)); int e = XINT (make_number (PT));
--- a/src/keyboard.c Sun Aug 15 23:36:33 2010 +0000 +++ b/src/keyboard.c Mon Aug 16 22:43:52 2010 +0000 @@ -368,7 +368,7 @@ Used by the `select-active-regions' feature. */ Lisp_Object Vsaved_region_selection; -Lisp_Object Qx_set_selection, QPRIMARY, Qlazy; +Lisp_Object Qx_set_selection, QPRIMARY; Lisp_Object Qself_insert_command; Lisp_Object Qforward_char; @@ -1790,27 +1790,34 @@ Vtransient_mark_mode = Qnil; else if (EQ (Vtransient_mark_mode, Qonly)) Vtransient_mark_mode = Qidentity; - else if (EQ (Vselect_active_regions, Qlazy) - ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) - : (!NILP (Vselect_active_regions) - && !NILP (Vtransient_mark_mode))) - { - /* Set window selection. If `select-active-regions' is - `lazy', only do it for temporarily active regions. */ - int beg = XINT (Fmarker_position (current_buffer->mark)); - int end = XINT (make_number (PT)); - if (beg < end) - call2 (Qx_set_selection, QPRIMARY, - make_buffer_string (beg, end, 0)); - else if (beg > end) - call2 (Qx_set_selection, QPRIMARY, - make_buffer_string (end, beg, 0)); - } if (!NILP (Vdeactivate_mark)) + /* If `select-active-regions' is non-nil, this call to + `deactivate-mark' also sets the PRIMARY selection. */ call0 (Qdeactivate_mark); - else if (current_buffer != prev_buffer || MODIFF != prev_modiff) - call1 (Vrun_hooks, intern ("activate-mark-hook")); + else + { + /* Even if not deactivating the mark, set PRIMARY if + `select-active-regions' is non-nil. */ + if (EQ (Vselect_active_regions, Qonly) + ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) + : (!NILP (Vselect_active_regions) + && !NILP (Vtransient_mark_mode))) + { + int beg = XINT (Fmarker_position (current_buffer->mark)); + int end = XINT (make_number (PT)); + if (beg < end) + call2 (Qx_set_selection, QPRIMARY, + make_buffer_string (beg, end, 0)); + else if (beg > end) + call2 (Qx_set_selection, QPRIMARY, + make_buffer_string (end, beg, 0)); + /* Don't set empty selections. */ + } + + if (current_buffer != prev_buffer || MODIFF != prev_modiff) + call1 (Vrun_hooks, intern ("activate-mark-hook")); + } Vsaved_region_selection = Qnil; } @@ -11718,8 +11725,6 @@ staticpro (&Qx_set_selection); QPRIMARY = intern_c_string ("PRIMARY"); staticpro (&QPRIMARY); - Qlazy = intern_c_string ("lazy"); - staticpro (&Qlazy); Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char"); staticpro (&Qinput_method_exit_on_first_char); @@ -12331,16 +12336,11 @@ DEFVAR_LISP ("select-active-regions", &Vselect_active_regions, doc: /* If non-nil, an active region automatically becomes the window selection. -This takes effect only when Transient Mark mode is enabled. - -If the value is `lazy', Emacs only sets the window selection during -`deactivate-mark'; unless the region is temporarily active -(e.g. mouse-drags or shift-selection), in which case it sets the -window selection after each command. - -For other non-nil value, Emacs sets the window selection after every -command. */); - Vselect_active_regions = Qlazy; +If the value is `only', only temporarily active regions (usually made +by mouse-dragging or shift-selection) set the window selection. + +This takes effect only when Transient Mark mode is enabled. */); + Vselect_active_regions = Qt; DEFVAR_LISP ("saved-region-selection", &Vsaved_region_selection,
--- a/src/keyboard.h Sun Aug 15 23:36:33 2010 +0000 +++ b/src/keyboard.h Mon Aug 16 22:43:52 2010 +0000 @@ -440,6 +440,9 @@ extern Lisp_Object Vdouble_click_time; +/* The primary selection. */ +extern Lisp_Object QPRIMARY; + /* Forward declaration for prototypes. */ struct input_event;
--- a/src/nsselect.m Sun Aug 15 23:36:33 2010 +0000 +++ b/src/nsselect.m Mon Aug 16 22:43:52 2010 +0000 @@ -33,10 +33,11 @@ #include "lisp.h" #include "nsterm.h" #include "termhooks.h" +#include "keyboard.h" #define CUT_BUFFER_SUPPORT -Lisp_Object QPRIMARY, QSECONDARY, QTEXT, QFILE_NAME; +Lisp_Object QSECONDARY, QTEXT, QFILE_NAME; static Lisp_Object Vns_sent_selection_hooks; static Lisp_Object Vns_lost_selection_hooks; @@ -542,7 +543,6 @@ void syms_of_nsselect (void) { - QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); QTEXT = intern ("TEXT"); staticpro (&QTEXT); QFILE_NAME = intern ("FILE_NAME"); staticpro (&QFILE_NAME);
--- a/src/xselect.c Sun Aug 15 23:36:33 2010 +0000 +++ b/src/xselect.c Mon Aug 16 22:43:52 2010 +0000 @@ -107,7 +107,7 @@ #define CUT_BUFFER_SUPPORT -Lisp_Object QPRIMARY, QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, +Lisp_Object QSECONDARY, QSTRING, QINTEGER, QCLIPBOARD, QTIMESTAMP, QTEXT, QDELETE, QMULTIPLE, QINCR, QEMACS_TMP, QTARGETS, QATOM, QNULL, QATOM_PAIR;