Now on revision 114314. ------------------------------------------------------------ revno: 114314 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-09-17 10:57:30 +0400 message: * xterm.c (handle_one_xevent): Do not call to x_clear_area if GTK >= 2.7.0. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-17 06:33:24 +0000 +++ src/ChangeLog 2013-09-17 06:57:30 +0000 @@ -5,6 +5,8 @@ (fn_g_type_init) [!WINDOWSNT]: Define only if Glib < 2.36.0. * xsettings.c (init_gconf, init_gsettings): Do not check for g_type_init. + * xterm.c (handle_one_xevent): Do not call to x_clear_area + if GTK >= 2.7.0. 2013-09-16 Jan Djärv === modified file 'src/xterm.c' --- src/xterm.c 2013-09-16 11:23:03 +0000 +++ src/xterm.c 2013-09-17 06:57:30 +0000 @@ -6151,7 +6151,7 @@ f = x_window_to_frame (dpyinfo, event->xexpose.window); if (f) { -#ifdef USE_GTK +#if ! GTK_CHECK_VERSION (2, 7, 0) /* This seems to be needed for GTK 2.6. */ x_clear_area (event->xexpose.display, event->xexpose.window, ------------------------------------------------------------ revno: 114313 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2013-09-17 10:33:24 +0400 message: * configure.ac: Do not check for g_type_init because we require glib >= 2.28 for GTK3, glib >= 2.10 for GTK2, glib >= 2.26 for GSettings and glib >= 2.7.0 for GConf, so suitable glib should provide g_type_init unconditionally. * src/image.c (fn_g_type_init) [WINDOWSNT]: Define and load only if Glib < 2.36.0. (fn_g_type_init) [!WINDOWSNT]: Define only if Glib < 2.36.0. * src/xsettings.c (init_gconf, init_gsettings): Do not check for g_type_init. diff: === modified file 'ChangeLog' --- ChangeLog 2013-09-15 17:58:46 +0000 +++ ChangeLog 2013-09-17 06:33:24 +0000 @@ -1,3 +1,10 @@ +2013-09-17 Dmitry Antipov + + * configure.ac: Do not check for g_type_init because we + require glib >= 2.28 for GTK3, glib >= 2.10 for GTK2, + glib >= 2.26 for GSettings and glib >= 2.7.0 for GConf, so + suitable glib should provide g_type_init unconditionally. + 2013-09-15 Jan Djärv * configure.ac: Add check for OSX 10.5, required for macfont.o. === modified file 'configure.ac' --- configure.ac 2013-09-15 17:58:46 +0000 +++ configure.ac 2013-09-17 06:33:24 +0000 @@ -2389,7 +2389,6 @@ SAVE_LIBS="$LIBS" CFLAGS="$SETTINGS_CFLAGS $CFLAGS" LIBS="$SETTINGS_LIBS $LIBS" - AC_CHECK_FUNCS([g_type_init]) CFLAGS="$SAVE_CFLAGS" LIBS="$SAVE_LIBS" fi === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-16 18:17:35 +0000 +++ src/ChangeLog 2013-09-17 06:33:24 +0000 @@ -1,3 +1,11 @@ +2013-09-17 Dmitry Antipov + + * image.c (fn_g_type_init) [WINDOWSNT]: Define and load + only if Glib < 2.36.0. + (fn_g_type_init) [!WINDOWSNT]: Define only if Glib < 2.36.0. + * xsettings.c (init_gconf, init_gsettings): Do not check + for g_type_init. + 2013-09-16 Jan Djärv * xsettings.c (init_gconf, init_gsettings): Check for Glib 2.36.0 === modified file 'src/image.c' --- src/image.c 2013-09-13 15:03:51 +0000 +++ src/image.c 2013-09-17 06:33:24 +0000 @@ -8590,7 +8590,9 @@ DEF_IMGLIB_FN (gboolean, gdk_pixbuf_get_has_alpha, (const GdkPixbuf *)); DEF_IMGLIB_FN (int, gdk_pixbuf_get_bits_per_sample, (const GdkPixbuf *)); +#if ! GLIB_CHECK_VERSION (2, 36, 0) DEF_IMGLIB_FN (void, g_type_init, (void)); +#endif DEF_IMGLIB_FN (void, g_object_unref, (gpointer)); DEF_IMGLIB_FN (void, g_error_free, (GError *)); @@ -8622,7 +8624,9 @@ LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_has_alpha); LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_bits_per_sample); +#if ! GLIB_CHECK_VERSION (2, 36, 0) LOAD_IMGLIB_FN (gobject, g_type_init); +#endif LOAD_IMGLIB_FN (gobject, g_object_unref); LOAD_IMGLIB_FN (glib, g_error_free); @@ -8647,7 +8651,9 @@ #define fn_gdk_pixbuf_get_has_alpha gdk_pixbuf_get_has_alpha #define fn_gdk_pixbuf_get_bits_per_sample gdk_pixbuf_get_bits_per_sample +#if ! GLIB_CHECK_VERSION (2, 36, 0) #define fn_g_type_init g_type_init +#endif #define fn_g_object_unref g_object_unref #define fn_g_error_free g_error_free #endif /* !WINDOWSNT */ @@ -8732,9 +8738,12 @@ int x; int y; - /* g_type_init is a glib function that must be called prior to using - gnome type library functions. */ +#if ! GLIB_CHECK_VERSION (2, 36, 0) + /* g_type_init is a glib function that must be called prior to + using gnome type library functions (obsolete since 2.36.0). */ fn_g_type_init (); +#endif + /* Make a handle to a new rsvg object. */ rsvg_handle = fn_rsvg_handle_new (); === modified file 'src/xsettings.c' --- src/xsettings.c 2013-09-16 18:17:35 +0000 +++ src/xsettings.c 2013-09-17 06:33:24 +0000 @@ -803,11 +803,9 @@ const gchar *const *schemas; int schema_found = 0; -#ifdef HAVE_G_TYPE_INIT #if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif -#endif schemas = g_settings_list_schemas (); if (schemas == NULL) return; @@ -862,11 +860,9 @@ #if defined (HAVE_GCONF) char *s; -#ifdef HAVE_G_TYPE_INIT #if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif -#endif gconf_client = gconf_client_get_default (); gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE); ------------------------------------------------------------ revno: 114312 committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2013-09-16 23:22:02 +0000 message: message.el (message-expand-group, message-completion-in-region): Correct the order of start and end of a region diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-09-13 07:30:32 +0000 +++ lisp/gnus/ChangeLog 2013-09-16 23:22:02 +0000 @@ -1,3 +1,8 @@ +2013-09-16 Katsumi Yamaoka + + * message.el (message-expand-group, message-completion-in-region): + Correct the order of start and end of a region. + 2013-09-13 Glenn Morris * mml2015.el (gnus-create-image): Autoload it. === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2013-08-01 22:58:40 +0000 +++ lisp/gnus/message.el 2013-09-16 23:22:02 +0000 @@ -7982,12 +7982,12 @@ group) collection)) gnus-active-hashtb)) - (message-completion-in-region e b collection))) + (message-completion-in-region b e collection))) (defalias 'message-completion-in-region (if (fboundp 'completion-in-region) 'completion-in-region - (lambda (e b hashtb) + (lambda (b e hashtb) (let* ((string (buffer-substring b e)) (completions (all-completions string hashtb)) comp) ------------------------------------------------------------ revno: 114311 fixes bug: http://debbugs.gnu.org/15285 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-16 17:28:11 -0400 message: * lisp/url/url-misc.el (url-data): Avoid match-data mix-up with base64 case. Use Content-Transfer-Encoding rather than Content-Encoding. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2013-09-13 07:01:55 +0000 +++ lisp/url/ChangeLog 2013-09-16 21:28:11 +0000 @@ -1,3 +1,8 @@ +2013-09-16 Glenn Morris + + * url-misc.el (url-data): Avoid match-data mix-up with base64 case. + Use Content-Transfer-Encoding rather than Content-Encoding. (Bug#15285) + 2013-09-13 Glenn Morris * url-http.el (url-handle-content-transfer-encoding): === modified file 'lisp/url/url-misc.el' --- lisp/url/url-misc.el 2013-01-02 16:13:04 +0000 +++ lisp/url/url-misc.el 2013-09-16 21:28:11 +0000 @@ -1,7 +1,6 @@ ;;; url-misc.el --- Misc Uniform Resource Locator retrieval code -;; Copyright (C) 1996-1999, 2002, 2004-2013 Free Software Foundation, -;; Inc. +;; Copyright (C) 1996-1999, 2002, 2004-2013 Free Software Foundation, Inc. ;; Keywords: comm, data, processes @@ -89,19 +88,19 @@ (save-excursion (if (not (string-match "\\([^,]*\\)?," desc)) (error "Malformed data URL: %s" desc) - (setq mediatype (match-string 1 desc)) + (setq mediatype (match-string 1 desc) + data (url-unhex-string (substring desc (match-end 0)))) (if (and mediatype (string-match ";base64\\'" mediatype)) (setq mediatype (substring mediatype 0 (match-beginning 0)) encoding "base64")) (if (or (null mediatype) (eq ?\; (aref mediatype 0))) - (setq mediatype (concat "text/plain" mediatype))) - (setq data (url-unhex-string (substring desc (match-end 0))))) + (setq mediatype (concat "text/plain" mediatype)))) (set-buffer (generate-new-buffer " *url-data*")) (mm-disable-multibyte) (insert (format "Content-Length: %d\n" (length data)) "Content-Type: " mediatype "\n" - "Content-Encoding: " encoding "\n" + "Content-Transfer-Encoding: " encoding "\n" "\n") (if data (insert data)) (current-buffer)))) ------------------------------------------------------------ revno: 114310 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-16 16:58:28 -0400 message: * test/automated/eshell.el (eshell-match-result): Return a more informative failure than simply "false". Update callers. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2013-09-16 18:42:41 +0000 +++ test/ChangeLog 2013-09-16 20:58:28 +0000 @@ -1,5 +1,8 @@ 2013-09-16 Glenn Morris + * automated/eshell.el (eshell-match-result): + Return a more informative failure than simply "false". Update callers. + * automated/eshell.el (eshell-test/for-name-shadow-loop): Test value before and after loop as well as during. === modified file 'test/automated/eshell.el' --- test/automated/eshell.el 2013-09-16 19:21:45 +0000 +++ test/automated/eshell.el 2013-09-16 20:58:28 +0000 @@ -47,13 +47,11 @@ (funcall (or func 'eshell-send-input))) (defun eshell-match-result (regexp) - "Insert a command at the end of the buffer." + "Check that text after `eshell-last-input-end' matches REGEXP." (goto-char eshell-last-input-end) - (looking-at regexp)) + (should (string-match-p regexp (buffer-substring-no-properties + (point) (point-max))))) -;; FIXME this does not return informative failure messages, just t or nil. -;; It should return the expected buffer contents and the actual one, -;; so that we can see what form any failure took. (defun eshell-command-result-p (text regexp &optional func) "Insert a command at the end of the buffer." (eshell-insert-command text func) @@ -93,9 +91,8 @@ "Test `eshell-command-result' with a for loop using an env-var." (let ((process-environment (cons "name=env-value" process-environment))) (with-temp-eshell - (should - (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo $name" - "env-value\n3\nenv-value\n"))))) + (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo $name" + "env-value\n3\nenv-value\n")))) (ert-deftest eshell-test/lisp-command-args () "Test `eshell-command-result' with elisp and trailing args. @@ -154,23 +151,20 @@ (ert-deftest eshell-test/last-result-var () "Test using the \"last result\" ($$) variable" (with-temp-eshell - (should - (eshell-command-result-p "+ 1 2; + $$ 2" - "3\n5\n")))) + (eshell-command-result-p "+ 1 2; + $$ 2" + "3\n5\n"))) (ert-deftest eshell-test/last-result-var2 () "Test using the \"last result\" ($$) variable twice" (with-temp-eshell - (should - (eshell-command-result-p "+ 1 2; + $$ $$" - "3\n6\n")))) + (eshell-command-result-p "+ 1 2; + $$ $$" + "3\n6\n"))) (ert-deftest eshell-test/last-arg-var () "Test using the \"last arg\" ($_) variable" (with-temp-eshell - (should - (eshell-command-result-p "+ 1 2; + $_ 4" - "3\n6\n")))) + (eshell-command-result-p "+ 1 2; + $_ 4" + "3\n6\n"))) (ert-deftest eshell-test/command-running-p () "Modeline should show no command running" @@ -204,14 +198,14 @@ (> count 0)) (sit-for 1) (setq count (1- count)))) - (should (eshell-match-result "alpha\n")))) + (eshell-match-result "alpha\n"))) (ert-deftest eshell-test/flush-output () "Test flushing of previous output" (with-temp-eshell (eshell-insert-command "echo alpha") (eshell-kill-output) - (should (eshell-match-result (regexp-quote "*** output flushed ***\n"))) + (eshell-match-result (regexp-quote "*** output flushed ***\n")) (should (forward-line)) (should (= (point) eshell-last-output-start)))) ------------------------------------------------------------ revno: 114309 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-16 15:21:45 -0400 message: Fix comment typo diff: === modified file 'test/automated/eshell.el' --- test/automated/eshell.el 2013-09-16 19:20:44 +0000 +++ test/automated/eshell.el 2013-09-16 19:21:45 +0000 @@ -53,7 +53,7 @@ ;; FIXME this does not return informative failure messages, just t or nil. ;; It should return the expected buffer contents and the actual one, -;; so that we can see what form ant failure took. +;; so that we can see what form any failure took. (defun eshell-command-result-p (text regexp &optional func) "Insert a command at the end of the buffer." (eshell-insert-command text func) ------------------------------------------------------------ revno: 114308 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-16 15:20:44 -0400 message: * test/automated/eshell (eshell-test/for-name-shadow-loop): Tweak previous diff: === modified file 'test/automated/eshell.el' --- test/automated/eshell.el 2013-09-16 18:42:41 +0000 +++ test/automated/eshell.el 2013-09-16 19:20:44 +0000 @@ -51,6 +51,9 @@ (goto-char eshell-last-input-end) (looking-at regexp)) +;; FIXME this does not return informative failure messages, just t or nil. +;; It should return the expected buffer contents and the actual one, +;; so that we can see what form ant failure took. (defun eshell-command-result-p (text regexp &optional func) "Insert a command at the end of the buffer." (eshell-insert-command text func) @@ -89,10 +92,10 @@ (ert-deftest eshell-test/for-name-shadow-loop () ; bug#15372 "Test `eshell-command-result' with a for loop using an env-var." (let ((process-environment (cons "name=env-value" process-environment))) - (should (equal (eshell-test-command-result "echo $name") "env-value")) - (should (equal (eshell-test-command-result - "for name in 3 { echo $name }") 3)) - (should (equal (eshell-test-command-result "echo $name") "env-value")))) + (with-temp-eshell + (should + (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo $name" + "env-value\n3\nenv-value\n"))))) (ert-deftest eshell-test/lisp-command-args () "Test `eshell-command-result' with elisp and trailing args. ------------------------------------------------------------ revno: 114307 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-09-16 15:09:24 -0400 message: * lisp/icomplete.el (icomplete-in-buffer): New var. (icomplete-pre-command-hook, icomplete-post-command-hook): Remove those vars and replace them with functions. (icomplete-minibuffer-setup): Adjust accordingly. (icomplete--completion-table, icomplete--completion-predicate) (icomplete--field-string, icomplete--field-beg, icomplete--field-end): New functions. (icomplete-forward-completions, icomplete-backward-completions) (icomplete-simple-completing-p, icomplete-exhibit) (icomplete-completions): Use them. (icomplete--in-region-buffer): New var. (icomplete--in-region-setup): New function. (icomplete-mode): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-16 18:23:30 +0000 +++ lisp/ChangeLog 2013-09-16 19:09:24 +0000 @@ -1,5 +1,19 @@ 2013-09-16 Stefan Monnier + * icomplete.el (icomplete-in-buffer): New var. + (icomplete-pre-command-hook, icomplete-post-command-hook): Remove those + vars and replace them with functions. + (icomplete-minibuffer-setup): Adjust accordingly. + (icomplete--completion-table, icomplete--completion-predicate) + (icomplete--field-string, icomplete--field-beg, icomplete--field-end): + New functions. + (icomplete-forward-completions, icomplete-backward-completions) + (icomplete-simple-completing-p, icomplete-exhibit) + (icomplete-completions): Use them. + (icomplete--in-region-buffer): New var. + (icomplete--in-region-setup): New function. + (icomplete-mode): Use it. + * eshell/esh-opt.el: Fix last change to set lexical-vars properly (bug#15379). (eshell--do-opts): Rename from eshell-do-opt, remove arg `body-fun', === modified file 'lisp/icomplete.el' --- lisp/icomplete.el 2013-09-06 22:46:44 +0000 +++ lisp/icomplete.el 2013-09-16 19:09:24 +0000 @@ -114,6 +114,9 @@ :type 'integer :group 'icomplete) +(defvar icomplete-in-buffer nil + "If non-nil, also use Icomplete when completing in non-mini buffers.") + (defcustom icomplete-minibuffer-setup-hook nil "Icomplete-specific customization of minibuffer setup. @@ -140,22 +143,13 @@ (defvar icomplete-overlay (make-overlay (point-min) (point-min) nil t t) "Overlay used to display the list of completions.") -;;;_ = icomplete-pre-command-hook -(defvar icomplete-pre-command-hook nil - "Incremental-minibuffer-completion pre-command-hook. - -Is run in minibuffer before user input when `icomplete-mode' is non-nil. -Use `icomplete-mode' function to set it up properly for incremental -minibuffer completion.") -(add-hook 'icomplete-pre-command-hook 'icomplete-tidy) -;;;_ = icomplete-post-command-hook -(defvar icomplete-post-command-hook nil - "Incremental-minibuffer-completion post-command-hook. - -Is run in minibuffer after user input when `icomplete-mode' is non-nil. -Use `icomplete-mode' function to set it up properly for incremental -minibuffer completion.") -(add-hook 'icomplete-post-command-hook 'icomplete-exhibit) +(defun icomplete-pre-command-hook () + (let ((non-essential t)) + (icomplete-tidy))) + +(defun icomplete-post-command-hook () + (let ((non-essential t)) ;E.g. don't prompt for password! + (icomplete-exhibit))) ;;;_ = icomplete-with-completion-tables (defcustom icomplete-with-completion-tables t @@ -179,8 +173,8 @@ Second entry becomes the first and can be selected with `minibuffer-force-complete-and-exit'." (interactive) - (let* ((beg (minibuffer-prompt-end)) - (end (point-max)) + (let* ((beg (icomplete--field-beg)) + (end (icomplete--field-end)) (comps (completion-all-sorted-completions beg end)) (last (last comps))) (when comps @@ -192,8 +186,8 @@ Last entry becomes the first and can be selected with `minibuffer-force-complete-and-exit'." (interactive) - (let* ((beg (minibuffer-prompt-end)) - (end (point-max)) + (let* ((beg (icomplete--field-beg)) + (end (icomplete--field-end)) (comps (completion-all-sorted-completions beg end)) (last-but-one (last comps 2)) (last (cdr last-but-one))) @@ -210,11 +204,32 @@ positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil." :global t :group 'icomplete - (if icomplete-mode - ;; The following is not really necessary after first time - - ;; no great loss. - (add-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup) - (remove-hook 'minibuffer-setup-hook 'icomplete-minibuffer-setup))) + (remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup) + (remove-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup) + (when icomplete-mode + (when icomplete-in-buffer + (add-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup)) + (add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup))) + +(defun icomplete--completion-table () + (if (window-minibuffer-p) minibuffer-completion-table + (or (nth 2 completion-in-region--data) + (message "In %S (w=%S): %S" + (current-buffer) (selected-window) (window-minibuffer-p))))) +(defun icomplete--completion-predicate () + (if (window-minibuffer-p) minibuffer-completion-predicate + (nth 3 completion-in-region--data))) +(defun icomplete--field-string () + (if (window-minibuffer-p) (minibuffer-contents) + (buffer-substring-no-properties + (nth 0 completion-in-region--data) + (nth 1 completion-in-region--data)))) +(defun icomplete--field-beg () + (if (window-minibuffer-p) (minibuffer-prompt-end) + (nth 0 completion-in-region--data))) +(defun icomplete--field-end () + (if (window-minibuffer-p) (point-max) + (nth 1 completion-in-region--data))) ;;;_ > icomplete-simple-completing-p () (defun icomplete-simple-completing-p () @@ -223,17 +238,16 @@ Conditions are: the selected window is a minibuffer, and not in the middle of macro execution, - and `minibuffer-completion-table' is not a symbol (which would + and the completion table is not a function (which would indicate some non-standard, non-simple completion mechanism, like file-name and other custom-func completions)." - (and (window-minibuffer-p) - (not executing-kbd-macro) - minibuffer-completion-table - (or (not (functionp minibuffer-completion-table)) - (eq icomplete-with-completion-tables t) - (member minibuffer-completion-table - icomplete-with-completion-tables)))) + (unless executing-kbd-macro + (let ((table (icomplete--completion-table))) + (and table + (or (not (functionp table)) + (eq icomplete-with-completion-tables t) + (member table icomplete-with-completion-tables)))))) ;;;_ > icomplete-minibuffer-setup () (defun icomplete-minibuffer-setup () @@ -243,16 +257,35 @@ (set (make-local-variable 'completion-show-inline-help) nil) (use-local-map (make-composed-keymap icomplete-minibuffer-map (current-local-map))) - (add-hook 'pre-command-hook - (lambda () (let ((non-essential t)) - (run-hooks 'icomplete-pre-command-hook))) - nil t) - (add-hook 'post-command-hook - (lambda () (let ((non-essential t)) ;E.g. don't prompt for password! - (run-hooks 'icomplete-post-command-hook))) - nil t) + (add-hook 'pre-command-hook #'icomplete-pre-command-hook nil t) + (add-hook 'post-command-hook #'icomplete-post-command-hook nil t) (run-hooks 'icomplete-minibuffer-setup-hook))) -; + +(defvar icomplete--in-region-buffer nil) + +(defun icomplete--in-region-setup () + (when (or (not completion-in-region-mode) + (and icomplete--in-region-buffer + (not (eq icomplete--in-region-buffer (current-buffer))))) + (with-current-buffer (or icomplete--in-region-buffer (current-buffer)) + (setq icomplete--in-region-buffer nil) + (delete-overlay icomplete-overlay) + (kill-local-variable 'completion-show-inline-help) + (remove-hook 'pre-command-hook 'icomplete-pre-command-hook t) + (remove-hook 'post-command-hook 'icomplete-post-command-hook t) + (message nil))) + (when (and completion-in-region-mode + icomplete-mode (icomplete-simple-completing-p)) + (setq icomplete--in-region-buffer (current-buffer)) + (set (make-local-variable 'completion-show-inline-help) nil) + (let ((tem (assq 'completion-in-region-mode + minor-mode-overriding-map-alist))) + (unless (memq icomplete-minibuffer-map (cdr tem)) + (setcdr tem (make-composed-keymap icomplete-minibuffer-map + (cdr tem))))) + (add-hook 'pre-command-hook 'icomplete-pre-command-hook nil t) + (add-hook 'post-command-hook 'icomplete-post-command-hook nil t))) + ;;;_* Completion @@ -274,28 +307,31 @@ (save-excursion (goto-char (point-max)) ; Insert the match-status information: - (if (and (> (point-max) (minibuffer-prompt-end)) + (if (and (> (icomplete--field-end) (icomplete--field-beg)) buffer-undo-list ; Wait for some user input. (or ;; Don't bother with delay after certain number of chars: - (> (- (point) (field-beginning)) icomplete-max-delay-chars) + (> (- (point) (icomplete--field-beg)) + icomplete-max-delay-chars) ;; Don't delay if the completions are known. completion-all-sorted-completions ;; Don't delay if alternatives number is small enough: - (and (sequencep minibuffer-completion-table) - (< (length minibuffer-completion-table) + (and (sequencep (icomplete--completion-table)) + (< (length (icomplete--completion-table)) icomplete-delay-completions-threshold)) ;; Delay - give some grace time for next keystroke, before ;; embarking on computing completions: (sit-for icomplete-compute-delay))) - (let ((text (while-no-input - (icomplete-completions - (field-string) - minibuffer-completion-table - minibuffer-completion-predicate - (not minibuffer-completion-confirm)))) - (buffer-undo-list t) - deactivate-mark) + (let* ((field-string (icomplete--field-string)) + (text (while-no-input + (icomplete-completions + field-string + (icomplete--completion-table) + (icomplete--completion-predicate) + (if (window-minibuffer-p) + (not minibuffer-completion-confirm))))) + (buffer-undo-list t) + deactivate-mark) ;; Do nothing if while-no-input was aborted. (when (stringp text) (move-overlay icomplete-overlay (point) (point) (current-buffer)) @@ -325,16 +361,19 @@ matches exist. \(Keybindings for uniquely matched commands are exhibited within the square braces.)" - (let* ((md (completion--field-metadata (field-beginning))) + (let* ((minibuffer-completion-table candidates) + (minibuffer-completion-predicate predicate) + (md (completion--field-metadata (icomplete--field-beg))) (comps (completion-all-sorted-completions - (minibuffer-prompt-end) (point-max))) + (icomplete--field-beg) (icomplete--field-end))) (last (if (consp comps) (last comps))) (base-size (cdr last)) (open-bracket (if require-match "(" "[")) (close-bracket (if require-match ")" "]"))) ;; `concat'/`mapconcat' is the slow part. (if (not (consp comps)) - (format " %sNo matches%s" open-bracket close-bracket) + (progn ;;(debug (format "Candidates=%S field=%S" candidates name)) + (format " %sNo matches%s" open-bracket close-bracket)) (if last (setcdr last nil)) (let* ((most-try (if (and base-size (> base-size 0)) @@ -389,7 +428,7 @@ ;; Else, use try-completion. (and (stringp prefix) (length prefix))) ;;) prospects comp limit) - (if (eq most-try t) ;; (or (null (cdr comps)) + (if (or (eq most-try t) (not (consp (cdr comps)))) (setq prospects nil) (when (member name comps) ;; NAME is complete but not unique. This scenario poses === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2013-09-06 22:46:44 +0000 +++ lisp/minibuffer.el 2013-09-16 19:09:24 +0000 @@ -1837,10 +1837,10 @@ ;; HACK: if the text we are completing is already in a field, we ;; want the completion field to take priority (e.g. Bug#6830). (when completion-in-region-mode-predicate - (completion-in-region-mode 1) (setq completion-in-region--data - (list (if (markerp start) start (copy-marker start)) - (copy-marker end) collection))) + `(,(if (markerp start) start (copy-marker start)) + ,(copy-marker end t) ,collection ,predicate)) + (completion-in-region-mode 1)) (completion--in-region-1 start end)))) (defvar completion-in-region-mode-map @@ -1874,22 +1874,25 @@ ;; (defalias 'completion-in-region--prech 'completion-in-region--postch) +(defvar completion-in-region-mode nil) ;Explicit defvar, i.s.o defcustom. + (define-minor-mode completion-in-region-mode - "Transient minor mode used during `completion-in-region'. -With a prefix argument ARG, enable the modemode if ARG is -positive, and disable it otherwise. If called from Lisp, enable -the mode if ARG is omitted or nil." + "Transient minor mode used during `completion-in-region'." :global t :group 'minibuffer - (setq completion-in-region--data nil) + ;; Prevent definition of a custom-variable since it makes no sense to + ;; customize this variable. + :variable completion-in-region-mode ;; (remove-hook 'pre-command-hook #'completion-in-region--prech) (remove-hook 'post-command-hook #'completion-in-region--postch) (setq minor-mode-overriding-map-alist (delq (assq 'completion-in-region-mode minor-mode-overriding-map-alist) minor-mode-overriding-map-alist)) (if (null completion-in-region-mode) - (unless (equal "*Completions*" (buffer-name (window-buffer))) - (minibuffer-hide-completions)) + (progn + (setq completion-in-region--data nil) + (unless (equal "*Completions*" (buffer-name (window-buffer))) + (minibuffer-hide-completions))) ;; (add-hook 'pre-command-hook #'completion-in-region--prech) (cl-assert completion-in-region-mode-predicate) (setq completion-in-region-mode--predicate @@ -2010,9 +2013,10 @@ ;; FIXME: We should somehow (ab)use completion-in-region-function or ;; introduce a corresponding hook (plus another for word-completion, ;; and another for force-completion, maybe?). + (setq completion-in-region--data + `(,start ,(copy-marker end t) ,collection + ,(plist-get plist :predicate))) (completion-in-region-mode 1) - (setq completion-in-region--data - (list start (copy-marker end) collection)) (minibuffer-completion-help start end))) (`(,hookfun . ,_) ;; The hook function already performed completion :-( ------------------------------------------------------------ revno: 114306 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-16 14:42:41 -0400 message: * test/automated/eshell.el (eshell-test/for-name-shadow-loop): Test value before and after loop as well as during. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2013-09-15 00:10:45 +0000 +++ test/ChangeLog 2013-09-16 18:42:41 +0000 @@ -1,3 +1,8 @@ +2013-09-16 Glenn Morris + + * automated/eshell.el (eshell-test/for-name-shadow-loop): + Test value before and after loop as well as during. + 2013-09-15 Glenn Morris * automated/eshell.el (eshell-test/for-name-shadow-loop): === modified file 'test/automated/eshell.el' --- test/automated/eshell.el 2013-09-15 00:10:45 +0000 +++ test/automated/eshell.el 2013-09-16 18:42:41 +0000 @@ -89,8 +89,10 @@ (ert-deftest eshell-test/for-name-shadow-loop () ; bug#15372 "Test `eshell-command-result' with a for loop using an env-var." (let ((process-environment (cons "name=env-value" process-environment))) + (should (equal (eshell-test-command-result "echo $name") "env-value")) (should (equal (eshell-test-command-result - "for name in 3 { echo $name }") 3)))) + "for name in 3 { echo $name }") 3)) + (should (equal (eshell-test-command-result "echo $name") "env-value")))) (ert-deftest eshell-test/lisp-command-args () "Test `eshell-command-result' with elisp and trailing args. ------------------------------------------------------------ revno: 114305 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15379 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-09-16 14:23:30 -0400 message: * lisp/eshell/esh-opt.el: Fix last change to set lexical-vars properly. (eshell--do-opts): Rename from eshell-do-opt, remove arg `body-fun', return args and options. (eshell-eval-using-options): Use the new return value of eshell--do-opts to set the options's vars in their scope. (eshell--set-option): Rename from eshell-set-option. Add arg `opt-vals'. (eshell--process-option): Rename from eshell-process-option. Add arg `opt-vals'. (eshell--process-args): Use an `opt-vals' alist to store the options's values during their processing and return them additionally to the remaining args. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-15 23:42:26 +0000 +++ lisp/ChangeLog 2013-09-16 18:23:30 +0000 @@ -1,3 +1,19 @@ +2013-09-16 Stefan Monnier + + * eshell/esh-opt.el: Fix last change to set lexical-vars properly + (bug#15379). + (eshell--do-opts): Rename from eshell-do-opt, remove arg `body-fun', + return args and options. + (eshell-eval-using-options): Use the new return value of + eshell--do-opts to set the options's vars in their scope. + (eshell--set-option): Rename from eshell-set-option. + Add arg `opt-vals'. + (eshell--process-option): Rename from eshell-process-option. + Add arg `opt-vals'. + (eshell--process-args): Use an `opt-vals' alist to store the options's + values during their processing and return them additionally to the + remaining args. + 2013-09-15 Dmitry Gutov * progmodes/ruby-mode.el (ruby-operator-re): Consider line === modified file 'lisp/eshell/esh-opt.el' --- lisp/eshell/esh-opt.el 2013-09-12 20:15:53 +0000 +++ lisp/eshell/esh-opt.el 2013-09-16 18:23:30 +0000 @@ -98,45 +98,44 @@ Lastly, any remaining arguments will be available in a locally interned variable `args' (created using a `let' form)." (declare (debug (form form sexp body))) - `(let ((temp-args - ,(if (memq ':preserve-args (cadr options)) - macro-args - (list 'eshell-stringify-list - (list 'eshell-flatten-list macro-args))))) - (let ,(delq nil (mapcar (lambda (opt) - (and (listp opt) (nth 3 opt))) - (cadr options))) - ;; FIXME: `options' ends up hiding some variable names under `quote', - ;; which is incompatible with lexical scoping!! - (eshell-do-opt ,name ,options (lambda (args) ,@body-forms) temp-args)))) + `(let* ((temp-args + ,(if (memq ':preserve-args (cadr options)) + macro-args + (list 'eshell-stringify-list + (list 'eshell-flatten-list macro-args)))) + (processed-args (eshell--do-opts ,name ,options temp-args)) + ,@(delete-dups + (delq nil (mapcar (lambda (opt) + (and (listp opt) (nth 3 opt) + `(,(nth 3 opt) (pop processed-args)))) + ;; `options' is of the form (quote OPTS). + (cadr options)))) + (args processed-args)) + ,@body-forms)) ;;; Internal Functions: ;; Documented part of the interface; see eshell-eval-using-options. (defvar eshell--args) -(defun eshell-do-opt (name options body-fun args) +(defun eshell--do-opts (name options args) "Helper function for `eshell-eval-using-options'. This code doesn't really need to be macro expanded everywhere." - (let* (last-value - (ext-command - (catch 'eshell-ext-command - (let ((usage-msg - (catch 'eshell-usage - (setq last-value nil) - (if (and (= (length args) 0) - (memq ':show-usage options)) - (throw 'eshell-usage - (eshell-show-usage name options))) - (setq args (eshell-process-args name args options) - last-value (funcall body-fun args)) - nil))) - (when usage-msg - (error "%s" usage-msg)))))) + (let ((ext-command + (catch 'eshell-ext-command + (let ((usage-msg + (catch 'eshell-usage + (if (and (= (length args) 0) + (memq ':show-usage options)) + (eshell-show-usage name options) + (setq args (eshell--process-args name args options)) + nil)))) + (when usage-msg + (error "%s" usage-msg)))))) (if ext-command - (throw 'eshell-external - (eshell-external-command ext-command args)) - last-value))) + (throw 'eshell-external + (eshell-external-command ext-command args)) + args))) (defun eshell-show-usage (name options) "Display the usage message for NAME, using OPTIONS." @@ -185,23 +184,24 @@ will be called instead." extcmd))))) (throw 'eshell-usage usage))) -(defun eshell-set-option (name ai opt options) +(defun eshell--set-option (name ai opt options opt-vals) "Using NAME's remaining args (index AI), set the OPT within OPTIONS. If the option consumes an argument for its value, the argument list will be modified." (if (not (nth 3 opt)) (eshell-show-usage name options) - (if (eq (nth 2 opt) t) - (if (> ai (length eshell--args)) - (error "%s: missing option argument" name) - (set (nth 3 opt) (nth ai eshell--args)) - (if (> ai 0) - (setcdr (nthcdr (1- ai) eshell--args) - (nthcdr (1+ ai) eshell--args)) - (setq eshell--args (cdr eshell--args)))) - (set (nth 3 opt) (or (nth 2 opt) t))))) + (setcdr (assq (nth 3 opt) opt-vals) + (if (eq (nth 2 opt) t) + (if (> ai (length eshell--args)) + (error "%s: missing option argument" name) + (prog1 (nth ai eshell--args) + (if (> ai 0) + (setcdr (nthcdr (1- ai) eshell--args) + (nthcdr (1+ ai) eshell--args)) + (setq eshell--args (cdr eshell--args))))) + (or (nth 2 opt) t))))) -(defun eshell-process-option (name switch kind ai options) +(defun eshell--process-option (name switch kind ai options opt-vals) "For NAME, process SWITCH (of type KIND), from args at index AI. The SWITCH will be looked up in the set of OPTIONS. @@ -219,7 +219,7 @@ (nth kind (car opts)) (equal switch (nth kind (car opts)))) (progn - (eshell-set-option name ai (car opts) options) + (eshell--set-option name ai (car opts) options opt-vals) (setq found t opts nil)) (setq opts (cdr opts)))) (unless found @@ -232,11 +232,18 @@ "%s: unrecognized option --%s") name switch))))))) -(defun eshell-process-args (name args options) - "Process the given ARGS using OPTIONS. -This assumes that symbols have been intern'd by `eshell-eval-using-options'." - (let ((ai 0) arg - (eshell--args args)) +(defun eshell--process-args (name args options) + "Process the given ARGS using OPTIONS." + (let* ((seen ()) + (opt-vals (delq nil (mapcar (lambda (opt) + (when (listp opt) + (let ((sym (nth 3 opt))) + (when (and sym (not (memq sym seen))) + (push sym seen) + (list sym))))) + options))) + (ai 0) arg + (eshell--args args)) (while (< ai (length args)) (setq arg (nth ai args)) (if (not (and (stringp arg) @@ -249,13 +256,14 @@ (setcdr (nthcdr (1- ai) args) (nthcdr (1+ ai) args))) (if dash (if (> (length switch) 0) - (eshell-process-option name switch 1 ai options) + (eshell--process-option name switch 1 ai options opt-vals) (setq ai (length args))) (let ((len (length switch)) (index 0)) (while (< index len) - (eshell-process-option name (aref switch index) 0 ai options) - (setq index (1+ index))))))))) - args) + (eshell--process-option name (aref switch index) + 0 ai options opt-vals) + (setq index (1+ index)))))))) + (nconc (mapcar #'cdr opt-vals) args))) ;;; esh-opt.el ends here === modified file 'lisp/eshell/esh-util.el' --- lisp/eshell/esh-util.el 2013-09-13 07:12:44 +0000 +++ lisp/eshell/esh-util.el 2013-09-16 18:23:30 +0000 @@ -144,7 +144,7 @@ Otherwise, evaluates FORM with no error handling." (declare (indent 2)) (if eshell-handle-errors - `(condition-case ,tag + `(condition-case-unless-debug ,tag ,form ,@handlers) form)) ------------------------------------------------------------ revno: 114304 committer: Jan D. branch nick: trunk timestamp: Mon 2013-09-16 20:17:35 +0200 message: * xsettings.c (init_gconf, init_gsettings): Check for Glib 2.36.0 before calling g_type_init. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-16 15:55:02 +0000 +++ src/ChangeLog 2013-09-16 18:17:35 +0000 @@ -1,5 +1,8 @@ 2013-09-16 Jan Djärv + * xsettings.c (init_gconf, init_gsettings): Check for Glib 2.36.0 + before calling g_type_init. + * font.c (syms_of_font): Move call to syms_of_(ns|mac)font ... * nsterm.m (syms_of_nsterm): ... to here. === modified file 'src/xsettings.c' --- src/xsettings.c 2013-09-16 10:41:41 +0000 +++ src/xsettings.c 2013-09-16 18:17:35 +0000 @@ -804,8 +804,10 @@ int schema_found = 0; #ifdef HAVE_G_TYPE_INIT +#if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif +#endif schemas = g_settings_list_schemas (); if (schemas == NULL) return; @@ -861,8 +863,10 @@ char *s; #ifdef HAVE_G_TYPE_INIT +#if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif +#endif gconf_client = gconf_client_get_default (); gconf_client_set_error_handling (gconf_client, GCONF_CLIENT_HANDLE_NONE); ------------------------------------------------------------ revno: 114303 committer: Jan D. branch nick: trunk timestamp: Mon 2013-09-16 17:55:02 +0200 message: Fix syms_of_(mac|ms)font calls. * font.c (syms_of_font): Move call to syms_of_(ns|mac)font ... * nsterm.m (syms_of_nsterm): ... to here. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-16 11:23:03 +0000 +++ src/ChangeLog 2013-09-16 15:55:02 +0000 @@ -1,3 +1,9 @@ +2013-09-16 Jan Djärv + + * font.c (syms_of_font): Move call to syms_of_(ns|mac)font ... + + * nsterm.m (syms_of_nsterm): ... to here. + 2013-09-16 Dmitry Antipov * xterm.c (toolkit_scroll_bar_interaction): Use bool for boolean. === modified file 'src/font.c' --- src/font.c 2013-09-15 19:43:32 +0000 +++ src/font.c 2013-09-16 15:55:02 +0000 @@ -5197,12 +5197,6 @@ #ifdef HAVE_NTGUI syms_of_w32font (); #endif /* HAVE_NTGUI */ -#ifdef HAVE_NS - syms_of_nsfont (); -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - syms_of_macfont (); -#endif -#endif /* HAVE_NS */ #endif /* HAVE_WINDOW_SYSTEM */ } === modified file 'src/nsterm.m' --- src/nsterm.m 2013-09-15 17:58:46 +0000 +++ src/nsterm.m 2013-09-16 15:55:02 +0000 @@ -7461,4 +7461,12 @@ /* Tell Emacs about this window system. */ Fprovide (Qns, Qnil); + + syms_of_nsfont (); +#ifdef NS_IMPL_COCOA +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + syms_of_macfont (); +#endif +#endif + } ------------------------------------------------------------ revno: 114302 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-16 15:23:03 +0400 message: * xterm.c (toolkit_scroll_bar_interaction): Use bool for boolean. (ignore_next_mouse_click_timeout): Use Time as X does. (handle_one_xevent): Avoid cast and use unsigned comparison. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-16 10:41:41 +0000 +++ src/ChangeLog 2013-09-16 11:23:03 +0000 @@ -1,5 +1,11 @@ 2013-09-16 Dmitry Antipov + * xterm.c (toolkit_scroll_bar_interaction): Use bool for boolean. + (ignore_next_mouse_click_timeout): Use Time as X does. + (handle_one_xevent): Avoid cast and use unsigned comparison. + +2013-09-16 Dmitry Antipov + Do not copy X event in handle_one_xevent except KeyPress case. Wnen XEvent is processed, it is unlikely to be changed except KeyPress case, so we can avoid copying and use const pointer to === modified file 'src/xterm.c' --- src/xterm.c 2013-09-16 10:41:41 +0000 +++ src/xterm.c 2013-09-16 11:23:03 +0000 @@ -160,20 +160,21 @@ static struct frame *pending_autoraise_frame; #ifdef USE_X_TOOLKIT + /* The application context for Xt use. */ XtAppContext Xt_app_con; static String Xt_default_resources[] = {0}; /* Non-zero means user is interacting with a toolkit scroll bar. */ +static bool toolkit_scroll_bar_interaction; -static int toolkit_scroll_bar_interaction; #endif /* USE_X_TOOLKIT */ /* Non-zero timeout value means ignore next mouse click if it arrives before that timeout elapses (i.e. as part of the same sequence of events resulting from clicking on a frame to select it). */ -static unsigned long ignore_next_mouse_click_timeout; +static Time ignore_next_mouse_click_timeout; /* Mouse movement. @@ -6893,7 +6894,7 @@ if (ignore_next_mouse_click_timeout) { if (event->type == ButtonPress - && (int)(event->xbutton.time - ignore_next_mouse_click_timeout) > 0) + && event->xbutton.time > ignore_next_mouse_click_timeout) { ignore_next_mouse_click_timeout = 0; construct_mouse_click (&inev.ie, &event->xbutton, f); ------------------------------------------------------------ revno: 114301 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-16 14:41:41 +0400 message: Do not copy X event in handle_one_xevent except KeyPress case. Wnen XEvent is processed, it is unlikely to be changed except KeyPress case, so we can avoid copying and use const pointer to const data to make sure that an event is not changed elsewhere. * xterm.c (handle_one_xevent): Change 2nd arg to 'const XEvent * const' and do not create local copy except for the KeyPress event. Use casts to avoid a few glitches. Adjust formatting. Add comments. (SET_SAVED_BUTTON_EVENT): Remove and move the code to the only user. (x_handle_net_wm_state, x_menubar_window_to_frame) (x_detect_focus_change, construct_mouse_click, note_mouse_movement) (x_scroll_bar_to_input_event, x_scroll_bar_expose) (x_scroll_bar_handle_click, x_scroll_bar_note_movement): * gtkutil.c (xg_event_is_for_menubar, xg_event_is_for_scrollbar): * xselect.c (x_handle_property_notify, x_handle_selection_notify) (x_handle_dnd_message): * xsettings.c (xft_settings_event): Use 'const XEvent * const' where appropriate. * xterm.h, gtkutil.h, xsettngs.h: Adjust related prototypes. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-16 07:27:51 +0000 +++ src/ChangeLog 2013-09-16 10:41:41 +0000 @@ -1,5 +1,26 @@ 2013-09-16 Dmitry Antipov + Do not copy X event in handle_one_xevent except KeyPress case. + Wnen XEvent is processed, it is unlikely to be changed except + KeyPress case, so we can avoid copying and use const pointer to + const data to make sure that an event is not changed elsewhere. + * xterm.c (handle_one_xevent): Change 2nd arg to 'const XEvent * + const' and do not create local copy except for the KeyPress event. + Use casts to avoid a few glitches. Adjust formatting. Add comments. + (SET_SAVED_BUTTON_EVENT): Remove and move the code to the only user. + (x_handle_net_wm_state, x_menubar_window_to_frame) + (x_detect_focus_change, construct_mouse_click, note_mouse_movement) + (x_scroll_bar_to_input_event, x_scroll_bar_expose) + (x_scroll_bar_handle_click, x_scroll_bar_note_movement): + * gtkutil.c (xg_event_is_for_menubar, xg_event_is_for_scrollbar): + * xselect.c (x_handle_property_notify, x_handle_selection_notify) + (x_handle_dnd_message): + * xsettings.c (xft_settings_event): + Use 'const XEvent * const' where appropriate. + * xterm.h, gtkutil.h, xsettngs.h: Adjust related prototypes. + +2013-09-16 Dmitry Antipov + Fix X event waiting to handle multiple frames. * frame.h (struct frame) [HAVE_X_WINDOWS]: New member wait_event_type. * xterm.c (pending_event_wait): Remove. Adjust users. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2013-09-13 16:46:18 +0000 +++ src/gtkutil.c 2013-09-16 10:41:41 +0000 @@ -3409,7 +3409,7 @@ } bool -xg_event_is_for_menubar (struct frame *f, XEvent *event) +xg_event_is_for_menubar (struct frame *f, const XEvent * const event) { struct x_output *x = f->output_data.x; GList *iter; @@ -3861,7 +3861,7 @@ frame. This function does additional checks. */ bool -xg_event_is_for_scrollbar (struct frame *f, XEvent *event) +xg_event_is_for_scrollbar (struct frame *f, const XEvent * const event) { bool retval = 0; === modified file 'src/gtkutil.h' --- src/gtkutil.h 2013-08-30 12:17:44 +0000 +++ src/gtkutil.h 2013-09-16 10:41:41 +0000 @@ -105,7 +105,7 @@ extern void xg_update_frame_menubar (struct frame *f); -extern bool xg_event_is_for_menubar (struct frame *f, XEvent *event); +extern bool xg_event_is_for_menubar (struct frame *, const XEvent * const); extern bool xg_have_tear_offs (void); @@ -129,7 +129,7 @@ int portion, int position, int whole); -extern bool xg_event_is_for_scrollbar (struct frame *f, XEvent *event); +extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent * const); extern int xg_get_default_scrollbar_width (void); extern void update_frame_tool_bar (struct frame *f); === modified file 'src/xselect.c' --- src/xselect.c 2013-09-13 15:03:51 +0000 +++ src/xselect.c 2013-09-16 10:41:41 +0000 @@ -1141,7 +1141,7 @@ /* Called from XTread_socket in response to a PropertyNotify event. */ void -x_handle_property_notify (XPropertyEvent *event) +x_handle_property_notify (const XPropertyEvent * const event) { struct prop_location *rest; @@ -1888,7 +1888,7 @@ We store t there if the reply is successful, lambda if not. */ void -x_handle_selection_notify (XSelectionEvent *event) +x_handle_selection_notify (const XSelectionEvent * const event) { if (event->requestor != reading_selection_window) return; @@ -2488,7 +2488,7 @@ /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ int -x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, +x_handle_dnd_message (struct frame *f, const XClientMessageEvent * const event, struct x_display_info *dpyinfo, struct input_event *bufp) { Lisp_Object vec; === modified file 'src/xsettings.c' --- src/xsettings.c 2013-07-30 05:56:18 +0000 +++ src/xsettings.c 2013-09-16 10:41:41 +0000 @@ -754,7 +754,7 @@ /* Check if EVENT for the display in DPYINFO is XSettings related. */ void -xft_settings_event (struct x_display_info *dpyinfo, XEvent *event) +xft_settings_event (struct x_display_info *dpyinfo, const XEvent * const event) { bool check_window_p = 0, apply_settings_p = 0; === modified file 'src/xsettings.h' --- src/xsettings.h 2013-01-01 09:11:05 +0000 +++ src/xsettings.h 2013-09-16 10:41:41 +0000 @@ -20,9 +20,8 @@ #ifndef XSETTINGS_H #define XSETTINGS_H -extern void xsettings_initialize (struct x_display_info *dpyinfo); -extern void xft_settings_event (struct x_display_info *dpyinfo, - XEvent *); +extern void xsettings_initialize (struct x_display_info *); +extern void xft_settings_event (struct x_display_info *, const XEvent * const); extern const char *xsettings_get_system_font (void); #ifdef USE_LUCID extern const char *xsettings_get_system_normal_font (void); === modified file 'src/xterm.c' --- src/xterm.c 2013-09-16 07:27:51 +0000 +++ src/xterm.c 2013-09-16 10:41:41 +0000 @@ -302,12 +302,13 @@ enum scroll_bar_part *, Lisp_Object *, Lisp_Object *, Time *); -static int x_handle_net_wm_state (struct frame *, XPropertyEvent *); +static int x_handle_net_wm_state (struct frame *, const XPropertyEvent * const); static void x_check_fullscreen (struct frame *); static void x_check_expected_move (struct frame *, int, int); static void x_sync_with_move (struct frame *, int, int, int); -static int handle_one_xevent (struct x_display_info *, XEvent *, - int *, struct input_event *); +static int handle_one_xevent (struct x_display_info *, + const XEvent * const, int *, + struct input_event *); #ifdef USE_GTK static int x_dispatch_event (XEvent *, Display *); #endif @@ -3459,7 +3460,8 @@ /* Likewise, but consider only the menu bar widget. */ static struct frame * -x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event) +x_menubar_window_to_frame (struct x_display_info *dpyinfo, + const XEvent * const event) { Window wdesc = event->xany.window; Lisp_Object tail, frame; @@ -3541,7 +3543,7 @@ static void x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, - XEvent *event, struct input_event *bufp) + const XEvent * const event, struct input_event *bufp) { if (!frame) return; @@ -3831,7 +3833,9 @@ the mouse. */ static Lisp_Object -construct_mouse_click (struct input_event *result, XButtonEvent *event, struct frame *f) +construct_mouse_click (struct input_event *result, + const XButtonEvent * const event, + struct frame *f) { /* Make the event type NO_EVENT; we'll change that when we decide otherwise. */ @@ -3863,7 +3867,7 @@ static Lisp_Object last_mouse_motion_frame; static int -note_mouse_movement (struct frame *frame, XMotionEvent *event) +note_mouse_movement (struct frame *frame, const XMotionEvent * const event) { last_mouse_movement_time = event->time; last_mouse_motion_event = *event; @@ -4207,13 +4211,7 @@ #ifdef USE_TOOLKIT_SCROLL_BARS -static void x_scroll_bar_to_input_event (XEvent *, struct input_event *); static void x_send_scroll_bar_event (Lisp_Object, int, int, int); -static void x_create_toolkit_scroll_bar (struct frame *, - struct scroll_bar *); -static void x_set_toolkit_scroll_bar_thumb (struct scroll_bar *, - int, int, int); - /* Lisp window being scrolled. Set when starting to interact with a toolkit scroll bar, reset to nil when ending the interaction. */ @@ -4360,7 +4358,8 @@ in *IEVENT. */ static void -x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) +x_scroll_bar_to_input_event (const XEvent * const event, + struct input_event *ievent) { XClientMessageEvent *ev = (XClientMessageEvent *) event; Lisp_Object window; @@ -5504,7 +5503,7 @@ mark bits. */ static void -x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) +x_scroll_bar_expose (struct scroll_bar *bar, const XEvent * const event) { Window w = bar->x_window; struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); @@ -5542,7 +5541,9 @@ static void -x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event) +x_scroll_bar_handle_click (struct scroll_bar *bar, + const XEvent * const event, + struct input_event *emacs_event) { if (! WINDOWP (bar->window)) emacs_abort (); @@ -5599,7 +5600,8 @@ mark bits. */ static void -x_scroll_bar_note_movement (struct scroll_bar *bar, XMotionEvent *event) +x_scroll_bar_note_movement (struct scroll_bar *bar, + const XMotionEvent * const event) { struct frame *f = XFRAME (XWINDOW (bar->window)->frame); @@ -5751,20 +5753,6 @@ static struct x_display_info *next_noop_dpyinfo; -#if defined USE_X_TOOLKIT || defined USE_GTK -#define SET_SAVED_BUTTON_EVENT \ - do \ - { \ - if (f->output_data.x->saved_menu_event == 0) \ - f->output_data.x->saved_menu_event = \ - xmalloc (sizeof (XEvent)); \ - *f->output_data.x->saved_menu_event = event; \ - inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ - XSETFRAME (inev.ie.frame_or_window, f); \ - } \ - while (0) -#endif - enum { X_EVENT_NORMAL, @@ -5858,11 +5846,13 @@ *FINISH is X_EVENT_GOTO_OUT if caller should stop reading events. *FINISH is zero if caller should continue reading events. *FINISH is X_EVENT_DROP if event should not be passed to the toolkit. + *EVENT is unchanged unless we're processing KeyPress event. We return the number of characters stored into the buffer. */ static int -handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, +handle_one_xevent (struct x_display_info *dpyinfo, + const XEvent * const event, int *finish, struct input_event *hold_quit) { union { @@ -5874,7 +5864,6 @@ ptrdiff_t nbytes = 0; struct frame *any, *f = NULL; struct coding_system coding; - XEvent event = *eventptr; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; /* This holds the state XLookupString needs to implement dead keys and other tricks known as "compose processing". _X Window System_ @@ -5890,21 +5879,19 @@ inev.ie.kind = NO_EVENT; inev.ie.arg = Qnil; - any = x_any_window_to_frame (dpyinfo, event.xany.window); + any = x_any_window_to_frame (dpyinfo, event->xany.window); - if (any && any->wait_event_type == event.type) + if (any && any->wait_event_type == event->type) any->wait_event_type = 0; /* Indicates we got it. */ - switch (event.type) + switch (event->type) { case ClientMessage: { - if (event.xclient.message_type - == dpyinfo->Xatom_wm_protocols - && event.xclient.format == 32) + if (event->xclient.message_type == dpyinfo->Xatom_wm_protocols + && event->xclient.format == 32) { - if (event.xclient.data.l[0] - == dpyinfo->Xatom_wm_take_focus) + if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_take_focus) { /* Use the value returned by x_any_window_to_frame because this could be the shell widget window @@ -5933,15 +5920,15 @@ since that might be an event for a deleted frame. */ if (f) { - Display *d = event.xclient.display; + Display *d = event->xclient.display; /* Catch and ignore errors, in case window has been iconified by a window manager such as GWM. */ x_catch_errors (d); - XSetInputFocus (d, event.xclient.window, + XSetInputFocus (d, event->xclient.window, /* The ICCCM says this is the only valid choice. */ RevertToParent, - event.xclient.data.l[1]); + event->xclient.data.l[1]); /* This is needed to detect the error if there is an error. */ XSync (d, False); @@ -5952,8 +5939,7 @@ goto done; } - if (event.xclient.data.l[0] - == dpyinfo->Xatom_wm_save_yourself) + if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_save_yourself) { /* Save state modify the WM_COMMAND property to something which can reinstate us. This notifies @@ -5968,23 +5954,22 @@ #endif { f = x_top_window_to_frame (dpyinfo, - event.xclient.window); + event->xclient.window); /* This is just so we only give real data once for a single Emacs process. */ if (f == SELECTED_FRAME ()) XSetCommand (FRAME_X_DISPLAY (f), - event.xclient.window, + event->xclient.window, initial_argv, initial_argc); else if (f) XSetCommand (FRAME_X_DISPLAY (f), - event.xclient.window, + event->xclient.window, 0, 0); } goto done; } - if (event.xclient.data.l[0] - == dpyinfo->Xatom_wm_delete_window) + if (event->xclient.data.l[0] == dpyinfo->Xatom_wm_delete_window) { f = any; if (!f) @@ -5998,20 +5983,16 @@ goto done; } - if (event.xclient.message_type - == dpyinfo->Xatom_wm_configure_denied) - { - goto done; - } + if (event->xclient.message_type == dpyinfo->Xatom_wm_configure_denied) + goto done; - if (event.xclient.message_type - == dpyinfo->Xatom_wm_window_moved) + if (event->xclient.message_type == dpyinfo->Xatom_wm_window_moved) { int new_x, new_y; - f = x_window_to_frame (dpyinfo, event.xclient.window); + f = x_window_to_frame (dpyinfo, event->xclient.window); - new_x = event.xclient.data.s[0]; - new_y = event.xclient.data.s[1]; + new_x = event->xclient.data.s[0]; + new_y = event->xclient.data.s[1]; if (f) { @@ -6022,28 +6003,25 @@ } #ifdef HACK_EDITRES - if (event.xclient.message_type - == dpyinfo->Xatom_editres) + if (event->xclient.message_type == dpyinfo->Xatom_editres) { f = any; if (f) - _XEditResCheckMessages (f->output_data.x->widget, NULL, - &event, NULL); + _XEditResCheckMessages (f->output_data.x->widget, + NULL, (XEvent *) event, NULL); goto done; } #endif /* HACK_EDITRES */ - if ((event.xclient.message_type - == dpyinfo->Xatom_DONE) - || (event.xclient.message_type - == dpyinfo->Xatom_PAGE)) + if (event->xclient.message_type == dpyinfo->Xatom_DONE + || event->xclient.message_type == dpyinfo->Xatom_PAGE) { /* Ghostview job completed. Kill it. We could reply with "Next" if we received "Page", but we currently never do because we are interested in images, only, which should have 1 page. */ - Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; - f = x_window_to_frame (dpyinfo, event.xclient.window); + Pixmap pixmap = (Pixmap) event->xclient.data.l[1]; + f = x_window_to_frame (dpyinfo, event->xclient.window); if (!f) goto OTHER; x_kill_gs_process (pixmap, f); @@ -6054,54 +6032,52 @@ #ifdef USE_TOOLKIT_SCROLL_BARS /* Scroll bar callbacks send a ClientMessage from which we construct an input_event. */ - if (event.xclient.message_type - == dpyinfo->Xatom_Scrollbar) + if (event->xclient.message_type == dpyinfo->Xatom_Scrollbar) { - x_scroll_bar_to_input_event (&event, &inev.ie); + x_scroll_bar_to_input_event (event, &inev.ie); *finish = X_EVENT_GOTO_OUT; goto done; } #endif /* USE_TOOLKIT_SCROLL_BARS */ /* XEmbed messages from the embedder (if any). */ - if (event.xclient.message_type - == dpyinfo->Xatom_XEMBED) + if (event->xclient.message_type == dpyinfo->Xatom_XEMBED) { - enum xembed_message msg = event.xclient.data.l[1]; + enum xembed_message msg = event->xclient.data.l[1]; if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT) - x_detect_focus_change (dpyinfo, any, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, event, &inev.ie); *finish = X_EVENT_GOTO_OUT; goto done; } - xft_settings_event (dpyinfo, &event); + xft_settings_event (dpyinfo, event); f = any; if (!f) goto OTHER; - if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev.ie)) + if (x_handle_dnd_message (f, &event->xclient, dpyinfo, &inev.ie)) *finish = X_EVENT_DROP; } break; case SelectionNotify: - dpyinfo->last_user_time = event.xselection.time; + dpyinfo->last_user_time = event->xselection.time; #ifdef USE_X_TOOLKIT - if (! x_window_to_frame (dpyinfo, event.xselection.requestor)) + if (! x_window_to_frame (dpyinfo, event->xselection.requestor)) goto OTHER; #endif /* not USE_X_TOOLKIT */ - x_handle_selection_notify (&event.xselection); + x_handle_selection_notify (&event->xselection); break; case SelectionClear: /* Someone has grabbed ownership. */ - dpyinfo->last_user_time = event.xselectionclear.time; + dpyinfo->last_user_time = event->xselectionclear.time; #ifdef USE_X_TOOLKIT - if (! x_window_to_frame (dpyinfo, event.xselectionclear.window)) + if (! x_window_to_frame (dpyinfo, event->xselectionclear.window)) goto OTHER; #endif /* USE_X_TOOLKIT */ { - XSelectionClearEvent *eventp = &(event.xselectionclear); + const XSelectionClearEvent * const eventp = &event->xselectionclear; inev.ie.kind = SELECTION_CLEAR_EVENT; SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; @@ -6111,29 +6087,29 @@ break; case SelectionRequest: /* Someone wants our selection. */ - dpyinfo->last_user_time = event.xselectionrequest.time; + dpyinfo->last_user_time = event->xselectionrequest.time; #ifdef USE_X_TOOLKIT - if (!x_window_to_frame (dpyinfo, event.xselectionrequest.owner)) + if (!x_window_to_frame (dpyinfo, event->xselectionrequest.owner)) goto OTHER; #endif /* USE_X_TOOLKIT */ { - XSelectionRequestEvent *eventp = &(event.xselectionrequest); + const XSelectionRequestEvent * const eventp = &event->xselectionrequest; - inev.ie.kind = SELECTION_REQUEST_EVENT; - SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; - SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor; - SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; - SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; - SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property; - SELECTION_EVENT_TIME (&inev.sie) = eventp->time; + inev.ie.kind = SELECTION_REQUEST_EVENT; + SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; + SELECTION_EVENT_REQUESTOR (&inev.sie) = eventp->requestor; + SELECTION_EVENT_SELECTION (&inev.sie) = eventp->selection; + SELECTION_EVENT_TARGET (&inev.sie) = eventp->target; + SELECTION_EVENT_PROPERTY (&inev.sie) = eventp->property; + SELECTION_EVENT_TIME (&inev.sie) = eventp->time; } break; case PropertyNotify: - dpyinfo->last_user_time = event.xproperty.time; - f = x_top_window_to_frame (dpyinfo, event.xproperty.window); - if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) - if (x_handle_net_wm_state (f, &event.xproperty) + dpyinfo->last_user_time = event->xproperty.time; + f = x_top_window_to_frame (dpyinfo, event->xproperty.window); + if (f && event->xproperty.atom == dpyinfo->Xatom_net_wm_state) + if (x_handle_net_wm_state (f, &event->xproperty) && FRAME_ICONIFIED_P (f) && f->output_data.x->net_wm_state_hidden_seen) { @@ -6148,16 +6124,16 @@ XSETFRAME (inev.ie.frame_or_window, f); } - x_handle_property_notify (&event.xproperty); - xft_settings_event (dpyinfo, &event); + x_handle_property_notify (&event->xproperty); + xft_settings_event (dpyinfo, event); goto OTHER; case ReparentNotify: - f = x_top_window_to_frame (dpyinfo, event.xreparent.window); + f = x_top_window_to_frame (dpyinfo, event->xreparent.window); if (f) { int x, y; - f->output_data.x->parent_desc = event.xreparent.parent; + f->output_data.x->parent_desc = event->xreparent.parent; x_real_positions (f, &x, &y); f->left_pos = x; f->top_pos = y; @@ -6171,15 +6147,15 @@ goto OTHER; case Expose: - f = x_window_to_frame (dpyinfo, event.xexpose.window); + f = x_window_to_frame (dpyinfo, event->xexpose.window); if (f) { #ifdef USE_GTK /* This seems to be needed for GTK 2.6. */ - x_clear_area (event.xexpose.display, - event.xexpose.window, - event.xexpose.x, event.xexpose.y, - event.xexpose.width, event.xexpose.height); + x_clear_area (event->xexpose.display, + event->xexpose.window, + event->xexpose.x, event->xexpose.y, + event->xexpose.width, event->xexpose.height); #endif if (!FRAME_VISIBLE_P (f)) { @@ -6189,9 +6165,8 @@ SET_FRAME_GARBAGED (f); } else - expose_frame (f, - event.xexpose.x, event.xexpose.y, - event.xexpose.width, event.xexpose.height); + expose_frame (f, event->xexpose.x, event->xexpose.y, + event->xexpose.width, event->xexpose.height); } else { @@ -6203,8 +6178,7 @@ themselves, so there's no way to dispatch events to them. Recognize this case separately. */ { - Widget widget - = x_window_to_menu_bar (event.xexpose.window); + Widget widget = x_window_to_menu_bar (event->xexpose.window); if (widget) xlwmenu_redisplay (widget); } @@ -6214,11 +6188,11 @@ /* Dispatch event to the widget. */ goto OTHER; #else /* not USE_TOOLKIT_SCROLL_BARS */ - bar = x_window_to_scroll_bar (event.xexpose.display, - event.xexpose.window); + bar = x_window_to_scroll_bar (event->xexpose.display, + event->xexpose.window); if (bar) - x_scroll_bar_expose (bar, &event); + x_scroll_bar_expose (bar, event); #ifdef USE_X_TOOLKIT else goto OTHER; @@ -6230,14 +6204,12 @@ case GraphicsExpose: /* This occurs when an XCopyArea's source area was obscured or not available. */ - f = x_window_to_frame (dpyinfo, event.xgraphicsexpose.drawable); + f = x_window_to_frame (dpyinfo, event->xgraphicsexpose.drawable); if (f) - { - expose_frame (f, - event.xgraphicsexpose.x, event.xgraphicsexpose.y, - event.xgraphicsexpose.width, - event.xgraphicsexpose.height); - } + expose_frame (f, event->xgraphicsexpose.x, + event->xgraphicsexpose.y, + event->xgraphicsexpose.width, + event->xgraphicsexpose.height); #ifdef USE_X_TOOLKIT else goto OTHER; @@ -6251,13 +6223,13 @@ case UnmapNotify: /* Redo the mouse-highlight after the tooltip has gone. */ - if (event.xunmap.window == tip_window) + if (event->xunmap.window == tip_window) { tip_window = 0; redo_mouse_highlight (); } - f = x_top_window_to_frame (dpyinfo, event.xunmap.window); + f = x_top_window_to_frame (dpyinfo, event->xunmap.window); if (f) /* F may no longer exist if the frame was deleted. */ { @@ -6282,7 +6254,7 @@ goto OTHER; case MapNotify: - if (event.xmap.window == tip_window) + if (event->xmap.window == tip_window) /* The tooltip has been drawn already. Avoid the SET_FRAME_GARBAGED below. */ goto OTHER; @@ -6290,7 +6262,7 @@ /* We use x_top_window_to_frame because map events can come for sub-windows and they don't mean that the frame is visible. */ - f = x_top_window_to_frame (dpyinfo, event.xmap.window); + f = x_top_window_to_frame (dpyinfo, event->xmap.window); if (f) { bool iconified = FRAME_ICONIFIED_P (f); @@ -6330,7 +6302,7 @@ case KeyPress: - dpyinfo->last_user_time = event.xkey.time; + dpyinfo->last_user_time = event->xkey.time; ignore_next_mouse_click_timeout = 0; #if defined (USE_X_TOOLKIT) || defined (USE_GTK) @@ -6359,7 +6331,7 @@ /* Scroll bars consume key events, but we want the keys to go to the scroll bar's frame. */ Widget widget = XtWindowToWidget (dpyinfo->display, - event.xkey.window); + event->xkey.window); if (widget && XmIsScrollBar (widget)) { widget = XtParent (widget); @@ -6388,6 +6360,8 @@ int modifiers; Lisp_Object coding_system = Qlatin_1; Lisp_Object c; + /* Event will be modified. */ + XKeyEvent xkey = event->xkey; #ifdef USE_GTK /* Don't pass keys to GTK. A Tab will shift focus to the @@ -6397,20 +6371,19 @@ *finish = X_EVENT_DROP; #endif - event.xkey.state - |= x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f), - extra_keyboard_modifiers); - modifiers = event.xkey.state; + xkey.state |= x_emacs_to_x_modifiers (FRAME_DISPLAY_INFO (f), + extra_keyboard_modifiers); + modifiers = xkey.state; /* This will have to go some day... */ /* make_lispy_event turns chars into control chars. Don't do it here because XLookupString is too eager. */ - event.xkey.state &= ~ControlMask; - event.xkey.state &= ~(dpyinfo->meta_mod_mask - | dpyinfo->super_mod_mask - | dpyinfo->hyper_mod_mask - | dpyinfo->alt_mod_mask); + xkey.state &= ~ControlMask; + xkey.state &= ~(dpyinfo->meta_mod_mask + | dpyinfo->super_mod_mask + | dpyinfo->hyper_mod_mask + | dpyinfo->alt_mod_mask); /* In case Meta is ComposeCharacter, clear its status. According to Markus Ehrnsperger @@ -6427,7 +6400,7 @@ coding_system = Vlocale_coding_system; nbytes = XmbLookupString (FRAME_XIC (f), - &event.xkey, (char *) copy_bufptr, + &xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, &status_return); if (status_return == XBufferOverflow) @@ -6435,7 +6408,7 @@ copy_bufsiz = nbytes + 1; copy_bufptr = alloca (copy_bufsiz); nbytes = XmbLookupString (FRAME_XIC (f), - &event.xkey, (char *) copy_bufptr, + &xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, &status_return); } @@ -6452,11 +6425,11 @@ emacs_abort (); } else - nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, + nbytes = XLookupString (&xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, &compose_status); #else - nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, + nbytes = XLookupString (&xkey, (char *) copy_bufptr, copy_bufsiz, &keysym, &compose_status); #endif @@ -6473,7 +6446,7 @@ XSETFRAME (inev.ie.frame_or_window, f); inev.ie.modifiers = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), modifiers); - inev.ie.timestamp = event.xkey.time; + inev.ie.timestamp = xkey.time; /* First deal with keysyms which have defined translations to characters. */ @@ -6649,6 +6622,8 @@ if (keysym == NoSymbol) break; } + /* FIXME: check side effects and remove this. */ + ((XEvent *) event)->xkey = xkey; } done_keysym: #ifdef HAVE_X_I18N @@ -6661,7 +6636,7 @@ #endif case KeyRelease: - dpyinfo->last_user_time = event.xkey.time; + dpyinfo->last_user_time = event->xkey.time; #ifdef HAVE_X_I18N /* Don't dispatch this event since XtDispatchEvent calls XFilterEvent, and two calls in a row may freeze the @@ -6672,35 +6647,35 @@ #endif case EnterNotify: - dpyinfo->last_user_time = event.xcrossing.time; - x_detect_focus_change (dpyinfo, any, &event, &inev.ie); + dpyinfo->last_user_time = event->xcrossing.time; + x_detect_focus_change (dpyinfo, any, event, &inev.ie); f = any; if (f && x_mouse_click_focus_ignore_position) - ignore_next_mouse_click_timeout = event.xmotion.time + 200; + ignore_next_mouse_click_timeout = event->xmotion.time + 200; /* EnterNotify counts as mouse movement, so update things that depend on mouse position. */ if (f && !f->output_data.x->hourglass_p) - note_mouse_movement (f, &event.xmotion); + note_mouse_movement (f, &event->xmotion); #ifdef USE_GTK /* We may get an EnterNotify on the buttons in the toolbar. In that case we moved out of any highlighted area and need to note this. */ if (!f && last_mouse_glyph_frame) - note_mouse_movement (last_mouse_glyph_frame, &event.xmotion); + note_mouse_movement (last_mouse_glyph_frame, &event->xmotion); #endif goto OTHER; case FocusIn: - x_detect_focus_change (dpyinfo, any, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, event, &inev.ie); goto OTHER; case LeaveNotify: - dpyinfo->last_user_time = event.xcrossing.time; - x_detect_focus_change (dpyinfo, any, &event, &inev.ie); + dpyinfo->last_user_time = event->xcrossing.time; + x_detect_focus_change (dpyinfo, any, event, &inev.ie); - f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); + f = x_top_window_to_frame (dpyinfo, event->xcrossing.window); if (f) { if (f == hlinfo->mouse_face_mouse_frame) @@ -6721,17 +6696,17 @@ #ifdef USE_GTK /* See comment in EnterNotify above */ else if (last_mouse_glyph_frame) - note_mouse_movement (last_mouse_glyph_frame, &event.xmotion); + note_mouse_movement (last_mouse_glyph_frame, &event->xmotion); #endif goto OTHER; case FocusOut: - x_detect_focus_change (dpyinfo, any, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, event, &inev.ie); goto OTHER; case MotionNotify: { - dpyinfo->last_user_time = event.xmotion.time; + dpyinfo->last_user_time = event->xmotion.time; previous_help_echo_string = help_echo_string; help_echo_string = Qnil; @@ -6739,7 +6714,7 @@ && FRAME_LIVE_P (last_mouse_frame)) f = last_mouse_frame; else - f = x_window_to_frame (dpyinfo, event.xmotion.window); + f = x_window_to_frame (dpyinfo, event->xmotion.window); if (hlinfo->mouse_face_hidden) { @@ -6748,7 +6723,7 @@ } #ifdef USE_GTK - if (f && xg_event_is_for_scrollbar (f, &event)) + if (f && xg_event_is_for_scrollbar (f, event)) f = 0; #endif if (f) @@ -6760,7 +6735,7 @@ { static Lisp_Object last_mouse_window; Lisp_Object window = window_from_coordinates - (f, event.xmotion.x, event.xmotion.y, 0, 0); + (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 @@ -6781,18 +6756,18 @@ /* Remember the last window where we saw the mouse. */ last_mouse_window = window; } - if (!note_mouse_movement (f, &event.xmotion)) + if (!note_mouse_movement (f, &event->xmotion)) help_echo_string = previous_help_echo_string; } else { #ifndef USE_TOOLKIT_SCROLL_BARS struct scroll_bar *bar - = x_window_to_scroll_bar (event.xmotion.display, - event.xmotion.window); + = x_window_to_scroll_bar (event->xmotion.display, + event->xmotion.window); if (bar) - x_scroll_bar_note_movement (bar, &event.xmotion); + x_scroll_bar_note_movement (bar, &event->xmotion); #endif /* USE_TOOLKIT_SCROLL_BARS */ /* If we move outside the frame, then we're @@ -6809,14 +6784,14 @@ } case ConfigureNotify: - f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); + f = x_top_window_to_frame (dpyinfo, event->xconfigure.window); #ifdef USE_GTK if (!f && (f = any) - && event.xconfigure.window == FRAME_X_WINDOW (f)) + && event->xconfigure.window == FRAME_X_WINDOW (f)) { - xg_frame_resized (f, event.xconfigure.width, - event.xconfigure.height); + xg_frame_resized (f, event->xconfigure.width, + event->xconfigure.height); f = 0; } #endif @@ -6824,8 +6799,8 @@ { #ifndef USE_X_TOOLKIT #ifndef USE_GTK - int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height); - int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width); + int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event->xconfigure.height); + int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event->xconfigure.width); /* In the toolkit version, change_frame_size is called by the code that handles resizing @@ -6836,16 +6811,16 @@ to check the pixel dimensions as well. */ if (columns != FRAME_COLS (f) || rows != FRAME_LINES (f) - || event.xconfigure.width != FRAME_PIXEL_WIDTH (f) - || event.xconfigure.height != FRAME_PIXEL_HEIGHT (f)) + || event->xconfigure.width != FRAME_PIXEL_WIDTH (f) + || event->xconfigure.height != FRAME_PIXEL_HEIGHT (f)) { change_frame_size (f, rows, columns, 0, 1, 0); SET_FRAME_GARBAGED (f); cancel_mouse_face (f); } - FRAME_PIXEL_WIDTH (f) = event.xconfigure.width; - FRAME_PIXEL_HEIGHT (f) = event.xconfigure.height; + FRAME_PIXEL_WIDTH (f) = event->xconfigure.width; + FRAME_PIXEL_HEIGHT (f) = event->xconfigure.height; #endif /* not USE_GTK */ #endif @@ -6876,17 +6851,17 @@ memset (&compose_status, 0, sizeof (compose_status)); last_mouse_glyph_frame = 0; - dpyinfo->last_user_time = event.xbutton.time; + 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_window_to_frame (dpyinfo, event->xbutton.window); #ifdef USE_GTK - if (f && xg_event_is_for_scrollbar (f, &event)) + if (f && xg_event_is_for_scrollbar (f, event)) f = 0; #endif if (f) @@ -6897,16 +6872,16 @@ && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) { Lisp_Object window; - int x = event.xbutton.x; - int y = event.xbutton.y; + int x = event->xbutton.x; + int y = event->xbutton.y; window = window_from_coordinates (f, x, y, 0, 1); tool_bar_p = EQ (window, f->tool_bar_window); - if (tool_bar_p && event.xbutton.button < 4) + if (tool_bar_p && event->xbutton.button < 4) handle_tool_bar_click - (f, x, y, event.xbutton.type == ButtonPress, - x_x_to_emacs_modifiers (dpyinfo, event.xbutton.state)); + (f, x, y, event->xbutton.type == ButtonPress, + x_x_to_emacs_modifiers (dpyinfo, event->xbutton.state)); } #endif /* !USE_GTK */ @@ -6917,52 +6892,52 @@ { if (ignore_next_mouse_click_timeout) { - if (event.type == ButtonPress - && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0) + if (event->type == ButtonPress + && (int)(event->xbutton.time - ignore_next_mouse_click_timeout) > 0) { ignore_next_mouse_click_timeout = 0; - construct_mouse_click (&inev.ie, &event.xbutton, f); + construct_mouse_click (&inev.ie, &event->xbutton, f); } - if (event.type == ButtonRelease) + if (event->type == ButtonRelease) ignore_next_mouse_click_timeout = 0; } else - construct_mouse_click (&inev.ie, &event.xbutton, f); + construct_mouse_click (&inev.ie, &event->xbutton, f); } if (FRAME_X_EMBEDDED_P (f)) - xembed_send_message (f, event.xbutton.time, + xembed_send_message (f, event->xbutton.time, XEMBED_REQUEST_FOCUS, 0, 0, 0); } else { struct scroll_bar *bar - = x_window_to_scroll_bar (event.xbutton.display, - event.xbutton.window); + = x_window_to_scroll_bar (event->xbutton.display, + event->xbutton.window); #ifdef USE_TOOLKIT_SCROLL_BARS /* Make the "Ctrl-Mouse-2 splits window" work for toolkit scroll bars. */ - if (bar && event.xbutton.state & ControlMask) + if (bar && event->xbutton.state & ControlMask) { - x_scroll_bar_handle_click (bar, &event, &inev.ie); + x_scroll_bar_handle_click (bar, event, &inev.ie); *finish = X_EVENT_DROP; } #else /* not USE_TOOLKIT_SCROLL_BARS */ if (bar) - x_scroll_bar_handle_click (bar, &event, &inev.ie); + x_scroll_bar_handle_click (bar, event, &inev.ie); #endif /* not USE_TOOLKIT_SCROLL_BARS */ } - if (event.type == ButtonPress) + if (event->type == ButtonPress) { - dpyinfo->grabbed |= (1 << event.xbutton.button); + dpyinfo->grabbed |= (1 << event->xbutton.button); last_mouse_frame = f; if (!tool_bar_p) last_tool_bar_item = -1; } else - dpyinfo->grabbed &= ~(1 << event.xbutton.button); + dpyinfo->grabbed &= ~(1 << event->xbutton.button); /* Ignore any mouse motion that happened before this event; any subsequent mouse-movement Emacs events should reflect @@ -6971,7 +6946,7 @@ f->mouse_moved = 0; #if defined (USE_X_TOOLKIT) || defined (USE_GTK) - f = x_menubar_window_to_frame (dpyinfo, &event); + f = x_menubar_window_to_frame (dpyinfo, event); /* For a down-event in the menu bar, don't pass it to Xt right now. Instead, save it away @@ -6980,19 +6955,23 @@ if (! popup_activated () #ifdef USE_GTK /* Gtk+ menus only react to the first three buttons. */ - && event.xbutton.button < 3 + && event->xbutton.button < 3 #endif - && f && event.type == ButtonPress + && f && event->type == ButtonPress /* Verify the event is really within the menu bar and not just sent to it due to grabbing. */ - && event.xbutton.x >= 0 - && event.xbutton.x < FRAME_PIXEL_WIDTH (f) - && event.xbutton.y >= 0 - && event.xbutton.y < f->output_data.x->menubar_height - && event.xbutton.same_screen) + && event->xbutton.x >= 0 + && event->xbutton.x < FRAME_PIXEL_WIDTH (f) + && event->xbutton.y >= 0 + && event->xbutton.y < f->output_data.x->menubar_height + && event->xbutton.same_screen) { - SET_SAVED_BUTTON_EVENT; - *finish = X_EVENT_DROP; + if (!f->output_data.x->saved_menu_event) + f->output_data.x->saved_menu_event = xmalloc (sizeof *event); + *f->output_data.x->saved_menu_event = *event; + inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; + XSETFRAME (inev.ie.frame_or_window, f); + *finish = X_EVENT_DROP; } else goto OTHER; @@ -7012,18 +6991,18 @@ case MappingNotify: /* Someone has changed the keyboard mapping - update the local cache. */ - switch (event.xmapping.request) + switch (event->xmapping.request) { case MappingModifier: x_find_modifier_meanings (dpyinfo); /* This is meant to fall through. */ case MappingKeyboard: - XRefreshKeyboardMapping (&event.xmapping); + XRefreshKeyboardMapping ((XMappingEvent *) &event->xmapping); } goto OTHER; case DestroyNotify: - xft_settings_event (dpyinfo, &event); + xft_settings_event (dpyinfo, event); break; default: @@ -7031,7 +7010,7 @@ #ifdef USE_X_TOOLKIT block_input (); if (*finish != X_EVENT_DROP) - XtDispatchEvent (&event); + XtDispatchEvent ((XEvent *) event); unblock_input (); #endif /* USE_X_TOOLKIT */ break; @@ -7069,7 +7048,6 @@ } SAFE_FREE (); - *eventptr = event; return count; } @@ -8554,7 +8532,7 @@ static int -x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) +x_handle_net_wm_state (struct frame *f, const XPropertyEvent * const event) { int value = FULLSCREEN_NONE; Lisp_Object lval; === modified file 'src/xterm.h' --- src/xterm.h 2013-09-15 08:28:30 +0000 +++ src/xterm.h 2013-09-16 10:41:41 +0000 @@ -888,11 +888,6 @@ #define SELECTION_EVENT_TIME(eventp) \ (((struct selection_input_event *) (eventp))->time) -/* From xselect.c. */ - -void x_handle_selection_notify (XSelectionEvent *); -void x_handle_property_notify (XPropertyEvent *); - /* From xfns.c. */ extern void x_free_gcs (struct frame *); @@ -946,8 +941,8 @@ /* Defined in xselect.c */ -extern void x_handle_property_notify (XPropertyEvent *); -extern void x_handle_selection_notify (XSelectionEvent *); +extern void x_handle_property_notify (const XPropertyEvent * const); +extern void x_handle_selection_notify (const XSelectionEvent * const); extern void x_handle_selection_event (struct input_event *); extern void x_clear_frame_selections (struct frame *); @@ -959,9 +954,9 @@ Lisp_Object values); extern int x_handle_dnd_message (struct frame *, - XClientMessageEvent *, + const XClientMessageEvent * const, struct x_display_info *, - struct input_event *bufp); + struct input_event *); extern int x_check_property_data (Lisp_Object); extern void x_fill_property_data (Display *, Lisp_Object, ------------------------------------------------------------ revno: 114300 committer: Glenn Morris branch nick: trunk timestamp: Mon 2013-09-16 06:17:41 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/configure' --- autogen/configure 2013-09-10 10:17:40 +0000 +++ autogen/configure 2013-09-16 10:17:41 +0000 @@ -10041,7 +10041,11 @@ - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + macfont_file="" + if test "${NS_IMPL_COCOA}" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSX 10.4 or newer" >&5 +$as_echo_n "checking for OSX 10.4 or newer... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -10066,6 +10070,45 @@ ns_osx_have_104=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ns_osx_have_104" >&5 +$as_echo "$ns_osx_have_104" >&6; } + + if test $ns_osx_have_104 = no; then + as_fn_error "\`OSX 10.4 or newer is required'" "$LINENO" 5; + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSX 10.5 or newer" >&5 +$as_echo_n "checking for OSX 10.5 or newer... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + +#ifdef MAC_OS_X_VERSION_MAX_ALLOWED +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 + ; /* OK */ +#else +#error "OSX 10.5 not found" +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ns_osx_have_105=yes +else + ns_osx_have_105=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ns_osx_have_105" >&5 +$as_echo "$ns_osx_have_105" >&6; } + if test $ns_osx_have_105 = yes; then + macfont_file="macfont.o" + fi + fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -10083,9 +10126,6 @@ ns_have_nsinteger=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ns_osx_have_104 = no; then - as_fn_error "\`OSX 10.4 or newer is required'" "$LINENO" 5; - fi if test $ns_have_nsinteger = yes; then $as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h @@ -10120,7 +10160,8 @@ leimdir="\${ns_appresdir}/leim" INSTALL_ARCH_INDEP_EXTRA= fi - NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o" + + NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o $macfont_file" fi CFLAGS="$tmp_CFLAGS" CPPFLAGS="$tmp_CPPFLAGS" ------------------------------------------------------------ revno: 114299 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-09-16 11:27:51 +0400 message: Fix X event waiting to handle multiple frames. * frame.h (struct frame) [HAVE_X_WINDOWS]: New member wait_event_type. * xterm.c (pending_event_wait): Remove. Adjust users. (x_detect_focus_change): Pass frame arg. (handle_one_xevent): Find related frame early and clear per-frame wait_event_type only if this is an event for the relevant frame. (x_wait_for_event): Use per-frame wait_event_type. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-09-15 19:43:32 +0000 +++ src/ChangeLog 2013-09-16 07:27:51 +0000 @@ -1,3 +1,13 @@ +2013-09-16 Dmitry Antipov + + Fix X event waiting to handle multiple frames. + * frame.h (struct frame) [HAVE_X_WINDOWS]: New member wait_event_type. + * xterm.c (pending_event_wait): Remove. Adjust users. + (x_detect_focus_change): Pass frame arg. + (handle_one_xevent): Find related frame early and clear per-frame + wait_event_type only if this is an event for the relevant frame. + (x_wait_for_event): Use per-frame wait_event_type. + 2013-09-15 Jan Djärv * nsfns.m (Fx_create_frame): Fix font driver registration for === modified file 'src/frame.h' --- src/frame.h 2013-09-15 07:06:05 +0000 +++ src/frame.h 2013-09-16 07:27:51 +0000 @@ -328,6 +328,11 @@ unsigned int external_menu_bar : 1; #endif +#if defined (HAVE_X_WINDOWS) + /* Used by x_wait_for_event when watching for an X event on this frame. */ + int wait_event_type; +#endif + /* Next two bitfields are mutually exclusive. They might both be zero if the frame has been made invisible without an icon. */ === modified file 'src/xterm.c' --- src/xterm.c 2013-09-15 08:28:30 +0000 +++ src/xterm.c 2013-09-16 07:27:51 +0000 @@ -159,13 +159,6 @@ static struct frame *pending_autoraise_frame; -/* This is a frame waiting for an event matching mask, within XTread_socket. */ - -static struct { - struct frame *f; - int eventtype; -} pending_event_wait; - #ifdef USE_X_TOOLKIT /* The application context for Xt use. */ XtAppContext Xt_app_con; @@ -293,8 +286,6 @@ static void x_new_focus_frame (struct x_display_info *, struct frame *); static void x_focus_changed (int, int, struct x_display_info *, struct frame *, struct input_event *); -static void x_detect_focus_change (struct x_display_info *, - XEvent *, struct input_event *); static void XTframe_rehighlight (struct frame *); static void x_frame_rehighlight (struct x_display_info *); static void x_draw_hollow_cursor (struct window *, struct glyph_row *); @@ -3549,12 +3540,10 @@ Returns FOCUS_IN_EVENT event in *BUFP. */ static void -x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct input_event *bufp) +x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, + XEvent *event, struct input_event *bufp) { - struct frame *frame; - - frame = x_any_window_to_frame (dpyinfo, event->xany.window); - if (! frame) + if (!frame) return; switch (event->type) @@ -5883,7 +5872,7 @@ int count = 0; int do_help = 0; ptrdiff_t nbytes = 0; - struct frame *f = NULL; + struct frame *any, *f = NULL; struct coding_system coding; XEvent event = *eventptr; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; @@ -5901,8 +5890,10 @@ inev.ie.kind = NO_EVENT; inev.ie.arg = Qnil; - if (pending_event_wait.eventtype == event.type) - pending_event_wait.eventtype = 0; /* Indicates we got it. */ + any = x_any_window_to_frame (dpyinfo, event.xany.window); + + if (any && any->wait_event_type == event.type) + any->wait_event_type = 0; /* Indicates we got it. */ switch (event.type) { @@ -5915,10 +5906,10 @@ if (event.xclient.data.l[0] == dpyinfo->Xatom_wm_take_focus) { - /* Use x_any_window_to_frame because this - could be the shell widget window - if the frame has no title bar. */ - f = x_any_window_to_frame (dpyinfo, event.xclient.window); + /* Use the value returned by x_any_window_to_frame + because this could be the shell widget window + if the frame has no title bar. */ + f = any; #ifdef HAVE_X_I18N /* Not quite sure this is needed -pd */ if (f && FRAME_XIC (f)) @@ -5995,8 +5986,7 @@ if (event.xclient.data.l[0] == dpyinfo->Xatom_wm_delete_window) { - f = x_any_window_to_frame (dpyinfo, - event.xclient.window); + f = any; if (!f) goto OTHER; /* May be a dialog that is to be removed */ @@ -6035,7 +6025,7 @@ if (event.xclient.message_type == dpyinfo->Xatom_editres) { - f = x_any_window_to_frame (dpyinfo, event.xclient.window); + f = any; if (f) _XEditResCheckMessages (f->output_data.x->widget, NULL, &event, NULL); @@ -6079,7 +6069,7 @@ { enum xembed_message msg = event.xclient.data.l[1]; if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT) - x_detect_focus_change (dpyinfo, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, &event, &inev.ie); *finish = X_EVENT_GOTO_OUT; goto done; @@ -6087,7 +6077,7 @@ xft_settings_event (dpyinfo, &event); - f = x_any_window_to_frame (dpyinfo, event.xclient.window); + f = any; if (!f) goto OTHER; if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev.ie)) @@ -6349,7 +6339,7 @@ goto OTHER; #endif - f = x_any_window_to_frame (dpyinfo, event.xkey.window); + f = any; #if ! defined (USE_GTK) /* If mouse-highlight is an integer, input clears out @@ -6683,9 +6673,9 @@ case EnterNotify: dpyinfo->last_user_time = event.xcrossing.time; - x_detect_focus_change (dpyinfo, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, &event, &inev.ie); - f = x_any_window_to_frame (dpyinfo, event.xcrossing.window); + f = any; if (f && x_mouse_click_focus_ignore_position) ignore_next_mouse_click_timeout = event.xmotion.time + 200; @@ -6703,12 +6693,12 @@ goto OTHER; case FocusIn: - x_detect_focus_change (dpyinfo, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, &event, &inev.ie); goto OTHER; case LeaveNotify: dpyinfo->last_user_time = event.xcrossing.time; - x_detect_focus_change (dpyinfo, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, &event, &inev.ie); f = x_top_window_to_frame (dpyinfo, event.xcrossing.window); if (f) @@ -6736,7 +6726,7 @@ goto OTHER; case FocusOut: - x_detect_focus_change (dpyinfo, &event, &inev.ie); + x_detect_focus_change (dpyinfo, any, &event, &inev.ie); goto OTHER; case MotionNotify: @@ -6822,7 +6812,7 @@ f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); #ifdef USE_GTK if (!f - && (f = x_any_window_to_frame (dpyinfo, event.xconfigure.window)) + && (f = any) && event.xconfigure.window == FRAME_X_WINDOW (f)) { xg_frame_resized (f, event.xconfigure.width, @@ -8733,15 +8723,14 @@ struct timespec tmo, tmo_at, time_now; int fd = ConnectionNumber (FRAME_X_DISPLAY (f)); - pending_event_wait.f = f; - pending_event_wait.eventtype = eventtype; + f->wait_event_type = eventtype; /* Set timeout to 0.1 second. Hopefully not noticeable. Maybe it should be configurable. */ tmo = make_timespec (0, 100 * 1000 * 1000); tmo_at = timespec_add (current_timespec (), tmo); - while (pending_event_wait.eventtype) + while (f->wait_event_type) { pending_signals = 1; totally_unblock_input (); @@ -8760,8 +8749,8 @@ if (pselect (fd + 1, &fds, NULL, NULL, &tmo, NULL) == 0) break; /* Timeout */ } - pending_event_wait.f = 0; - pending_event_wait.eventtype = 0; + + f->wait_event_type = 0; } @@ -10684,8 +10673,6 @@ #endif pending_autoraise_frame = 0; - pending_event_wait.f = 0; - pending_event_wait.eventtype = 0; /* Note that there is no real way portable across R3/R4 to get the original error handler. */ ------------------------------------------------------------ revno: 114298 fixes bug: http://debbugs.gnu.org/15369 committer: Dmitry Gutov branch nick: trunk timestamp: Mon 2013-09-16 02:42:26 +0300 message: * lisp/progmodes/ruby-mode.el (ruby-operator-re): Consider line continuation character an operator, as far as indentation is concerned. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-09-15 16:08:04 +0000 +++ lisp/ChangeLog 2013-09-15 23:42:26 +0000 @@ -1,3 +1,9 @@ +2013-09-15 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-operator-re): Consider line + continuation character an operator, as far as indentation is + concerned (Bug#15369). + 2013-09-15 Martin Rudalics * window.el (window--state-put-2): Don't process buffer state === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-09-12 05:43:55 +0000 +++ lisp/progmodes/ruby-mode.el 2013-09-15 23:42:26 +0000 @@ -132,7 +132,7 @@ ruby-block-end-re "\\|}\\|\\]\\)") "Regexp to match where the indentation gets shallower.") -(defconst ruby-operator-re "[-,.+*/%&|^~=<>:]" +(defconst ruby-operator-re "[-,.+*/%&|^~=<>:]\\|\\\\$" "Regexp to match operators.") (defconst ruby-symbol-chars "a-zA-Z0-9_" === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-09-03 00:29:10 +0000 +++ test/indent/ruby.rb 2013-09-15 23:42:26 +0000 @@ -71,3 +71,7 @@ if something == :== do_something end + +# Bug#15369 +MSG = 'Separate every 3 digits in the integer portion of a number' \ + 'with underscores(_).'