Now on revision 114389. ------------------------------------------------------------ revno: 114389 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 23:56:47 -0700 message: * eshell/em-unix.el (eshell-remove-entries): Rename argument to avoid name-clash with global `top-level'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-19 03:44:55 +0000 +++ lisp/ChangeLog 2013-09-19 06:56:47 +0000 @@ -1,5 +1,8 @@ 2013-09-19 Glenn Morris + * eshell/em-unix.el (eshell-remove-entries): + Rename argument to avoid name-clash with global `top-level'. + * eshell/esh-proc.el (eshell-kill-process-function): Remove eshell-reset-after-proc from eshell-kill-hook if present. (eshell-reset-after-proc): Remove unused arg `proc'. === modified file 'lisp/eshell/em-unix.el' --- lisp/eshell/em-unix.el 2013-09-19 02:42:36 +0000 +++ lisp/eshell/em-unix.el 2013-09-19 06:56:47 +0000 @@ -195,12 +195,12 @@ (Info-menu (car args)) (setq args (cdr args))))) -(defun eshell-remove-entries (files &optional top-level) +(defun eshell-remove-entries (files &optional toplevel) "Remove all of the given FILES, perhaps interactively." (while files (if (string-match "\\`\\.\\.?\\'" (file-name-nondirectory (car files))) - (if top-level + (if toplevel (eshell-error "rm: cannot remove `.' or `..'\n")) (if (and (file-directory-p (car files)) (not (file-symlink-p (car files)))) ------------------------------------------------------------ revno: 114388 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2013-09-19 09:21:32 +0400 message: Do not use external array to process X scroll bar messages. * xterm.c (scroll_bar_windows, scroll_bar_windows_size): Remove. (x_send_scroll_bar_event): Pack window pointer into two slots of XClientMessageEvent if we're 64-bit. Adjust comment. (x_scroll_bar_to_input_event): Unpack accordingly. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-18 09:33:36 +0000 +++ src/ChangeLog 2013-09-19 05:21:32 +0000 @@ -1,3 +1,11 @@ +2013-09-19 Dmitry Antipov + + Do not use external array to process X scroll bar messages. + * xterm.c (scroll_bar_windows, scroll_bar_windows_size): Remove. + (x_send_scroll_bar_event): Pack window pointer into two slots + of XClientMessageEvent if we're 64-bit. Adjust comment. + (x_scroll_bar_to_input_event): Unpack accordingly. + 2013-09-18 Dmitry Antipov Ifdef away recent changes which aren't relevant to NS port. === modified file 'src/xterm.c' --- src/xterm.c 2013-09-18 09:23:10 +0000 +++ src/xterm.c 2013-09-19 05:21:32 +0000 @@ -4266,13 +4266,6 @@ } #endif /* not USE_GTK */ -/* A vector of windows used for communication between - x_send_scroll_bar_event and x_scroll_bar_to_input_event. */ - -static struct window **scroll_bar_windows; -static ptrdiff_t scroll_bar_windows_size; - - /* Send a client message with message type Xatom_Scrollbar for a scroll action to the frame of WINDOW. PART is a value identifying the part of the scroll bar that was clicked on. PORTION is the @@ -4282,10 +4275,9 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) { XEvent event; - XClientMessageEvent *ev = (XClientMessageEvent *) &event; + XClientMessageEvent *ev = &event.xclient; struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); - ptrdiff_t i; block_input (); @@ -4296,33 +4288,30 @@ ev->window = FRAME_X_WINDOW (f); ev->format = 32; - /* We can only transfer 32 bits in the XClientMessageEvent, which is - not enough to store a pointer or Lisp_Object on a 64 bit system. - So, store the window in scroll_bar_windows and pass the index - into that array in the event. */ - for (i = 0; i < scroll_bar_windows_size; ++i) - if (scroll_bar_windows[i] == NULL) - break; - - if (i == scroll_bar_windows_size) - { - ptrdiff_t old_nbytes = - scroll_bar_windows_size * sizeof *scroll_bar_windows; - ptrdiff_t nbytes; - enum { XClientMessageEvent_MAX = 0x7fffffff }; - scroll_bar_windows = - xpalloc (scroll_bar_windows, &scroll_bar_windows_size, 1, - XClientMessageEvent_MAX, sizeof *scroll_bar_windows); - nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows; - memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes); - } - - scroll_bar_windows[i] = w; - ev->data.l[0] = (long) i; - ev->data.l[1] = (long) part; - ev->data.l[2] = (long) 0; - ev->data.l[3] = (long) portion; - ev->data.l[4] = (long) whole; + /* 32-bit X client on a 64-bit X server can pass window pointer + as is. 64-bit client on a 32-bit X server is in trouble + because pointer does not fit and will be truncated while + passing through the server. So we should use two slots + and hope that X12 will resolve such an issues someday. */ + + if (BITS_PER_LONG > 32) + { + union { + int i[2]; + void *v; + } val; + val.v = w; + ev->data.l[0] = val.i[0]; + ev->data.l[1] = val.i[1]; + } + else + { + ev->data.l[0] = 0; + ev->data.l[1] = (long) w; + } + ev->data.l[2] = part; + ev->data.l[3] = portion; + ev->data.l[4] = whole; /* Make Xt timeouts work while the scroll bar is active. */ #ifdef USE_X_TOOLKIT @@ -4345,12 +4334,24 @@ x_scroll_bar_to_input_event (const XEvent *event, struct input_event *ievent) { - XClientMessageEvent *ev = (XClientMessageEvent *) event; + const XClientMessageEvent *ev = &event->xclient; Lisp_Object window; struct window *w; - w = scroll_bar_windows[ev->data.l[0]]; - scroll_bar_windows[ev->data.l[0]] = NULL; + /* See the comment in the function above. */ + + if (BITS_PER_LONG > 32) + { + union { + int i[2]; + void *v; + } val; + val.i[0] = ev->data.l[0]; + val.i[1] = ev->data.l[1]; + w = val.v; + } + else + w = (void *) ev->data.l[1]; XSETWINDOW (window, w); @@ -4363,10 +4364,10 @@ ievent->timestamp = XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (w->frame))); #endif - ievent->part = ev->data.l[1]; - ievent->code = ev->data.l[2]; - ievent->x = make_number ((int) ev->data.l[3]); - ievent->y = make_number ((int) ev->data.l[4]); + ievent->code = 0; + ievent->part = ev->data.l[2]; + ievent->x = make_number (ev->data.l[3]); + ievent->y = make_number (ev->data.l[4]); ievent->modifiers = 0; } ------------------------------------------------------------ revno: 114387 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 20:44:55 -0700 message: Revise previous esh-proc change * eshell/esh-proc.el (eshell-kill-process-function): Remove eshell-reset-after-proc from eshell-kill-hook if present. (eshell-reset-after-proc): Remove unused arg `proc'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-19 02:55:00 +0000 +++ lisp/ChangeLog 2013-09-19 03:44:55 +0000 @@ -1,5 +1,9 @@ 2013-09-19 Glenn Morris + * eshell/esh-proc.el (eshell-kill-process-function): + Remove eshell-reset-after-proc from eshell-kill-hook if present. + (eshell-reset-after-proc): Remove unused arg `proc'. + * eshell/esh-util.el (eshell-read-hosts-file): Use `filename' arg. (directory-files-and-attributes): Mark unused arg. @@ -14,8 +18,7 @@ * eshell/em-smart.el (eshell-smart-scroll-window) (eshell-disable-after-change): - * eshell/em-term.el (eshell-term-sentinel): - * eshell/esh-proc.el (eshell-reset-after-proc): Mark unused arg. + * eshell/em-term.el (eshell-term-sentinel): Mark unused arg. 2013-09-18 Alan Mackenzie === modified file 'lisp/eshell/esh-proc.el' --- lisp/eshell/esh-proc.el 2013-09-19 02:55:00 +0000 +++ lisp/eshell/esh-proc.el 2013-09-19 03:44:55 +0000 @@ -116,9 +116,11 @@ (defun eshell-kill-process-function (proc status) "Function run when killing a process. Runs `eshell-reset-after-proc' and `eshell-kill-hook', passing arguments -PROC and STATUS to both." - (or (memq 'eshell-reset-after-proc eshell-kill-hook) - (eshell-reset-after-proc proc status)) +PROC and STATUS to functions on the latter." + ;; Was there till 24.1, but it is not optional. + (if (memq 'eshell-reset-after-proc eshell-kill-hook) + (setq eshell-kill-hook (delq 'eshell-reset-after-proc eshell-kill-hook))) + (eshell-reset-after-proc status) (run-hook-with-args 'eshell-kill-hook proc status)) (defun eshell-proc-initialize () @@ -133,11 +135,7 @@ ; (define-key eshell-command-map [(control ?z)] 'eshell-stop-process) (define-key eshell-command-map [(control ?\\)] 'eshell-quit-process)) -;; This used to be on `eshell-kill-hook', which calls its functions -;; with two arguments. Nowadays we call it directly in -;; `eshell-kill-process-function', but in case anyone still has it -;; on `eshell-kill-hook', _proc has to stay. -(defun eshell-reset-after-proc (_proc status) +(defun eshell-reset-after-proc (status) "Reset the command input location after a process terminates. The signals which will cause this to happen are matched by `eshell-reset-signals'." ------------------------------------------------------------ revno: 114386 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:55:00 -0700 message: * eshell/esh-proc.el (eshell-reset-after-proc): Mark unused arg. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-19 02:48:01 +0000 +++ lisp/ChangeLog 2013-09-19 02:55:00 +0000 @@ -14,7 +14,8 @@ * eshell/em-smart.el (eshell-smart-scroll-window) (eshell-disable-after-change): - * eshell/em-term.el (eshell-term-sentinel): Mark unused arg. + * eshell/em-term.el (eshell-term-sentinel): + * eshell/esh-proc.el (eshell-reset-after-proc): Mark unused arg. 2013-09-18 Alan Mackenzie === modified file 'lisp/eshell/esh-proc.el' --- lisp/eshell/esh-proc.el 2013-09-12 20:15:53 +0000 +++ lisp/eshell/esh-proc.el 2013-09-19 02:55:00 +0000 @@ -133,7 +133,11 @@ ; (define-key eshell-command-map [(control ?z)] 'eshell-stop-process) (define-key eshell-command-map [(control ?\\)] 'eshell-quit-process)) -(defun eshell-reset-after-proc (proc status) +;; This used to be on `eshell-kill-hook', which calls its functions +;; with two arguments. Nowadays we call it directly in +;; `eshell-kill-process-function', but in case anyone still has it +;; on `eshell-kill-hook', _proc has to stay. +(defun eshell-reset-after-proc (_proc status) "Reset the command input location after a process terminates. The signals which will cause this to happen are matched by `eshell-reset-signals'." ------------------------------------------------------------ revno: 114385 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:48:01 -0700 message: * eshell/esh-util.el (eshell-read-hosts-file): Use `filename' arg. (directory-files-and-attributes): Mark unused arg. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-19 02:42:36 +0000 +++ lisp/ChangeLog 2013-09-19 02:48:01 +0000 @@ -1,5 +1,8 @@ 2013-09-19 Glenn Morris + * eshell/esh-util.el (eshell-read-hosts-file): Use `filename' arg. + (directory-files-and-attributes): Mark unused arg. + * eshell/em-unix.el (eshell-remove-entries): Remove unused arg `path'. Update callers. === modified file 'lisp/eshell/esh-util.el' --- lisp/eshell/esh-util.el 2013-09-18 02:45:31 +0000 +++ lisp/eshell/esh-util.el 2013-09-19 02:48:01 +0000 @@ -477,10 +477,10 @@ (defalias 'eshell-user-name 'user-login-name) (defun eshell-read-hosts-file (filename) - "Read in the hosts from the /etc/hosts file." + "Read in the hosts from FILENAME, default `eshell-hosts-file'." (let (hosts) (with-temp-buffer - (insert-file-contents eshell-hosts-file) + (insert-file-contents (or filename eshell-hosts-file)) (goto-char (point-min)) (while (re-search-forward "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) @@ -563,9 +563,11 @@ (defvar ange-cache) +;; Partial reimplementation of Emacs's builtin directory-files-and-attributes. +;; id-format not implemented. (and (featurep 'xemacs) (not (fboundp 'directory-files-and-attributes)) - (defun directory-files-and-attributes (directory &optional full match nosort id-format) + (defun directory-files-and-attributes (directory &optional full match nosort _id-format) "Return a list of names of files and their attributes in DIRECTORY. There are three optional arguments: If FULL is non-nil, return absolute file names. Otherwise return names ------------------------------------------------------------ revno: 114384 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:42:36 -0700 message: * eshell/em-unix.el (eshell-remove-entries): Remove unused arg `path'. Update callers. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-19 02:38:25 +0000 +++ lisp/ChangeLog 2013-09-19 02:42:36 +0000 @@ -1,5 +1,8 @@ 2013-09-19 Glenn Morris + * eshell/em-unix.el (eshell-remove-entries): + Remove unused arg `path'. Update callers. + * eshell/em-hist.el (eshell-hist-parse-arguments): Remove unused arg `silent'. Update callers. === modified file 'lisp/eshell/em-unix.el' --- lisp/eshell/em-unix.el 2013-09-18 05:11:38 +0000 +++ lisp/eshell/em-unix.el 2013-09-19 02:42:36 +0000 @@ -195,8 +195,8 @@ (Info-menu (car args)) (setq args (cdr args))))) -(defun eshell-remove-entries (path files &optional top-level) - "From PATH, remove all of the given FILES, perhaps interactively." +(defun eshell-remove-entries (files &optional top-level) + "Remove all of the given FILES, perhaps interactively." (while files (if (string-match "\\`\\.\\.?\\'" (file-name-nondirectory (car files))) @@ -296,9 +296,9 @@ (y-or-n-p (format "rm: descend into directory `%s'? " entry))) - (eshell-remove-entries nil (list entry) t)) + (eshell-remove-entries (list entry) t)) (eshell-error (format "rm: %s: is a directory\n" entry))) - (eshell-remove-entries nil (list entry) t)))))) + (eshell-remove-entries (list entry) t)))))) (setq args (cdr args))) nil)) ------------------------------------------------------------ revno: 114383 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:38:25 -0700 message: * eshell/em-hist.el (eshell-hist-parse-arguments): Remove unused arg `silent'. Update callers. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-19 02:28:20 +0000 +++ lisp/ChangeLog 2013-09-19 02:38:25 +0000 @@ -1,5 +1,8 @@ 2013-09-19 Glenn Morris + * eshell/em-hist.el (eshell-hist-parse-arguments): + Remove unused arg `silent'. Update callers. + * eshell/em-ls.el (eshell-ls-use-in-dired): Use `symbol' arg. Fix (f)boundp mix-up. === modified file 'lisp/eshell/em-hist.el' --- lisp/eshell/em-hist.el 2013-09-18 01:48:00 +0000 +++ lisp/eshell/em-hist.el 2013-09-19 02:38:25 +0000 @@ -531,7 +531,7 @@ ((string= "%" ref) (error "`%%' history word designator not yet implemented")))) -(defun eshell-hist-parse-arguments (&optional silent b e) +(defun eshell-hist-parse-arguments (&optional b e) "Parse current command arguments in a history-code-friendly way." (let ((end (or e (point))) (begin (or b (save-excursion (eshell-bol) (point)))) @@ -571,7 +571,7 @@ (defun eshell-expand-history-references (beg end) "Parse and expand any history references in current input." - (let ((result (eshell-hist-parse-arguments t beg end))) + (let ((result (eshell-hist-parse-arguments beg end))) (when result (let ((textargs (nreverse (nth 0 result))) (posb (nreverse (nth 1 result))) @@ -699,7 +699,7 @@ (here (point)) textargs) (insert hist) - (setq textargs (car (eshell-hist-parse-arguments nil here (point)))) + (setq textargs (car (eshell-hist-parse-arguments here (point)))) (delete-region here (point)) (if (string= nth "*") (if mth ------------------------------------------------------------ revno: 114382 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:32:27 -0700 message: * erc/erc-list.el (erc-list-handle-322): Mark unused argument. diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2013-09-19 02:21:31 +0000 +++ lisp/erc/ChangeLog 2013-09-19 02:32:27 +0000 @@ -1,6 +1,7 @@ 2013-09-19 Glenn Morris * erc-button.el (erc-button-click-button, erc-button-press-button): + * erc-list.el (erc-list-handle-322): Mark unused arguments. * erc.el (erc-open-server-buffer-p): Actually use the `buffer' arg. === modified file 'lisp/erc/erc-list.el' --- lisp/erc/erc-list.el 2013-08-22 04:06:45 +0000 +++ lisp/erc/erc-list.el 2013-09-19 02:32:27 +0000 @@ -164,7 +164,8 @@ ;; Handle a "322" response. This response tells us about a single ;; channel. -(defun erc-list-handle-322 (proc parsed) +;; Called via erc-once-with-server-event with two arguments. +(defun erc-list-handle-322 (_proc parsed) (let* ((args (cdr (erc-response.command-args parsed))) (channel (car args)) (nusers (car (cdr args))) ------------------------------------------------------------ revno: 114381 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:28:20 -0700 message: Address some "unused lexical argument" warnings in eshell * eshell/em-ls.el (eshell-ls-use-in-dired): Use `symbol' arg. Fix (f)boundp mix-up. * eshell/em-smart.el (eshell-smart-scroll-window) (eshell-disable-after-change): * eshell/em-term.el (eshell-term-sentinel): Mark unused arg. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-18 20:47:37 +0000 +++ lisp/ChangeLog 2013-09-19 02:28:20 +0000 @@ -1,3 +1,12 @@ +2013-09-19 Glenn Morris + + * eshell/em-ls.el (eshell-ls-use-in-dired): Use `symbol' arg. + Fix (f)boundp mix-up. + + * eshell/em-smart.el (eshell-smart-scroll-window) + (eshell-disable-after-change): + * eshell/em-term.el (eshell-term-sentinel): Mark unused arg. + 2013-09-18 Alan Mackenzie Fix fontification of type when followed by "const". === modified file 'lisp/eshell/em-ls.el' --- lisp/eshell/em-ls.el 2013-09-12 20:15:53 +0000 +++ lisp/eshell/em-ls.el 2013-09-19 02:28:20 +0000 @@ -50,9 +50,7 @@ (defcustom eshell-ls-unload-hook (list - (function - (lambda () - (fset 'insert-directory eshell-ls-orig-insert-directory)))) + (lambda () (fset 'insert-directory eshell-ls-orig-insert-directory))) "When unloading `eshell-ls', restore the definition of `insert-directory'." :type 'hook :group 'eshell-ls) @@ -77,17 +75,17 @@ :type '(repeat :tag "Arguments" string) :group 'eshell-ls) +;; FIXME should use advice, like ls-lisp.el does now. (defcustom eshell-ls-use-in-dired nil - "If non-nil, use `eshell-ls' to read directories in Dired." + "If non-nil, use `eshell-ls' to read directories in Dired. +Changing this without using customize has no effect." :set (lambda (symbol value) (if value - (unless (and (boundp 'eshell-ls-use-in-dired) - eshell-ls-use-in-dired) - (fset 'insert-directory 'eshell-ls-insert-directory)) - (when (and (boundp 'eshell-ls-insert-directory) - eshell-ls-use-in-dired) - (fset 'insert-directory eshell-ls-orig-insert-directory))) - (setq eshell-ls-use-in-dired value)) + (or (bound-and-true-p eshell-ls-use-in-dired) + (fset 'insert-directory 'eshell-ls-insert-directory)) + (and (fboundp 'eshell-ls-insert-directory) eshell-ls-use-in-dired + (fset 'insert-directory eshell-ls-orig-insert-directory))) + (set symbol value)) :type 'boolean :require 'em-ls :group 'eshell-ls) === modified file 'lisp/eshell/em-smart.el' --- lisp/eshell/em-smart.el 2013-09-12 20:15:53 +0000 +++ lisp/eshell/em-smart.el 2013-09-19 02:28:20 +0000 @@ -194,7 +194,8 @@ (add-hook 'eshell-post-command-hook 'eshell-smart-maybe-jump-to-end nil t)))) -(defun eshell-smart-scroll-window (wind start) +;; This is called by window-scroll-functions with two arguments. +(defun eshell-smart-scroll-window (wind _start) "Scroll the given Eshell window accordingly." (unless eshell-currently-handling-window (let ((inhibit-point-motion-hooks t) @@ -237,7 +238,8 @@ (add-hook 'pre-command-hook 'eshell-smart-display-move nil t) (eshell-refresh-windows)) -(defun eshell-disable-after-change (b e l) +;; Called from after-change-functions with 3 arguments. +(defun eshell-disable-after-change (_b _e _l) "Disable smart display mode if the buffer changes in any way." (when eshell-smart-command-done (remove-hook 'pre-command-hook 'eshell-smart-display-move t) === modified file 'lisp/eshell/em-term.el' --- lisp/eshell/em-term.el 2013-09-12 20:15:53 +0000 +++ lisp/eshell/em-term.el 2013-09-19 02:28:20 +0000 @@ -189,7 +189,8 @@ (term-set-escape-char ?\C-x)))) nil) -(defun eshell-term-sentinel (proc string) +;; Process sentinels receive two arguments. +(defun eshell-term-sentinel (proc _string) "Destroy the buffer visiting PROC." (let ((proc-buf (process-buffer proc))) (when (and proc-buf (buffer-live-p proc-buf) ------------------------------------------------------------ revno: 114380 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 19:21:31 -0700 message: Address some "unused lexical argument" warnings in erc * erc/erc.el (erc-open-server-buffer-p): Actually use the `buffer' arg. * erc/erc-backend.el (erc-server-process-alive): Take optional `buffer' arg. * erc/erc-button.el (erc-button-click-button, erc-button-press-button): Mark unused arguments. diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2013-09-18 01:48:00 +0000 +++ lisp/erc/ChangeLog 2013-09-19 02:21:31 +0000 @@ -1,3 +1,11 @@ +2013-09-19 Glenn Morris + + * erc-button.el (erc-button-click-button, erc-button-press-button): + Mark unused arguments. + + * erc.el (erc-open-server-buffer-p): Actually use the `buffer' arg. + * erc-backend.el (erc-server-process-alive): Take optional `buffer' arg. + 2013-09-18 Glenn Morris * erc-button.el (erc-button-add-buttons): Remove unused local vars. === modified file 'lisp/erc/erc-backend.el' --- lisp/erc/erc-backend.el 2013-05-30 03:19:04 +0000 +++ lisp/erc/erc-backend.el 2013-09-19 02:21:31 +0000 @@ -497,11 +497,12 @@ erc-server-ping-handler) erc-server-ping-timer-alist))))) -(defun erc-server-process-alive () - "Return non-nil when `erc-server-process' is open or running." - (and erc-server-process - (processp erc-server-process) - (memq (process-status erc-server-process) '(run open)))) +(defun erc-server-process-alive (&optional buffer) + "Return non-nil when BUFFER has an `erc-server-process' open or running." + (with-current-buffer (or buffer (current-buffer)) + (and erc-server-process + (processp erc-server-process) + (memq (process-status erc-server-process) '(run open))))) ;;;; Connecting to a server === modified file 'lisp/erc/erc-button.el' --- lisp/erc/erc-button.el 2013-09-18 01:48:00 +0000 +++ lisp/erc/erc-button.el 2013-09-19 02:21:31 +0000 @@ -407,7 +407,7 @@ ;; Since Emacs runs this directly, rather than with ;; widget-button-click, we need to fake an extra arg in the ;; interactive spec. -(defun erc-button-click-button (ignore event) +(defun erc-button-click-button (_ignore event) "Call `erc-button-press-button'." (interactive "P\ne") (save-excursion @@ -416,7 +416,7 @@ ;; XEmacs calls this via widget-button-press with a bunch of arguments ;; which we don't care about. -(defun erc-button-press-button (&rest ignore) +(defun erc-button-press-button (&rest _ignore) "Check text at point for a callback function. If the text at point has a `erc-callback' property, call it with the value of the `erc-data' text property." === modified file 'lisp/erc/erc.el' --- lisp/erc/erc.el 2013-09-14 23:33:19 +0000 +++ lisp/erc/erc.el 2013-09-19 02:21:31 +0000 @@ -1312,13 +1312,13 @@ (and (eq major-mode 'erc-mode) (null (erc-default-target))))) -(defun erc-open-server-buffer-p (&optional buffer) ;FIXME: `buffer' is ignored! +(defun erc-open-server-buffer-p (&optional buffer) "Return non-nil if argument BUFFER is an ERC server buffer that has an open IRC process. If BUFFER is nil, the current buffer is used." - (and (erc-server-buffer-p) - (erc-server-process-alive))) + (and (erc-server-buffer-p buffer) + (erc-server-process-alive buffer))) (defun erc-query-buffer-p (&optional buffer) "Return non-nil if BUFFER is an ERC query buffer. ------------------------------------------------------------ revno: 114379 committer: Alan Mackenzie branch nick: trunk timestamp: Wed 2013-09-18 20:47:37 +0000 message: Fix fontification of type when followed by "const". * progmodes/cc-engine.el (c-forward-decl-or-cast-1): Don't exclude "known" types from fontification. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-18 05:19:28 +0000 +++ lisp/ChangeLog 2013-09-18 20:47:37 +0000 @@ -1,3 +1,9 @@ +2013-09-18 Alan Mackenzie + + Fix fontification of type when followed by "const". + * progmodes/cc-engine.el (c-forward-decl-or-cast-1): Don't exclude + "known" types from fontification. + 2013-09-18 Glenn Morris * emacs-lisp/chart.el (x-display-color-cells): Declare. === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2013-09-07 14:33:50 +0000 +++ lisp/progmodes/cc-engine.el 2013-09-18 20:47:37 +0000 @@ -7408,7 +7408,11 @@ ;; interactive refontification. (c-put-c-type-property (point) 'c-decl-arg-start)) - (when (and c-record-type-identifiers at-type (not (eq at-type t))) + (when (and c-record-type-identifiers at-type ;; (not (eq at-type t)) + ;; There seems no reason to exclude a token from + ;; fontification just because it's "a known type that can't + ;; be a name or other expression". 2013-09-18. + ) (let ((c-promote-possible-types t)) (save-excursion (goto-char type-start) ------------------------------------------------------------ revno: 114378 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2013-09-18 17:18:39 +0400 message: * w32term.c (note_mouse_movement): Fix last change. diff: === modified file 'src/w32term.c' --- src/w32term.c 2013-09-18 09:23:10 +0000 +++ src/w32term.c 2013-09-18 13:18:39 +0000 @@ -3311,7 +3311,7 @@ int mouse_x = LOWORD (msg->lParam); int mouse_y = HIWORD (msg->lParam); - if (!FRAME_W32_OUTPUT (frame)) + if (!FRAME_X_OUTPUT (frame)) return 0; dpyinfo = FRAME_DISPLAY_INFO (frame); ------------------------------------------------------------ revno: 114377 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-09-18 06:19:31 -0400 message: Auto-commit of loaddefs files. diff: === modified file 'lisp/mail/rmail.el' --- lisp/mail/rmail.el 2013-09-11 10:19:47 +0000 +++ lisp/mail/rmail.el 2013-09-18 10:19:31 +0000 @@ -4668,7 +4668,7 @@ ;;;*** -;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "93951f748e43e1015da1b485088970ca") +;;;### (autoloads nil "rmailmm" "rmailmm.el" "8c14f4cf6e7dacb0c94fd300d814caf7") ;;; Generated autoloads from rmailmm.el (autoload 'rmail-mime "rmailmm" "\ ------------------------------------------------------------ revno: 114376 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2013-09-18 13:33:36 +0400 message: Ifdef away recent changes which aren't relevant to NS port. * dispextern.h (x_mouse_grabbed, x_redo_mouse_highlight) [!HAVE_NS]: Declare as such. * frame.c (x_mouse_grabbed, x_redo_mouse_highlight) [!HAVE_NS]: Define as such. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-18 09:23:10 +0000 +++ src/ChangeLog 2013-09-18 09:33:36 +0000 @@ -1,5 +1,13 @@ 2013-09-18 Dmitry Antipov + Ifdef away recent changes which aren't relevant to NS port. + * dispextern.h (x_mouse_grabbed, x_redo_mouse_highlight) + [!HAVE_NS]: Declare as such. + * frame.c (x_mouse_grabbed, x_redo_mouse_highlight) + [!HAVE_NS]: Define as such. + +2013-09-18 Dmitry Antipov + * frame.c (x_redo_mouse_highlight): New function to factor out common code used in W32 and X ports. * dispextern.h (x_redo_mouse_highlight): Add prototype. === modified file 'src/dispextern.h' --- src/dispextern.h 2013-09-18 09:23:10 +0000 +++ src/dispextern.h 2013-09-18 09:33:36 +0000 @@ -3530,7 +3530,6 @@ RES_TYPE_BOOLEAN_NUMBER }; -extern bool x_mouse_grabbed (Display_Info *); extern Display_Info *check_x_display_info (Lisp_Object); extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object, Lisp_Object, const char *, const char *class, @@ -3545,7 +3544,11 @@ enum resource_types); extern char *x_get_string_resource (XrmDatabase, const char *, const char *); + +#ifndef HAVE_NS /* These both used on W32 and X only. */ +extern bool x_mouse_grabbed (Display_Info *); extern void x_redo_mouse_highlight (Display_Info *); +#endif /* HAVE_NS */ #endif /* HAVE_WINDOW_SYSTEM */ === modified file 'src/frame.c' --- src/frame.c 2013-09-18 09:23:10 +0000 +++ src/frame.c 2013-09-18 09:33:36 +0000 @@ -3432,6 +3432,8 @@ return; } +#ifndef HAVE_NS + /* Non-zero if mouse is grabbed on DPYINFO and we know the frame where it is. */ @@ -3455,6 +3457,8 @@ dpyinfo->last_mouse_motion_y); } +#endif /* HAVE_NS */ + /* Subroutines of creating an X frame. */ /* Make sure that Vx_resource_name is set to a reasonable value. ------------------------------------------------------------ revno: 114375 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2013-09-18 13:23:10 +0400 message: * frame.c (x_redo_mouse_highlight): New function to factor out common code used in W32 and X ports. * dispextern.h (x_redo_mouse_highlight): Add prototype. * xterm.h (struct x_display_info): * w32term.h (struct w32_display_info): * nsterm.h (struct ns_display_info): New members last_mouse_motion_frame, last_mouse_motion_x and last_mouse_motion_y, going to replace static variables below. * xterm.c (last_mouse_motion_event, last_mouse_motion_frame) (redo_mouse_highlight): Remove. (note_mouse_movement, syms_of_xterm): Adjust user. (handle_one_xevent): Likewise. Use x_redo_mouse_highlight. * w32term.c (last_mouse_motion_event, last_mouse_motion_frame) (redo_mouse_highlight): Remove. (note_mouse_movement, syms_of_w32term): Adjust user. (w32_read_socket): Likewise. Use x_redo_mouse_highlight. * nsterm.m (last_mouse_motion_position, last_mouse_motion_frame): Remove. (note_mouse_movement, mouseMoved, syms_of_nsterm): * nsfns.m (compute_tip_xy): Adjust user. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-18 06:48:11 +0000 +++ src/ChangeLog 2013-09-18 09:23:10 +0000 @@ -1,5 +1,28 @@ 2013-09-18 Dmitry Antipov + * frame.c (x_redo_mouse_highlight): New function + to factor out common code used in W32 and X ports. + * dispextern.h (x_redo_mouse_highlight): Add prototype. + * xterm.h (struct x_display_info): + * w32term.h (struct w32_display_info): + * nsterm.h (struct ns_display_info): New members + last_mouse_motion_frame, last_mouse_motion_x and + last_mouse_motion_y, going to replace static variables below. + * xterm.c (last_mouse_motion_event, last_mouse_motion_frame) + (redo_mouse_highlight): Remove. + (note_mouse_movement, syms_of_xterm): Adjust user. + (handle_one_xevent): Likewise. Use x_redo_mouse_highlight. + * w32term.c (last_mouse_motion_event, last_mouse_motion_frame) + (redo_mouse_highlight): Remove. + (note_mouse_movement, syms_of_w32term): Adjust user. + (w32_read_socket): Likewise. Use x_redo_mouse_highlight. + * nsterm.m (last_mouse_motion_position, last_mouse_motion_frame): + Remove. + (note_mouse_movement, mouseMoved, syms_of_nsterm): + * nsfns.m (compute_tip_xy): Adjust user. + +2013-09-18 Dmitry Antipov + * frame.c (x_mouse_grabbed): New function. * dispextern.h (x_mouse_grabbed): Add prototype. (last_mouse_frame): Remove declaration. === modified file 'src/dispextern.h' --- src/dispextern.h 2013-09-18 06:48:11 +0000 +++ src/dispextern.h 2013-09-18 09:23:10 +0000 @@ -3545,6 +3545,7 @@ enum resource_types); extern char *x_get_string_resource (XrmDatabase, const char *, const char *); +extern void x_redo_mouse_highlight (Display_Info *); #endif /* HAVE_WINDOW_SYSTEM */ === modified file 'src/frame.c' --- src/frame.c 2013-09-18 06:48:11 +0000 +++ src/frame.c 2013-09-18 09:23:10 +0000 @@ -3442,6 +3442,19 @@ && FRAME_LIVE_P (dpyinfo->last_mouse_frame)); } +/* Re-highlight something with mouse-face properties + on DPYINFO using saved frame and mouse position. */ + +void +x_redo_mouse_highlight (Display_Info *dpyinfo) +{ + if (dpyinfo->last_mouse_motion_frame + && FRAME_LIVE_P (dpyinfo->last_mouse_motion_frame)) + note_mouse_highlight (dpyinfo->last_mouse_motion_frame, + dpyinfo->last_mouse_motion_x, + dpyinfo->last_mouse_motion_y); +} + /* Subroutines of creating an X frame. */ /* Make sure that Vx_resource_name is set to a reasonable value. === modified file 'src/nsfns.m' --- src/nsfns.m 2013-09-17 12:27:21 +0000 +++ src/nsfns.m 2013-09-18 09:23:10 +0000 @@ -2564,6 +2564,7 @@ { Lisp_Object left, top; EmacsView *view = FRAME_NS_VIEW (f); + struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); NSPoint pt; /* Start with user-specified or mouse position. */ @@ -2572,7 +2573,8 @@ if (!INTEGERP (left) || !INTEGERP (top)) { - pt = last_mouse_motion_position; + pt.x = dpyinfo->last_mouse_motion_x; + pt.y = dpyinfo->last_mouse_motion_y; /* Convert to screen coordinates */ pt = [view convertPoint: pt toView: nil]; pt = [[view window] convertBaseToScreen: pt]; === modified file 'src/nsterm.h' --- src/nsterm.h 2013-09-18 06:48:11 +0000 +++ src/nsterm.h 2013-09-18 09:23:10 +0000 @@ -600,6 +600,14 @@ /* The frame where the mouse was last time we reported a mouse event. */ struct frame *last_mouse_frame; + + /* The frame where the mouse was last time we reported a mouse motion. */ + struct frame *last_mouse_motion_frame; + + /* Position where the mouse was last time we reported a motion. + This is a position on last_mouse_motion_frame. */ + int last_mouse_motion_x; + int last_mouse_motion_y; }; /* This is a chain of structures for all the NS displays currently in use. */ @@ -869,7 +877,6 @@ sigset_t const *sigmask); extern unsigned long ns_get_rgb_color (struct frame *f, float r, float g, float b, float a); -extern NSPoint last_mouse_motion_position; /* From nsterm.m, needed in nsfont.m. */ #ifdef __OBJC__ === modified file 'src/nsterm.m' --- src/nsterm.m 2013-09-18 06:48:11 +0000 +++ src/nsterm.m 2013-09-18 09:23:10 +0000 @@ -191,10 +191,8 @@ long context_menu_value = 0; /* display update */ -NSPoint last_mouse_motion_position; static NSRect last_mouse_glyph; static Time last_mouse_movement_time = 0; -static Lisp_Object last_mouse_motion_frame; static EmacsScroller *last_mouse_scroll_bar = nil; static struct frame *ns_updating_frame; static NSView *focus_view = NULL; @@ -1742,7 +1740,7 @@ { // NSTRACE (note_mouse_movement); - XSETFRAME (last_mouse_motion_frame, frame); + FRAME_DISPLAY_INFO (frame)->last_mouse_motion_frame = frame; /* Note, this doesn't get called for enter/leave, since we don't have a position. Those are taken care of in the corresponding NSView methods. */ @@ -5448,13 +5446,16 @@ - (void)mouseMoved: (NSEvent *)e { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe); + struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); Lisp_Object frame; + NSPoint pt; // NSTRACE (mouseMoved); last_mouse_movement_time = EV_TIMESTAMP (e); - last_mouse_motion_position - = [self convertPoint: [e locationInWindow] fromView: nil]; + pt = [self convertPoint: [e locationInWindow] fromView: nil]; + dpyinfo->last_mouse_motion_x = pt.x; + dpyinfo->last_mouse_motion_y = pt.y; /* update any mouse face */ if (hlinfo->mouse_face_hidden) @@ -5471,9 +5472,8 @@ { NSTRACE (mouse_autoselect_window); 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); + Lisp_Object window + = window_from_coordinates (emacsframe, pt.x, pt.y, 0, 0); if (WINDOWP (window) && !EQ (window, last_mouse_window) @@ -5491,8 +5491,7 @@ last_mouse_window = window; } - if (!note_mouse_movement (emacsframe, last_mouse_motion_position.x, - last_mouse_motion_position.y)) + if (!note_mouse_movement (emacsframe, pt.x, pt.y)) help_echo_string = previous_help_echo_string; XSETFRAME (frame, emacsframe); @@ -7416,9 +7415,6 @@ staticpro (&ns_display_name_list); ns_display_name_list = Qnil; - staticpro (&last_mouse_motion_frame); - last_mouse_motion_frame = Qnil; - DEFVAR_LISP ("ns-auto-hide-menu-bar", ns_auto_hide_menu_bar, doc: /* Non-nil means that the menu bar is hidden, but appears when the mouse is near. Only works on OSX 10.6 or later. */); === modified file 'src/w32term.c' --- src/w32term.c 2013-09-18 06:48:11 +0000 +++ src/w32term.c 2013-09-18 09:23:10 +0000 @@ -3304,21 +3304,21 @@ the mainstream emacs code by setting mouse_moved. If not, ask for another motion event, so we can check again the next time it moves. */ -static MSG last_mouse_motion_event; -static Lisp_Object last_mouse_motion_frame; - static int note_mouse_movement (struct frame *frame, MSG *msg) { + struct w32_display_info *dpyinfo; int mouse_x = LOWORD (msg->lParam); int mouse_y = HIWORD (msg->lParam); + if (!FRAME_W32_OUTPUT (frame)) + return 0; + + dpyinfo = FRAME_DISPLAY_INFO (frame); last_mouse_movement_time = msg->time; - memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); - XSETFRAME (last_mouse_motion_frame, frame); - - if (!FRAME_X_OUTPUT (frame)) - return 0; + dpyinfo->last_mouse_motion_frame = frame; + dpyinfo->last_mouse_motion_x = mouse_x; + dpyinfo->last_mouse_motion_y = mouse_y; if (msg->hwnd != FRAME_W32_WINDOW (frame)) { @@ -3364,16 +3364,6 @@ static void x_check_fullscreen (struct frame *); static void -redo_mouse_highlight (void) -{ - if (!NILP (last_mouse_motion_frame) - && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) - note_mouse_highlight (XFRAME (last_mouse_motion_frame), - LOWORD (last_mouse_motion_event.lParam), - HIWORD (last_mouse_motion_event.lParam)); -} - -static void w32_define_cursor (Window window, Cursor cursor) { PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); @@ -4683,7 +4673,7 @@ if (!msg.msg.wParam && msg.msg.hwnd == tip_window) { tip_window = NULL; - redo_mouse_highlight (); + x_redo_mouse_highlight (dpyinfo); } /* If window has been obscured or exposed by another window @@ -6649,9 +6639,6 @@ With MS Windows or Nextstep, the value is t. */); Vx_toolkit_scroll_bars = Qt; - staticpro (&last_mouse_motion_frame); - last_mouse_motion_frame = Qnil; - /* Tell Emacs about this window system. */ Fprovide (Qw32, Qnil); } === modified file 'src/w32term.h' --- src/w32term.h 2013-09-18 06:48:11 +0000 +++ src/w32term.h 2013-09-18 09:23:10 +0000 @@ -185,6 +185,14 @@ /* The frame where the mouse was last time we reported a mouse event. */ struct frame *last_mouse_frame; + + /* The frame where the mouse was last time we reported a mouse motion. */ + struct frame *last_mouse_motion_frame; + + /* Position where the mouse was last time we reported a motion. + This is a position on last_mouse_motion_frame. */ + int last_mouse_motion_x; + int last_mouse_motion_y; }; /* This is a chain of structures for all the displays currently in use. */ === modified file 'src/xterm.c' --- src/xterm.c 2013-09-18 06:48:11 +0000 +++ src/xterm.c 2013-09-18 09:23:10 +0000 @@ -3860,19 +3860,20 @@ the mainstream emacs code by setting mouse_moved. If not, ask for another motion event, so we can check again the next time it moves. */ -static XMotionEvent last_mouse_motion_event; -static Lisp_Object last_mouse_motion_frame; - static int note_mouse_movement (struct frame *frame, const XMotionEvent *event) { - last_mouse_movement_time = event->time; - last_mouse_motion_event = *event; - XSETFRAME (last_mouse_motion_frame, frame); + struct x_display_info *dpyinfo; if (!FRAME_X_OUTPUT (frame)) return 0; + dpyinfo = FRAME_DISPLAY_INFO (frame); + last_mouse_movement_time = event->time; + dpyinfo->last_mouse_motion_frame = frame; + dpyinfo->last_mouse_motion_x = event->x; + dpyinfo->last_mouse_motion_y = event->y; + if (event->window != FRAME_X_WINDOW (frame)) { frame->mouse_moved = 1; @@ -3902,23 +3903,6 @@ return 0; } - -/************************************************************************ - Mouse Face - ************************************************************************/ - -static void -redo_mouse_highlight (void) -{ - if (!NILP (last_mouse_motion_frame) - && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) - note_mouse_highlight (XFRAME (last_mouse_motion_frame), - last_mouse_motion_event.x, - last_mouse_motion_event.y); -} - - - /* Return the current position of the mouse. *FP should be a frame which indicates which display to ask about. @@ -6223,7 +6207,7 @@ if (event->xunmap.window == tip_window) { tip_window = 0; - redo_mouse_highlight (); + x_redo_mouse_highlight (dpyinfo); } f = x_top_window_to_frame (dpyinfo, event->xunmap.window); @@ -10705,9 +10689,6 @@ Vx_toolkit_scroll_bars = Qnil; #endif - staticpro (&last_mouse_motion_frame); - last_mouse_motion_frame = Qnil; - Qmodifier_value = intern_c_string ("modifier-value"); Qalt = intern_c_string ("alt"); Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); === modified file 'src/xterm.h' --- src/xterm.h 2013-09-18 06:48:11 +0000 +++ src/xterm.h 2013-09-18 09:23:10 +0000 @@ -308,9 +308,17 @@ /* The frame where the mouse was last time we reported a mouse event. */ struct frame *last_mouse_frame; + /* The frame where the mouse was last time we reported a mouse motion. */ + struct frame *last_mouse_motion_frame; + /* Time of last user interaction as returned in X events on this display. */ Time last_user_time; + /* Position where the mouse was last time we reported a motion. + This is a position on last_mouse_motion_frame. */ + int last_mouse_motion_x; + int last_mouse_motion_y; + /* The gray pixmap. */ Pixmap gray; ------------------------------------------------------------ revno: 114374 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2013-09-18 10:48:11 +0400 message: * frame.c (x_mouse_grabbed): New function. * dispextern.h (x_mouse_grabbed): Add prototype. (last_mouse_frame): Remove declaration. * xterm.h (struct x_display_info): * w32term.h (struct w32_display_info): * nsterm.h (struct ns_display_info): New member last_mouse_frame, going to replace... * xdisp.c (last_mouse_frame): ...global variable. (note_tool_bar_highlight): * w32term.c (w32_mouse_position, w32_read_socket): * xterm.c (XTmouse_position, handle_one_xevent): Use x_mouse_grabbed. * nsterm.m (ns_mouse_position, mouseDown): Adjust user. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-17 15:57:45 +0000 +++ src/ChangeLog 2013-09-18 06:48:11 +0000 @@ -1,3 +1,19 @@ +2013-09-18 Dmitry Antipov + + * frame.c (x_mouse_grabbed): New function. + * dispextern.h (x_mouse_grabbed): Add prototype. + (last_mouse_frame): Remove declaration. + * xterm.h (struct x_display_info): + * w32term.h (struct w32_display_info): + * nsterm.h (struct ns_display_info): New member + last_mouse_frame, going to replace... + * xdisp.c (last_mouse_frame): ...global variable. + (note_tool_bar_highlight): + * w32term.c (w32_mouse_position, w32_read_socket): + * xterm.c (XTmouse_position, handle_one_xevent): + Use x_mouse_grabbed. + * nsterm.m (ns_mouse_position, mouseDown): Adjust user. + 2013-09-17 Dmitry Antipov * w32term.c (w32_read_socket): Avoid temporary === modified file 'src/dispextern.h' --- src/dispextern.h 2013-09-17 12:27:21 +0000 +++ src/dispextern.h 2013-09-18 06:48:11 +0000 @@ -3194,7 +3194,6 @@ extern Lisp_Object help_echo_string, help_echo_window; extern Lisp_Object help_echo_object, previous_help_echo_string; extern ptrdiff_t help_echo_pos; -extern struct frame *last_mouse_frame; extern int last_tool_bar_item; extern void reseat_at_previous_visible_line_start (struct it *); extern Lisp_Object lookup_glyphless_char_display (int, struct it *); @@ -3531,6 +3530,7 @@ RES_TYPE_BOOLEAN_NUMBER }; +extern bool x_mouse_grabbed (Display_Info *); extern Display_Info *check_x_display_info (Lisp_Object); extern Lisp_Object x_get_arg (Display_Info *, Lisp_Object, Lisp_Object, const char *, const char *class, === modified file 'src/frame.c' --- src/frame.c 2013-09-17 12:59:45 +0000 +++ src/frame.c 2013-09-18 06:48:11 +0000 @@ -3432,7 +3432,16 @@ return; } - +/* Non-zero if mouse is grabbed on DPYINFO + and we know the frame where it is. */ + +bool x_mouse_grabbed (Display_Info *dpyinfo) +{ + return (dpyinfo->grabbed + && dpyinfo->last_mouse_frame + && FRAME_LIVE_P (dpyinfo->last_mouse_frame)); +} + /* Subroutines of creating an X frame. */ /* Make sure that Vx_resource_name is set to a reasonable value. === modified file 'src/nsterm.h' --- src/nsterm.h 2013-09-17 12:27:21 +0000 +++ src/nsterm.h 2013-09-18 06:48:11 +0000 @@ -597,6 +597,9 @@ struct frame *x_highlight_frame; struct frame *x_focus_frame; + + /* The frame where the mouse was last time we reported a mouse event. */ + struct frame *last_mouse_frame; }; /* This is a chain of structures for all the NS displays currently in use. */ === modified file 'src/nsterm.m' --- src/nsterm.m 2013-09-16 15:55:02 +0000 +++ src/nsterm.m 2013-09-18 06:48:11 +0000 @@ -1812,8 +1812,9 @@ XFRAME (frame)->mouse_moved = 0; last_mouse_scroll_bar = nil; - if (last_mouse_frame && FRAME_LIVE_P (last_mouse_frame)) - f = last_mouse_frame; + if (dpyinfo->last_mouse_frame + && FRAME_LIVE_P (dpyinfo->last_mouse_frame)) + f = dpyinfo->last_mouse_frame; else f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame : SELECTED_FRAME (); @@ -5362,6 +5363,7 @@ /* This is what happens when the user presses a mouse button. */ - (void)mouseDown: (NSEvent *)theEvent { + struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe); NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil]; NSTRACE (mouseDown); @@ -5371,10 +5373,10 @@ if (!emacs_event) return; - last_mouse_frame = emacsframe; + dpyinfo->last_mouse_frame = emacsframe; /* appears to be needed to prevent spurious movement events generated on button clicks */ - last_mouse_frame->mouse_moved = 0; + emacsframe->mouse_moved = 0; if ([theEvent type] == NSScrollWheel) { === modified file 'src/w32term.c' --- src/w32term.c 2013-09-17 15:57:45 +0000 +++ src/w32term.c 2013-09-18 06:48:11 +0000 @@ -3404,6 +3404,7 @@ unsigned long *time) { struct frame *f1; + struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); block_input (); @@ -3426,19 +3427,11 @@ /* Now we have a position on the root; find the innermost window containing the pointer. */ { - if (FRAME_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) - { - /* If mouse was grabbed on a frame, give coords for that frame - even if the mouse is now outside it. */ - f1 = last_mouse_frame; - } - else - { - /* Is window under mouse one of our frames? */ - f1 = x_any_window_to_frame (FRAME_DISPLAY_INFO (*fp), - WindowFromPoint (pt)); - } + /* If mouse was grabbed on a frame, give coords for that + frame even if the mouse is now outside it. Otherwise + check for window under mouse on one of our frames. */ + f1 = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : x_any_window_to_frame (dpyinfo, WindowFromPoint (pt))); /* If not, is it one of our scroll bars? */ if (! f1) @@ -4479,11 +4472,8 @@ previous_help_echo_string = help_echo_string; help_echo_string = Qnil; - if (dpyinfo->grabbed && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) - f = last_mouse_frame; - else - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : x_window_to_frame (dpyinfo, msg.msg.hwnd)); if (hlinfo->mouse_face_hidden) { @@ -4559,11 +4549,8 @@ int button; int up; - if (dpyinfo->grabbed && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) - f = last_mouse_frame; - else - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : x_window_to_frame (dpyinfo, msg.msg.hwnd)); if (f) { @@ -4602,7 +4589,7 @@ else { dpyinfo->grabbed |= (1 << button); - last_mouse_frame = f; + dpyinfo->last_mouse_frame = f; /* Ignore any mouse motion that happened before this event; any subsequent mouse-movement Emacs events should reflect only motion after @@ -4619,11 +4606,8 @@ case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: { - if (dpyinfo->grabbed && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) - f = last_mouse_frame; - else - f = x_window_to_frame (dpyinfo, msg.msg.hwnd); + f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : x_window_to_frame (dpyinfo, msg.msg.hwnd)); if (f) { @@ -4640,7 +4624,7 @@ ButtonPress. */ f->mouse_moved = 0; } - last_mouse_frame = f; + dpyinfo->last_mouse_frame = f; last_tool_bar_item = -1; } break; === modified file 'src/w32term.h' --- src/w32term.h 2013-09-17 08:24:20 +0000 +++ src/w32term.h 2013-09-18 06:48:11 +0000 @@ -182,6 +182,9 @@ /* The frame waiting to be auto-raised in w32_read_socket. */ struct frame *w32_pending_autoraise_frame; + + /* The frame where the mouse was last time we reported a mouse event. */ + struct frame *last_mouse_frame; }; /* This is a chain of structures for all the displays currently in use. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2013-09-17 07:39:54 +0000 +++ src/xdisp.c 2013-09-18 06:48:11 +0000 @@ -11454,10 +11454,6 @@ #ifdef HAVE_WINDOW_SYSTEM -/* Where the mouse was last time we reported a mouse event. */ - -struct frame *last_mouse_frame; - /* Tool-bar item index of the item on which a mouse button was pressed or -1. */ @@ -12320,9 +12316,9 @@ clear_mouse_face (hlinfo); /* Mouse is down, but on different tool-bar item? */ - mouse_down_p = (dpyinfo->grabbed - && f == last_mouse_frame - && FRAME_LIVE_P (f)); + mouse_down_p = (x_mouse_grabbed (dpyinfo) + && f == dpyinfo->last_mouse_frame); + if (mouse_down_p && last_tool_bar_item != prop_idx) return; === modified file 'src/xterm.c' --- src/xterm.c 2013-09-17 15:57:45 +0000 +++ src/xterm.c 2013-09-18 06:48:11 +0000 @@ -3945,6 +3945,7 @@ Time *timestamp) { struct frame *f1; + struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); block_input (); @@ -4004,22 +4005,24 @@ x_catch_errors (FRAME_X_DISPLAY (*fp)); - if (FRAME_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) + if (x_mouse_grabbed (dpyinfo)) { /* If mouse was grabbed on a frame, give coords for that frame even if the mouse is now outside it. */ XTranslateCoordinates (FRAME_X_DISPLAY (*fp), - /* From-window, to-window. */ - root, FRAME_X_WINDOW (last_mouse_frame), + /* From-window. */ + root, + + /* To-window. */ + FRAME_X_WINDOW (dpyinfo->last_mouse_frame), /* From-position, to-position. */ root_x, root_y, &win_x, &win_y, /* Child of win. */ &child); - f1 = last_mouse_frame; + f1 = dpyinfo->last_mouse_frame; } else { @@ -4043,7 +4046,7 @@ want the edit window. For non-Gtk+ the innermost window is the edit window. For Gtk+ it might not be. It might be the tool bar for example. */ - if (x_window_to_frame (FRAME_DISPLAY_INFO (*fp), win)) + if (x_window_to_frame (dpyinfo, win)) break; #endif win = child; @@ -4065,10 +4068,10 @@ #ifdef USE_GTK /* We don't wan't to know the innermost window. We want the edit window. */ - f1 = x_window_to_frame (FRAME_DISPLAY_INFO (*fp), win); + f1 = x_window_to_frame (dpyinfo, win); #else /* Is win one of our frames? */ - f1 = x_any_window_to_frame (FRAME_DISPLAY_INFO (*fp), win); + f1 = x_any_window_to_frame (dpyinfo, win); #endif #ifdef USE_X_TOOLKIT @@ -6704,11 +6707,8 @@ previous_help_echo_string = help_echo_string; help_echo_string = Qnil; - if (dpyinfo->grabbed && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) - f = last_mouse_frame; - else - f = x_window_to_frame (dpyinfo, event->xmotion.window); + f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : x_window_to_frame (dpyinfo, event->xmotion.window)); if (hlinfo->mouse_face_hidden) { @@ -6845,12 +6845,8 @@ last_mouse_glyph_frame = 0; dpyinfo->last_user_time = event->xbutton.time; - if (dpyinfo->grabbed - && last_mouse_frame - && FRAME_LIVE_P (last_mouse_frame)) - f = last_mouse_frame; - else - f = x_window_to_frame (dpyinfo, event->xbutton.window); + f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame + : x_window_to_frame (dpyinfo, event->xbutton.window)); #ifdef USE_GTK if (f && xg_event_is_for_scrollbar (f, event)) @@ -6923,7 +6919,7 @@ if (event->type == ButtonPress) { dpyinfo->grabbed |= (1 << event->xbutton.button); - last_mouse_frame = f; + dpyinfo->last_mouse_frame = f; if (!tool_bar_p) last_tool_bar_item = -1; === modified file 'src/xterm.h' --- src/xterm.h 2013-09-17 12:27:21 +0000 +++ src/xterm.h 2013-09-18 06:48:11 +0000 @@ -305,6 +305,9 @@ /* The frame waiting to be auto-raised in XTread_socket. */ struct frame *x_pending_autoraise_frame; + /* The frame where the mouse was last time we reported a mouse event. */ + struct frame *last_mouse_frame; + /* Time of last user interaction as returned in X events on this display. */ Time last_user_time;