------------------------------------------------------------ revno: 114633 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-10-11 21:10:25 -0400 message: * lisp/isearch.el (isearch-pre-command-hook): Don't build in knowledge about internals of universal-argument. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-11 18:20:08 +0000 +++ lisp/ChangeLog 2013-10-12 01:10:25 +0000 @@ -1,3 +1,8 @@ +2013-10-12 Stefan Monnier + + * isearch.el (isearch-pre-command-hook): Don't build in knowledge about + internals of universal-argument. + 2013-10-11 Eli Zaretskii * menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit. === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-10-09 23:52:46 +0000 +++ lisp/isearch.el 2013-10-12 01:10:25 +0000 @@ -2233,6 +2233,9 @@ (let* ((key (this-single-command-keys)) (main-event (aref key 0))) (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))) ;; Don't exit Isearch for isearch key bindings. ((commandp (lookup-key isearch-mode-map key nil))) ;; Optionally edit the search string instead of exiting. @@ -2241,8 +2244,6 @@ ;; Handle a scrolling function or prefix argument. ((or (and isearch-allow-prefix (memq this-command '(universal-argument - universal-argument-more - universal-argument-minus digit-argument negative-argument))) (and isearch-allow-scroll (or (eq (get this-command 'isearch-scroll) t) ------------------------------------------------------------ revno: 114632 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2013-10-11 23:45:14 +0300 message: * test/indent/ruby.rb: Add two more cases. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2013-10-10 21:43:47 +0000 +++ test/ChangeLog 2013-10-11 20:45:14 +0000 @@ -1,3 +1,7 @@ +2013-10-11 Dmitry Gutov + + * indent/ruby.rb: Add two more cases. + 2013-10-10 Stefan Monnier * automated/ruby-mode-tests.el (ruby-with-temp-buffer): Move before === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-10-11 02:11:37 +0000 +++ test/indent/ruby.rb 2013-10-11 20:45:14 +0000 @@ -163,3 +163,10 @@ foo = [1, 2, 3].map do |i| i + 1 end + +foo_bar_tee(1, 2, 3) + .qux + +if foo && + bar +end ------------------------------------------------------------ revno: 114631 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-10-11 14:29:18 -0400 message: * configure.ac (LIBGNUTLS): Don't set LIBGNUTLS_* back to the empty string when gnutls2 is installed but gnutls3 is not. diff: === modified file 'ChangeLog' --- ChangeLog 2013-10-11 13:47:35 +0000 +++ ChangeLog 2013-10-11 18:29:18 +0000 @@ -1,3 +1,8 @@ +2013-10-11 Stefan Monnier + + * configure.ac (LIBGNUTLS): Don't set LIBGNUTLS_* back to the empty + string when gnutls2 is installed but gnutls3 is not. + 2013-10-11 Teodor Zlatanov * configure.ac: Define HAVE_GNUTLS3 if GnuTLS v3 is found. === modified file 'configure.ac' --- configure.ac 2013-10-11 13:47:35 +0000 +++ configure.ac 2013-10-11 18:29:18 +0000 @@ -2424,16 +2424,17 @@ HAVE_GNUTLS=no HAVE_GNUTLS3=no if test "${with_gnutls}" = "yes" ; then - PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no) PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], HAVE_GNUTLS3=yes, HAVE_GNUTLS3=no) + if test "${HAVE_GNUTLS3}" = "yes"; then + AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.]) + HAVE_GNUTLS="yes" + else + PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no) + fi if test "${HAVE_GNUTLS}" = "yes"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) fi - if test "${HAVE_GNUTLS3}" = "yes"; then - AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.]) - fi - # Windows loads GnuTLS dynamically if test "${opsys}" = "mingw32"; then LIBGNUTLS_LIBS= ------------------------------------------------------------ revno: 114630 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2013-10-11 21:20:08 +0300 message: Fix popping down a menu by a second mouse click. lisp/menu-bar.el (tty-menu-navigation-map): Bind all menu-bar sequences to tty-menu-exit -- this pops down a dropped menu on second mouse click on the menu bar. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-11 17:44:41 +0000 +++ lisp/ChangeLog 2013-10-11 18:20:08 +0000 @@ -1,6 +1,8 @@ 2013-10-11 Eli Zaretskii * menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit. + Bind all menu-bar sequences to tty-menu-exit -- this pops down a + dropped menu on second mouse click on the menu bar. 2013-10-11 Stefan Monnier === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2013-10-11 17:44:41 +0000 +++ lisp/menu-bar.el 2013-10-11 18:20:08 +0000 @@ -2333,16 +2333,7 @@ ;; The bindings of menu-bar items are so that clicking on the menu ;; bar when a menu is already shown pops down that menu. - ;; FIXME: we should iterate over all the visible menu-bar items, - ;; instead of naming them explicitly here. Also, this doesn't - ;; include items added by current major mode. - ;; - ;; FIXME: Why not (define-key map [menu-bat t] 'tty-menu-exit) ? --Stef - (dolist (event '(file edit options buffer tools help-menu)) - (substitute-key-definition - (lookup-key (current-global-map) (vector 'menu-bar event)) - 'tty-menu-exit - map (current-global-map))) + (define-key map [menu-bar t] 'tty-menu-exit) (define-key map [?\C-r] 'tty-menu-select) (define-key map [?\C-j] 'tty-menu-select) ------------------------------------------------------------ revno: 114629 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2013-10-11 20:44:41 +0300 message: Make the same key that opens TTY menus also exit the menu. lisp/menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-11 03:28:31 +0000 +++ lisp/ChangeLog 2013-10-11 17:44:41 +0000 @@ -1,3 +1,7 @@ +2013-10-11 Eli Zaretskii + + * menu-bar.el (tty-menu-navigation-map): Remap F10 to tty-menu-exit. + 2013-10-11 Stefan Monnier * progmodes/sh-script.el: Provide simpl(e|istic) completion. === modified file 'lisp/menu-bar.el' --- lisp/menu-bar.el 2013-10-10 10:47:11 +0000 +++ lisp/menu-bar.el 2013-10-11 17:44:41 +0000 @@ -2261,6 +2261,50 @@ (popup-menu-normalize-position (event-end position))) (t position))) +(defcustom tty-menu-open-use-tmm nil + "If non-nil, \\[menu-bar-open] on a TTY will invoke `tmm-menubar'. + +If nil, \\[menu-bar-open] will drop down the menu corresponding to the +first (leftmost) menu-bar item; you can select other items by typing +\\[forward-char], \\[backward-char], \\[right-char] and \\[left-char]." + :type '(choice (const :tag "F10 drops down TTY menus" nil) + (const :tag "F10 invokes tmm-menubar" t)) + :group 'display + :version "24.4") + +(defvar tty-menu--initial-menu-x 1 + "X coordinate of the first menu-bar menu dropped by F10. + +This is meant to be used only for debugging TTY menus.") + +(defun menu-bar-open (&optional frame) + "Start key navigation of the menu bar in FRAME. + +This function decides which method to use to access the menu +depending on FRAME's terminal device. On X displays, it calls +`x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it +calls either `popup-menu' or `tmm-menubar' depending on whether +\`tty-menu-open-use-tmm' is nil or not. + +If FRAME is nil or not given, use the selected frame." + (interactive) + (let ((type (framep (or frame (selected-frame))))) + (cond + ((eq type 'x) (x-menu-bar-open frame)) + ((eq type 'w32) (w32-menu-bar-open frame)) + ((and (null tty-menu-open-use-tmm) + (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))) + (let* ((x tty-menu--initial-menu-x) + (menu (menu-bar-menu-at-x-y x 0 frame))) + (popup-menu (or + (lookup-key global-map (vector 'menu-bar menu)) + (lookup-key (current-local-map) (vector 'menu-bar menu))) + (posn-at-x-y x 0 nil t) nil t))) + (t (with-selected-frame (or frame (selected-frame)) + (tmm-menubar)))))) + +(global-set-key [f10] 'menu-bar-open) + (defvar tty-menu-navigation-map (let ((map (make-sparse-keymap))) ;; The next line is disabled because it breaks interpretation of @@ -2282,7 +2326,8 @@ (next-line . tty-menu-next-item) (previous-line . tty-menu-prev-item) (newline . tty-menu-select) - (newline-and-indent . tty-menu-select))) + (newline-and-indent . tty-menu-select) + (menu-bar-open . tty-menu-exit))) (substitute-key-definition (car bind) (cdr bind) map (current-global-map))) @@ -2327,51 +2372,6 @@ map) "Keymap used while processing TTY menus.") - -(defcustom tty-menu-open-use-tmm nil - "If non-nil, \\[menu-bar-open] on a TTY will invoke `tmm-menubar'. - -If nil, \\[menu-bar-open] will drop down the menu corresponding to the -first (leftmost) menu-bar item; you can select other items by typing -\\[forward-char], \\[backward-char], \\[right-char] and \\[left-char]." - :type '(choice (const :tag "F10 drops down TTY menus" nil) - (const :tag "F10 invokes tmm-menubar" t)) - :group 'display - :version "24.4") - -(defvar tty-menu--initial-menu-x 1 - "X coordinate of the first menu-bar menu dropped by F10. - -This is meant to be used only for debugging TTY menus.") - -(defun menu-bar-open (&optional frame) - "Start key navigation of the menu bar in FRAME. - -This function decides which method to use to access the menu -depending on FRAME's terminal device. On X displays, it calls -`x-menu-bar-open'; on Windows, `w32-menu-bar-open'; otherwise it -calls either `popup-menu' or `tmm-menubar' depending on whether -\`tty-menu-open-use-tmm' is nil or not. - -If FRAME is nil or not given, use the selected frame." - (interactive) - (let ((type (framep (or frame (selected-frame))))) - (cond - ((eq type 'x) (x-menu-bar-open frame)) - ((eq type 'w32) (w32-menu-bar-open frame)) - ((and (null tty-menu-open-use-tmm) - (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))) - (let* ((x tty-menu--initial-menu-x) - (menu (menu-bar-menu-at-x-y x 0 frame))) - (popup-menu (or - (lookup-key global-map (vector 'menu-bar menu)) - (lookup-key (current-local-map) (vector 'menu-bar menu))) - (posn-at-x-y x 0 nil t) nil t))) - (t (with-selected-frame (or frame (selected-frame)) - (tmm-menubar)))))) - -(global-set-key [f10] 'menu-bar-open) - (provide 'menu-bar) ;;; menu-bar.el ends here ------------------------------------------------------------ revno: 114628 fixes bug: http://debbugs.gnu.org/15575 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2013-10-11 18:42:06 +0300 message: Support frame dimension changes while TTY menus are displayed. src/xdisp.c (deep_copy_glyph_row): Handle the case that FROM and TO have different dimensions. src/dispnew.c (fill_up_frame_row_with_spaces): Now has external visibility. src/dispextern.h (fill_up_frame_row_with_spaces): Add prototype. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 15:30:21 +0000 +++ src/ChangeLog 2013-10-11 15:42:06 +0000 @@ -1,3 +1,13 @@ +2013-10-11 Eli Zaretskii + + * xdisp.c (deep_copy_glyph_row): Handle the case that FROM and TO + have different dimensions. (Bug#15575) + + * dispnew.c (fill_up_frame_row_with_spaces): Now has external + visibility. + + * dispextern.h (fill_up_frame_row_with_spaces): Add prototype. + 2013-10-11 Dmitry Antipov * term.c (tty_menu_show): Never return with unbalanced === modified file 'src/dispextern.h' --- src/dispextern.h 2013-10-08 17:49:20 +0000 +++ src/dispextern.h 2013-10-11 15:42:06 +0000 @@ -3472,6 +3472,7 @@ void syms_of_display (void); extern Lisp_Object Qredisplay_dont_pause; extern void spec_glyph_lookup_face (struct window *, GLYPH *); +extern void fill_up_frame_row_with_spaces (struct glyph_row *, int); /* Defined in terminal.c */ === modified file 'src/dispnew.c' --- src/dispnew.c 2013-10-11 11:11:28 +0000 +++ src/dispnew.c 2013-10-11 15:42:06 +0000 @@ -77,7 +77,6 @@ static int required_matrix_width (struct window *); static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool); static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t); -static void fill_up_frame_row_with_spaces (struct glyph_row *, int); static void build_frame_matrix_from_window_tree (struct glyph_matrix *, struct window *); static void build_frame_matrix_from_leaf_window (struct glyph_matrix *, @@ -2503,7 +2502,7 @@ /* Add spaces to the end of ROW in a frame matrix until index UPTO is reached. In frame matrices only one area, TEXT_AREA, is used. */ -static void +void fill_up_frame_row_with_spaces (struct glyph_row *row, int upto) { int i = row->used[TEXT_AREA]; === modified file 'src/xdisp.c' --- src/xdisp.c 2013-10-11 11:01:48 +0000 +++ src/xdisp.c 2013-10-11 15:42:06 +0000 @@ -20590,10 +20590,10 @@ deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from) { struct glyph *pointers[1 + LAST_AREA]; + int to_used = to->used[TEXT_AREA]; /* Save glyph pointers of TO. */ memcpy (pointers, to->glyphs, sizeof to->glyphs); - eassert (to->used[TEXT_AREA] == from->used[TEXT_AREA]); /* Do a structure assignment. */ *to = *from; @@ -20603,7 +20603,12 @@ /* Copy the glyphs. */ memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], - from->used[TEXT_AREA] * sizeof (struct glyph)); + min (from->used[TEXT_AREA], to_used) * sizeof (struct glyph)); + + /* If we filled only part of the TO row, fill the rest with + space_glyph (which will display as empty space). */ + if (to_used > from->used[TEXT_AREA]) + fill_up_frame_row_with_spaces (to, to_used); } /* Display one menu item on a TTY, by overwriting the glyphs in the ------------------------------------------------------------ revno: 114627 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-10-11 19:30:21 +0400 message: * term.c (tty_menu_show): Never return with unbalanced specpdl. Use eassert for debugging check. Adjust style. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 14:42:05 +0000 +++ src/ChangeLog 2013-10-11 15:30:21 +0000 @@ -1,3 +1,8 @@ +2013-10-11 Dmitry Antipov + + * term.c (tty_menu_show): Never return with unbalanced + specpdl. Use eassert for debugging check. Adjust style. + 2013-10-11 Eli Zaretskii * term.c (read_menu_input): Make selection of menu items === modified file 'src/term.c' --- src/term.c 2013-10-11 14:42:05 +0000 +++ src/term.c 2013-10-11 15:30:21 +0000 @@ -3561,10 +3561,9 @@ int dispwidth, dispheight; int i, j, lines, maxlines; int maxwidth; - ptrdiff_t specpdl_count = SPECPDL_INDEX (); + ptrdiff_t specpdl_count; - if (! FRAME_TERMCAP_P (f)) - emacs_abort (); + eassert (FRAME_TERMCAP_P (f)); *error_name = 0; if (menu_items_n_panes == 0) @@ -3586,7 +3585,7 @@ /* Don't GC while we prepare and show the menu, because we give the menu functions pointers to the contents of strings. */ - inhibit_garbage_collection (); + specpdl_count = inhibit_garbage_collection (); /* Adjust coordinates to be root-window-relative. */ item_x = x += f->left_pos; @@ -3617,7 +3616,8 @@ { tty_menu_destroy (menu); *error_name = "Can't create pane"; - return Qnil; + entry = Qnil; + goto tty_menu_end; } i += MENU_ITEMS_PANE_LENGTH; @@ -3679,7 +3679,8 @@ { tty_menu_destroy (menu); *error_name = "Can't add selection to menu"; - return Qnil; + entry = Qnil; + goto tty_menu_end; } i += MENU_ITEMS_ITEM_LENGTH; lines++; @@ -3696,12 +3697,12 @@ x = max (x, 1); y = max (y, 1); tty_menu_locate (menu, x, y, &ulx, &uly, &width, &height); - if (ulx+width > dispwidth) + if (ulx + width > dispwidth) { x -= (ulx + width) - dispwidth; ulx = dispwidth - width; } - if (uly+height > dispheight) + if (uly + height > dispheight) { y -= (uly + height) - dispheight; uly = dispheight - height; @@ -3807,8 +3808,9 @@ break; } + tty_menu_end: + unbind_to (specpdl_count, Qnil); - return entry; } ------------------------------------------------------------ revno: 114626 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2013-10-11 17:42:05 +0300 message: Menu item selection on TTYs is now cyclical. src/term.c (read_menu_input): Make selection of menu items cyclical. Suggested by Dmitry Antipov . (tty_menu_activate): Fix off-by-one error when computing max_y. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 13:47:35 +0000 +++ src/ChangeLog 2013-10-11 14:42:05 +0000 @@ -1,3 +1,9 @@ +2013-10-11 Eli Zaretskii + + * term.c (read_menu_input): Make selection of menu items + cyclical. Suggested by Dmitry Antipov . + (tty_menu_activate): Fix off-by-one error when computing max_y. + 2013-10-11 Teodor Zlatanov * gnutls.c (gnutls_audit_log_function): Add function for GnuTLS === modified file 'src/term.c' --- src/term.c 2013-10-11 11:11:28 +0000 +++ src/term.c 2013-10-11 14:42:05 +0000 @@ -3177,11 +3177,15 @@ { if (*y < max_y) *y += 1; + else + *y = min_y; } else if (EQ (cmd, Qtty_menu_prev_item)) { if (*y > min_y) *y -= 1; + else + *y = max_y; } else if (EQ (cmd, Qtty_menu_select)) st = 1; @@ -3290,7 +3294,7 @@ { int input_status; int min_y = state[0].y; - int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf)) - 1; + int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf) - 1) - 1; input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); if (input_status) ------------------------------------------------------------ revno: 114625 committer: Ted Zlatanov branch nick: quickfixes timestamp: Fri 2013-10-11 09:47:35 -0400 message: Support GnuTLS v3 and set up its audit logging properly. * configure.ac: Define HAVE_GNUTLS3 if GnuTLS v3 is found. * src/gnutls.c (gnutls_audit_log_function): Add function for GnuTLS audit logging (only used with GnuTLS 3.x) and enable it. diff: === modified file 'ChangeLog' --- ChangeLog 2013-10-10 00:37:44 +0000 +++ ChangeLog 2013-10-11 13:47:35 +0000 @@ -1,3 +1,7 @@ +2013-10-11 Teodor Zlatanov + + * configure.ac: Define HAVE_GNUTLS3 if GnuTLS v3 is found. + 2013-10-10 Barry Fishman (tiny change) * configure.ac: Update for giflib 5. (Bug#15531) === modified file 'configure.ac' --- configure.ac 2013-10-10 00:37:44 +0000 +++ configure.ac 2013-10-11 13:47:35 +0000 @@ -2422,12 +2422,18 @@ AC_SUBST(LIBSELINUX_LIBS) HAVE_GNUTLS=no +HAVE_GNUTLS3=no if test "${with_gnutls}" = "yes" ; then PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.6.6], HAVE_GNUTLS=yes, HAVE_GNUTLS=no) + PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.0.0], HAVE_GNUTLS3=yes, HAVE_GNUTLS3=no) if test "${HAVE_GNUTLS}" = "yes"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) fi + if test "${HAVE_GNUTLS3}" = "yes"; then + AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.]) + fi + # Windows loads GnuTLS dynamically if test "${opsys}" = "mingw32"; then LIBGNUTLS_LIBS= === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 11:11:28 +0000 +++ src/ChangeLog 2013-10-11 13:47:35 +0000 @@ -1,3 +1,8 @@ +2013-10-11 Teodor Zlatanov + + * gnutls.c (gnutls_audit_log_function): Add function for GnuTLS + audit logging (only used with GnuTLS 3.x) and enable it. + 2013-10-11 Dmitry Antipov * dispnew.c (redraw_frame): Remove useless #ifdef because === modified file 'src/gnutls.c' --- src/gnutls.c 2013-01-02 16:13:04 +0000 +++ src/gnutls.c 2013-10-11 13:47:35 +0000 @@ -55,6 +55,7 @@ static Lisp_Object QCgnutls_bootprop_callbacks_verify; static void gnutls_log_function (int, const char *); +static void gnutls_audit_log_function (gnutls_session_t, const char *); static void gnutls_log_function2 (int, const char*, const char*); @@ -108,6 +109,9 @@ DEF_GNUTLS_FN (int, gnutls_error_is_fatal, (int)); DEF_GNUTLS_FN (int, gnutls_global_init, (void)); DEF_GNUTLS_FN (void, gnutls_global_set_log_function, (gnutls_log_func)); +#ifdef HAVE_GNUTLS3 +DEF_GNUTLS_FN (void, gnutls_global_set_audit_log_function, (gnutls_audit_log_func)); +#endif DEF_GNUTLS_FN (void, gnutls_global_set_log_level, (int)); DEF_GNUTLS_FN (void, gnutls_global_set_mem_functions, (gnutls_alloc_function, gnutls_alloc_function, @@ -173,6 +177,9 @@ LOAD_GNUTLS_FN (library, gnutls_error_is_fatal); LOAD_GNUTLS_FN (library, gnutls_global_init); LOAD_GNUTLS_FN (library, gnutls_global_set_log_function); +#ifdef HAVE_GNUTLS3 + LOAD_GNUTLS_FN (library, gnutls_global_set_audit_log_function); +#endif LOAD_GNUTLS_FN (library, gnutls_global_set_log_level); LOAD_GNUTLS_FN (library, gnutls_global_set_mem_functions); LOAD_GNUTLS_FN (library, gnutls_handshake); @@ -230,6 +237,9 @@ #define fn_gnutls_error_is_fatal gnutls_error_is_fatal #define fn_gnutls_global_init gnutls_global_init #define fn_gnutls_global_set_log_function gnutls_global_set_log_function +#ifdef HAVE_GNUTLS3 +#define fn_gnutls_global_set_audit_log_function gnutls_global_set_audit_log_function +#endif #define fn_gnutls_global_set_log_level gnutls_global_set_log_level #define fn_gnutls_global_set_mem_functions gnutls_global_set_mem_functions #define fn_gnutls_handshake gnutls_handshake @@ -249,6 +259,16 @@ #endif /* !WINDOWSNT */ +/* Function to log a simple audit message. */ +static void +gnutls_audit_log_function (gnutls_session_t session, const char* string) +{ + if (global_gnutls_log_level >= 1) + { + message ("gnutls.c: [audit] %s", string); + } +} + /* Function to log a simple message. */ static void gnutls_log_function (int level, const char* string) @@ -797,6 +817,9 @@ if (TYPE_RANGED_INTEGERP (int, loglevel)) { fn_gnutls_global_set_log_function (gnutls_log_function); +#ifdef HAVE_GNUTLS3 + fn_gnutls_global_set_audit_log_function (gnutls_audit_log_function); +#endif fn_gnutls_global_set_log_level (XINT (loglevel)); max_log_level = XINT (loglevel); XPROCESS (proc)->gnutls_log_level = max_log_level; ------------------------------------------------------------ revno: 114624 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-10-11 15:11:28 +0400 message: * dispnew.c (redraw_frame): Remove useless #ifdef because FRAME_MSDOS_P is a compile-time zero everywhere except MS-DOS. Also, move TTY fflush to... * term.c (tty_update_end): ...this function. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 11:01:48 +0000 +++ src/ChangeLog 2013-10-11 11:11:28 +0000 @@ -1,3 +1,10 @@ +2013-10-11 Dmitry Antipov + + * dispnew.c (redraw_frame): Remove useless #ifdef because + FRAME_MSDOS_P is a compile-time zero everywhere except MS-DOS. + Also, move TTY fflush to... + * term.c (tty_update_end): ...this function. + 2013-10-11 Eli Zaretskii * xdisp.c (display_tty_menu_item): Make sure we never write beyond === modified file 'src/dispnew.c' --- src/dispnew.c 2013-10-11 06:32:29 +0000 +++ src/dispnew.c 2013-10-11 11:11:28 +0000 @@ -2937,15 +2937,11 @@ /* Error if F has no glyphs. */ eassert (f->glyphs_initialized_p); update_begin (f); -#ifdef MSDOS if (FRAME_MSDOS_P (f)) FRAME_TERMINAL (f)->set_terminal_modes_hook (FRAME_TERMINAL (f)); -#endif clear_frame (f); clear_current_matrices (f); update_end (f); - if (FRAME_TERMCAP_P (f)) - fflush (FRAME_TTY (f)->output); windows_or_buffers_changed++; /* Mark all windows as inaccurate, so that every window will have its redisplay done. */ === modified file 'src/term.c' --- src/term.c 2013-10-11 11:01:48 +0000 +++ src/term.c 2013-10-11 11:11:28 +0000 @@ -220,6 +220,7 @@ tty_show_cursor (tty); tty_turn_off_insert (tty); tty_background_highlight (tty); + fflush (tty->output); } /* The implementation of set_terminal_window for termcap frames. */ ------------------------------------------------------------ revno: 114623 fixes bug: http://debbugs.gnu.org/15575 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2013-10-11 14:01:48 +0300 message: Fix bug #15575 with crashes in TTY menus. src/xdisp.c (display_tty_menu_item): Make sure we never write beyond the end of the frame's glyph matrix. src/term.c (tty_menu_display): Don't move cursor while overwriting frame's glyphs with menu items. Limit the number of items displayed to what can be shown on the available screen lines, excluding the echo area. (tty_menu_activate): Limit the Y coordinate allowed by read_menu_input to the last screen line used for menu display. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 06:32:29 +0000 +++ src/ChangeLog 2013-10-11 11:01:48 +0000 @@ -1,3 +1,15 @@ +2013-10-11 Eli Zaretskii + + * xdisp.c (display_tty_menu_item): Make sure we never write beyond + the end of the frame's glyph matrix. (Bug#15575) + + * term.c (tty_menu_display): Don't move cursor while overwriting + frame's glyphs with menu items. Limit the number of items + displayed to what can be shown on the available screen lines, + excluding the echo area. + (tty_menu_activate): Limit the Y coordinate allowed by + read_menu_input to the last screen line used for menu display. + 2013-10-11 Paul Eggert * lisp.h (eassume): New macro. === modified file 'src/term.c' --- src/term.c 2013-10-10 19:26:13 +0000 +++ src/term.c 2013-10-11 11:01:48 +0000 @@ -2919,17 +2919,20 @@ int i, face, width, enabled, mousehere, row, col; struct frame *sf = SELECTED_FRAME (); struct tty_display_info *tty = FRAME_TTY (sf); + /* Don't try to display more menu items than the console can display + using the available screen lines. Exclude the echo area line, as + it will be overwritten by the help-echo anyway. */ + int max_items = min (menu->count, FRAME_LINES (sf) - 1); menu_help_message = NULL; width = menu->width; col = cursorX (tty); row = cursorY (tty); - for (i = 0; i < menu->count; i++) + for (i = 0; i < max_items; i++) { int max_width = width + 2; /* +2 for padding blanks on each side */ - cursor_to (sf, y + i, x); if (menu->submenu[i]) max_width += 2; /* for displaying " >" after the item */ enabled @@ -3285,7 +3288,8 @@ while (!leave) { int input_status; - int min_y = state[0].y, max_y = min_y + state[0].menu->count - 1; + int min_y = state[0].y; + int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf)) - 1; input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); if (input_status) === modified file 'src/xdisp.c' --- src/xdisp.c 2013-10-11 03:55:26 +0000 +++ src/xdisp.c 2013-10-11 11:01:48 +0000 @@ -20640,6 +20640,14 @@ eassert (FRAME_TERMCAP_P (f)); + /* Don't write beyond the matrix's last row. This can happen for + TTY screens that are not high enough to show the entire menu. + (This is actually a bit of defensive programming, as + tty_menu_display already limits the number of menu items to one + less than the number of screen lines.) */ + if (y >= f->desired_matrix->nrows) + return; + init_iterator (&it, w, -1, -1, f->desired_matrix->rows + y, MENU_FACE_ID); it.first_visible_x = 0; it.last_visible_x = FRAME_COLS (f) - 1; @@ -20654,6 +20662,7 @@ /* Arrange for the menu item glyphs to start at (X,Y) and have the desired face. */ + eassert (x < f->desired_matrix->matrix_w); it.current_x = it.hpos = x; it.current_y = it.vpos = y; saved_used = row->used[TEXT_AREA]; ------------------------------------------------------------ revno: 114622 committer: Paul Eggert branch nick: trunk timestamp: Thu 2013-10-10 23:32:29 -0700 message: * lisp.h (eassume): New macro. Also, include , for 'assume'. * alloc.c (bool_vector_payload_bytes, Fmake_bool_vector) (vroundup, vector_nbytes): * data.c (bool_vector_spare_mask, bool_vector_binop_driver) (Fbool_vector_not, Fbool_vector_count_matches) (Fbool_vector_count_matches_at): Use eassume, not eassert. * casetab.c (set_identity, shuffle): * composite.c (composition_gstring_put_cache): * dispnew.c (update_frame_1): * ftfont.c (ftfont_shape_by_flt): * image.c (gif_load): * intervals.c (offset_intervals): * macfont.m (macfont_shape): Remove calls to 'assume' that are no longer needed, because --enable-gcc-warnings no longer generates bogus warnings when these calls are removed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-11 03:55:26 +0000 +++ src/ChangeLog 2013-10-11 06:32:29 +0000 @@ -1,3 +1,24 @@ +2013-10-11 Paul Eggert + + * lisp.h (eassume): New macro. + Also, include , for 'assume'. + * alloc.c (bool_vector_payload_bytes, Fmake_bool_vector) + (vroundup, vector_nbytes): + * data.c (bool_vector_spare_mask, bool_vector_binop_driver) + (Fbool_vector_not, Fbool_vector_count_matches) + (Fbool_vector_count_matches_at): + Use eassume, not eassert. + * casetab.c (set_identity, shuffle): + * composite.c (composition_gstring_put_cache): + * dispnew.c (update_frame_1): + * ftfont.c (ftfont_shape_by_flt): + * image.c (gif_load): + * intervals.c (offset_intervals): + * macfont.m (macfont_shape): + Remove calls to 'assume' that are no longer needed, because + --enable-gcc-warnings no longer generates bogus warnings + when these calls are removed. + 2013-10-11 Dmitry Antipov * xdisp.c (deep_copy_glyph_row): Remove unused locals. === modified file 'src/alloc.c' --- src/alloc.c 2013-10-08 17:49:20 +0000 +++ src/alloc.c 2013-10-11 06:32:29 +0000 @@ -2027,7 +2027,7 @@ ptrdiff_t exact_needed_bytes; ptrdiff_t needed_bytes; - eassert (nr_bits >= 0); + eassume (nr_bits >= 0); exact_needed_bytes = ROUNDUP ((size_t) nr_bits, CHAR_BIT) / CHAR_BIT; needed_bytes = ROUNDUP ((size_t) nr_bits, BITS_PER_BITS_WORD) / CHAR_BIT; @@ -2064,8 +2064,8 @@ total_payload_bytes = bool_vector_payload_bytes (XFASTINT (length), &exact_payload_bytes); - eassert (exact_payload_bytes <= total_payload_bytes); - eassert (0 <= exact_payload_bytes); + eassume (exact_payload_bytes <= total_payload_bytes); + eassume (0 <= exact_payload_bytes); needed_elements = ROUNDUP ((size_t) ((bool_header_size - header_size) + total_payload_bytes), @@ -2622,7 +2622,7 @@ /* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at compile time. */ #define vroundup_ct(x) ROUNDUP ((size_t) (x), roundup_size) /* Round up X to nearest mult-of-ROUNDUP_SIZE --- use at runtime. */ -#define vroundup(x) (assume ((x) >= 0), vroundup_ct (x)) +#define vroundup(x) (eassume ((x) >= 0), vroundup_ct (x)) /* Rounding helps to maintain alignment constraints if USE_LSB_TAG. */ @@ -2820,7 +2820,7 @@ ptrdiff_t payload_bytes = bool_vector_payload_bytes (bv->size, NULL); - eassert (payload_bytes >= 0); + eassume (payload_bytes >= 0); size = bool_header_size + ROUNDUP (payload_bytes, word_size); } else === modified file 'src/casetab.c' --- src/casetab.c 2013-09-22 09:31:55 +0000 +++ src/casetab.c 2013-10-11 06:32:29 +0000 @@ -205,7 +205,6 @@ from = to = XINT (c); to++; - assume (to <= MAX_CHAR + 1); for (; from < to; from++) CHAR_TABLE_SET (table, from, make_number (from)); } @@ -232,7 +231,6 @@ from = to = XINT (c); to++; - assume (to <= MAX_CHAR + 1); for (; from < to; from++) { Lisp_Object tem = Faref (table, elt); === modified file 'src/composite.c' --- src/composite.c 2013-09-24 06:43:20 +0000 +++ src/composite.c 2013-10-11 06:32:29 +0000 @@ -674,7 +674,6 @@ len = j; } - assume (len <= TYPE_MAXIMUM (ptrdiff_t) - 2); copy = Fmake_vector (make_number (len + 2), Qnil); LGSTRING_SET_HEADER (copy, Fcopy_sequence (header)); for (i = 0; i < len; i++) === modified file 'src/data.c' --- src/data.c 2013-10-08 04:25:33 +0000 +++ src/data.c 2013-10-11 06:32:29 +0000 @@ -2969,7 +2969,7 @@ static bits_word bool_vector_spare_mask (ptrdiff_t nr_bits) { - eassert (nr_bits > 0); + eassume (nr_bits > 0); return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; } @@ -3019,7 +3019,7 @@ nr_bits = min (nr_bits, XBOOL_VECTOR (dest)->size); } - eassert (nr_bits >= 0); + eassume (nr_bits >= 0); nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; adata = (bits_word *) XBOOL_VECTOR (dest)->data; @@ -3185,7 +3185,7 @@ bdata = (bits_word *) XBOOL_VECTOR (b)->data; adata = (bits_word *) XBOOL_VECTOR (a)->data; - eassert (nr_bits >= 0); + eassume (nr_bits >= 0); for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; i++) bdata[i] = ~adata[i]; @@ -3220,7 +3220,7 @@ match = NILP (b) ? -1 : 0; adata = (bits_word *) XBOOL_VECTOR (a)->data; - eassert (nr_bits >= 0); + eassume (nr_bits >= 0); for (i = 0; i < nr_bits / BITS_PER_BITS_WORD; ++i) count += popcount_bits_word (adata[i] ^ match); @@ -3262,7 +3262,7 @@ adata = (bits_word *) XBOOL_VECTOR (a)->data; - assume (nr_bits >= 0); + eassume (nr_bits >= 0); nr_words = ROUNDUP (nr_bits, BITS_PER_BITS_WORD) / BITS_PER_BITS_WORD; pos = XFASTINT (i) / BITS_PER_BITS_WORD; === modified file 'src/dispnew.c' --- src/dispnew.c 2013-10-08 20:04:40 +0000 +++ src/dispnew.c 2013-10-11 06:32:29 +0000 @@ -4480,7 +4480,6 @@ } } - assume (0 <= FRAME_LINES (f)); pause_p = 0 < i && i < FRAME_LINES (f) - 1; /* Now just clean up termcap drivers and set cursor, etc. */ === modified file 'src/ftfont.c' --- src/ftfont.c 2013-09-22 09:31:55 +0000 +++ src/ftfont.c 2013-10-11 06:32:29 +0000 @@ -2425,7 +2425,6 @@ } len = i; - assume (len <= STRING_BYTES_BOUND); if (with_variation_selector) { === modified file 'src/image.c' --- src/image.c 2013-10-10 19:15:33 +0000 +++ src/image.c 2013-10-11 06:32:29 +0000 @@ -7571,10 +7571,7 @@ y++, row += interlace_increment[pass]) { while (subimg_height <= row) - { - assume (pass < 3); - row = interlace_start[++pass]; - } + row = interlace_start[++pass]; for (x = 0; x < subimg_width; x++) { === modified file 'src/intervals.c' --- src/intervals.c 2013-10-09 17:56:58 +0000 +++ src/intervals.c 2013-10-11 06:32:29 +0000 @@ -1404,10 +1404,7 @@ adjust_intervals_for_insertion (buffer_intervals (buffer), start, length); else - { - assume (- TYPE_MAXIMUM (ptrdiff_t) <= length); - adjust_intervals_for_deletion (buffer, start, -length); - } + adjust_intervals_for_deletion (buffer, start, -length); } /* Merge interval I with its lexicographic successor. The resulting === modified file 'src/lisp.h' --- src/lisp.h 2013-10-09 17:52:38 +0000 +++ src/lisp.h 2013-10-11 06:32:29 +0000 @@ -31,6 +31,7 @@ #include #include +#include INLINE_HEADER_BEGIN @@ -113,28 +114,48 @@ /* Extra internal type checking? */ -/* Define an Emacs version of 'assert (COND)'. COND should be free of - side effects; it may be evaluated zero or more times. */ +/* Define Emacs versions of 's 'assert (COND)' and 's + 'assume (COND)'. COND should be free of side effects, as it may or + may not be evaluated. + + 'eassert (COND)' checks COND at runtime if ENABLE_CHECKING is + defined and suppress_checking is false, and does nothing otherwise. + Emacs dies if COND is checked and is false. The suppress_checking + variable is initialized to 0 in alloc.c. Set it to 1 using a + debugger to temporarily disable aborting on detected internal + inconsistencies or error conditions. + + In some cases, a good compiler may be able to optimize away the + eassert macro even if ENABLE_CHECKING is true, e.g., if XSTRING (x) + uses eassert to test STRINGP (x), but a particular use of XSTRING + is invoked only after testing that STRINGP (x) is true, making the + test redundant. + + eassume is like eassert except that it also causes the compiler to + assume that COND is true afterwards, regardless of whether runtime + checking is enabled. This can improve performance in some cases, + though it can degrade performance in others. It's often suboptimal + for COND to call external functions or access volatile storage. */ + #ifndef ENABLE_CHECKING # define eassert(cond) ((void) (0 && (cond))) /* Check that COND compiles. */ +# define eassume(cond) assume (cond) #else /* ENABLE_CHECKING */ extern _Noreturn void die (const char *, const char *, int); -/* The suppress_checking variable is initialized to 0 in alloc.c. Set - it to 1 using a debugger to temporarily disable aborting on - detected internal inconsistencies or error conditions. - - In some cases, a good compiler may be able to optimize away the - eassert macro altogether, e.g., if XSTRING (x) uses eassert to test - STRINGP (x), but a particular use of XSTRING is invoked only after - testing that STRINGP (x) is true, making the test redundant. */ extern bool suppress_checking EXTERNALLY_VISIBLE; # define eassert(cond) \ (suppress_checking || (cond) \ ? (void) 0 \ : die (# cond, __FILE__, __LINE__)) +# define eassume(cond) \ + (suppress_checking \ + ? assume (cond) \ + : (cond) \ + ? (void) 0 \ + : die (# cond, __FILE__, __LINE__)) #endif /* ENABLE_CHECKING */ === modified file 'src/macfont.m' --- src/macfont.m 2013-10-02 18:52:34 +0000 +++ src/macfont.m 2013-10-11 06:32:29 +0000 @@ -2817,7 +2817,6 @@ } len = i; - assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2); if (INT_MAX / 2 < len) memory_full (SIZE_MAX);