Now on revision 114112. ------------------------------------------------------------ revno: 114112 fixes bug: http://debbugs.gnu.org/15138 committer: Jan Djärv branch nick: trunk timestamp: Tue 2013-09-03 08:56:25 +0200 message: * nsfont.m (INVALID_GLYPH): New define. (nsfont_encode_char): Use INVALID_GLYPH. (ns_uni_to_glyphs): Ditto, check for NSNullGlyph. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 17:23:26 +0000 +++ src/ChangeLog 2013-09-03 06:56:25 +0000 @@ -1,3 +1,9 @@ +2013-09-03 Jan Djärv + + * nsfont.m (INVALID_GLYPH): New define. + (nsfont_encode_char): Use INVALID_GLYPH. + (ns_uni_to_glyphs): Ditto, check for NSNullGlyph (Bug#15138). + 2013-09-02 Dmitry Antipov * xterm.c (x_last_mouse_movement_time): Revert last change. === modified file 'src/nsfont.m' --- src/nsfont.m 2013-08-09 12:25:34 +0000 +++ src/nsfont.m 2013-09-03 06:56:25 +0000 @@ -61,6 +61,7 @@ static void ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block); +#define INVALID_GLYPH 0xFFFF /* ========================================================================== @@ -981,7 +982,7 @@ ns_uni_to_glyphs (font_info, high); g = font_info->glyphs[high][low]; - return g == 0xFFFF ? FONT_INVALID_CODE : g; + return g == INVALID_GLYPH ? FONT_INVALID_CODE : g; } @@ -1354,8 +1355,8 @@ #else g = glyphStorage->cglyphs[i]; /* TODO: is this a good check? maybe need to use coveredChars.. */ - if (g > numGlyphs) - g = 0xFFFF; /* hopefully unused... */ + if (g > numGlyphs || g == NSNullGlyph) + g = INVALID_GLYPH; /* hopefully unused... */ #endif *glyphs = g; } @@ -1483,7 +1484,7 @@ characterIndex: (NSUInteger)charIndex { len = glyphIndex+length; - for (i =glyphIndex; i maxGlyph) maxGlyph = len; ------------------------------------------------------------ revno: 114111 fixes bug: http://debbugs.gnu.org/15208 committer: Dmitry Gutov branch nick: trunk timestamp: Tue 2013-09-03 03:29:10 +0300 message: * lisp/progmodes/ruby-mode.el (ruby-calculate-indent): Consider two-character operators and whether the character preceding them changes their meaning. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-02 13:56:03 +0000 +++ lisp/ChangeLog 2013-09-03 00:29:10 +0000 @@ -1,3 +1,9 @@ +2013-09-03 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-calculate-indent): Consider + two-character operators and whether the character preceding them + changes their meaning (Bug#15208). + 2013-09-02 Fabián Ezequiel Gallina Format code sent to Python shell for robustness. === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-08-29 18:06:46 +0000 +++ lisp/progmodes/ruby-mode.el 2013-09-03 00:29:10 +0000 @@ -137,6 +137,7 @@ (defconst ruby-symbol-chars "a-zA-Z0-9_" "List of characters that symbol names may contain.") + (defconst ruby-symbol-re (concat "[" ruby-symbol-chars "]") "Regexp to match symbols.") @@ -935,6 +936,10 @@ (not (looking-at "[a-z_]")))) (and (looking-at ruby-operator-re) (not (ruby-special-char-p)) + (save-excursion + (forward-char -1) + (or (not (looking-at ruby-operator-re)) + (not (eq (char-before) ?:)))) ;; Operator at the end of line. (let ((c (char-after (point)))) (and === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-05-19 06:01:23 +0000 +++ test/indent/ruby.rb 2013-09-03 00:29:10 +0000 @@ -66,3 +66,8 @@ Given /toto/ do print "hello" end + +# Bug#15208 +if something == :== + do_something +end ------------------------------------------------------------ revno: 114110 committer: martin rudalics branch nick: trunk timestamp: Mon 2013-09-02 19:23:26 +0200 message: Move Flast_nonminibuf_frame from dispnew.c to frame.c. * dispnew.c (Flast_nonminibuf_frame): Move from here ... * frame.c (Flast_nonminibuf_frame): ... to here. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 15:48:59 +0000 +++ src/ChangeLog 2013-09-02 17:23:26 +0000 @@ -8,8 +8,10 @@ 2013-09-02 Martin Rudalics - * frame.c (check_minibuf_window): Don't abort if no window was - found (Bug#15247). + * dispnew.c (Flast_nonminibuf_frame): Move from here ... + * frame.c (Flast_nonminibuf_frame): ... to here. + (check_minibuf_window): Don't abort if no window was found + (Bug#15247). 2013-09-02 Dmitry Antipov === modified file 'src/dispnew.c' --- src/dispnew.c 2013-09-01 16:21:48 +0000 +++ src/dispnew.c 2013-09-02 17:23:26 +0000 @@ -6172,19 +6172,6 @@ { return decode_any_window (window)->cursor_off_p ? Qnil : Qt; } - -DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame, - Slast_nonminibuf_frame, 0, 0, 0, - doc: /* Value is last nonminibuffer frame. */) - (void) -{ - Lisp_Object frame = Qnil; - - if (last_nonminibuf_frame) - XSETFRAME (frame, last_nonminibuf_frame); - - return frame; -} /*********************************************************************** Initialization @@ -6203,7 +6190,6 @@ defsubr (&Ssend_string_to_terminal); defsubr (&Sinternal_show_cursor); defsubr (&Sinternal_show_cursor_p); - defsubr (&Slast_nonminibuf_frame); #ifdef GLYPH_DEBUG defsubr (&Sdump_redisplay_history); === modified file 'src/frame.c' --- src/frame.c 2013-09-02 12:22:21 +0000 +++ src/frame.c 2013-09-02 17:23:26 +0000 @@ -1078,6 +1078,19 @@ CHECK_LIVE_FRAME (frame); return prev_frame (frame, miniframe); } + +DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame, + Slast_nonminibuf_frame, 0, 0, 0, + doc: /* Return last non-minibuffer frame selected. */) + (void) +{ + Lisp_Object frame = Qnil; + + if (last_nonminibuf_frame) + XSETFRAME (frame, last_nonminibuf_frame); + + return frame; +} /* Return 1 if it is ok to delete frame F; 0 if all frames aside from F are invisible. @@ -4492,6 +4505,7 @@ defsubr (&Sframe_list); defsubr (&Snext_frame); defsubr (&Sprevious_frame); + defsubr (&Slast_nonminibuf_frame); defsubr (&Sdelete_frame); defsubr (&Smouse_position); defsubr (&Smouse_pixel_position); ------------------------------------------------------------ revno: 114109 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-02 19:48:59 +0400 message: * xterm.c (x_last_mouse_movement_time): Revert last change. This code should use XDisplayMotionBufferSize to check display's motion history first, and there are few other issues as well. (x_scroll_bar_note_movement): Pass XMotionEvent rather than XEvent. (handle_one_xevent): Adjust user. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 12:22:21 +0000 +++ src/ChangeLog 2013-09-02 15:48:59 +0000 @@ -1,3 +1,11 @@ +2013-09-02 Dmitry Antipov + + * xterm.c (x_last_mouse_movement_time): Revert last change. + This code should use XDisplayMotionBufferSize to check display's + motion history first, and there are few other issues as well. + (x_scroll_bar_note_movement): Pass XMotionEvent rather than XEvent. + (handle_one_xevent): Adjust user. + 2013-09-02 Martin Rudalics * frame.c (check_minibuf_window): Don't abort if no window was === modified file 'src/xterm.c' --- src/xterm.c 2013-09-02 11:24:11 +0000 +++ src/xterm.c 2013-09-02 15:48:59 +0000 @@ -133,9 +133,6 @@ #include #endif -/* Default to using XGetMotionEvents. */ -#define X_MOTION_HISTORY 1 - /* Default to using XIM if available. */ #ifdef USE_XIM int use_xim = 1; @@ -224,6 +221,15 @@ static Lisp_Object last_mouse_scroll_bar; +/* This is a hack. We would really prefer that XTmouse_position would + return the time associated with the position it returns, but there + doesn't seem to be any way to wrest the time-stamp from the server + along with the position query. So, we just keep track of the time + of the last movement we received, and return that in hopes that + it's somewhat accurate. */ + +static Time last_mouse_movement_time; + /* Time for last user interaction as returned in X events. */ static Time last_user_time; @@ -3716,48 +3722,6 @@ return Qnil; } -#ifdef X_MOTION_HISTORY - -/* Here we assume that X server supports XGetMotionEvents. If you hit - eassert in the function below, most probably your X server is too - old and/or buggy. Undef X_MOTION_HISTORY to enable legacy code. */ - -static Time -x_last_mouse_movement_time (struct frame *f) -{ - Time t; - int nevents; - XTimeCoord *xtc; - - block_input (); - xtc = XGetMotionEvents (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - 1, last_user_time, &nevents); - eassert (xtc && nevents > 0); - t = xtc[nevents - 1].time; - XFree (xtc); - unblock_input (); - return t; -} - -#else /* no X_MOTION_HISTORY */ - -/* This is a hack. We would really prefer that XTmouse_position would - return the time associated with the position it returns, but there - doesn't seem to be any way to wrest the time-stamp from the server - along with the position query. So, we just keep track of the time - of the last movement we received, and return that in hopes that - it's somewhat accurate. */ - -static Time last_mouse_movement_time; - -static Time -x_last_mouse_movement_time (struct frame *f) -{ - return last_mouse_movement_time; -} - -#endif /* X_MOTION_HISTORY */ - /* Function to report a mouse movement to the mainstream Emacs code. The input handler calls this. @@ -3772,9 +3736,7 @@ static int note_mouse_movement (struct frame *frame, XMotionEvent *event) { -#ifndef X_MOTION_HISTORY last_mouse_movement_time = event->time; -#endif /* legacy */ last_mouse_motion_event = *event; XSETFRAME (last_mouse_motion_frame, frame); @@ -4030,7 +3992,7 @@ *fp = f1; XSETINT (*x, win_x); XSETINT (*y, win_y); - *timestamp = x_last_mouse_movement_time (f1); + *timestamp = last_mouse_movement_time; } } } @@ -5533,12 +5495,12 @@ mark bits. */ static void -x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) +x_scroll_bar_note_movement (struct scroll_bar *bar, XMotionEvent *event) { struct frame *f = XFRAME (XWINDOW (bar->window)->frame); -#ifndef X_MOTION_HISTORY - last_mouse_movement_time = event->xmotion.time; -#endif /* legacy */ + + last_mouse_movement_time = event->time; + f->mouse_moved = 1; XSETVECTOR (last_mouse_scroll_bar, bar); @@ -5546,7 +5508,7 @@ if (! NILP (bar->dragging)) { /* Where should the handle be now? */ - int new_start = event->xmotion.y - XINT (bar->dragging); + int new_start = event->y - XINT (bar->dragging); if (new_start != bar->start) { @@ -5623,9 +5585,10 @@ f->mouse_moved = 0; last_mouse_scroll_bar = Qnil; - *timestamp = x_last_mouse_movement_time (f); } + *timestamp = last_mouse_movement_time; + unblock_input (); } @@ -6722,7 +6685,7 @@ event.xmotion.window); if (bar) - x_scroll_bar_note_movement (bar, &event); + x_scroll_bar_note_movement (bar, &event.xmotion); #endif /* USE_TOOLKIT_SCROLL_BARS */ /* If we move outside the frame, then we're ------------------------------------------------------------ revno: 114108 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Mon 2013-09-02 10:56:03 -0300 message: Format code sent to Python shell for robustness. * progmodes/python.el (python-shell-buffer-substring): New function. (python-shell-send-region, python-shell-send-buffer): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-02 13:41:08 +0000 +++ lisp/ChangeLog 2013-09-02 13:56:03 +0000 @@ -1,3 +1,10 @@ +2013-09-02 Fabián Ezequiel Gallina + + Format code sent to Python shell for robustness. + * progmodes/python.el (python-shell-buffer-substring): New + function. + (python-shell-send-region, python-shell-send-buffer): Use it. + 2013-09-02 Michael Albinus * net/tramp-compat.el (tramp-compat-user-error): Move it ... === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2013-09-02 03:37:18 +0000 +++ lisp/progmodes/python.el 2013-09-02 13:56:03 +0000 @@ -2137,17 +2137,58 @@ (define-obsolete-function-alias 'python-send-string 'python-shell-internal-send-string "24.3") +(defun python-shell-buffer-substring (start end &optional nomain) + "Send buffer substring from START to END formatted for shell. +This is a wrapper over `buffer-substring' that takes care of +different transformations for the code sent to be evaluated in +the python shell: + 1. When Optional Argument NOMAIN is non-nil everything under an + \"if __name__ == '__main__'\" block will be removed. + 2. When a subregion of the buffer is sent, it takes care of + appending extra whitelines so tracebacks are correct. + 3. Wraps indented regions under an \"if True:\" block so the + interpreter evaluates them correctly." + (let ((substring (buffer-substring-no-properties start end)) + (fillstr (make-string (1- (line-number-at-pos start)) ?\n)) + (toplevel-block-p (save-excursion + (goto-char start) + (or (zerop (line-number-at-pos start)) + (progn + (python-util-forward-comment 1) + (zerop (current-indentation))))))) + (with-temp-buffer + (python-mode) + (insert fillstr) + (insert substring) + (goto-char (point-min)) + (when (not toplevel-block-p) + (insert "if True:") + (delete-region (point) (line-end-position))) + (when nomain + (let* ((if-name-main-start-end + (and nomain + (save-excursion + (when (python-nav-if-name-main) + (cons (point) + (progn (python-nav-forward-sexp) + (point))))))) + ;; Oh destructuring bind, how I miss you. + (if-name-main-start (car if-name-main-start-end)) + (if-name-main-end (cdr if-name-main-start-end))) + (when if-name-main-start-end + (goto-char if-name-main-start) + (delete-region if-name-main-start if-name-main-end) + (insert + (make-string + (- (line-number-at-pos if-name-main-end) + (line-number-at-pos if-name-main-start)) ?\n))))) + (buffer-substring-no-properties (point-min) (point-max))))) + (defun python-shell-send-region (start end) "Send the region delimited by START and END to inferior Python process." (interactive "r") (python-shell-send-string - (concat - (let ((line-num (line-number-at-pos start))) - ;; When sending a region, add blank lines for non sent code so - ;; backtraces remain correct. - (make-string (1- line-num) ?\n)) - (buffer-substring start end)) - nil t)) + (python-shell-buffer-substring start end) nil t)) (defun python-shell-send-buffer (&optional arg) "Send the entire buffer to inferior Python process. @@ -2156,13 +2197,9 @@ (interactive "P") (save-restriction (widen) - (let ((str (buffer-substring (point-min) (point-max)))) - (and - (not arg) - (setq str (replace-regexp-in-string - (python-rx if-name-main) - "if __name__ == '__main__ ':" str))) - (python-shell-send-string str)))) + (python-shell-send-string + (python-shell-buffer-substring + (point-min) (point-max) (not arg))))) (defun python-shell-send-defun (arg) "Send the current defun to inferior Python process. ------------------------------------------------------------ revno: 114107 committer: Michael Albinus branch nick: trunk timestamp: Mon 2013-09-02 15:41:08 +0200 message: * net/tramp-compat.el (tramp-compat-user-error): Move it ... * net/tramp.el (tramp-user-error): ... here. (tramp-find-method, tramp-check-proper-host) (tramp-dissect-file-name, tramp-debug-message) (tramp-handle-shell-command): * net/tramp-adb.el (tramp-adb-handle-shell-command): * net/tramp-gvfs.el (tramp-gvfs-file-name-handler): Adapt callees. * net/tramp-cache.el (tramp-cache-print): Don't print text properties. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-02 07:11:26 +0000 +++ lisp/ChangeLog 2013-09-02 13:41:08 +0000 @@ -1,3 +1,15 @@ +2013-09-02 Michael Albinus + + * net/tramp-compat.el (tramp-compat-user-error): Move it ... + * net/tramp.el (tramp-user-error): ... here. + (tramp-find-method, tramp-check-proper-host) + (tramp-dissect-file-name, tramp-debug-message) + (tramp-handle-shell-command): + * net/tramp-adb.el (tramp-adb-handle-shell-command): + * net/tramp-gvfs.el (tramp-gvfs-file-name-handler): Adapt callees. + + * net/tramp-cache.el (tramp-cache-print): Don't print text properties. + 2013-09-02 Martin Rudalics * avoid.el (mouse-avoidance-point-position) === modified file 'lisp/net/tramp-adb.el' --- lisp/net/tramp-adb.el 2013-08-26 13:17:22 +0000 +++ lisp/net/tramp-adb.el 2013-09-02 13:41:08 +0000 @@ -874,7 +874,7 @@ (when p (if (yes-or-no-p "A command is running. Kill it? ") (ignore-errors (kill-process p)) - (tramp-compat-user-error "Shell command in progress"))) + (tramp-user-error p "Shell command in progress"))) (if current-buffer-p (progn === modified file 'lisp/net/tramp-cache.el' --- lisp/net/tramp-cache.el 2013-08-15 14:29:08 +0000 +++ lisp/net/tramp-cache.el 2013-09-02 13:41:08 +0000 @@ -285,6 +285,11 @@ (let (result) (maphash (lambda (key value) + ;; Remove text properties from KEY. + (when (vectorp key) + (dotimes (i (length key)) + (when (stringp (aref key i)) + (aset key i (substring-no-properties (aref key i)))))) (let ((tmp (format "(%s %s)" (if (processp key) === modified file 'lisp/net/tramp-compat.el' --- lisp/net/tramp-compat.el 2013-08-26 13:17:22 +0000 +++ lisp/net/tramp-compat.el 2013-09-02 13:41:08 +0000 @@ -518,12 +518,6 @@ "`dos', `unix', or `mac'"))))) (t (error "Can't change EOL conversion -- is MULE missing?")))) -;; `user-error' has been added to Emacs 24.3. -(defun tramp-compat-user-error (format &rest args) - "Signal a pilot error." -; (tramp-backtrace) - (apply (if (fboundp 'user-error) 'user-error 'error) format args)) - (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-compat 'force))) === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2013-08-26 13:17:22 +0000 +++ lisp/net/tramp-gvfs.el 2013-09-02 13:41:08 +0000 @@ -490,7 +490,7 @@ First arg specifies the OPERATION, second arg is a list of arguments to pass to the OPERATION." (unless tramp-gvfs-enabled - (tramp-compat-user-error "Package `tramp-gvfs' not supported")) + (tramp-user-error nil "Package `tramp-gvfs' not supported")) (let ((fn (assoc operation tramp-gvfs-file-name-handler-alist))) (if fn (save-match-data (apply (cdr fn) args)) === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2013-08-29 19:55:58 +0000 +++ lisp/net/tramp.el 2013-09-02 13:41:08 +0000 @@ -1120,6 +1120,12 @@ ;;; Internal functions which must come first: +(defsubst tramp-user-error (vec-or-proc format &rest args) + "Signal a pilot error." + (apply + 'tramp-error vec-or-proc + (if (fboundp 'user-error) 'user-error 'error) format args)) + ;; Conversion functions between external representation and ;; internal data structure. Convenience functions for internal ;; data structure. @@ -1232,9 +1238,9 @@ (if noninteractive (warn "Method %s is obsolete, using %s" result (substring result 0 -1)) - (unless (y-or-n-p (format "Method %s is obsolete, use %s? " + (unless (y-or-n-p (format "Method \"%s\" is obsolete, use \"%s\"? " result (substring result 0 -1))) - (tramp-compat-user-error "Method \"%s\" not supported" result))) + (tramp-user-error nil "Method \"%s\" not supported" result))) (add-to-list 'tramp-warned-obsolete-methods result)) ;; This works with the current set of `tramp-obsolete-methods'. ;; Must be improved, if their are more sophisticated replacements. @@ -1289,8 +1295,8 @@ (or (null method) (get-text-property 0 'tramp-default method)) (or (null user) (get-text-property 0 'tramp-default user)) (member host (mapcar 'car tramp-methods))) - (tramp-compat-user-error - "Host name must not match method `%s'" host)))) + (tramp-cleanup-connection vec) + (tramp-user-error vec "Host name must not match method \"%s\"" host)))) (defun tramp-dissect-file-name (name &optional nodefault) "Return a `tramp-file-name' structure. @@ -1300,7 +1306,7 @@ values." (save-match-data (let ((match (string-match (nth 0 tramp-file-name-structure) name))) - (unless match (tramp-compat-user-error "Not a Tramp file name: %s" name)) + (unless match (tramp-user-error nil "Not a Tramp file name: \"%s\"" name)) (let ((method (match-string (nth 1 tramp-file-name-structure) name)) (user (match-string (nth 2 tramp-file-name-structure) name)) (host (match-string (nth 3 tramp-file-name-structure) name)) @@ -1485,7 +1491,8 @@ "tramp-debug-message" "tramp-error" "tramp-error-with-buffer" - "tramp-message") + "tramp-message" + "tramp-user-error") t) "$") fn))) @@ -3236,7 +3243,7 @@ (when p (if (yes-or-no-p "A command is running. Kill it? ") (ignore-errors (kill-process p)) - (tramp-compat-user-error "Shell command in progress"))) + (tramp-user-error p "Shell command in progress"))) (if current-buffer-p (progn ------------------------------------------------------------ revno: 114106 committer: martin rudalics branch nick: trunk timestamp: Mon 2013-09-02 14:22:21 +0200 message: In check_minibuf_window don't abort if no window was found (Bug#15247). * frame.c (check_minibuf_window): Don't abort if no window was found (Bug#15247). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 11:24:11 +0000 +++ src/ChangeLog 2013-09-02 12:22:21 +0000 @@ -1,3 +1,8 @@ +2013-09-02 Martin Rudalics + + * frame.c (check_minibuf_window): Don't abort if no window was + found (Bug#15247). + 2013-09-02 Dmitry Antipov Use XGetMotionEvents to ask the last mouse motion time from X server. === modified file 'src/frame.c' --- src/frame.c 2013-08-26 17:31:00 +0000 +++ src/frame.c 2013-09-02 12:22:21 +0000 @@ -1137,9 +1137,8 @@ } } - if (!WINDOWP (window)) - emacs_abort (); - else + /* Don't abort if no window was found (Bug#15247). */ + if (WINDOWP (window)) { /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ ------------------------------------------------------------ revno: 114105 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-02 15:24:11 +0400 message: * xterm.c (handle_one_xevent): Use event.xunmap and not event.xmap when handling UnmapNotify event. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 08:45:32 +0000 +++ src/ChangeLog 2013-09-02 11:24:11 +0000 @@ -8,6 +8,8 @@ Ifdef away legacy code. (XTmouse_position, x_scroll_bar_report_motion): Use x_last_mouse_movement_time. + (handle_one_xevent): Use event.xunmap and not event.xmap when handling + UnmapNotify event. 2013-09-02 Dmitry Antipov === modified file 'src/xterm.c' --- src/xterm.c 2013-09-02 10:37:06 +0000 +++ src/xterm.c 2013-09-02 11:24:11 +0000 @@ -6183,7 +6183,7 @@ case UnmapNotify: /* Redo the mouse-highlight after the tooltip has gone. */ - if (event.xmap.window == tip_window) + if (event.xunmap.window == tip_window) { tip_window = 0; redo_mouse_highlight (); ------------------------------------------------------------ revno: 114104 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-02 14:37:06 +0400 message: * xterm.c (x_last_mouse_movement_time) [X_MOTION_HISTORY]: Fix last change. diff: === modified file 'src/xterm.c' --- src/xterm.c 2013-09-02 08:45:32 +0000 +++ src/xterm.c 2013-09-02 10:37:06 +0000 @@ -3727,11 +3727,15 @@ { Time t; int nevents; - XTimeCoord *xtc = XGetMotionEvents (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - 1, last_user_time, &nevents); + XTimeCoord *xtc; + + block_input (); + xtc = XGetMotionEvents (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + 1, last_user_time, &nevents); eassert (xtc && nevents > 0); t = xtc[nevents - 1].time; XFree (xtc); + unblock_input (); return t; } ------------------------------------------------------------ revno: 114103 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-02 06:17:37 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/Makefile.in' --- autogen/Makefile.in 2013-08-28 10:17:39 +0000 +++ autogen/Makefile.in 2013-09-02 10:17:37 +0000 @@ -1220,6 +1220,7 @@ ns_appdir = @ns_appdir@ ns_appresdir = @ns_appresdir@ ns_appsrc = @ns_appsrc@ +ns_check_file = @ns_check_file@ ns_self_contained = @ns_self_contained@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ === modified file 'autogen/configure' --- autogen/configure 2013-09-01 10:19:10 +0000 +++ autogen/configure 2013-09-02 10:17:37 +0000 @@ -604,6 +604,7 @@ LTLIBOBJS LIBOBJS SUBDIR_MAKEFILES_IN +ns_check_file WINDOW_SYSTEM_OBJ EMACS_HEAPSIZE TEMACS_POST_LINK @@ -29053,10 +29054,13 @@ if test "$NS_IMPL_GNUSTEP" = yes; then ac_config_files="$ac_config_files nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in" + ns_check_file=Resources/Info-gnustep.plist else ac_config_files="$ac_config_files nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in" + ns_check_file=Contents/Info.plist fi + fi SUBDIR_MAKEFILES="lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile nextstep/Makefile nt/Makefile" ------------------------------------------------------------ revno: 114102 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-02 12:45:32 +0400 message: Use XGetMotionEvents to ask the last mouse motion time from X server. * xterm.c (X_MOTION_HISTORY): Default to 1. (x_last_mouse_movement_time) [X_MOTION_HISTORY]: New function. (x_last_mouse_movement_time) [!X_MOTION_HISTORY]: Legacy version. (note_mouse_movement, x_scroll_bar_note_movement) [!X_MOTION_HISTORY]: Ifdef away legacy code. (XTmouse_position, x_scroll_bar_report_motion): Use x_last_mouse_movement_time. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 06:45:04 +0000 +++ src/ChangeLog 2013-09-02 08:45:32 +0000 @@ -1,5 +1,16 @@ 2013-09-02 Dmitry Antipov + Use XGetMotionEvents to ask the last mouse motion time from X server. + * xterm.c (X_MOTION_HISTORY): Default to 1. + (x_last_mouse_movement_time) [X_MOTION_HISTORY]: New function. + (x_last_mouse_movement_time) [!X_MOTION_HISTORY]: Legacy version. + (note_mouse_movement, x_scroll_bar_note_movement) [!X_MOTION_HISTORY]: + Ifdef away legacy code. + (XTmouse_position, x_scroll_bar_report_motion): + Use x_last_mouse_movement_time. + +2013-09-02 Dmitry Antipov + * msdos.c (last_mouse_window): Move to... (dos_rawgetc): ...this function and adjust comment. * nsterm.m (last_window): Rename to last_mouse_window, move to... === modified file 'src/xterm.c' --- src/xterm.c 2013-09-02 06:45:04 +0000 +++ src/xterm.c 2013-09-02 08:45:32 +0000 @@ -133,6 +133,9 @@ #include #endif +/* Default to using XGetMotionEvents. */ +#define X_MOTION_HISTORY 1 + /* Default to using XIM if available. */ #ifdef USE_XIM int use_xim = 1; @@ -221,15 +224,6 @@ static Lisp_Object last_mouse_scroll_bar; -/* This is a hack. We would really prefer that XTmouse_position would - return the time associated with the position it returns, but there - doesn't seem to be any way to wrest the time-stamp from the server - along with the position query. So, we just keep track of the time - of the last movement we received, and return that in hopes that - it's somewhat accurate. */ - -static Time last_mouse_movement_time; - /* Time for last user interaction as returned in X events. */ static Time last_user_time; @@ -3722,7 +3716,44 @@ return Qnil; } - +#ifdef X_MOTION_HISTORY + +/* Here we assume that X server supports XGetMotionEvents. If you hit + eassert in the function below, most probably your X server is too + old and/or buggy. Undef X_MOTION_HISTORY to enable legacy code. */ + +static Time +x_last_mouse_movement_time (struct frame *f) +{ + Time t; + int nevents; + XTimeCoord *xtc = XGetMotionEvents (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + 1, last_user_time, &nevents); + eassert (xtc && nevents > 0); + t = xtc[nevents - 1].time; + XFree (xtc); + return t; +} + +#else /* no X_MOTION_HISTORY */ + +/* This is a hack. We would really prefer that XTmouse_position would + return the time associated with the position it returns, but there + doesn't seem to be any way to wrest the time-stamp from the server + along with the position query. So, we just keep track of the time + of the last movement we received, and return that in hopes that + it's somewhat accurate. */ + +static Time last_mouse_movement_time; + +static Time +x_last_mouse_movement_time (struct frame *f) +{ + return last_mouse_movement_time; +} + +#endif /* X_MOTION_HISTORY */ + /* Function to report a mouse movement to the mainstream Emacs code. The input handler calls this. @@ -3737,7 +3768,9 @@ static int note_mouse_movement (struct frame *frame, XMotionEvent *event) { +#ifndef X_MOTION_HISTORY last_mouse_movement_time = event->time; +#endif /* legacy */ last_mouse_motion_event = *event; XSETFRAME (last_mouse_motion_frame, frame); @@ -3993,7 +4026,7 @@ *fp = f1; XSETINT (*x, win_x); XSETINT (*y, win_y); - *timestamp = last_mouse_movement_time; + *timestamp = x_last_mouse_movement_time (f1); } } } @@ -5499,9 +5532,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) { struct frame *f = XFRAME (XWINDOW (bar->window)->frame); - +#ifndef X_MOTION_HISTORY last_mouse_movement_time = event->xmotion.time; - +#endif /* legacy */ f->mouse_moved = 1; XSETVECTOR (last_mouse_scroll_bar, bar); @@ -5586,10 +5619,9 @@ f->mouse_moved = 0; last_mouse_scroll_bar = Qnil; + *timestamp = x_last_mouse_movement_time (f); } - *timestamp = last_mouse_movement_time; - unblock_input (); } ------------------------------------------------------------ revno: 114101 committer: martin rudalics branch nick: trunk timestamp: Mon 2013-09-02 09:11:26 +0200 message: In avoid.el handle case where posn-at-point returns nil. * avoid.el (mouse-avoidance-point-position) (mouse-avoidance-too-close-p): Handle case where posn-at-point returns nil. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-02 03:37:18 +0000 +++ lisp/ChangeLog 2013-09-02 07:11:26 +0000 @@ -1,3 +1,9 @@ +2013-09-02 Martin Rudalics + + * avoid.el (mouse-avoidance-point-position) + (mouse-avoidance-too-close-p): Handle case where posn-at-point + returns nil. + 2013-09-02 Fabián Ezequiel Gallina * progmodes/python.el (python-shell-completion-get-completions): === modified file 'lisp/avoid.el' --- lisp/avoid.el 2013-08-29 19:55:58 +0000 +++ lisp/avoid.el 2013-09-02 07:11:26 +0000 @@ -154,13 +154,15 @@ (defun mouse-avoidance-point-position () "Return the position of point as (FRAME X . Y). Analogous to `mouse-position'." - (let ((edges (window-inside-edges)) - (x-y (posn-x-y (posn-at-point)))) - (cons (selected-frame) - (cons (+ (car edges) - (/ (car x-y) (frame-char-width))) - (+ (car (cdr edges)) - (/ (cdr x-y) (frame-char-height))))))) + (let* ((edges (window-inside-edges)) + (posn-at-point (posn-at-point)) + (x-y (and posn-at-point (posn-x-y posn-at-point)))) + (when x-y + (cons (selected-frame) + (cons (+ (car edges) + (/ (car x-y) (frame-char-width))) + (+ (car (cdr edges)) + (/ (cdr x-y) (frame-char-height)))))))) ;(defun mouse-avoidance-point-position-test () ; (interactive) @@ -185,19 +187,21 @@ Acceptable distance is defined by `mouse-avoidance-threshold'." (let* ((frame (car mouse)) (mouse-y (cdr (cdr mouse))) - (tool-bar-lines (frame-parameter nil 'tool-bar-lines))) + (tool-bar-lines (frame-parameter nil 'tool-bar-lines)) + point) (or tool-bar-lines (setq tool-bar-lines 0)) - (if (and mouse-y (< mouse-y tool-bar-lines)) - nil - (let ((point (mouse-avoidance-point-position)) - (mouse-x (car (cdr mouse)))) + (cond + ((and mouse-y (< mouse-y tool-bar-lines)) + nil) + ((setq point (mouse-avoidance-point-position)) + (let ((mouse-x (car (cdr mouse)))) (and (eq frame (car point)) (not (null mouse-x)) (< (abs (- mouse-x (car (cdr point)))) mouse-avoidance-threshold) (< (abs (- mouse-y (cdr (cdr point)))) - mouse-avoidance-threshold)))))) + mouse-avoidance-threshold))))))) (defun mouse-avoidance-banish-destination () "The position to which Mouse Avoidance mode `banish' moves the mouse. ------------------------------------------------------------ revno: 114100 committer: Jan Djärv branch nick: trunk timestamp: Mon 2013-09-02 09:01:53 +0200 message: Fix copying of nextstep/Emacs.app for make -j install * configure.ac: Add ns_check_file. * nextstep/Makefile.in (${ns_check_file}): Add so Emacs.app gets properly updated when doing parallel make install. diff: === modified file 'ChangeLog' --- ChangeLog 2013-08-31 20:00:22 +0000 +++ ChangeLog 2013-09-02 07:01:53 +0000 @@ -1,3 +1,7 @@ +2013-09-02 Jan Djärv + + * configure.ac: Add ns_check_file. + 2013-08-31 Glenn Morris * configure.ac (--with-sound): Rename ossaudio to bsd-ossaudio, === modified file 'configure.ac' --- configure.ac 2013-08-31 20:00:22 +0000 +++ configure.ac 2013-09-02 07:01:53 +0000 @@ -4897,10 +4897,13 @@ if test "$NS_IMPL_GNUSTEP" = yes; then AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \ nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in]) + ns_check_file=Resources/Info-gnustep.plist else AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \ nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in]) + ns_check_file=Contents/Info.plist fi + AC_SUBST(ns_check_file) fi dnl Obviously there is duplication here wrt $SUBDIR_MAKEFILES. === modified file 'nextstep/ChangeLog' --- nextstep/ChangeLog 2013-08-28 06:01:52 +0000 +++ nextstep/ChangeLog 2013-09-02 07:01:53 +0000 @@ -1,3 +1,8 @@ +2013-09-02 Jan Djärv + + * Makefile.in (${ns_check_file}): Add so Emacs.app gets properly + updated when doing parallel make install. + 2013-08-28 Paul Eggert * Makefile.in (SHELL): Now @SHELL@, not /bin/sh, === modified file 'nextstep/Makefile.in' --- nextstep/Makefile.in 2013-08-28 06:01:52 +0000 +++ nextstep/Makefile.in 2013-09-02 07:01:53 +0000 @@ -31,8 +31,9 @@ ns_appdir = @ns_appdir@ ns_appbindir = @ns_appbindir@ ns_appsrc = @ns_appsrc@ +ns_check_file = @ns_appdir@/@ns_check_file@ -${ns_appdir}: ${srcdir}/${ns_appsrc} ${ns_appsrc} +${ns_check_file} ${ns_appdir}: ${srcdir}/${ns_appsrc} ${ns_appsrc} rm -rf ${ns_appdir} ${MKDIR_P} ${ns_appdir} ( cd ${srcdir}/${ns_appsrc} ; tar cfh - . ) | \ @@ -42,7 +43,7 @@ ( cd ${ns_appdir} ; umask 022; tar xf - ) touch ${ns_appdir} -${ns_appbindir}/Emacs: ${ns_appdir} ../src/emacs${EXEEXT} +${ns_appbindir}/Emacs: ${ns_appdir} ${ns_check_file} ../src/emacs${EXEEXT} ${MKDIR_P} ${ns_appbindir} cp -f ../src/emacs${EXEEXT} ${ns_appbindir}/Emacs ------------------------------------------------------------ revno: 114099 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-02 10:45:04 +0400 message: * msdos.c (last_mouse_window): Move to... (dos_rawgetc): ...this function and adjust comment. * nsterm.m (last_window): Rename to last_mouse_window, move to... (mouseMoved): ...this function and adjust comment. * w32term.c (last_window): Likewise with... (w32_read_socket): ...this function. * xterm.c (last_window): Likewise with... (handle_one_xevent): ...this function. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-02 06:12:26 +0000 +++ src/ChangeLog 2013-09-02 06:45:04 +0000 @@ -1,5 +1,16 @@ 2013-09-02 Dmitry Antipov + * msdos.c (last_mouse_window): Move to... + (dos_rawgetc): ...this function and adjust comment. + * nsterm.m (last_window): Rename to last_mouse_window, move to... + (mouseMoved): ...this function and adjust comment. + * w32term.c (last_window): Likewise with... + (w32_read_socket): ...this function. + * xterm.c (last_window): Likewise with... + (handle_one_xevent): ...this function. + +2013-09-02 Dmitry Antipov + * window.h (Vmouse_window, Vmouse_event): Remove the leftovers. * xterm.c (toplevel): Drop obsolete comment and move compose_status... (handle_one_xevent): ...to here. === modified file 'src/msdos.c' --- src/msdos.c 2013-09-02 03:39:06 +0000 +++ src/msdos.c 2013-09-02 06:45:04 +0000 @@ -946,9 +946,6 @@ Mouse Highlight (and friends..) ************************************************************************/ -/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ -static Lisp_Object last_mouse_window; - static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ int @@ -2668,10 +2665,10 @@ /* Generate SELECT_WINDOW_EVENTs when needed. */ if (!NILP (Vmouse_autoselect_window)) { - mouse_window = window_from_coordinates (SELECTED_FRAME (), - mouse_last_x, - mouse_last_y, - 0, 0); + static Lisp_Object last_mouse_window; + + mouse_window = window_from_coordinates + (SELECTED_FRAME (), mouse_last_x, mouse_last_y, 0, 0); /* A window will be selected only when it is not selected now, and the last mouse movement event was not in it. A minibuffer window will be selected iff @@ -2686,10 +2683,9 @@ event.timestamp = event_timestamp (); kbd_buffer_store_event (&event); } + /* Remember the last window where we saw the mouse. */ last_mouse_window = mouse_window; } - else - last_mouse_window = Qnil; previous_help_echo_string = help_echo_string; help_echo_string = help_echo_object = help_echo_window = Qnil; === modified file 'src/nsterm.m' --- src/nsterm.m 2013-09-01 16:39:20 +0000 +++ src/nsterm.m 2013-09-02 06:45:04 +0000 @@ -184,9 +184,6 @@ Lisp_Object ns_display_name_list; long context_menu_value = 0; -/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ -static Lisp_Object last_window; - /* display update */ NSPoint last_mouse_motion_position; static NSRect last_mouse_glyph; @@ -5458,11 +5455,13 @@ if (!NILP (Vmouse_autoselect_window)) { NSTRACE (mouse_autoselect_window); - Lisp_Object window; - window = window_from_coordinates(emacsframe, last_mouse_motion_position.x, - last_mouse_motion_position.y, 0, 0); + static Lisp_Object last_mouse_window; + Lisp_Object window = window_from_coordinates + (emacsframe, last_mouse_motion_position.x, + last_mouse_motion_position.y, 0, 0); + if (WINDOWP (window) - && !EQ (window, last_window) + && !EQ (window, last_mouse_window) && !EQ (window, selected_window) && (focus_follows_mouse || (EQ (XWINDOW (window)->frame, @@ -5473,7 +5472,8 @@ emacs_event->frame_or_window = window; EV_TRAILER2 (e); } - last_window = window; + /* Remember the last window where we saw the mouse. */ + last_mouse_window = window; } if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x, === modified file 'src/w32term.c' --- src/w32term.c 2013-09-02 03:39:06 +0000 +++ src/w32term.c 2013-09-02 06:45:04 +0000 @@ -84,9 +84,6 @@ static int any_help_event_p; -/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ -static Lisp_Object last_window; - extern unsigned int msh_mousewheel; extern void free_frame_menubar (struct frame *); @@ -4503,18 +4500,16 @@ /* Generate SELECT_WINDOW_EVENTs when needed. */ if (!NILP (Vmouse_autoselect_window)) { - Lisp_Object window; - int x = LOWORD (msg.msg.lParam); - int y = HIWORD (msg.msg.lParam); - - window = window_from_coordinates (f, x, y, 0, 0); + static Lisp_Object last_mouse_window; + Lisp_Object window = window_from_coordinates + (f, LOWORD (msg.msg.lParam), HIWORD (msg.msg.lParam), 0, 0); /* Window will be selected only when it is not selected now and last mouse movement event was not in it. Minibuffer window will be selected only when it is active. */ if (WINDOWP (window) - && !EQ (window, last_window) + && !EQ (window, last_mouse_window) && !EQ (window, selected_window) /* For click-to-focus window managers create event iff we don't leave the @@ -4526,8 +4521,8 @@ inev.kind = SELECT_WINDOW_EVENT; inev.frame_or_window = window; } - - last_window = window; + /* Remember the last window where we saw the mouse. */ + last_mouse_window = window; } if (!note_mouse_movement (f, &msg.msg)) help_echo_string = previous_help_echo_string; === modified file 'src/xterm.c' --- src/xterm.c 2013-09-02 05:59:35 +0000 +++ src/xterm.c 2013-09-02 06:45:04 +0000 @@ -140,16 +140,11 @@ int use_xim = 0; /* configure --without-xim */ #endif - - /* Non-zero means that a HELP_EVENT has been generated since Emacs start. */ static bool any_help_event_p; -/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ -static Lisp_Object last_window; - /* This is a chain of structures for all the X displays currently in use. */ @@ -6656,18 +6651,16 @@ /* Generate SELECT_WINDOW_EVENTs when needed. Don't let popup menus influence things (bug#1261). */ if (!NILP (Vmouse_autoselect_window) && !popup_activated ()) - { - Lisp_Object window; - - window = window_from_coordinates (f, - event.xmotion.x, event.xmotion.y, - 0, 0); - - /* Window will be selected only when it is not selected now and - last mouse movement event was not in it. Minibuffer window - will be selected only when it is active. */ - if (WINDOWP (window) - && !EQ (window, last_window) + { + static Lisp_Object last_mouse_window; + Lisp_Object window = window_from_coordinates + (f, event.xmotion.x, event.xmotion.y, 0, 0); + + /* Window will be selected only when it is not selected now and + last mouse movement event was not in it. Minibuffer window + will be selected only when it is active. */ + if (WINDOWP (window) + && !EQ (window, last_mouse_window) && !EQ (window, selected_window) /* For click-to-focus window managers create event iff we don't leave the @@ -6675,13 +6668,13 @@ && (focus_follows_mouse || (EQ (XWINDOW (window)->frame, XWINDOW (selected_window)->frame)))) - { - inev.ie.kind = SELECT_WINDOW_EVENT; - inev.ie.frame_or_window = window; - } - - last_window=window; - } + { + inev.ie.kind = SELECT_WINDOW_EVENT; + inev.ie.frame_or_window = window; + } + /* Remember the last window where we saw the mouse. */ + last_mouse_window = window; + } if (!note_mouse_movement (f, &event.xmotion)) help_echo_string = previous_help_echo_string; }