1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-27 07:41:28 -08:00
Commit graph

36309 commits

Author SHA1 Message Date
Paul Eggert
59355ea9ce Default to stack objects on non-GNU/Linux, non-DOS_NT platforms.
* lisp.h (USE_STACK_LISP_OBJECTS): Also default to true
if !defined DOS_NT && !defined GNU_LINUX.  I've tested this on AIX
and Solaris and it's likely to work on similar platforms.
2014-09-24 13:54:25 -07:00
Paul Eggert
203a9eb0ec Avoid signed integer overflow when converting Time to ptrdiff_t.
* keyboard.c (INPUT_EVENT_POS_MAX, INPUT_EVENT_POS_MIN):
New macros.
(position_to_Time, Time_to_position): New functions.
(gen_help_event, kbd_buffer_get_event): Use them.
* systime.h (Time) [emacs && !HAVE_X_WINDOWS]:
Go back to plain 'unsigned long', so that 'Time' is the same
for both X and non-X builds; this is less likely to cause surprise.
* termhooks.h: Remove compile-time check that Time and ptrdiff_t
are the same size; this is no longer required.
2014-09-24 13:30:28 -07:00
Paul Eggert
cd812613c8 * keyboard.c (make_lispy_event): Avoid unnecessary tests
of bit 28 and of whether an unsigned value is negative.
This simplifies the code a bit, and pacifies clang 3.4.
2014-09-24 11:25:04 -07:00
Ken Brown
cb61706445 * lisp.h (toplevel) [!USE_STACK_LISP_OBJECTS]: Fix poorly nested
conditions (Bug#18544).
2014-09-24 17:42:42 +04:00
Dmitry Antipov
e9a86416c6 * lisp.h (USE_STACK_LISP_OBJECTS): Enable by default if GNU_LINUX
&& __GNUC__ && !__clang__.  Mention known problems.  Adjust comment.
2014-09-24 15:59:13 +04:00
Dmitry Antipov
c0b1b03715 * chartab.c (uniprop_encode_value_numeric):
* font.c (font_style_to_value): Use make_local_vector.
(font_delete_unmatched): Use local_cons but respect MAX_ALLOCA.
* keymap.c (append_key): Use scoped_list1.
2014-09-24 15:11:14 +04:00
Eli Zaretskii
d4dfe4ea85 Fix fallout on MinGW64 from the previous commit.
src/systime.h (Time): Define as size_t, to be consistent with 64-bit
 Windows builds, where 'long' is a 32-bit type.
 src/w32inevt.h (w32_console_mouse_position): Update the argument
 types to use 'Time'.
 src/w32term.c (w32_mouse_position)
 (x_horizontal_scroll_bar_report_motion)
 (x_scroll_bar_report_motion): Update the argument types to use
 'Time'.
2014-09-24 13:06:53 +03:00
Dmitry Antipov
4b930ccbb4 * termhooks.h (enum scroll_bar_part): Begin from 0 to allow...
(struct input_event): ...unsigned bitfields.  Likewise for
`event_kind' member.  Prefer unsigned for `code' and 'modifiers'.
Use `timestamp' for HELP_EVENT position.  Add compile-time assert.
* keyboard.c (gen_help_event, kbd_buffer_store_help_event)
(kbd_buffer_get_event): Adjust users.
(scroll_bar_parts): Add Qnil to match scroll_bar_nowhere.
(make_scroll_bar_position): New function, refactored out of...
(make_lispy_event): ...adjusted user.
* nsterm.h (EmacsScroller): Use enum for `last_hit_part' member.
* nsterm.m (ns_mouse_position, mouseUp):
* term.c (term_mouse_position):
* w32inevt.c (w32_console_mouse_position):
* w32term.c (w32_mouse_position):
* xterm.c (XTmouse_position): Use scroll_bar_above_handle.
(x_send_scroll_bar_event, xm_scroll_callback, xg_scroll_callback):
Prefer enum and explicit enum members to integers and numeric values.
2014-09-24 11:17:51 +04:00
Paul Eggert
4620e6bccd Fix some slow uses and misuses of strcat.
* doc.c (get_doc_string):
* gtkutil.c (get_utf8_string):
* xsmfns.c (x_session_initialize):
Avoid recomputation of string length.
* ftfont.c (ftfont_spec_pattern):
* xfns.c (xic_create_fontsetname):
Don't assume output buffer is initially zero.
2014-09-23 21:12:37 -07:00
Paul Eggert
97914756e8 * lisp.h (lispstpcpy): Rename from lispstrcpy, and act like stpcpy.
All callers changed.
* xterm.c (x_term_init): Use new functionality to avoid two needs
to compute a string length.
2014-09-23 10:03:48 -07:00
Paul Eggert
ccc7be94d7 * dispextern.h, xdisp.c (window_box_right_offset): Now static. 2014-09-23 09:07:23 -07:00
Dmitry Antipov
59e10fbd93 Use known length of a Lisp string to copy it faster.
* lisp.h (lispstrcpy): New function.  Add comment.
* callproc.c (child_setup):
* dbusbind.c (xd_append_arg):
* doc.c (get_doc_string):
* font.c (Ffont_xlfd_name):
* frame.c (xrdb_get_resource):
* process.c (Fmake_network_process, network_interface_info):
* w32fns.c (Fx_open_connection):
* w32proc.c (sys_spawnve):
* xfns.c (select_visual):
* xfont.c (xfont_list):
* xsmfns.c (x_session_initialize):
* xterm.c (x_term_init): Use it.
2014-09-23 19:49:00 +04:00
Paul Eggert
cb8e2bfba7 Fix SAFE_ALLOCA to not exhaust the stack when in a loop.
Problem reported by Dmietry Antipov in thread leading to:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00713.html
This patch fixes only SAFE_ALLOCA, SAFE_NALLOCA, and SAFE_ALLOCA_LISP;
the experimental local_* macros enabled by USE_LOCAL_ALLOCATORS
remain unfixed.
* callproc.c (call_process): Save and restore sa_avail.
* lisp.h (USE_SAFE_ALLOCA): Define sa_avail.
(AVAIL_ALLOCA): New macro.
(SAFE_ALLOCA, SAFE_NALLOCA, SAFE_ALLOCA_LISP):
Use it, and check against sa_avail rather than MAX_ALLOCA.
2014-09-22 22:42:47 -07:00
Stefan Monnier
9949231fb0 Merge from emacs-24 2014-09-22 15:20:45 -04:00
Eli Zaretskii
f11af8a48c Fix bug #18516 with SIGSEGV in expand-file-name.
src/fileio.c (Fexpand_file_name) [DOS_NT]: Make sure newdirlim is
 always set to a valid value.  Make sure the size passed to alloca
 is always positive.
2014-09-22 17:37:22 +03:00
Dmitry Antipov
99c3fad7d4 Avoid extra call to oblookup when interning symbols.
* lisp.h (intern_driver): Add prototype.
* lread.c (intern_driver): New function.
(intern1, intern_c_string_1, Fintern):
* font.c (font_intern_prop):
* w32font.c (intern_font_name): Use it.
2014-09-22 10:06:19 +04:00
Dmitry Antipov
fc5ebc3f49 On OSX, do not free font-specific data more than once (Bug#18501).
* macfont.m (macfont_close): Release and free font-specific data
only if it wasn't previously freed.
2014-09-22 09:34:05 +04:00
Paul Eggert
f135e94e4e Minor improvements to new stack-allocated Lisp objects.
* frame.h (FRAME_PARAMETER):
Prefer scoped_list1 to local_list1 where either would do.
* lisp.h (scoped_list4): New macro.
(local_cons, local_list1, local_list2, local_list3, local_list4)
(make_local_vector, make_local_string, build_local_string):
Prefer functions to macros where either would do.
* xdisp.c (build_desired_tool_bar_string):
Prefer scoped_list4 to local_list4 where either would do.
2014-09-21 15:49:24 -07:00
David Caldwell
63126683db * configure.ac: Increase headerpad_extra to 1000, update the comment
about load commands.

* src/unexmacosx.c (dump_it): Improve error message.

Fixes: debbugs:18505
2014-09-21 22:35:22 +02:00
Juri Linkov
3a449b759c * src/image.c (imagemagick_load_image): Add delay to imagemagick metadata.
(Bug#10747, bug#18334)
2014-09-18 23:59:55 +03:00
Eli Zaretskii
41932b21a2 Clarify the doc strings of mouse-position and set-mouse-position.
src/frame.c (Fmouse_position, Fset_mouse_position): Clarify the
 units in which the position is measured.  (Bug#18493)
2014-09-18 20:20:57 +03:00
Eli Zaretskii
a810675374 Fix bug #18490 with redisplay of other windows showing a narrowed buffer.
src/xdisp.c (redisplay_internal): Force redisplay of all windows
 that show a buffer whose narrowing has changed.
2014-09-18 18:10:33 +03:00
Dmitry Antipov
3cab7dd46f More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS.
* lisp.h (local_list4) [USE_LOCAL_ALLOCATORS]: New macro.
[!USE_LOCAL_ALLOCATORS]: Fall back to regular list4.
* frame.h (FRAME_PARAMETER): New macro.
* dispnew.c (init_display):
* fontset.c (Fset_fontset_font):
* frame.c (x_default_parameter):
* xfaces.c (set_font_frame_param, Finternal_merge_in_global_face):
* xfns.c (x_default_scroll_bar_color_parameter)
(x_default_font_parameter, x_create_tip_frame): Use it.
* editfns.c (Fpropertize): Use local_cons.
* process.c (status_message): Use build_local_string.
* xfont.c (xfont_open): Use make_local_string.
* xdisp.c (build_desired_tool_bar_string): Use local_list4.
2014-09-18 15:34:24 +04:00
Paul Eggert
e8be4f442b Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64.
Revert previous lisp.h change, and install the following instead.
* lisp.h (USE_LOCAL_ALLOCATORS): Define only if __GNUC__ &&
!__clang__.  This works with GCC and with clang and is safer for
compilers we don't know about.
2014-09-17 22:40:17 -07:00
Paul Eggert
bb95ed98f4 Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64.
* lisp.h (ALLOCA_FIXUP): New constant.
(LOCAL_ALLOCA): New macro.
(local_cons, make_local_vector, make_local_string): Use them.
(local_cons): Rename parameter to make capture less likely.
2014-09-17 18:03:40 -07:00
Samuel Bronson
5db525e400 * unexmacosx.c (copy_data_segment): Port to GCC 4.6+.
Fixes: debbugs:9927
2014-09-17 12:58:31 -07:00
Paul Eggert
9356a87288 Fix minor problems found by static checking.
* alloc.c, lisp.h (SAVE_TYPE_INT_OBJ, make_save_int_obj):
Remove; now unused.
* buffer.h (decode_buffer): Doc and indentation fixes.
* fns.c (Qstring_collate_lessp, Qstring_collate_equalp): Now static.
2014-09-17 11:27:36 -07:00
Dmitry Antipov
18f88a41a7 Avoid clang-specific warnings.
* buffer.c (init_buffer): Shut up -Wself-assign.
* process.c (server_accept_connection): Shut up -Wunsequenced.
2014-09-17 19:34:37 +04:00
Dmitry Antipov
70d0c024da * alloc.c (local_vector_init): Remove useless INLINE. 2014-09-17 15:22:45 +04:00
Eli Zaretskii
534f1f7cb6 Fix display of hollow-box and hbar cursors on r2L lines.
src/xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor):
 src/w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L
 lines, draw the hollow-box and hbar cursors on the right side of
 cursor-glyph.  Thanks to Martin Rudalics <rudalics@gmx.at> for
 testing on X.
2014-09-16 18:53:36 +03:00
Eli Zaretskii
c20b4c2de5 Fix block cursor display in R2L lines.
src/xterm.c (x_draw_stretch_glyph_string):
 src/w32term.c (x_draw_stretch_glyph_string): Fix a thinko that
 caused the block cursor to disappear on a TAB in R2L lines in
 every window except the leftmost one.  Reported by Martin Rudalics
 <rudalics@gmx.at>.
2014-09-16 18:44:51 +03:00
Daniel Colascione
89b34071dd For symbols, use address as hash code.
* src/fns.c (sxhash): For symbols, use address as hash code.
2014-09-16 06:07:57 -07:00
Dmitry Antipov
3e67a981c4 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-16 15:43:49 +04:00
Dmitry Antipov
b98b1a831b 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-16 12:20:08 +04:00
Dmitry Antipov
005aff7092 Prefer ptrdiff_t to int and avoid integer overflows.
* fileio.c (make_temp_name):
* font.c (font_parse_family_registry): Avoid integer
overflow on string size calculation.
* data.c (Faset): Likewise for byte index.
2014-09-16 08:07:51 +04:00
Dmitry Antipov
ccb767d639 Always use matched specpdl entry to record call arguments (Bug#18473).
* lisp.h (record_in_backtrace): Adjust prototype.
* eval.c (record_in_backtrace): Return current specpdl level.
(set_backtrace_args, set_backtrace_nargs): Merge.  Adjust all users.
(eval_sub, Ffuncall): Record call arguments in matched specpdl
entry and use that entry in call to backtrace_debug_on_exit.
(apply_lambda): Likewise.  Get current specpdl level as 3rd arg.
(do_debug_on_call): Get current specpdl level as 2nd arg.
2014-09-16 08:04:56 +04:00
Eli Zaretskii
a7fc3ab8f1 Support playing on MS-Windows non-ASCII sound files using Unicode APIs.
src/sound.c [WINDOWSNT]: Include w32common.h and mbstring.h.
 (SOUND_WARNING) [WINDOWSNT]: Include in do..while and improve the
 error message format.  Use message_with_string to have non-ASCII
 file names properly displayed.
 (do_play_sound) [WINDOWSNT]: Use Unicode APIs to play sound files
 when w32-unicode-filenames is non-nil, but not on Windows 9X,
 where these APIs are not available even in UNICOWS.DLL.  Improve
 the format of error messages and include the file name in them
 where appropriate.
 (Fplay_sound_internal) [WINDOWSNT]: Make the MS-Windows branch
 call play-sound-functions, per documentation.
 src/w32.c (w32_get_long_filename, w32_get_short_filename): Constify
 the input file name arguments.
 src/w32.h (w32_get_long_filename, w32_get_short_filename): Update
 prototypes.
2014-09-15 18:51:57 +03:00
Eli Zaretskii
2d83441cc0 src/dispextern.h: Commentary fix. 2014-09-15 18:29:40 +03:00
Eli Zaretskii
6b682d2b39 Fix display of R2L lines in partial-width windows.
src/xdisp.c (init_iterator): Don't use it->bidi_p before it is
 assigned the correct value.
 (extend_face_to_end_of_line): Account for truncation and
 continuation glyphs in R2L rows when one of the fringes is not
 displayed.
 (display_line): Don't assign negative X offset to a row if we are
 going to produce a truncation glyph for it.  When handling
 truncated R2L rows, consider the width of the left fringe instead
 of the right one.
 (produce_special_glyphs): Fix bogus assignments.
2014-09-15 18:25:54 +03:00
Dmitry Antipov
edb0288b83 If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.
* lisp.h (local_cons, local_list1, local_list2, local_list3)
[USE_LOCAL_ALLOCATORS]: New macros.
[!USE_LOCAL_ALLOCATORS]: Fall back to regular functions.
(build_local_string): Avoid argument name expansion clash with
make_local_string.
* alloc.c (toplevel)
[USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]:
Preprocessor guard to avoid impossible configuration.
* charset.c (Ffind_charset_region, Ffind_charset_string):
Use make_local_vector.
* lread.c (read1, substitute_object_recurse): Use scoped_cons.
* textprop.c (Fput_text_property, Fadd_face_text_property):
Use scoped_list2.
(copy_text_properties): Use local_cons and local_list3.
* chartab.c (uniprop_table):
* data.c (wrong_choice, wrong_range):
* doc.c (get_doc_string):
* editfns.c (format2):
* fileio.c (Fexpand_file_name, auto_save_error):
* fns.c (Fyes_or_no_p):
* font.c (font_parse_xlfd, font_parse_family_registry, font_add_log):
* fontset.c (Fset_fontset_font):
* keyboard.c (echo_add_key, echo_dash, parse_menu_item)
(read_char_minibuf_menu_prompt):
* keymap.c (silly_event_symbol_error, describe_vector):
* menu.c (single_menu_item):
* minibuf.c (Fread_buffer):
* process.c (status_message, Fformat_network_address)
(server_accept_connection): Use make_local_string and
build_local_string.  Prefer compound literals where appropriate.
2014-09-15 18:53:23 +04:00
Daniel Colascione
497daa1274 Tweak sort docstring
* fns.c (Fsort): Tweak sort docstring.
2014-09-14 22:09:44 -07:00
Glenn Morris
11af46027d Merge from emacs-24; up to 2014-07-09T02:04:12Z!rgm@gnu.org 2014-09-14 17:20:21 -07:00
Eli Zaretskii
9ed670023f Fix bug #18420 with deadlocks communicating with subprocess on MS-Windows.
src/w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of
 pipes.
 (sys_write): When a write to a non-blocking pipe returns ENOSPC,
 set errno to EAGAIN instead, to allow the caller to retry the
 write after some waiting.  Fixes deadlocks when Emacs exchanges a
 lot of data through the pipe.
2014-09-14 18:18:39 +03:00
Jan Djärv
3f7ae02b89 * callproc.c (init_callproc): Fix bug introduced at 2014-09-07.
Fixes: debbugs:18474
2014-09-14 10:23:48 +02:00
Eli Zaretskii
a6cc335aef Fix expansion and encoding of sound file names on MS-Windows.
src/sound.c (Fplay_sound_internal): Encode the sound file name in
 the ANSI codepage.  Expand it against data-directory, as per docs,
 not against the current directory.  No need to make a local copy
 of the file name; pass the encoded file name directly to
 do_play_sound.  (Bug#18463)
 src/w32.c (ansi_encode_filename): If w32_get_short_filename returns
 NULL, and the file name is not encodable in ANSI codepage, return
 the string with "?" replacement characters, which will fail the
 caller.  This avoids returning a random value in that case.
2014-09-13 11:26:44 +03:00
Dmitry Antipov
5599832145 Prefer ptrdiff_t to int and avoid integer overflows.
* fileio.c (make_temp_name):
* font.c (font_parse_family_registry): Avoid integer
overflow on string size calculation.
* data.c (Faset): Likewise for byte index.
2014-09-13 08:41:54 +04:00
Detlev Zundel
9f4ee99776 * buffer.c (syms_of_buffer): DEFSYM Qchoice (Bug#18337). 2014-09-12 15:12:40 +04:00
Paul Eggert
0f2ed59206 Spelling fixes.
* lisp/ses.el (ses-file-format-extend-parameter-list): Rename from
ses-file-format-extend-paramter-list.  All uses changed.
* lisp/gnus-cloud.el (gnus-cloud-parse-version-1): Fix misspelling
of ":delete".
2014-09-11 12:44:25 -07:00
Dmitry Antipov
1dd1218653 Remove redundant GCPROs around Ffuncall and Fapply calls. This
is safe because Ffuncall protects all of its arguments by itself.
* charset.c (map_charset_for_dump): Remove redundant GCPRO.
* eval.c (Fapply, apply1, call0, call1, call2, call3, call4, call5)
(call6, call7): Likewise.  Use compound literals where applicable.
(run_hook_with_args_2): Use compound literal.
2014-09-11 17:21:19 +04:00
Dmitry Antipov
20d3625380 * lread.c (readevalloop_eager_expand_eval): Add GCPRO and fix
bootstrap broken if GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE.
2014-09-11 17:02:09 +04:00