------------------------------------------------------------ revno: 117891 committer: Paul Eggert branch nick: trunk timestamp: Tue 2014-09-16 17:07:12 -0700 message: Don't assume 'grep' supports GREP_OPTIONS. The GREP_OPTIONS environment variable is planned to be marked obsolescent in GNU grep, due to problems in its use, so stop relying on it. * progmodes/grep.el (grep-highlight-matches): Document this. (grep-process-setup): Do not set GREP_OPTIONS. (grep-compute-defaults): Use an explicit --color option if supported. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-09-16 00:28:28 +0000 +++ lisp/ChangeLog 2014-09-17 00:07:12 +0000 @@ -1,3 +1,13 @@ +2014-09-17 Paul Eggert + + Don't assume 'grep' supports GREP_OPTIONS. + The GREP_OPTIONS environment variable is planned to be marked + obsolescent in GNU grep, due to problems in its use, so stop + relying on it. + * progmodes/grep.el (grep-highlight-matches): Document this. + (grep-process-setup): Do not set GREP_OPTIONS. + (grep-compute-defaults): Use an explicit --color option if supported. + 2014-09-16 Stefan Monnier * msb.el (msb--make-keymap-menu, msb-menu-bar-update-buffers): === modified file 'lisp/progmodes/grep.el' --- lisp/progmodes/grep.el 2014-05-09 09:10:56 +0000 +++ lisp/progmodes/grep.el 2014-09-17 00:07:12 +0000 @@ -76,11 +76,10 @@ you will not get highlighting. This option sets the environment variable GREP_COLORS to specify -markers for highlighting and GREP_OPTIONS to add the --color -option in front of any explicit grep options before starting -the grep. +markers for highlighting and adds the --color option in front of +any explicit grep options before starting the grep. -When this option is `auto', grep uses `--color=auto' to highlight +When this option is `auto', grep uses `--color' to highlight matches only when it outputs to a terminal (when `grep' is the last command in the pipe), thus avoiding the use of any potentially-harmful escape sequences when standard output goes to a file or pipe. @@ -96,7 +95,7 @@ :type '(choice (const :tag "Do not highlight matches with grep markers" nil) (const :tag "Highlight matches with grep markers" t) (const :tag "Use --color=always" always) - (const :tag "Use --color=auto" auto) + (const :tag "Use --color" auto) (other :tag "Not Set" auto-detect)) :set 'grep-apply-setting :version "22.1" @@ -466,10 +465,6 @@ ;; `setenv' modifies `process-environment' let-bound in `compilation-start' ;; Any TERM except "dumb" allows GNU grep to use `--color=auto' (setenv "TERM" "emacs-grep") - (setenv "GREP_OPTIONS" - (concat (getenv "GREP_OPTIONS") - " --color=" (if (eq grep-highlight-matches 'always) - "always" "auto"))) ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions (setenv "GREP_COLOR" "01;31") ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions @@ -569,7 +564,13 @@ (unless (and grep-command grep-find-command grep-template grep-find-template) (let ((grep-options - (concat (if grep-use-null-device "-n" "-nH") + (concat (and grep-highlight-matches + (grep-probe grep-program + `(nil nil nil "--color" "x" ,null-device) + nil 1) + (if (eq grep-highlight-matches 'always) + "--color=always " "--color ")) + (if grep-use-null-device "-n" "-nH") (if (grep-probe grep-program `(nil nil nil "-e" "foo" ,null-device) nil 1) ------------------------------------------------------------ revno: 117890 committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-09-16 06:07:57 -0700 message: For symbols, use address as hash code. * src/fns.c (sxhash): For symbols, use address as hash code. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-16 11:43:49 +0000 +++ src/ChangeLog 2014-09-16 13:07:57 +0000 @@ -1,3 +1,7 @@ +2014-09-16 Daniel Colascione + + * fns.c (sxhash): For symbols, use address as hash code. + 2014-09-16 Dmitry Antipov If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack. === modified file 'src/fns.c' --- src/fns.c 2014-09-16 08:20:08 +0000 +++ src/fns.c 2014-09-16 13:07:57 +0000 @@ -4476,13 +4476,10 @@ break; case Lisp_Misc: + case Lisp_Symbol: hash = XHASH (obj); break; - case Lisp_Symbol: - obj = SYMBOL_NAME (obj); - /* Fall through. */ - case Lisp_String: hash = sxhash_string (SSDATA (obj), SBYTES (obj)); break; ------------------------------------------------------------ revno: 117889 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2014-09-16 15:43:49 +0400 message: Avoid more integer overflows on string size calculations. * category.c (Fmake_category_set): * xdisp.c (get_overlay_arrow_glyph_row): * w32font.c (intern_font_name): Prefer ptrdiff_t to int. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-16 08:20:08 +0000 +++ src/ChangeLog 2014-09-16 11:43:49 +0000 @@ -16,6 +16,11 @@ (x_clipboard_manager_save_all): * xterm.c (x_term_init): Use build_local_string. + Avoid more integer overflows on string size calculations. + * category.c (Fmake_category_set): + * xdisp.c (get_overlay_arrow_glyph_row): + * w32font.c (intern_font_name): Prefer ptrdiff_t to int. + 2014-09-15 Eli Zaretskii * sound.c [WINDOWSNT]: Include w32common.h and mbstring.h. === modified file 'src/category.c' --- src/category.c 2014-01-01 07:43:34 +0000 +++ src/category.c 2014-09-16 11:43:49 +0000 @@ -96,7 +96,7 @@ (Lisp_Object categories) { Lisp_Object val; - int len; + ptrdiff_t len; CHECK_STRING (categories); val = MAKE_CATEGORY_SET; === modified file 'src/w32font.c' --- src/w32font.c 2014-08-25 07:00:42 +0000 +++ src/w32font.c 2014-09-16 11:43:49 +0000 @@ -287,7 +287,7 @@ intern_font_name (char * string) { Lisp_Object str = DECODE_SYSTEM (build_string (string)); - int len = SCHARS (str); + ptrdiff_t len = SCHARS (str); Lisp_Object obarray = check_obarray (Vobarray); Lisp_Object tem = oblookup (obarray, SDATA (str), len, len); /* This code is similar to intern function from lread.c. */ === modified file 'src/xdisp.c' --- src/xdisp.c 2014-09-16 08:20:08 +0000 +++ src/xdisp.c 2014-09-16 11:43:49 +0000 @@ -18858,7 +18858,7 @@ struct buffer *buffer = XBUFFER (w->contents); struct buffer *old = current_buffer; const unsigned char *arrow_string = SDATA (overlay_arrow_string); - int arrow_len = SCHARS (overlay_arrow_string); + ptrdiff_t arrow_len = SCHARS (overlay_arrow_string); const unsigned char *arrow_end = arrow_string + arrow_len; const unsigned char *p; struct it it; ------------------------------------------------------------ revno: 117888 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2014-09-16 12:20:08 +0400 message: If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack. * charset.c (load_charset_map_from_file): Use scoped_list2 and build_local_string. * buffer.c (Fother_buffer, other_buffer_safely, init_buffer): * emacs.c (init_cmdargs, decode_env_path): * fileio.c (Fexpand_file_name): * fns.c (maybe_resize_hash_table) [ENABLE_CHECKING]: * frame.c (x_get_arg): * keyboard.c (safe_run_hooks_error): * lread.c (load_warn_old_style_backquotes): * xdisp.c (Fcurrent_bidi_paragraph_direction): * xfns.c (x_default_scroll_bar_color_parameter, select_visual): * xselect.c (x_clipboard_manager_error_1) (x_clipboard_manager_save_all): * xterm.c (x_term_init): Use build_local_string. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-15 15:51:57 +0000 +++ src/ChangeLog 2014-09-16 08:20:08 +0000 @@ -1,3 +1,21 @@ +2014-09-16 Dmitry Antipov + + If USE_LOCAL_ALLOCATORS, allocate even more Lisp objects on stack. + * charset.c (load_charset_map_from_file): Use scoped_list2 + and build_local_string. + * buffer.c (Fother_buffer, other_buffer_safely, init_buffer): + * emacs.c (init_cmdargs, decode_env_path): + * fileio.c (Fexpand_file_name): + * fns.c (maybe_resize_hash_table) [ENABLE_CHECKING]: + * frame.c (x_get_arg): + * keyboard.c (safe_run_hooks_error): + * lread.c (load_warn_old_style_backquotes): + * xdisp.c (Fcurrent_bidi_paragraph_direction): + * xfns.c (x_default_scroll_bar_color_parameter, select_visual): + * xselect.c (x_clipboard_manager_error_1) + (x_clipboard_manager_save_all): + * xterm.c (x_term_init): Use build_local_string. + 2014-09-15 Eli Zaretskii * sound.c [WINDOWSNT]: Include w32common.h and mbstring.h. === modified file 'src/buffer.c' --- src/buffer.c 2014-09-12 11:12:40 +0000 +++ src/buffer.c 2014-09-16 08:20:08 +0000 @@ -1552,10 +1552,10 @@ return notsogood; else { - buf = Fget_buffer (build_string ("*scratch*")); + buf = Fget_buffer (build_local_string ("*scratch*")); if (NILP (buf)) { - buf = Fget_buffer_create (build_string ("*scratch*")); + buf = Fget_buffer_create (build_local_string ("*scratch*")); Fset_buffer_major_mode (buf); } return buf; @@ -1575,10 +1575,10 @@ if (candidate_buffer (buf, buffer)) return buf; - buf = Fget_buffer (build_string ("*scratch*")); + buf = Fget_buffer (build_local_string ("*scratch*")); if (NILP (buf)) { - buf = Fget_buffer_create (build_string ("*scratch*")); + buf = Fget_buffer_create (build_local_string ("*scratch*")); Fset_buffer_major_mode (buf); } @@ -5289,7 +5289,7 @@ initialized = initialized; #endif /* USE_MMAP_FOR_BUFFERS */ - Fset_buffer (Fget_buffer_create (build_string ("*scratch*"))); + Fset_buffer (Fget_buffer_create (build_local_string ("*scratch*"))); if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) Fset_buffer_multibyte (Qnil); @@ -5328,7 +5328,7 @@ && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) bset_directory (current_buffer, - concat2 (build_string ("/:"), BVAR (current_buffer, directory))); + concat2 (build_local_string ("/:"), BVAR (current_buffer, directory))); temp = get_minibuffer (0); bset_directory (XBUFFER (temp), BVAR (current_buffer, directory)); === modified file 'src/charset.c' --- src/charset.c 2014-09-15 14:53:23 +0000 +++ src/charset.c 2014-09-16 08:20:08 +0000 @@ -490,7 +490,8 @@ int n_entries; ptrdiff_t count; - suffixes = list2 (build_string (".map"), build_string (".TXT")); + suffixes = scoped_list2 (build_local_string (".map"), + build_local_string (".TXT")); count = SPECPDL_INDEX (); record_unwind_protect_nothing (); === modified file 'src/data.c' --- src/data.c 2014-09-15 14:53:23 +0000 +++ src/data.c 2014-09-16 08:20:08 +0000 @@ -983,7 +983,7 @@ USE_SAFE_ALLOCA; SAFE_ALLOCA_LISP (args, len * 2 + 1); - args[i++] = build_string ("One of "); + args[i++] = build_local_string ("One of "); for (obj = choice; !NILP (obj); obj = XCDR (obj)) { === modified file 'src/emacs.c' --- src/emacs.c 2014-09-01 02:37:22 +0000 +++ src/emacs.c 2014-09-16 08:20:08 +0000 @@ -423,7 +423,7 @@ if it would otherwise be treated as magic. */ handler = Ffind_file_name_handler (raw_name, Qt); if (! NILP (handler)) - raw_name = concat2 (build_string ("/:"), raw_name); + raw_name = concat2 (build_local_string ("/:"), raw_name); Vinvocation_name = Ffile_name_nondirectory (raw_name); Vinvocation_directory = Ffile_name_directory (raw_name); @@ -441,7 +441,7 @@ if it would otherwise be treated as magic. */ handler = Ffind_file_name_handler (found, Qt); if (! NILP (handler)) - found = concat2 (build_string ("/:"), found); + found = concat2 (build_local_string ("/:"), found); Vinvocation_directory = Ffile_name_directory (found); } } @@ -2323,7 +2323,7 @@ } if (! NILP (tem)) - element = concat2 (build_string ("/:"), element); + element = concat2 (build_local_string ("/:"), element); } /* !NILP (element) */ lpath = Fcons (element, lpath); === modified file 'src/fileio.c' --- src/fileio.c 2014-09-15 14:53:23 +0000 +++ src/fileio.c 2014-09-16 08:20:08 +0000 @@ -1111,7 +1111,7 @@ name = make_specified_string (nm, -1, p - nm, multibyte); temp[0] = DRIVE_LETTER (drive); - name = concat2 (build_string (temp), name); + name = concat2 (build_local_string (temp), name); } #ifdef WINDOWSNT if (!NILP (Vw32_downcase_file_names)) === modified file 'src/fns.c' --- src/fns.c 2014-09-15 14:53:23 +0000 +++ src/fns.c 2014-09-16 08:20:08 +0000 @@ -3994,12 +3994,9 @@ #ifdef ENABLE_CHECKING if (HASH_TABLE_P (Vpurify_flag) && XHASH_TABLE (Vpurify_flag) == h) - { - Lisp_Object args[2]; - args[0] = build_string ("Growing hash table to: %d"); - args[1] = make_number (new_size); - Fmessage (2, args); - } + Fmessage (2, ((Lisp_Object []) + { build_local_string ("Growing hash table to: %d"), + make_number (new_size) })); #endif set_hash_key_and_value (h, larger_vector (h->key_and_value, === modified file 'src/frame.c' --- src/frame.c 2014-09-11 19:44:25 +0000 +++ src/frame.c 2014-09-16 08:20:08 +0000 @@ -4162,10 +4162,9 @@ { if (attribute && dpyinfo) { - tem = display_x_get_resource (dpyinfo, - build_string (attribute), - build_string (class), - Qnil, Qnil); + tem = display_x_get_resource + (dpyinfo, build_local_string (attribute), + build_local_string (class), Qnil, Qnil); if (NILP (tem)) return Qunbound; === modified file 'src/keyboard.c' --- src/keyboard.c 2014-09-15 14:53:23 +0000 +++ src/keyboard.c 2014-09-16 08:20:08 +0000 @@ -1894,16 +1894,13 @@ static Lisp_Object safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args) { - Lisp_Object hook, fun, msgargs[4]; + Lisp_Object hook, fun; eassert (nargs == 2); hook = args[0]; fun = args[1]; - msgargs[0] = build_string ("Error in %s (%S): %S"); - msgargs[1] = hook; - msgargs[2] = fun; - msgargs[3] = error; - Fmessage (4, msgargs); + Fmessage (4, ((Lisp_Object []) + { build_local_string ("Error in %s (%S): %S"), hook, fun, error })); if (SYMBOLP (hook)) { === modified file 'src/lread.c' --- src/lread.c 2014-09-15 14:53:23 +0000 +++ src/lread.c 2014-09-16 08:20:08 +0000 @@ -969,12 +969,9 @@ load_warn_old_style_backquotes (Lisp_Object file) { if (!NILP (Vold_style_backquotes)) - { - Lisp_Object args[2]; - args[0] = build_string ("Loading `%s': old-style backquotes detected!"); - args[1] = file; - Fmessage (2, args); - } + Fmessage (2, ((Lisp_Object []) + { build_local_string ("Loading `%s': old-style backquotes detected!"), + file })); } DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0, === modified file 'src/xdisp.c' --- src/xdisp.c 2014-09-15 00:20:21 +0000 +++ src/xdisp.c 2014-09-16 08:20:08 +0000 @@ -20884,7 +20884,7 @@ the previous non-empty line. */ if (pos >= ZV && pos > BEGV) DEC_BOTH (pos, bytepos); - if (fast_looking_at (build_string ("[\f\t ]*\n"), + if (fast_looking_at (build_local_string ("[\f\t ]*\n"), pos, bytepos, ZV, ZV_BYTE, Qnil) > 0) { while ((c = FETCH_BYTE (bytepos)) == '\n' === modified file 'src/xfns.c' --- src/xfns.c 2014-09-03 15:10:29 +0000 +++ src/xfns.c 2014-09-16 08:20:08 +0000 @@ -1571,13 +1571,13 @@ /* See if an X resource for the scroll bar color has been specified. */ - tem = display_x_get_resource (dpyinfo, - build_string (foreground_p - ? "foreground" - : "background"), - empty_unibyte_string, - build_string ("verticalScrollBar"), - empty_unibyte_string); + tem = display_x_get_resource + (dpyinfo, build_local_string (foreground_p + ? "foreground" + : "background"), + empty_unibyte_string, + build_local_string ("verticalScrollBar"), + empty_unibyte_string); if (!STRINGP (tem)) { /* If nothing has been specified, scroll bars will use a @@ -4273,13 +4273,12 @@ { Display *dpy = dpyinfo->display; Screen *screen = dpyinfo->screen; - Lisp_Object value; /* See if a visual is specified. */ - value = display_x_get_resource (dpyinfo, - build_string ("visualClass"), - build_string ("VisualClass"), - Qnil, Qnil); + Lisp_Object value = display_x_get_resource + (dpyinfo, build_local_string ("visualClass"), + build_local_string ("VisualClass"), Qnil, Qnil); + if (STRINGP (value)) { /* VALUE should be of the form CLASS-DEPTH, where CLASS is one === modified file 'src/xselect.c' --- src/xselect.c 2014-09-07 19:47:28 +0000 +++ src/xselect.c 2014-09-16 08:20:08 +0000 @@ -2159,11 +2159,10 @@ static Lisp_Object x_clipboard_manager_error_1 (Lisp_Object err) { - Lisp_Object args[2]; - args[0] = build_string ("X clipboard manager error: %s\n\ -If the problem persists, set `x-select-enable-clipboard-manager' to nil."); - args[1] = CAR (CDR (err)); - Fmessage (2, args); + Fmessage (2, ((Lisp_Object []) + { build_local_string ("X clipboard manager error: %s\n\ +If the problem persists, set `x-select-enable-clipboard-manager' to nil."), + CAR (CDR (err)) })); return Qnil; } @@ -2230,10 +2229,9 @@ local_frame = XCAR (XCDR (XCDR (XCDR (local_selection)))); if (FRAME_LIVE_P (XFRAME (local_frame))) { - Lisp_Object args[1]; - args[0] = build_string ("Saving clipboard to X clipboard manager..."); - Fmessage (1, args); - + Fmessage (1, ((Lisp_Object []) + { build_local_string + ("Saving clipboard to X clipboard manager...") })); internal_condition_case_1 (x_clipboard_manager_save, local_frame, Qt, x_clipboard_manager_error_2); } === modified file 'src/xterm.c' --- src/xterm.c 2014-09-10 17:18:38 +0000 +++ src/xterm.c 2014-09-16 08:20:08 +0000 @@ -10946,10 +10946,9 @@ if (dpyinfo->visual->class == PseudoColor) { Lisp_Object value; - value = display_x_get_resource (dpyinfo, - build_string ("privateColormap"), - build_string ("PrivateColormap"), - Qnil, Qnil); + value = display_x_get_resource + (dpyinfo, build_local_string ("privateColormap"), + build_local_string ("PrivateColormap"), Qnil, Qnil); if (STRINGP (value) && (!strcmp (SSDATA (value), "true") || !strcmp (SSDATA (value), "on"))) @@ -11156,11 +11155,9 @@ /* See if we should run in synchronous mode. This is useful for debugging X code. */ { - Lisp_Object value; - value = display_x_get_resource (dpyinfo, - build_string ("synchronous"), - build_string ("Synchronous"), - Qnil, Qnil); + Lisp_Object value = display_x_get_resource + (dpyinfo, build_local_string ("synchronous"), + build_local_string ("Synchronous"), Qnil, Qnil); if (STRINGP (value) && (!strcmp (SSDATA (value), "true") || !strcmp (SSDATA (value), "on"))) @@ -11168,11 +11165,9 @@ } { - Lisp_Object value; - value = display_x_get_resource (dpyinfo, - build_string ("useXIM"), - build_string ("UseXIM"), - Qnil, Qnil); + Lisp_Object value = display_x_get_resource + (dpyinfo, build_local_string ("useXIM"), + build_local_string ("UseXIM"), Qnil, Qnil); #ifdef USE_XIM if (STRINGP (value) && (!strcmp (SSDATA (value), "false") ------------------------------------------------------------ revno: 117887 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18482 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2014-09-15 20:28:28 -0400 message: * lisp/msb.el (msb--make-keymap-menu, msb-menu-bar-update-buffers): Don't add outdated key-shortcut cache. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-09-15 00:20:21 +0000 +++ lisp/ChangeLog 2014-09-16 00:28:28 +0000 @@ -1,3 +1,8 @@ +2014-09-16 Stefan Monnier + + * msb.el (msb--make-keymap-menu, msb-menu-bar-update-buffers): + Don't add outdated key-shortcut cache (bug#18482). + 2014-09-15 Glenn Morris * image.el (image-multi-frame-p): Fix thinko - do not force === modified file 'lisp/msb.el' --- lisp/msb.el 2014-02-10 01:34:22 +0000 +++ lisp/msb.el 2014-09-16 00:28:28 +0000 @@ -1064,7 +1064,7 @@ list)) (defun msb--make-keymap-menu (raw-menu) - (let ((end (cons '(nil) 'menu-bar-select-buffer)) + (let ((end 'menu-bar-select-buffer) (mcount 0)) (mapcar (lambda (sub-menu) @@ -1105,13 +1105,12 @@ (setcdr (nthcdr msb-max-menu-items frames) nil)) (setq frames-menu (nconc - (list 'frame f-title '(nil) 'keymap f-title) + (list 'frame f-title 'keymap f-title) (mapcar (lambda (frame) (nconc (list (frame-parameter frame 'name) - (frame-parameter frame 'name) - (cons nil nil)) + (frame-parameter frame 'name)) `(lambda () (interactive) (menu-bar-select-frame ,frame)))) frames)))))