------------------------------------------------------------ revno: 115394 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-12-06 09:49:05 +0400 message: * xterm.c (input_signal_count): Remove. (x_dispatch_event): Define unconditionally. (x_make_frame_visible): Process X events until the frame is really visible (Bug#16027). * xterm.h (x_dispatch_event): Declare unconditionally. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-05 16:20:11 +0000 +++ src/ChangeLog 2013-12-06 05:49:05 +0000 @@ -1,3 +1,11 @@ +2013-12-06 Dmitry Antipov + + * xterm.c (input_signal_count): Remove. + (x_dispatch_event): Define unconditionally. + (x_make_frame_visible): Process X events until the frame + is really visible (Bug#16027). + * xterm.h (x_dispatch_event): Declare unconditionally. + 2013-12-05 Jan Djärv * nsfns.m (ns_frame_parm_handlers): Add right/bottom_divider_width. === modified file 'src/xterm.c' --- src/xterm.c 2013-12-05 13:46:30 +0000 +++ src/xterm.c 2013-12-06 05:49:05 +0000 @@ -165,11 +165,6 @@ static Time ignore_next_mouse_click_timeout; -/* Incremented by XTread_socket whenever it really tries to read - events. */ - -static int volatile input_signal_count; - /* Used locally within XTread_socket. */ static int x_noop_count; @@ -253,9 +248,6 @@ static int handle_one_xevent (struct x_display_info *, const XEvent *, int *, struct input_event *); -#ifdef USE_GTK -static int x_dispatch_event (XEvent *, Display *); -#endif /* Don't declare this _Noreturn because we want no interference with debugging failing X calls. */ static void x_connection_closed (Display *, const char *); @@ -6853,8 +6845,6 @@ return count; } -#if defined USE_GTK || defined USE_X_TOOLKIT - /* Handles the XEvent EVENT on display DISPLAY. This is used for event loops outside the normal event handling, i.e. looping while a popup menu or a dialog is posted. @@ -6873,8 +6863,6 @@ return finish; } -#endif - /* Read events coming from the X server. Return as soon as there are no more events to be read. @@ -6893,9 +6881,6 @@ block_input (); - /* So people can tell when we have read the available input. */ - input_signal_count++; - /* For debugging, this gives a way to fake an I/O error. */ if (dpyinfo == XTread_socket_fake_io_error) { @@ -8826,9 +8811,6 @@ x_make_frame_visible (struct frame *f) { int original_top, original_left; - int retry_count = 2; - - retry: block_input (); @@ -8877,7 +8859,6 @@ so that incoming events are handled. */ { Lisp_Object frame; - int count; /* This must be before UNBLOCK_INPUT since events that arrive in response to the actions above will set it when they are handled. */ @@ -8931,46 +8912,18 @@ XSETFRAME (frame, f); - /* Wait until the frame is visible. Process X events until a - MapNotify event has been seen, or until we think we won't get a - MapNotify at all.. */ - for (count = input_signal_count + 10; - input_signal_count < count && !FRAME_VISIBLE_P (f);) + /* Process X events until a MapNotify event has been seen. */ + while (!FRAME_VISIBLE_P (f)) { /* Force processing of queued events. */ x_sync (f); - - /* Machines that do polling rather than SIGIO have been - observed to go into a busy-wait here. So we'll fake an - alarm signal to let the handler know that there's something - to be read. We used to raise a real alarm, but it seems - that the handler isn't always enabled here. This is - probably a bug. */ - if (input_polling_used ()) + if (XPending (FRAME_X_DISPLAY (f))) { - /* It could be confusing if a real alarm arrives while - processing the fake one. Turn it off and let the - handler reset it. */ - int old_poll_suppress_count = poll_suppress_count; - poll_suppress_count = 1; - poll_for_input_1 (); - poll_suppress_count = old_poll_suppress_count; + XEvent xev; + XNextEvent (FRAME_X_DISPLAY (f), &xev); + x_dispatch_event (&xev, FRAME_X_DISPLAY (f)); } } - - /* 2000-09-28: In - - (let ((f (selected-frame))) - (iconify-frame f) - (raise-frame f)) - - the frame is not raised with various window managers on - FreeBSD, GNU/Linux and Solaris. It turns out that, for some - unknown reason, the call to XtMapWidget is completely ignored. - Mapping the widget a second time works. */ - - if (!FRAME_VISIBLE_P (f) && --retry_count != 0) - goto retry; } } === modified file 'src/xterm.h' --- src/xterm.h 2013-12-02 13:35:53 +0000 +++ src/xterm.h 2013-12-06 05:49:05 +0000 @@ -945,9 +945,7 @@ extern void x_mouse_leave (struct x_display_info *); #endif -#ifdef USE_X_TOOLKIT extern int x_dispatch_event (XEvent *, Display *); -#endif extern int x_x_to_emacs_modifiers (struct x_display_info *, int); extern int x_display_pixel_height (struct x_display_info *); extern int x_display_pixel_width (struct x_display_info *); ------------------------------------------------------------ revno: 115393 committer: Leo Liu branch nick: trunk timestamp: Fri 2013-12-06 12:26:17 +0800 message: * progmodes/octave.el (inferior-octave-prompt): Use shy groups. (inferior-octave-startup): Always use "octave> " for prompt. (octave-goto-function-definition) (octave-sync-function-file-names) (octave-find-definition-default-filename): Remove redundant backquotes. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-06 04:22:08 +0000 +++ lisp/ChangeLog 2013-12-06 04:26:17 +0000 @@ -1,3 +1,11 @@ +2013-12-06 Leo Liu + + * progmodes/octave.el (inferior-octave-prompt): Use shy groups. + (inferior-octave-startup): Always use "octave> " for prompt. + (octave-goto-function-definition) + (octave-sync-function-file-names) + (octave-find-definition-default-filename): Remove redundant backquotes. + 2013-12-06 Dmitry Gutov * progmodes/ruby-mode.el (ruby-mode-syntax-table): Don't modify === modified file 'lisp/progmodes/octave.el' --- lisp/progmodes/octave.el 2013-12-06 00:48:52 +0000 +++ lisp/progmodes/octave.el 2013-12-06 04:26:17 +0000 @@ -444,7 +444,7 @@ "unwind_protect_cleanup") (smie-rule-parent octave-block-offset) ;; For (invalid) code between switch and case. - ;; (if (smie-parent-p "switch") 4) + ;; (if (smie-rule-parent-p "switch") 4) nil)))) (defun octave-indent-comment () @@ -599,7 +599,9 @@ :group 'octave) (defcustom inferior-octave-prompt - "\\(^octave\\(\\|.bin\\|.exe\\|-gui\\)\\(-[.0-9]+\\)?\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ " + ;; For Octave >= 3.8, default is always 'octave', see + ;; http://hg.savannah.gnu.org/hgweb/octave/rev/708173343c50 + "\\(?:^octave\\(?:.bin\\|.exe\\)?\\(?:-[.0-9]+\\)?\\(?::[0-9]+\\)?\\|^debug\\|^\\)>+ " "Regexp to match prompts for the inferior Octave process." :type 'regexp :group 'octave) @@ -821,7 +823,8 @@ (inferior-octave-send-list-and-digest (list "more off;\n" (unless (equal inferior-octave-output-string ">> ") - "PS1 ('\\s> ');\n") + ;; See http://hg.savannah.gnu.org/hgweb/octave/rev/708173343c50 + "PS1 ('octave> ');\n") (when (and inferior-octave-startup-file (file-exists-p inferior-octave-startup-file)) (format "source ('%s');\n" inferior-octave-startup-file)))) @@ -1030,8 +1033,8 @@ (unless found (goto-char orig)) found)))) (pcase (and buffer-file-name (file-name-extension buffer-file-name)) - (`"cc" (funcall search - "\\_ branch nick: trunk timestamp: Fri 2013-12-06 06:22:08 +0200 message: Fix Bug#15874 * lisp/progmodes/ruby-mode.el (ruby-mode-syntax-table): Don't modify syntax for `?'. (ruby-expr-beg): Expect that `!' will have syntax class "symbol" where appropriate already. (ruby-syntax-propertize-function): Propertize `?' and `!' at the end of method names. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-06 00:55:20 +0000 +++ lisp/ChangeLog 2013-12-06 04:22:08 +0000 @@ -1,3 +1,12 @@ +2013-12-06 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-mode-syntax-table): Don't modify + syntax for `?'. + (ruby-expr-beg): Expect that `!' will have syntax class "symbol" + where appropriate already. + (ruby-syntax-propertize-function): Propertize `?' and `!' at the + end of method names (Bug#15874). + 2013-12-06 Juri Linkov * isearch.el (isearch--saved-overriding-local-map): === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-11-22 12:36:38 +0000 +++ lisp/progmodes/ruby-mode.el 2013-12-06 04:22:08 +0000 @@ -186,7 +186,6 @@ (modify-syntax-entry ?\n ">" table) (modify-syntax-entry ?\\ "\\" table) (modify-syntax-entry ?$ "." table) - (modify-syntax-entry ?? "_" table) (modify-syntax-entry ?_ "_" table) (modify-syntax-entry ?: "_" table) (modify-syntax-entry ?< "." table) @@ -783,7 +782,7 @@ ruby-block-mid-keywords) 'words)) (goto-char (match-end 0)) - (not (looking-at "\\s_\\|!"))) + (not (looking-at "\\s_"))) ((eq option 'expr-qstr) (looking-at "[a-zA-Z][a-zA-z0-9_]* +%[^ \t]")) ((eq option 'expr-re) @@ -1648,6 +1647,14 @@ ;; Not within a string. (nth 3 (syntax-ppss (match-beginning 0)))) (string-to-syntax "\\")))) + ;; Part of symbol when at the end of a method name. + ("[!?]" + (0 (unless (save-excursion + (or (nth 8 (syntax-ppss (match-beginning 0))) + (let (parse-sexp-lookup-properties) + (or (zerop (skip-syntax-backward "w_")) + (memq (preceding-char) '(?@ ?$)))))) + (string-to-syntax "_")))) ;; Regular expressions. Start with matching unescaped slash. ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)" (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1))))) === modified file 'test/automated/ruby-mode-tests.el' --- test/automated/ruby-mode-tests.el 2013-11-22 03:08:31 +0000 +++ test/automated/ruby-mode-tests.el 2013-12-06 04:22:08 +0000 @@ -91,8 +91,7 @@ (ert-deftest ruby-no-heredoc-inside-quotes () (ruby-assert-state "\"<<\", \"\",\nfoo" 3 nil)) -;; Change result if you fix http://debbugs.gnu.org/15874 -(ert-deftest ruby-exit!-font-lock () :expected-result :failed +(ert-deftest ruby-exit!-font-lock () (ruby-assert-face "exit!" 5 font-lock-builtin-face)) (ert-deftest ruby-deep-indent () ------------------------------------------------------------ revno: 115391 fixes bug: http://debbugs.gnu.org/16035 committer: Juri Linkov branch nick: trunk timestamp: Fri 2013-12-06 02:55:20 +0200 message: * lisp/isearch.el (isearch--saved-overriding-local-map): New internal variable. (isearch-mode): Set it to the initial value of `overriding-terminal-local-map'. (isearch-pre-command-hook): Compare `overriding-terminal-local-map' with `isearch--saved-overriding-local-map'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-06 00:48:52 +0000 +++ lisp/ChangeLog 2013-12-06 00:55:20 +0000 @@ -1,3 +1,12 @@ +2013-12-06 Juri Linkov + + * isearch.el (isearch--saved-overriding-local-map): + New internal variable. + (isearch-mode): Set it to the initial value of + `overriding-terminal-local-map'. + (isearch-pre-command-hook): Compare `overriding-terminal-local-map' + with `isearch--saved-overriding-local-map'. (Bug#16035) + 2013-12-06 Dmitry Gutov * progmodes/octave.el (inferior-octave-completion-table): Turn === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-12-04 00:12:02 +0000 +++ lisp/isearch.el 2013-12-06 00:55:20 +0000 @@ -637,6 +637,8 @@ ;; isearch is invoked. (defvar isearch-input-method-local-p nil) +(defvar isearch--saved-overriding-local-map nil) + ;; Minor-mode-alist changes - kind of redundant with the ;; echo area, but if isearching in multiple windows, it can be useful. @@ -904,6 +906,9 @@ (setq overriding-terminal-local-map isearch-mode-map) (run-hooks 'isearch-mode-hook) + ;; Remember the initial map possibly modified + ;; by external packages in isearch-mode-hook. (Bug#16035) + (setq isearch--saved-overriding-local-map overriding-terminal-local-map) ;; Pushing the initial state used to be before running isearch-mode-hook, ;; but a hook might set `isearch-push-state-function' used in @@ -2235,7 +2240,7 @@ (cond ;; Don't exit Isearch if we're in the middle of some ;; set-temporary-overlay-map thingy like universal-argument--mode. - ((not (eq overriding-terminal-local-map isearch-mode-map))) + ((not (eq overriding-terminal-local-map isearch--saved-overriding-local-map))) ;; Don't exit Isearch for isearch key bindings. ((commandp (lookup-key isearch-mode-map key nil))) ;; Optionally edit the search string instead of exiting. ------------------------------------------------------------ revno: 115390 fixes bug: http://debbugs.gnu.org/11906 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2013-12-06 02:48:52 +0200 message: Add caching variant of `completion-table-dynamic' * lisp/minibuffer.el (completion-table-with-cache): New function. * lisp/progmodes/octave.el (inferior-octave-completion-table): Turn back into function, use `completion-table-with-cache'. Update all references. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-05 20:25:54 +0000 +++ lisp/ChangeLog 2013-12-06 00:48:52 +0000 @@ -1,3 +1,11 @@ +2013-12-06 Dmitry Gutov + + * progmodes/octave.el (inferior-octave-completion-table): Turn + back into function, use `completion-table-with-cache' + (Bug#11906). Update all references. + + * minibuffer.el (completion-table-with-cache): New function. + 2013-12-05 Cameron Desautels (tiny change) * emacs-lisp/regexp-opt.el (regexp-opt-charset): Fix ^ (bug#16046). === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2013-11-24 14:08:02 +0000 +++ lisp/minibuffer.el 2013-12-06 00:48:52 +0000 @@ -190,6 +190,24 @@ (current-buffer))) (complete-with-action action (funcall fun string) string pred))))) +(defun completion-table-with-cache (fun &optional ignore-case) + "Create dynamic completion table from FUN, with cache. +This wraps `completion-table-dynamic', but saves the last +argument-result pair from FUN, so that several lookups with the +same argument (or with an argument that starts with the first one) +only need to call FUN once. Most useful when FUN performs a relatively +slow operation, such as calling an external process (see Bug#11906). +When IGNORE-CASE is non-nil, FUN is expected to be case-insensitive." + (let* (last-arg last-result + (new-fun + (lambda (arg) + (if (and last-arg (string-prefix-p last-arg arg ignore-case)) + last-result + (prog1 + (setq last-result (funcall fun arg)) + (setq last-arg arg)))))) + (completion-table-dynamic new-fun))) + (defmacro lazy-completion-table (var fun) "Initialize variable VAR as a lazy completion table. If the completion table VAR is used for the first time (e.g., by passing VAR === modified file 'lisp/progmodes/octave.el' --- lisp/progmodes/octave.el 2013-12-02 07:13:01 +0000 +++ lisp/progmodes/octave.el 2013-12-06 00:48:52 +0000 @@ -838,21 +838,13 @@ ;; `comint-history-isearch-backward-regexp'. Bug#14433. (comint-send-string proc "\n"))) -(defvar inferior-octave-completion-table - ;; - ;; Use cache to avoid repetitive computation of completions due to - ;; bug#11906 - http://debbugs.gnu.org/11906 - which may cause - ;; noticeable delay. CACHE: (CMD . VALUE). - (let ((cache)) - (completion-table-dynamic - (lambda (command) - (unless (equal (car cache) command) - (inferior-octave-send-list-and-digest - (list (format "completion_matches ('%s');\n" command))) - (setq cache (cons command - (delete-consecutive-dups - (sort inferior-octave-output-list 'string-lessp))))) - (cdr cache))))) +(defun inferior-octave-completion-table () + (completion-table-with-cache + (lambda (command) + (inferior-octave-send-list-and-digest + (list (format "completion_matches ('%s');\n" command))) + (delete-consecutive-dups + (sort inferior-octave-output-list 'string-lessp))))) (defun inferior-octave-completion-at-point () "Return the data to complete the Octave symbol at point." @@ -864,7 +856,7 @@ (end (point))) (when (and beg (> end beg)) (list beg end (completion-table-in-turn - inferior-octave-completion-table + (inferior-octave-completion-table) 'comint-completion-file-name-table)))))) (define-obsolete-function-alias 'inferior-octave-complete @@ -1022,7 +1014,7 @@ (completing-read (format (if def "Function (default %s): " "Function: ") def) - inferior-octave-completion-table + (inferior-octave-completion-table) nil nil nil nil def))) (defun octave-goto-function-definition (fn) @@ -1406,7 +1398,7 @@ (setq end (point)))) (when (> end beg) (list beg end (or (and (inferior-octave-process-live-p) - inferior-octave-completion-table) + (inferior-octave-completion-table)) octave-reserved-words))))) (define-obsolete-function-alias 'octave-complete-symbol ------------------------------------------------------------ revno: 115389 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16046 author: Cameron Desautels committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-12-05 15:25:54 -0500 message: * lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Fix ^. * test/automated/regexp-tests.el: New file. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-05 16:04:53 +0000 +++ lisp/ChangeLog 2013-12-05 20:25:54 +0000 @@ -1,3 +1,7 @@ +2013-12-05 Cameron Desautels (tiny change) + + * emacs-lisp/regexp-opt.el (regexp-opt-charset): Fix ^ (bug#16046). + 2013-12-05 Teodor Zlatanov * net/eww.el (eww-current-source): New variable to store page === modified file 'lisp/emacs-lisp/regexp-opt.el' --- lisp/emacs-lisp/regexp-opt.el 2013-01-01 09:11:05 +0000 +++ lisp/emacs-lisp/regexp-opt.el 2013-12-05 20:25:54 +0000 @@ -285,7 +285,9 @@ ;; ;; Make sure a caret is not first and a dash is first or last. (if (and (string-equal charset "") (string-equal bracket "")) - (concat "[" dash caret "]") + (if (string-equal dash "") + "\\^" ; [^] is not a valid regexp + (concat "[" dash caret "]")) (concat "[" bracket charset caret dash "]")))) (provide 'regexp-opt) === modified file 'test/ChangeLog' --- test/ChangeLog 2013-11-29 10:33:31 +0000 +++ test/ChangeLog 2013-12-05 20:25:54 +0000 @@ -1,13 +1,16 @@ +2013-12-05 Stefan Monnier + + * automated/regexp-tests.el: New file. + 2013-11-29 Eli Zaretskii - * automated/reftex-tests.el (reftex-parse-from-file-test): Run - temp-dir through file-truename, to make sure the temporary file + * automated/reftex-tests.el (reftex-parse-from-file-test): + Run temp-dir through file-truename, to make sure the temporary file names are comparable as strings. * automated/decoder-tests.el (ert-test-decoder-prefer-utf-8): Force Unix EOLs by using 'utf-8-unix', since the default of - 'utf-8' is system-dependent, while the test expects to see Unix - EOLs. + 'utf-8' is system-dependent, while the test expects to see Unix EOLs. 2013-11-28 Glenn Morris @@ -15,8 +18,7 @@ 2013-11-28 Eli Zaretskii - * automated/Makefile.in (PATH_SEP): Set this instead of - PATH_SEPARATOR. + * automated/Makefile.in (PATH_SEP): Set this instead of PATH_SEPARATOR. (EMACSOPT): Use $(PATH_SEP). 2013-11-28 Michael Albinus @@ -115,8 +117,7 @@ (tramp-test22-file-times, tramp-test23-visited-file-modtime) (tramp-test24-file-name-completion, tramp-test25-load) (tramp-test26-process-file, tramp-test27-start-file-process): - (tramp-test28-shell-command): Protect unwindforms with - `ignore-errors'. + (tramp-test28-shell-command): Protect unwindforms with `ignore-errors'. (tramp-test29-utf8): New test. 2013-11-13 Michael Albinus === added file 'test/automated/regexp-tests.el' --- test/automated/regexp-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/regexp-tests.el 2013-12-05 20:25:54 +0000 @@ -0,0 +1,31 @@ +;;; regexp-tests.el --- Test suite for regular expression handling. + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;; Author: Stefan Monnier +;; Keywords: internal +;; Human-Keywords: internal + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(ert-deftest regexp-test-regexp-opt () + "Test the `compilation-error-regexp-alist' regexps. +The test data is in `compile-tests--test-regexps-data'." + (should (string-match (regexp-opt-charset '(?^)) "a^b"))) + +;;; regexp-tests.el ends here. ------------------------------------------------------------ revno: 115388 committer: Jan D. branch nick: trunk timestamp: Thu 2013-12-05 17:20:11 +0100 message: Fix some pixelwise breakage, more remain. * nsfns.m (ns_frame_parm_handlers): Add right/bottom_divider_width. * nsterm.m (x_set_window_size): Handle pixelwise. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-05 13:46:30 +0000 +++ src/ChangeLog 2013-12-05 16:20:11 +0000 @@ -1,3 +1,9 @@ +2013-12-05 Jan Djärv + + * nsfns.m (ns_frame_parm_handlers): Add right/bottom_divider_width. + + * nsterm.m (x_set_window_size): Handle pixelwise. + 2013-12-05 Martin Rudalics * w32term.c (x_new_font): === modified file 'src/nsfns.m' --- src/nsfns.m 2013-11-30 09:25:31 +0000 +++ src/nsfns.m 2013-12-05 16:20:11 +0000 @@ -946,6 +946,8 @@ x_set_icon_name, x_set_icon_type, x_set_internal_border_width, /* generic OK */ + 0, /* x_set_right_divider_width */ + 0, /* x_set_bottom_divider_width */ x_set_menu_bar_lines, x_set_mouse_color, x_explicitly_set_name, === modified file 'src/nsterm.m' --- src/nsterm.m 2013-12-01 22:33:13 +0000 +++ src/nsterm.m 2013-12-05 16:20:11 +0000 @@ -1258,7 +1258,7 @@ if (view == nil) return; -/*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ +/*fprintf (stderr, "\tsetWindowSize: %d x %d, pixelwise %d, font size %d x %d\n", cols, rows, pixelwise, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f));*/ block_input (); @@ -1267,8 +1267,18 @@ f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); compute_fringe_widths (f, 0); - pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); - pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); + if (pixelwise) + { + pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, cols); + pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, rows); + cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); + } + else + { + pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); + pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); + } /* If we have a toolbar, take its height into account. */ if (tb && ! [view isFullscreen]) ------------------------------------------------------------ revno: 115387 committer: Ted Zlatanov branch nick: quickfixes timestamp: Thu 2013-12-05 11:04:53 -0500 message: eww: add command to view page source * net/eww.el (eww-current-source): New variable to store page source. (eww-display-html, eww-mode, eww-save-history) (eww-restore-history): Use it. (eww-view-source): New command to view page source. Opportunistically uses `html-mode' to highlight the buffer. (eww-mode-map): Install it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-05 15:29:59 +0000 +++ lisp/ChangeLog 2013-12-05 16:04:53 +0000 @@ -1,3 +1,13 @@ +2013-12-05 Teodor Zlatanov + + * net/eww.el (eww-current-source): New variable to store page + source. + (eww-display-html, eww-mode, eww-save-history) + (eww-restore-history): Use it. + (eww-view-source): New command to view page source. + Opportunistically uses `html-mode' to highlight the buffer. + (eww-mode-map): Install it. + 2013-12-05 Michael Albinus * net/dbus.el (dbus-unregister-service) === modified file 'lisp/net/eww.el' --- lisp/net/eww.el 2013-12-03 04:54:17 +0000 +++ lisp/net/eww.el 2013-12-05 16:04:53 +0000 @@ -117,6 +117,7 @@ (defvar eww-current-url nil) (defvar eww-current-dom nil) +(defvar eww-current-source nil) (defvar eww-current-title "" "Title of current page.") (defvar eww-history nil) @@ -247,6 +248,7 @@ (list 'base (list (cons 'href url)) (libxml-parse-html-region (point) (point-max)))))) + (setq eww-current-source (buffer-substring (point) (point-max))) (eww-setup-buffer) (setq eww-current-dom document) (let ((inhibit-read-only t) @@ -375,6 +377,18 @@ (unless (eq major-mode 'eww-mode) (eww-mode))) +(defun eww-view-source () + (interactive) + (let ((buf (get-buffer-create "*eww-source*")) + (source eww-current-source)) + (with-current-buffer buf + (delete-region (point-min) (point-max)) + (insert (or eww-current-source "no source")) + (goto-char (point-min)) + (when (featurep 'html-mode) + (html-mode))) + (view-buffer buf))) + (defvar eww-mode-map (let ((map (make-sparse-keymap))) (suppress-keymap map) @@ -395,6 +409,7 @@ (define-key map "d" 'eww-download) (define-key map "w" 'eww-copy-page-url) (define-key map "C" 'url-cookie-list) + (define-key map "v" 'eww-view-source) (define-key map "b" 'eww-add-bookmark) (define-key map "B" 'eww-list-bookmarks) @@ -411,6 +426,7 @@ :active (not (zerop eww-history-position))] ["Browse with external browser" eww-browse-with-external-browser t] ["Download" eww-download t] + ["View page source" eww-view-source] ["Copy page URL" eww-copy-page-url t] ["Add bookmark" eww-add-bookmark t] ["List bookmarks" eww-copy-page-url t] @@ -424,6 +440,7 @@ ;; FIXME? This seems a strange default. (set (make-local-variable 'eww-current-url) 'author) (set (make-local-variable 'eww-current-dom) nil) + (set (make-local-variable 'eww-current-source) nil) (set (make-local-variable 'browse-url-browser-function) 'eww-browse-url) (set (make-local-variable 'after-change-functions) 'eww-process-text-input) (set (make-local-variable 'eww-history) nil) @@ -437,6 +454,7 @@ :title eww-current-title :point (point) :dom eww-current-dom + :source eww-current-source :text (buffer-string)) eww-history)) @@ -468,6 +486,7 @@ (let ((inhibit-read-only t)) (erase-buffer) (insert (plist-get elem :text)) + (setq eww-current-source (plist-get elem :source)) (setq eww-current-dom (plist-get elem :dom)) (goto-char (plist-get elem :point)) (setq eww-current-url (plist-get elem :url) ------------------------------------------------------------ revno: 115386 committer: Michael Albinus branch nick: trunk timestamp: Thu 2013-12-05 16:34:30 +0100 message: * dbus.texi (Type Conversion): Clarify unibyte-ness of strings. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2013-11-30 18:34:58 +0000 +++ doc/misc/ChangeLog 2013-12-05 15:34:30 +0000 @@ -1,3 +1,7 @@ +2013-12-05 Michael Albinus + + * dbus.texi (Type Conversion): Clarify unibyte-ness of strings. + 2013-11-30 Glenn Morris * Makefile.in (distclean): Remove Makefile. === modified file 'doc/misc/dbus.texi' --- doc/misc/dbus.texi 2013-07-03 07:51:34 +0000 +++ doc/misc/dbus.texi 2013-12-05 15:34:30 +0000 @@ -1138,10 +1138,11 @@ (@var{INTEGER} ((@var{STRING} @var{BOOL} @var{BOOL}) (@var{STRING} @var{BOOL} @var{BOOL}) @dots{})) @end lisp -@defun dbus-byte-array-to-string byte-array +@defun dbus-byte-array-to-string byte-array &optional multibyte If a D-Bus method or signal returns an array of bytes, which are known to represent an UTF8 string, this function converts @var{byte-array} -to the corresponding string. Example: +to the corresponding string. The string is unibyte encoded, unless +@var{multibyte} is non-@code{nil}. Example: @lisp (dbus-byte-array-to-string '(47 101 116 99 47 104 111 115 116 115)) @@ -1151,20 +1152,30 @@ @end defun @defun dbus-unescape-from-identifier string -Retrieve the original string from the encoded @var{string}. -@var{string} must have been coded with +Retrieve the original string from the encoded @var{string} as unibyte +string. @var{string} must have been encoded with @code{dbus-escape-as-identifier}. Example: @lisp (dbus-unescape-from-identifier "_30123abc_5fxyz_01_ff") -@ifinfo -@result{} "0123abc_xyz^Aÿ" -@end ifinfo -@ifnotinfo -@result{} "0123abc_xyz^A@"y" -@end ifnotinfo -@end lisp +@result{} "0123abc_xyz\x01\xff" +@end lisp + +If the original string used in @code{dbus-escape-as-identifier} is a +multibyte string, it cannot be expected that this function returns +that string: + +@lisp +(string-equal + (dbus-unescape-from-identifier + (dbus-escape-as-identifier "Grüß Göttin")) + "Grüß Göttin") + +@result{} nil +@end lisp + + @end defun ------------------------------------------------------------ revno: 115385 committer: Michael Albinus branch nick: trunk timestamp: Thu 2013-12-05 16:31:57 +0100 message: * automated/dbus-tests.el: New file. diff: === added file 'test/automated/dbus-tests.el' --- test/automated/dbus-tests.el 1970-01-01 00:00:00 +0000 +++ test/automated/dbus-tests.el 2013-12-05 15:31:57 +0000 @@ -0,0 +1,136 @@ +;;; dbus-tests.el --- Tests of D-Bus integration into Emacs + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;; Author: Michael Albinus + +;; This program is free software: you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Code: + +(require 'ert) +(require 'dbus) + +(setq dbus-debug nil) + +(defvar dbus--test-enabled-session-bus + (and (featurep 'dbusbind) + (dbus-ignore-errors (dbus-get-unique-name :session))) + "Check, whether we are registered at the session bus.") + +(defvar dbus--test-enabled-system-bus + (and (featurep 'dbusbind) + (dbus-ignore-errors (dbus-get-unique-name :system))) + "Check, whether we are registered at the system bus.") + +(defun dbus--test-availability (bus) + "Test availability of D-Bus BUS." + (should (dbus-list-names bus)) + (should (dbus-list-activatable-names bus)) + (should (dbus-list-known-names bus)) + (should (dbus-get-unique-name bus))) + +(ert-deftest dbus-test00-availability-session () + "Test availability of D-Bus `:session'." + :expected-result (if dbus--test-enabled-session-bus :passed :failed) + (dbus--test-availability :session)) + +(ert-deftest dbus-test00-availability-system () + "Test availability of D-Bus `:system'." + :expected-result (if dbus--test-enabled-system-bus :passed :failed) + (dbus--test-availability :system)) + +(ert-deftest dbus-test01-type-conversion () + "Check type conversion functions." + (let ((ustr "0123abc_xyz\x01\xff") + (mstr "Grüß Göttin")) + (should + (string-equal + (dbus-byte-array-to-string (dbus-string-to-byte-array "")) "")) + (should + (string-equal + (dbus-byte-array-to-string (dbus-string-to-byte-array ustr)) ustr)) + (should + (string-equal + (dbus-byte-array-to-string (dbus-string-to-byte-array mstr) 'multibyte) + mstr)) + ;; Should not work for multibyte strings. + (should-not + (string-equal + (dbus-byte-array-to-string (dbus-string-to-byte-array mstr)) mstr)) + + (should + (string-equal + (dbus-unescape-from-identifier (dbus-escape-as-identifier "")) "")) + (should + (string-equal + (dbus-unescape-from-identifier (dbus-escape-as-identifier ustr)) ustr)) + ;; Should not work for multibyte strings. + (should-not + (string-equal + (dbus-unescape-from-identifier (dbus-escape-as-identifier mstr)) mstr)))) + +(defun dbus--test-register-service (bus) + "Check service registration at BUS." + ;; Cleanup. + (dbus-ignore-errors (dbus-unregister-service bus dbus-service-emacs)) + + ;; Register an own service. + (should (eq (dbus-register-service bus dbus-service-emacs) :primary-owner)) + (should (dbus-ping bus dbus-service-emacs 100)) + (should (eq (dbus-register-service bus dbus-service-emacs) :already-owner)) + (should (dbus-ping bus dbus-service-emacs 100)) + + ;; Unregister the service. + (should (eq (dbus-unregister-service bus dbus-service-emacs) :released)) + (should-not (dbus-ping bus dbus-service-emacs 100)) + (should (eq (dbus-unregister-service bus dbus-service-emacs) :non-existent)) + (should-not (dbus-ping bus dbus-service-emacs 100)) + + ;; `dbus-service-dbus' is reserved for the BUS itself. + (should-error (dbus-register-service bus dbus-service-dbus)) + (should-error (dbus-unregister-service bus dbus-service-dbus))) + +(ert-deftest dbus-test02-register-service-session () + "Check service registration at `:session'." + (skip-unless (and dbus--test-enabled-session-bus + (dbus-register-service :session dbus-service-emacs))) + (dbus--test-register-service :session) + + (let ((service "org.freedesktop.Notifications")) + (when (dbus-ping :session service 100) + ;; Cleanup. + (dbus-ignore-errors (dbus-unregister-service :session service)) + + (should (eq (dbus-register-service :session service) :in-queue)) + (should (eq (dbus-unregister-service :session service) :released)) + + (should + (eq (dbus-register-service :session service :do-not-queue) :exists)) + (should (eq (dbus-unregister-service :session service) :not-owner))))) + +(ert-deftest dbus-test02-register-service-system () + "Check service registration at `:system'." + (skip-unless (and dbus--test-enabled-system-bus + (dbus-register-service :system dbus-service-emacs))) + (dbus--test-register-service :system)) + +(defun dbus-test-all (&optional interactive) + "Run all tests for \\[dbus]." + (interactive "p") + (funcall + (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^dbus")) + +(provide 'dbus-tests) +;;; dbus-tests.el ends here ------------------------------------------------------------ revno: 115384 committer: Michael Albinus branch nick: trunk timestamp: Thu 2013-12-05 16:29:59 +0100 message: Minor changes, detected by test suite. * net/dbus.el (dbus-unregister-service) (dbus-escape-as-identifier, dbus-unescape-from-identifier): Fix docstring. (dbus-unregister-service): Skip :serial entries in `dbus-registered-objects-table'. (dbus-byte-array-to-string): New optional arg MULTIBYTE. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-04 21:32:05 +0000 +++ lisp/ChangeLog 2013-12-05 15:29:59 +0000 @@ -1,3 +1,12 @@ +2013-12-05 Michael Albinus + + * net/dbus.el (dbus-unregister-service) + (dbus-escape-as-identifier, dbus-unescape-from-identifier): + Fix docstring. + (dbus-unregister-service): Skip :serial entries in + `dbus-registered-objects-table'. + (dbus-byte-array-to-string): New optional arg MULTIBYTE. + 2013-12-04 Teodor Zlatanov * emacs-lisp/lisp-mnt.el (lm-keywords-list): Trim whitespace === modified file 'lisp/net/dbus.el' --- lisp/net/dbus.el 2013-12-04 14:10:09 +0000 +++ lisp/net/dbus.el 2013-12-05 15:29:59 +0000 @@ -521,7 +521,7 @@ The function returns a keyword, indicating the result of the operation. One of the following keywords is returned: -`:released': Service has become the primary owner of the name. +`:released': We successfully released the service. `:non-existent': Service name does not exist on this bus. @@ -530,12 +530,13 @@ (maphash (lambda (key value) - (dolist (elt value) - (ignore-errors - (when (and (equal bus (cadr key)) (string-equal service (cadr elt))) - (unless - (puthash key (delete elt value) dbus-registered-objects-table) - (remhash key dbus-registered-objects-table)))))) + (unless (equal :serial (car key)) + (dolist (elt value) + (ignore-errors + (when (and (equal bus (cadr key)) (string-equal service (cadr elt))) + (unless + (puthash key (delete elt value) dbus-registered-objects-table) + (remhash key dbus-registered-objects-table))))))) dbus-registered-objects-table) (let ((reply (dbus-call-method bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus @@ -827,12 +828,13 @@ (dolist (elt (string-to-list string) (append '(:array) result)) (setq result (append result (list :byte elt))))))) -(defun dbus-byte-array-to-string (byte-array) +(defun dbus-byte-array-to-string (byte-array &optional multibyte) "Transforms BYTE-ARRAY into UTF8 coded string. BYTE-ARRAY must be a list of structure (c1 c2 ...), or a byte -array as produced by `dbus-string-to-byte-array'." +array as produced by `dbus-string-to-byte-array'. The resulting +string is unibyte encoded, unless MULTIBYTE is non-nil." (apply - 'string + (if multibyte 'string 'unibyte-string) (if (equal byte-array '(:array :signature "y")) nil (let (result) @@ -855,7 +857,7 @@ \"_\". Returns the escaped string. Algorithm taken from -telepathy-glib's `tp-escape-as-identifier'." +telepathy-glib's `tp_escape_as_identifier'." (if (zerop (length string)) "_" (replace-regexp-in-string @@ -864,8 +866,8 @@ string))) (defun dbus-unescape-from-identifier (string) - "Retrieve the original string from the encoded STRING. -STRING must have been coded with `dbus-escape-as-identifier'" + "Retrieve the original string from the encoded STRING as unibyte string. +STRING must have been encoded with `dbus-escape-as-identifier'." (if (string-equal string "_") "" (replace-regexp-in-string ------------------------------------------------------------ revno: 115383 committer: martin rudalics branch nick: trunk timestamp: Thu 2013-12-05 14:46:30 +0100 message: In x_new_font calculate new frame sizes from new font size (Bug#16028). * w32term.c (x_new_font): * xterm.c (x_new_font): Calculate new frame size from new font size (Bug#16028). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-04 22:10:46 +0000 +++ src/ChangeLog 2013-12-05 13:46:30 +0000 @@ -1,3 +1,9 @@ +2013-12-05 Martin Rudalics + + * w32term.c (x_new_font): + * xterm.c (x_new_font): Calculate new frame size from new font + size (Bug#16028). + 2013-12-04 Stefan Monnier * lisp.h (FOR_EACH_TAIL): New macro. === modified file 'src/w32term.c' --- src/w32term.c 2013-11-30 15:51:16 +0000 +++ src/w32term.c 2013-12-05 13:46:30 +0000 @@ -5479,8 +5479,8 @@ doing it because it's done in Fx_show_tip, and it leads to problems because the tip frame has no widget. */ if (NILP (tip_frame) || XFRAME (tip_frame) != f) - x_set_window_size (f, 0, FRAME_TEXT_WIDTH (f), - FRAME_TEXT_HEIGHT (f), 1); + x_set_window_size (f, 0, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), + FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1); } /* X version sets font of input methods here also. */ === modified file 'src/xterm.c' --- src/xterm.c 2013-12-04 14:11:33 +0000 +++ src/xterm.c 2013-12-05 13:46:30 +0000 @@ -7725,7 +7725,8 @@ doing it because it's done in Fx_show_tip, and it leads to problems because the tip frame has no widget. */ if (NILP (tip_frame) || XFRAME (tip_frame) != f) - x_set_window_size (f, 0, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 1); + x_set_window_size (f, 0, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), + FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1); } #ifdef HAVE_X_I18N ------------------------------------------------------------ revno: 115382 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-12-04 17:10:46 -0500 message: * src/lisp.h (FOR_EACH_TAIL): New macro. * src/fns.c (Fdelq): Use it to avoid inf-loops; remove QUIT. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-04 21:08:21 +0000 +++ src/ChangeLog 2013-12-04 22:10:46 +0000 @@ -1,5 +1,8 @@ 2013-12-04 Stefan Monnier + * lisp.h (FOR_EACH_TAIL): New macro. + * fns.c (Fdelq): Use it to avoid inf-loops; remove QUIT. + * window.c (select_window): Call second wset_redisplay before we change selected_window (bug#16034). === modified file 'src/fns.c' --- src/fns.c 2013-11-29 19:47:58 +0000 +++ src/fns.c 2013-12-04 22:10:46 +0000 @@ -1537,15 +1537,12 @@ the value of a list `foo'. */) (register Lisp_Object elt, Lisp_Object list) { - register Lisp_Object tail, prev; - register Lisp_Object tem; + Lisp_Object tail, tortoise, prev = Qnil; + bool skip; - tail = list; - prev = Qnil; - while (CONSP (tail)) + FOR_EACH_TAIL (tail, list, tortoise, skip) { - CHECK_LIST_CONS (tail, list); - tem = XCAR (tail); + Lisp_Object tem = XCAR (tail); if (EQ (elt, tem)) { if (NILP (prev)) @@ -1555,8 +1552,6 @@ } else prev = tail; - tail = XCDR (tail); - QUIT; } return list; } === modified file 'src/lisp.h' --- src/lisp.h 2013-11-30 09:25:31 +0000 +++ src/lisp.h 2013-12-04 22:10:46 +0000 @@ -4443,6 +4443,20 @@ memory_full (SIZE_MAX); \ } while (0) +/* Loop over all tails of a list, checking for cycles. + FIXME: Make tortoise and n internal declarations. + FIXME: Unroll the loop body so we don't need `n'. */ +#define FOR_EACH_TAIL(hare, list, tortoise, n) \ + for (tortoise = hare = (list), n = true; \ + CONSP (hare); \ + (hare = XCDR (hare), n = !n, \ + (n \ + ? ((EQ (hare, tortoise) \ + && (xsignal1 (Qcircular_list, (list)), 0))) \ + /* Move tortoise before the next iteration, in case */ \ + /* the next iteration does an Fsetcdr. */ \ + : (tortoise = XCDR (tortoise), 0)))) + /* Do a `for' loop over alist values. */ #define FOR_EACH_ALIST_VALUE(head_var, list_var, value_var) \