summaryrefslogtreecommitdiff
path: root/src/term.c
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup when opening a new terminal fails. (Bug#32794)John Shahid2018-09-291-0/+1
| | | | | | | | | * src/term.c (init_tty): Call delete_terminal_internal if emacs_open fail. * src/terminal.c (delete_terminal): Move some code into delete_terminal_internal and call it. (delete_terminal_internal): New function. * src/termhooks.h: Prototype for delete_terminal_internal.
* Fix display of TABs in hscrolled windows with line numbersEli Zaretskii2018-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | * src/dispextern.h (struct it): New members tab_offset and line_number_produced_p. * src/xdisp.c (display_line): Don't set row->x to a negative value if line numbers are being displayed. (Bug#30582) Reset the line_number_produced_p flag before laying out the glyph row. (x_produce_glyphs): Use the line_number_produced_p flag to decide whether to offset the X coordinate due to line-number display. Use the tab_offset member to restore the original TAB width for alignment purposes. (move_it_in_display_line_to): Don't produce line numbers when moving in hscrolled window to the left of first_visible_x. (maybe_produce_line_number): Set the line_number_produced_p flag. (Bug#30584) * src/term.c (produce_glyphs): Correct TAB width only when line_number_produced_p flag is set. (cherry picked from commit 1ac190553886ff20817d3dd218464e2fc6f9e42a)
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* maint: shorten https://lists.gnu.org/archive/html/... linksPaul Eggert2017-11-251-1/+1
|
* Prefer HTTPS to HTTP for gnu.orgPaul Eggert2017-10-011-1/+1
| | | | | | | | | This fixes some URLs I omitted from my previous pass, notably those in lists.gnu.org. Although lists.gnu.org does not yet support TLS 1.1, TLS 1.0 is better than nothing. * lisp/erc/erc.el (erc-official-location): * lisp/mail/emacsbug.el (report-emacs-bug): Use https:, not http:.
* Avoid crash with C-g C-g in GCPaul Eggert2017-09-171-4/+8
| | | | | | | Problem reported by Richard Stallman (Bug#17406). Based on fix suggested by Eli Zaretskii (Bug#28279#16). * src/term.c (tty_send_additional_strings): Use only safe accessors, to avoid crash when C-g C-g in GC.
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Avoid compiler warnings on MS-Windows with GCC 6 and 7Eli Zaretskii2017-09-081-1/+1
| | | | | | | | | | | | | | * src/w32font.c (SUBRANGE): Use unsigned arithmetic for bit-shifting, to avoid compiler warnings. (w32font_text_extents): Tell GCC NGLYPHS is non-negative, to avoid a warning. For details of the warning, see http://lists.gnu.org/archive/html/emacs-devel/2017-09/msg00093.html. * src/term.c (keys) [WINDOWSNT]: Don't define, as it is not used in that build. * src/sound.c (sound_perror): Ifdef away on WINDOWSNT, as this function is not used in that build. * configure.ac: Disable -Wsuggest-attribute=format on MS-Windows.
* Support display of line numbers nativelyEli Zaretskii2017-07-081-1/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This merges branch 'line-numbers'. * src/buffer.c (disable_line_numbers_overlay_at_eob): New function. * src/lisp.h (disable_line_numbers_overlay_at_eob): Add prototype. * src/dispextern.h (struct it): New members pt_lnum, lnum, lnum_bytepos, lnum_width, and lnum_pixel_width. * src/indent.c (line_number_display_width): New function, refactored from line-number width calculations in vertical-motion. (Fvertical_motion): Call line_number_display_width when the width of line-number display is needed. (Fline_number_display_width): New defun. (syms_of_indent): Defsubr it. * src/indent.c (Fvertical_motion): Help C-n/C-p estimate correctly the width used up by line numbers by looking near the window-start point. If window-start is outside of the accessible portion, temporarily widen the buffer. * src/term.c (produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display. * src/xdisp.c (display_count_lines_logically) (display_count_lines_visually, maybe_produce_line_number) (should_produce_line_number, row_text_area_empty): New functions. (try_window_reusing_current_matrix): Don't use this method when display-line-numbers is in effect. (try_window_id, try_cursor_movement): Disable these optimizations when the line-number-current-line face is different from line-number face and for relative line numbers. (try_window_id, redisplay_window, try_cursor_movement): For visual line-number display, disable the same redisplay optimizations as for relative. (x_produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display. (hscroll_window_tree): Adjust hscroll calculations to line-number display. (DISP_INFINITY): Renamed from INFINITY to avoid clashes with math.h; all users changed. (set_cursor_from_row): Fix calculation of cursor X coordinate in R2L rows with display-produced glyphs at the beginning. (display_line): Use should_produce_line_number to determine whether a line number should be produced for each glyph row, and maybe_produce_line_number to produce line numbers. Don't display line numbers in the minibuffer and in tooltip frames. Call row_text_area_empty to verify that a glyph row's text area is devoid of any glyphs that came from a buffer or a string. This fixes a bug with empty-lines indication disappearing when line numbers or line-prefix are displayed. (syms_of_xdisp) <display-line-numbers, display-line-numbers-widen> <display-line-number-width>: New buffer-local variables. <display-line-numbers-current-absolute>: New variable. * lisp/cus-start.el (standard): Provide customization forms for display-line-numbers and its sub-features. * lisp/faces.el (line-number, line-number-current-line): New faces. * lisp/frame.el: Add display-line-numbers, display-line-numbers-widen, display-line-numbers-current-absolute, and display-line-number-width to the list of variables that should trigger redisplay of the current buffer. * lisp/menu-bar.el (menu-bar-showhide-menu): Add menu-bar item to turn display-line-numbers on and off. (toggle-display-line-numbers): New function. * lisp/simple.el (last--line-number-width): New internal variable. (line-move-visual): Use it to adjust temporary-goal-column when line-number display changes its width. * doc/emacs/basic.texi (Position Info): Add cross-reference to "Display Custom", for line-number display. * doc/emacs/custom.texi (Init Rebinding): * doc/emacs/modes.texi (Minor Modes): Remove references to linum-mode. * doc/emacs/display.texi (Display Custom): Describe the line-number display. * doc/lispref/display.texi (Size of Displayed Text): Document line-number-display-width. * etc/NEWS: Document display-line-numbers and its customizations.
| * Fix hscrolling with line numbers on TTY framesEli Zaretskii2017-06-301-4/+6
| | | | | | | | | | | | | | * src/xdisp.c (hscroll_window_tree): Correct the X offset calculations on TTY frames. * src/term.c (produce_glyphs): Use it->lnum_pixel_width instead of a kludge using it->lnum_width.
| * Partial fix of hscroll of truncated lines with line numbersEli Zaretskii2017-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (x_produce_glyphs, hscroll_window_tree): Adjust hscroll calculations to line-number display. * src/term.c (produce_glyphs): Adjust tab stop to window's hscroll. These two changes fix horizontal scrolling when line numbers are displayed. But there's still a bug: the horizontal shift of lines that begin with a TAB is different from the rest. * src/xdisp.c (move_it_in_display_line_to): Call should_produce_line_number to determine whether a line number should be produced for this screen line.
| * Fix tab stops when line numbers are displayedEli Zaretskii2017-06-241-0/+4
| | | | | | | | | | | | * src/xdisp.c (x_produce_glyphs): * src/term.c (produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display.
* | Use unlocked stdio more systematicallyPaul Eggert2017-06-221-23/+24
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can improve performance significantly on stdio-bottlenecked code. E.g., make-docfile is 3x faster on my Fedora 25 x86-64 desktop. * admin/merge-gnulib (GNULIB_MODULES): Add unlocked-io. * lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c: * lib-src/hexl.c, lib-src/make-docfile.c, lib-src/movemail.c: * lib-src/profile.c, lib-src/update-game-score.c: Include unlocked-io.h instead of stdio.h, since these programs are single-threaded. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lib/unlocked-io.h, m4/unlocked-io.m4: New files, copied from Gnulib. * src/charset.c, src/cm.c, src/emacs.c, src/image.c, src/keyboard.c: * src/lread.c, src/term.c: Include sysstdio.h, possibly instead of stdio.h, to define the unlocked functions if the system does not provide them. * src/charset.c, src/lread.c (getc_unlocked): Remove, since sysstdio.h now defines it if needed. * src/cm.c (cmputc, cmcheckmagic): * src/dispnew.c (update_frame, update_frame_with_menu) (update_frame_1, Fsend_string_to_terminal, Fding, bitch_at_user): * src/emacs.c (main, Fdump_emacs): * src/fileio.c (Fdo_auto_save, Fset_binary_mode): * src/image.c (slurp_file, png_read_from_file, png_load_body) (our_stdio_fill_input_buffer): * src/keyboard.c (record_char, kbd_buffer_get_event, handle_interrupt): * src/lread.c (readbyte_from_file): * src/minibuf.c (read_minibuf_noninteractive): * src/print.c (printchar_to_stream, strout) (Fredirect_debugging_output): * src/sysdep.c (reset_sys_modes, procfs_ttyname) (procfs_get_total_memory): * src/term.c (tty_ring_bell, tty_send_additional_strings) (tty_set_terminal_modes, tty_reset_terminal_modes) (tty_update_end, tty_clear_end_of_line, tty_write_glyphs) (tty_write_glyphs_with_face, tty_insert_glyphs) (tty_menu_activate): * src/xfaces.c (Fx_load_color_file): Use unlocked stdio when it should be safe. * src/sysstdio.h (clearerr_unlocked, feof_unlocked, ferror_unlocked) (fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked) (fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked) (putc_unlocked, putchar_unloced): Provide substitutes if not declared.
* Use 'char *FOO' instead of 'char* FOO'Paul Eggert2017-02-181-4/+7
|
* Support 24-bit direct colors on text terminalsRami Ylimäki2017-02-181-0/+14
| | | | | | | | | | | | | | | | | | | * src/term.c (init_tty): Use 24-bit terminal colors if corresponding foreground and background functions are present in terminal type definition. * src/tparam.h: Define prototype for tigetstr. * lisp/term/tty-colors.el (tty-color-define): Convert color palette index to pixel value on 16.7M color terminals. (tty-color-24bit): New function to convert color palette index to pixel value on 16.7M color terminals. (tty-color-desc): Don't approximate colors on 16.7M color terminals. * lisp/term/xterm.el (xterm-register-default-colors): Define all named TTY colors on 16.7M color terminals. * doc/misc/efaq.texi (Colors on a TTY): Add instructions on how to enable direct color TTY mode. * etc/NEWS: Mention direct color TTY mode and point to FAQ.
* Remove unused TN_max_pairs fieldRami Ylimäki2017-02-181-6/+0
| | | | | | | * src/termchar.h (tty_display_info): Remove TN_max_pairs field, describing maximum number of terminal background/foreground color pairs. * src/term.c (tty_default_color_capabilities, tty_setup_colors) (init_tty): Remove references to TN_max_pairs.
* Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ | | | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | Limit <config.h>’s includesPaul Eggert2016-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on recent problems with the fact that config.h includes stdlib.h etc.; some files need to include stdlib.h later. config.h generally should limit itself to includes that are universally safe; outside of MS-Windows, only stdbool.h makes the cut among the files currently included. So, move the other includes to just the files that need them (Bug#24506). * configure.ac (config_opsysfile): Remove, as this generic hook is no longer needed. * lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c: * src/w32proc.c (_GNU_SOURCE): Remove, as it’s OK for config.h to do this now. * src/conf_post.h: Include <ms-w32.h>, instead of the generic config_opsysfile, for simplicity as this old way of configuring is now done only for the MS-Windows port. Do not include <ms-w32.h> if DEFER_MS_W32_H, for the benefit of the few files that want its effects later. Do not include <alloca.h>, <string.h>, or <stdlib.h>. Other files modified to include these headers as needed, or to not include headers that are no longer needed. * src/lisp.h: Include <alloca.h> and <string.h> here, since some of the inline functions need them. * src/regex.c: Include <alloca.h> if not emacs. (If emacs, we can rely on SAFE_ALLOCA.) There is no longer any need to worry about HAVE_ALLOCA_H. * src/unexmacosx.c: Rely on config.h not including stdlib.h. * src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H): Define before including <config.h> first, and include <ms-w32.h> after the troublesome headers.
* | Prefer now-standard int width macrosPaul Eggert2016-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/data.c (ULL_WIDTH): * src/lisp.h (EMACS_INT_WIDTH, BITS_PER_BITS_WORD): * src/lread.c (read_integer): * src/term.c (produce_glyphless_glyph): * src/xterm.c (x_send_scroll_bar_event): Use *_WIDTH macros instead of CHAR_BIT * sizeof. * src/data.c (ULL_WIDTH): Rename from BITS_PER_ULL for consistency with the *_WIDTH standard macros. All uses changed. * src/gmalloc.c (INT_BIT): Remove. All uses replaced with INT_WIDTH. * src/lisp.h (EMACS_INT_WIDTH): Rename from BITS_PER_EMACS_INT for consistency with the *_WIDTH standard macros. All uses changed. (BITS_PER_CHAR): Remove; all uses replaced by CHAR_BIT. This must be the same as CHAR_WIDTH and avoids confusion with Elisp char-width, which counts columns not bits. (BITS_PER_SHORT): Remove; all uses replaced by SHRT_WIDTH. (BITS_PER_LONG): Remove; all uses replaced by LONG_WIDTH. * src/lread.c: Do not include limits.h since CHAR_BIT is no longer used directly.
* | Port to ISO/IEC TS 18661-1:2014Paul Eggert2016-09-131-3/+3
| | | | | | | | | | * src/character.h (CHARACTER_WIDTH): Rename from CHAR_WIDTH. All uses changed.
* | Use DEV_TTY more consistentlyPaul Eggert2016-09-061-1/+1
| | | | | | | | | | | | | | | | * src/conf_post.h (DEV_TTY): Move from here ... * src/keyboard.c, src/keyboard.h: ... to here, as it doesn’t need to be visible everywhere. Make it a constant. * src/keyboard.c (handle_interrupt, Fset_quit_char): * src/process.c (create_process): Prefer DEV_TTY to "/dev/tty".
* | Treat SIGINT correctly in GUI sessions on MS-WindowsEli Zaretskii2016-09-051-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | * src/w32proc.c (sys_signal): Don't reject SIGINT, as it is supported by MS runtime. * src/term.c (DEV_TTY): Move from here ... * src/conf_post.h (DEV_TTY): ... to here. Separate definitions for WINDOWSNT and for the rest. * src/keyboard.c (handle_interrupt_signal): Use DEV_TTY instead of a literal "/dev/tty". * etc/NEWS: Mention the behavior change.
* | ‘signal’ no longer returnsPaul Eggert2016-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although for decades ‘signal’ has been documented to not return, a corner case in the Lisp debugger causes ‘signal’ to return. Remove the corner case and adjust Emacs internals accordingly. An alternative would be to document the corner case, but this would complicate the Lisp API unnecessarily. (Bug#24047) * src/eval.c (signal_or_quit): New function, with most of the old contents of Fsignal. (quit): New function, which uses signal_or_quit and which might return. All keyboard-based callers of Fsignal (Qquit, Qnil) changed to use this new function instead. (Fsignal): Use signal_or_quit. Now _Noreturn. All callers changed. (xsignal): Move to lisp.h. * src/lisp.h (xsignal): Now an inline function, as it's now just an alias for Fsignal.
* | Fix cursor positioning on TTY frames after stretch glyphEli Zaretskii2016-07-021-2/+8
| | | | | | | | | | | | | | | | * src/term.c (append_glyph, append_composite_glyph) (append_glyphless_glyph): Set the avoid_cursor_p and multibyte_p members of the produced 'struct glyph'. Fixes cursor positioning on the first character after a stretch glyph produced from line-prefix, wrap-prefix, etc. on TTY frames.
* | Replace IF_LINT by NONVOLATILE and UNINITPaul Eggert2016-06-081-4/+4
| | | | | | | | | | | | | | Inspired by a suggestion from RMS in: http://bugs.gnu.org/23640#58 * .dir-locals.el (c-mode): Adjust to macro changes. * src/conf_post.h (NONVOLATILE, UNINIT): New macros (Bug#23640). (IF_LINT): Remove. All uses replaced by the new macros.
* | Fix compiler warnings in the MinGW buildEli Zaretskii2016-05-211-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac [mingw32]: Don't add -Wpointer-sign, and add -Wno-pointer-sign, to keep the noise level down. * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable -Wredundant-decls, as that produces a lot of noise due to redeclaration of time-related functions by gnulib. * nt/runemacs.c (set_user_model_id): Fix argument type of 'SetCurrentProcessExplicitAppUserModelID'. * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't declare 'dpyinfo', as it is unused. (xpm_load): Fix warnings about pointer signedness. * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant prototypes. (sys_spawnve): Avoid warnings about discarding 'const' qualifier. (sys_select): Provide prototype. (g_b_init_compare_string_w): Move declaration to file scope. * src/w32heap.c (dumped_data_commit): Now static. (FREEABLE_P): Avoid warnings about pointer comparison with integer. (mmap_realloc): Cast to 'char *' for arithmetics on void pointers. * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr) (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear): Provide prototypes. * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove redundant prototypes. (w32_get_internal_run_time, map_w32_filename): Provide prototype. (init_environment, sys_ctime): Avoid warnings about discarding 'const' qualifier. Include utimens.h. (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir) (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock) (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide prototypes. (sys_rename_replace): Use %d to avoid compiler warnings. (_wsa_errlist): Make the message text 'const char *', to avoid compilation warnings. (dynlib_reset_last_error): Move prototype to file scope. (w32_get_resource): First argument is now 'const char *'. * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype. (otf_features): Second argument is no 'const char *'. * src/w32term.c (free_frame_menubar, x_wm_set_size_hint) (x_set_window_size): Remove redundant prototypes. (XChangeGC, XGetGCValues, w32_draw_underwave) (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave) (x_calc_absolute_position, x_destroy_window): Now static. (menubar_selection_callback): Move prototype to file scope. * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant declaration. (w32_to_x_charset): Fix warnings about discarding 'const' qualifier. (w32font_full_name): Fix warnings about implicit conversion of 'float' to 'double'. * src/w32reg.c (w32_get_rdb_resource): Fix warnings about discarding 'const' qualifier. * src/w32menu.c (syms_of_w32menu, globals_of_w32menu) (set_frame_menubar): Remove redundant prototypes. (menubar_selection_callback, w32_menu_display_help): Provide prototypes. (simple_dialog_show): Avoid warnings about discarding 'const' qualifier. * src/w32fns.c (syms_of_w32fns, globals_of_w32fns) (free_frame_menubar, w32_strerror, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): Remove redundant prototypes. (current_popup_menu): Remove redundant declaration. (colormap_t): Member 'name' is now 'const char *'. (add_system_logical_colors_to_map): Fix signed/unsigned warnings. (x_decode_color, x_set_border_pixel) (x_clear_under_internal_border, x_set_name, hook_w32_key) (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now static. (w32_load_cursor, w32_key_to_modifier, map_keypad_keys) (w32_msg_worker, w32_last_error): Provide prototypes. (funhook, lookup_vk_code): Avoid warnings about missing parentheses. (x_default_font_parameter, Fw32_notification_notify): Avoid warnings about discarding 'const' qualifier. (Fx_create_frame): Avoid warnings about empty body of 'else'. (x_screen_planes): Ifdef away unused function. (Fx_show_tip): Remove unused variables. (Fw32_battery_status): Avoid warnings about implicit promotion from float to double. (Fw32_notification_notify): Initialize 'timeout'. * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only define the TIMER_SETTIME_RUNNING value if it will be used. * src/w32notify.c (send_notifications): Ifdef away an empty if clause. Remove unused variable. (watch_end, watch_completion): Provide prototypes. * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused. * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix warning with pointer signedness. * src/gnutls.c (gnutls_x509_crt_get_signature) (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and don't load them from the GnuTLS library, as they are no longer used. * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't define, as it's unused. * src/unexw32.c (open_input_file, open_output_file) (close_file_data): Remove redundant prototypes. (_start): provide prototype. (mainCRTStartup): Move prototype to file level. (find_section): Use type-cast to shut up compiler warnings. (offset_to_section, relocate_offset): Now static. (find_section): First argument is now a 'const char *'. (offset_to_section): Ifdef away, as it's unused. * src/w32heap.h (find_section): Adjust prototype. * src/dynlib.c (dynlib_reset_last_error): Provide prototype. * src/dired.c (directory_files_internal_w32_unwind): Avoid warnings about missing prototypes. (is_slow_fs) [WINDOWSNT]: Provide prototype at file level. (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer signedness. * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]: Fix warnings about pointer signedness. * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's unused. * src/sysdep.c (_getpid): Remove redundant prototype. (sys_subshell) [DOS_NT]: Don't define 'status', it's unused. [!MSDOS]: Don't define 'st', it's unused. (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused. (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness. * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define n_to_read, as it is not used. (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused. * src/w32font.h (syms_of_w32font): Remove redundant prototype. * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro. * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are not used by DOS_NT builds, to avoid compiler warnings. * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant declaration. * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * src/w32term.h (x_set_window_size, x_get_focus_frame) (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame) (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon) (x_free_frame_resources, x_real_positions) (display_x_get_resource): Remove redundant prototypes. * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp) (sys_rename, gettimeofday): Provide prototypes. * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant declarations. * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'. (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname) (close_winsock, initialize_sockets, w32_set_user_model_id) (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add prototypes. (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness difference. (w32_set_user_model_id): Update prototype of SetCurrentProcessExplicitAppUserModelID to avoid compiler warnings. (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro.
* | Port --enable-gcc-warnings to GCC 6.1Paul Eggert2016-05-181-2/+0
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (WERROR_CFLAGS): Omit -Wunused-const-variable=2. * lib-src/etags.c (LOOKING_AT, LOOKING_AT_NOCASE): Omit test whether pointer plus a constant equals a null pointer. * src/alloc.c (compact_small_strings): Avoid pointer arithmetic on null pointers. * src/alloc.c (mark_face_cache): * src/fontset.c (free_realized_fontsets, Fset_fontset_font): * src/fringe.c (draw_fringe_bitmap_1) (Fset_fringe_bitmap_face): * src/macfont.m (macfont_draw): * src/msdos.c (IT_set_face, IT_clear_screen): * src/nsfont.m (nsfont_draw): * src/nsterm.h (FRAME_DEFAULT_FACE): * src/nsterm.m (ns_draw_window_cursor) (ns_draw_vertical_window_border, ns_draw_window_divider) (ns_dumpglyphs_box_or_relief) (ns_maybe_dumpglyphs_background, ns_dumpglyphs_image) (ns_dumpglyphs_stretch): * src/w32term.c (w32_draw_vertical_window_border) (w32_draw_window_divider, x_set_mouse_face_gc): * src/xdisp.c (estimate_mode_line_height, init_iterator) (handle_face_prop, handle_single_display_spec, pop_it) (CHAR_COMPOSED_P, get_next_display_element) (next_element_from_display_vector, extend_face_to_end_of_line) (fill_gstring_glyph_string,BUILD_COMPOSITE_GLYPH_STRING): * src/xfaces.c (Finternal_merge_in_global_face, Fface_font) (lookup_named_face): * src/xterm.c (x_draw_vertical_window_border) (x_draw_window_divider, x_set_mouse_face_gc): Prefer FACE_OPT_FROM_ID to FACE_FROM_ID when the result might be null. * src/xterm.c (try_window_id): Redo loop to convince GCC 6.1 that it is null pointer safe. (x_color_cells): Use eassume as necessary to pacify GCC 6.1. * src/dispextern.h (FACE_FROM_ID, IMAGE_FROM_ID): Now returns non-null. (FACE_OPT_FROM_ID, IMAGE_OPT_FROM_ID): New macro, with the old behavior of the non-_OPT macro, to be used when the result might be a null pointer. * src/dispnew.c (buffer_posn_from_coords, marginal_area_string) [HAVE_WINDOW_SYSTEM]: * src/intervals.h (INTERVAL_WRITABLE_P): * src/term.c (turn_off_face): * src/xdisp.c (get_glyph_face_and_encoding, fill_image_glyph_string) (produce_image_glyph, produce_xwidget_glyph): * src/xfaces.c (lookup_named_face): Remove unnecessary test for null pointer. * src/keyboard.c (read_char): Suppress bogus -Wclobbered warning. * src/process.c (would_block): New function. (server_accept_connection, wait_reading_process_output, send_process): Use it. * src/xdisp.c (get_window_cursor_type, note_mouse_highlight): Prefer IMAGE_OPT_FROM_ID to IMAGE_FROM_ID when the result might be null.
* Avoid crashes due to insanely large columns in tabulated-list-formatEli Zaretskii2016-04-011-0/+1
| | | | | | | | | | | * src/xdisp.c (append_stretch_glyph, produce_xwidget_glyph) (produce_image_glyph): Limit the pixel width of the produced glyph to SHRT_MAX. (Bug#23178) (append_composite_glyph, append_glyph, append_glyphless_glyph): Add assertions to verify that the pixel width of the glyph will never overflow a 'short'. * src/term.c (append_composite_glyph): Add assertion to verify that the pixel width of the glyph will never overflow a 'short'.
* Preserve current buffer when popping up TTY menusEli Zaretskii2016-03-241-1/+6
| | | | | * src/term.c (tty_menu_show): Be sure to save and restore the current buffer around TTY menu pop-ups. (Bug#23101)
* Rework C source files to avoid ^(Paul Eggert2016-03-101-2/+2
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* Use INT_ADD_WRAPV etc. to check integer overflowPaul Eggert2015-11-081-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string): * src/buffer.c (record_overlay_string, overlay_strings): * src/casefiddle.c (casify_object): * src/ccl.c (Fccl_execute_on_string): * src/character.c (char_width, c_string_width, lisp_string_width) (count_size_as_multibyte, string_escape_byte8): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display): * src/editfns.c (styled_format): * src/fns.c (Ffillarray): * src/ftfont.c (ftfont_shape_by_flt): * src/gnutls.c (gnutls_hex_string): * src/gtkutil.c (get_utf8_string): * src/image.c (x_to_xcolors, x_detect_edges, png_load_body): * src/keymap.c (Fkey_description): * src/lisp.h (SAFE_ALLOCA_LISP): * src/term.c (encode_terminal_code): * src/tparam.c (tparam1): * src/xselect.c (x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (x_term_init): When checking for integer overflow, prefer INT_MULTIPLY_WRAPV to more-complicated code involving division and/or INT_MULTIPLY_OVERFLOW, and similarly for INT_ADD_WRAPV and subtraction and/or INT_ADD_OVERFLOW. * src/casefiddle.c (casify_object): Simplify multibyte size check. * src/character.c: Remove some obsolete ‘#ifdef emacs’s. * src/data.c (arith_driver): Also check for division overflow, as that’s now possible given that the accumulator can now contain any Emacs integer. * src/lisp.h (lisp_word_count): Remove; no longer used.
* Prefer xpalloc to doubling buffers by handPaul Eggert2015-11-071-4/+4
| | | | | | | | | | | * src/lread.c (grow_read_buffer): New function, which uses xpalloc. (read1): Use it for simplicity. * src/macros.c (store_kbd_macro_char): * src/minibuf.c (read_minibuf_noninteractive): * src/term.c (encode_terminal_code): * src/xrdb.c (magic_db): Prefer xpalloc to growing buffers by hand. This doesn’t fix any bugs, but simplifies the code a bit.
* Include-file cleanup for src directoryPaul Eggert2015-10-201-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit ‘#include "foo.h"’ unless the file needs foo.h (Bug#21707). In a few cases, add ‘#include "foo.h"’ if the file needs foo.h but does not include it directly. As a general rule, a source file should include foo.h if it needs the interfaces that foo.h defines. * src/alloc.c: Don’t include process.h. Include dispextern.h, systime.h. * src/atimer.c: Don’t include blockinput.h. * src/buffer.c: Include coding.h, systime.h. Don’t include keyboard.h, coding.h. * src/callint.c: Don’t include commands.h, keymap.h. * src/callproc.c: Don’t include character.h, ccl.h, composite.h, systty.h, termhooks.h. * src/casetab.c: Don’t include character.h. * src/category.c: Don’t include charset.h, keymap.h. * src/ccl.h: Don’t include character.h. * src/character.c: Don’t include charset.h. * src/charset.c: Don’t include disptab.h. * src/chartab.c: Don’t include ccl.h. * src/cm.c: Don’t include frame.h, termhooks.h. * src/cmds.c: Don’t include window.h, dispextern.h. * src/coding.c: Don’t include window.h, frame.h. * src/composite.c: Include composite.h. Don’t include window.h, font.h. * src/data.c: Don’t include syssignal.h, termhooks.h, font.h. * src/dbusbind.c: Don’t include frame.h. * src/decompress.c: Don’t include character.h. * src/dired.c: Don’t include character.h, commands.h, charset.h. * src/dispnew.c: Don’t include character.h, indent.h, intervals.h, process.h, timespec.h. Include systime.h. * src/doc.c: Include coding.h. Don’t include keyboard.h. * src/editfns.c: Include composite.h. Don’t include frame.h. * src/emacs.c: Include fcntl.h, coding.h. Don’t include commands.h, systty.h.. * src/fileio.c: Don’t include intervals.h, dispextern.h. Include composite.h. * src/filelock.c: Don’t include character.h, systime.h. * src/fns.c: Don’t include time.h, commands.h, keyboard.h, keymap.h, frame.h, blockinput.h, xterm.h. Include composite.h. * src/font.c: Include termhooks.h. * src/font.h: Don’t include ccl.h, frame.h. Add forward decls of struct composition_it, struct face, struct glyph_string. * src/fontset.c: Don’t include buffer.h, ccl.h, keyboard.h, intervals.h, window.h, termhooks.h. * src/frame.c: Don’t include character.h, commands.h, font.h. * src/frame.h: Don’t include dispextern.h. * src/fringe.c: Don’t include character.h. * src/ftcrfont.c: Don’t include dispextern.h, frame.h, character.h, charset.h, fontset.h. * src/ftfont.c: Don’t include frame.h, blockinput.h, coding.h, fontset.h. * src/ftxfont.c: Don’t include dispextern.h, character.h, charset.h, fontset.h. * src/gfilenotify.c: Don’t include frame.h, process.h. * src/gtkutil.c: Include dispextern.h, frame.h, systime.h. Don’t include syssignal.h, buffer.h, charset.h, font.h. * src/gtkutil.h: Don’t include frame.h. * src/image.c: Include fcntl.h and stdio.h instead of sysstdio.h. Don’t include character.h. * src/indent.c: Don’t include keyboard.h, termchar.h. * src/inotify.c: Don’t include character.h, frame.h. * src/insdel.c: Include composite.h. Don’t include blockinput.h. * src/intervals.c: Don’t include character.h, keyboard.h. * src/intervals.h: Don’t include dispextern.h, composite.h. * src/keyboard.c: Don’t include sysstdio.h, disptab.h, puresize.h. Include coding.h. * src/keyboard.h: Don’t incldue systime.h. * src/keymap.c: Don’t include charset.h, frame.h. * src/lread.c: Include dispextern.h and systime.h. Don’t include frame.h. Include systime.h. * src/macros.c: Don’t include commands.h, character.h, buffer.h. * src/menu.c: Include character.h, coding.h. Don’t include dispextern.h. * src/menu.h: Don’t include systime.h. * src/minibuf.c: Don’t include commands.h, dispextern.h, syntax.h, intervals.h, termhooks.h. * src/print.c: Include coding.h. Don’t include keyboard.h, window.h, dispextern.h, termchar.h, termhooks.h, font.h. Add forward decl of struct terminal. * src/process.c: Don’t include termhooks.h, commands.h, dispextern.h, composite.h. * src/region-cache.c: Don’t include character.h. * src/scroll.c: Don’t include keyboard.h, window.h. * src/search.c: Don’t include category.h, commands.h. * src/sound.c: Don’t include dispextern.h. * src/syntax.c: Don’t include command.h, keymap.h. * src/sysdep.c: Don’t include window.h, dispextern.h. * src/systime.h: Use ‘#ifdef emacs’, not ‘#ifdef EMACS_LISP_H’, * src/term.c: Don’t include systty.h, intervals.h, xterm.h. * src/terminal.c: Include character.h. Don’t include charset.h, coding.h. * src/textprop.c: Don’t include character.h. * src/undo.c: Don’t include character.h, commands.h, window.h. * src/unexsol.c: Don’t include character.h, charset.h. * src/widget.c: Include widget.h. Don’t include keyboard.h, window.h, dispextern.h, blockinput.h, character.h, font.h. * src/widgetprv.h: Don’t include widget.h. * src/window.c: Don’t include character.h, menu.h, intervals.h. * src/xdisp.c: Include composite.h, systime.h. Don’t include macros.h, process.h. * src/xfaces.c: Don’t include charset.h, keyboard.h, termhooks.h, intervals.h. * src/xfns.c: Don’t include menu.h, character.h, intervals.h, epaths.h, fontset.h, systime.h, atimer.h, termchar.h. * src/xfont.c: Don’t include dispextern.h, fontset.h, ccl.h. * src/xftfont.c: Don’t include dispextern.h, character.h, fontset.h. * src/xgselect.c: Don’t include timespec.h, frame.h. Include systime.h. * src/xgselect.h: Don’t include time.h. Use a forward decl to struct timespec instead. * src/xmenu.c: Don’t include keymap.h, character.h, charset.h, dispextern.h. Include systime.h. * src/xml.c: Don’t include character.h. * src/xrdb.c [USE_MOTIF]: Don’t include keyboard.h. * src/xselect.c: Don’t include dispextern.h, character.h, buffer.h, process.h. * src/xsmfns.c: Don’t include systime.h, sysselect.h. * src/xterm.c: Don’t include syssignal.h, charset.h, disptab.h, intervals.h process.h, keymap.h, xgselect.h. Include composite.h.
* Prevent timers from messing up TTY menusEli Zaretskii2015-09-241-0/+7
| | | | | * src/term.c (tty_menu_activate): Inhibit redisplay for as long as the TTY menu is open. (Bug#21530)
* Avoid grave accent quoting in stderr diagnosticsPaul Eggert2015-05-311-8/+8
| | | | | | | | | | | | | | | | | | | A few Emacs diagnostics go directly to stderr, and so can't easily contain curved quotes (as non-UTF-8 locales might mishandle them). Instead of bothering to add support for this rarity, reword the diagnostics so that they don't use grave accent to quote. * src/alloc.c (mark_memory): Fix comment. * src/buffer.c (init_buffer): * src/dispnew.c (init_display): * src/emacs.c (main, sort_args): * src/lread.c (dir_warning): * src/term.c (init_tty): * src/unexmacosx.c (unexec): * src/xfns.c (select_visual): * src/xterm.c (cvt_string_to_pixel, x_io_error_quitter): Reword stderr diagnostics to avoid quoting `like this'. * src/unexmacosx.c: Include errno.h. * src/xfns.c (select_visual): Encode value for locale.
* Port --enable-gcc-warnings to GCC 5.1 x86-64Paul Eggert2015-04-241-3/+5
| | | | | | | | | | | | | | | | | | | | * lib-src/ebrowse.c (dump_sym): * lib-src/hexl.c (main): * src/ccl.c (ccl_driver): * src/character.c (string_escape_byte8): * src/dbusbind.c (xd_retrieve_arg, xd_add_watch): * src/gnutls.c (Fgnutls_boot): * src/gtkutil.c (xg_check_special_colors): * src/image.c (x_build_heuristic_mask): * src/print.c (safe_debug_print, print_object): * src/term.c (produce_glyphless_glyph): * src/xdisp.c (get_next_display_element) (produce_glyphless_glyph): * src/xterm.c (x_draw_glyphless_glyph_string_foreground): Don't use a signed format to print an unsigned integer, or vice versa. GCC 5.1's new -Wformat-signedness option warns about this. * src/image.c (png_load_body, jpeg_load_body): Silence a bogus setjump diagnostic from GCC 5.1 (GCC bug 54561).
* Count MANY function args more reliablyPaul Eggert2015-01-251-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * alloc.c (Fgc_status, purecopy, unbind_to, garbage_collect_1): * buffer.c (Fbuffer_list, Fkill_buffer): * callint.c (read_file_name, Fcall_interactively): * charset.c (Fset_charset_priority, syms_of_charset): * chartab.c (uniprop_encode_value_numeric): * coding.c (syms_of_coding): * composite.c (syms_of_composite): * data.c (wrong_range): * dbusbind.c (syms_of_dbusbind): * dired.c (file_attributes): * editfns.c (Fdecode_time, update_buffer_properties, format2): * eval.c (run_hook_with_args_2, apply1, call1, call2, call3) (call4, call5, call6, call7): * fileio.c (Finsert_file_contents, choose_write_coding_system) (Fcar_less_than_car, build_annotations, auto_save_error): * filelock.c (get_boot_time): * fns.c (internal_equal, nconc2, Fyes_or_no_p, Fwidget_apply): (maybe_resize_hash_table, secure_hash): * font.c (font_style_to_value, font_open_by_name, Flist_fonts): * fontset.c (fontset_add, Fset_fontset_font): * ftfont.c (ftfont_lookup_cache): * gtkutil.c (xg_get_font): * insdel.c (signal_before_change, signal_after_change): * keymap.c (append_key): * lread.c (load_warn_old_style_backquotes, Fload, init_lread): * minibuf.c (Fread_buffer): * print.c (print_preprocess): * process.c (Fformat_network_address, Fmake_network_process) (server_accept_connection): * sound.c (Fplay_sound_internal): * term.c (Fsuspend_tty, Fresume_tty): * window.c (window_list): * xdisp.c (run_redisplay_end_trigger_hook, add_to_log) (message_with_string): * xfaces.c (Fx_list_fonts): * xfont.c (syms_of_xfont): * xselect.c (x_handle_selection_request) (x_handle_selection_clear, x_clear_frame_selections) (x_clipboard_manager_error_1): Prefer CALLMANY and CALLN to counting args by hand. * doc.c (reread_doc_file): Remove unused code. * fns.c (concat2, concat3): Redo to avoid need for local-var vector. (cmpfn_user_defined, hashfn_user_defined, Fmaphash): Prefer call1 and call2 to Ffuncall. * keyboard.c (safe_run_hook_funcall, safe_run_hooks): Use struct literal rather than a local var, for simplicity. * keymap.c (where_is_internal): Use NULL rather than a pointer to unused args. * lisp.h (CALLMANY, CALLN): New macros. * sound.c (Fplay_sound_internal): Coalesce duplicate code. Fixes: bug#19634
* Compute C decls for DEFSYMs automaticallyPaul Eggert2015-01-051-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes Bug#15880. This patch also makes Q constants (e.g., Qnil) constant addresses from the C point of view. * make-docfile.c: Revamp to generate table of symbols, too. Include <stdbool.h>. (xstrdup): New function. (main): Don't process the same file twice. (SYMBOL): New constant in enum global_type. (struct symbol): Turn 'value' member into a union, either v.value for int or v.svalue for string. All uses changed. (add_global): New arg svalue, which overrides value, so that globals can have a string value. (close_emacs_global): New arg num_symbols; all uses changed. Output lispsym decl. (write_globals): Output symbol globals too. Output more ATTRIBUTE_CONST, now that Qnil etc. are C constants. Output defsym_name table. (scan_c_file): Move most of guts into ... (scan_c_stream): ... new function. Scan for DEFSYMs and record symbols found. Don't read past EOF if file doesn't end in newline. * alloc.c, bidi.c, buffer.c, bytecode.c, callint.c, casefiddle: * casetab.c, category.c, ccl.c, charset.c, chartab.c, cmds.c, coding.c: * composite.c, data.c, dbusbind.c, decompress.c, dired.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, fns.c, font.c, fontset.c: * frame.c, fringe.c, ftfont.c, ftxfont.c, gfilenotify.c, gnutls.c: * image.c, inotify.c, insdel.c, keyboard.c, keymap.c, lread.c: * macfont.m, macros.c, minibuf.c, nsfns.m, nsfont.m, nsimage.m: * nsmenu.m, nsselect.m, nsterm.m, print.c, process.c, profiler.c: * search.c, sound.c, syntax.c, term.c, terminal.c, textprop.c, undo.c: * window.c, xdisp.c, xfaces.c, xfns.c, xftfont.c, xmenu.c, xml.c: * xselect.c, xsettings.c, xterm.c: Remove Q vars that represent symbols (e.g., Qnil, Qt, Qemacs). These names are now defined automatically by make-docfile. * alloc.c (init_symbol): New function. (Fmake_symbol): Use it. (c_symbol_p): New function. (valid_lisp_object_p, purecopy): Use it. * alloc.c (marked_pinned_symbols): Use make_lisp_symbol instead of make_lisp_ptr. (garbage_collect_1): Mark lispsym symbols. (CHECK_ALLOCATED_AND_LIVE_SYMBOL): New macro. (mark_object): Use it. (sweep_symbols): Sweep lispsym symbols. (symbol_uses_obj): New function. (which_symbols): Use it. Work for lispsym symbols, too. (init_alloc_once): Initialize Vpurify_flag here; no need to wait, since Qt's address is already known now. (syms_of_alloc): Add lispsym count to symbols_consed. * buffer.c (init_buffer_once): Compare to Qnil, not to make_number (0), when testing whether storage is all bits zero. * dispextern (struct image_type): * font.c (font_property_table): * frame.c (struct frame_parm_table, frame_parms): * keyboard.c (scroll_bar_parts, struct event_head): * xdisp.c (struct props): Use XSYMBOL_INIT (Qfoo) and struct Lisp_Symbol * rather than &Qfoo and Lisp_Object *, since Qfoo is no longer an object whose address can be taken. All uses changed. * eval.c (run_hook): New function. Most uses of Frun_hooks changed to use it, so that they no longer need to take the address of a Lisp sym. (syms_of_eval): Don't use DEFSYM on Vrun_hooks, as it's a variable. * frame.c (syms_of_frame): Add defsyms for the frame_parms table. * keyboard.c (syms_of_keyboard): Don't DEFSYM Qmenu_bar here. DEFSYM Qdeactivate_mark before the corresponding var. * keymap.c (syms_of_keymap): Use DEFSYM for Qmenu_bar and Qmode_line instead of interning their symbols; this avoids duplicates. (LISP_INITIALLY, TAG_PTR) (DEFINE_LISP_SYMBOL_BEGIN, DEFINE_LISP_SYMBOL_END, XSYMBOL_INIT): New macros. (LISP_INITIALLY_ZERO): Use it. (enum symbol_interned, enum symbol_redirect, struct Lisp_Symbol) (EXFUN, DEFUN_ARGS_MANY, DEFUN_ARGS_UNEVALLED, DEFUN_ARGS_*): Move decls up, to avoid forward uses. Include globals.h earlier, too. (make_lisp_symbol): New function. (XSETSYMBOL): Use it. (DEFSYM): Now just a placeholder for make-docfile. * lread.c (DEFINE_SYMBOLS): Define, for globals.h. (intern_sym): New function, with body taken from old intern_driver. (intern_driver): Use it. Last arg is now Lisp integer, not ptrdiff_t. All uses changed. (define_symbol): New function. (init_obarray): Define the C symbols taken from lispsym. Use plain DEFSYM for Qt and Qnil. * syntax.c (init_syntax_once): No need to worry about Qchar_table_extra_slots.
* Revert previous change to produce_composite_glyphPaul Eggert2015-01-031-1/+1
| | | | * term.c (produce_composite_glyph): Revert previous change (Bug#19496).
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Fix produce_composite_width typoPaul Eggert2014-12-281-1/+1
| | | | | * term.c (produce_composite_glyph): Fix typo that confused number of columns for pixel width.
* Merge from trunk and resolve conflicts.Eli Zaretskii2014-10-141-84/+26
|\
| * Cleanup terminal handling code.Dmitry Antipov2014-10-141-79/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dispextern.h (get_named_tty): Remove prototype but... * termhooks.h (get_named_terminal): ...resurrect it under more meaningful name. (get_terminal): Likewise, but with... (decode_live_terminal): ...this name. (decode_tty_terminal): Add prototype. * term.c (get_tty_terminal): Remove. (get_named_tty): Remove. (Ftty_display_color_p, Ftty_display_color_cells, Ftty_type) (Fcontrolling_tty_p, Fsuspend_tty, Fresume_tty): Use decode_tty_terminal. (Ftty_no_underline, Ftty_top_frame): Use decode_live_terminal. * terminal.c (get_terminal): Refactor to... (decode_terminal, decode_live_terminal): ...new functions. (decode_tty_terminal): Replacement for get_tty_terminal. (get_named_terminal): Likewise for get_named_tty. * coding.c (Fset_terminal_coding_system_internal) (Fterminal_coding_system, Fset_keyboard_coding_system_internal): (Fkeyboard_coding_system): * composite.c (Fcomposition_get_gstring): * dispnew.c (Fsend_string_to_terminal): * frame.c (Fmake_terminal_frame): * nsfns.m (check_ns_display_info): * w32fns.c, xfns.c (check_x_display_info): * xselect.c (frame_for_x_selection): Use decode_live_terminal. * keyboard.c (handle_interrupt_signal, handle_interrupt) (Fset_quit_char): Use get_named_terminal. (Fset_output_flow_control, Fset_input_meta_mode): Use decode_tty_terminal.
| * * termhooks.h (enum scroll_bar_part): Begin from 0 to allow...Dmitry Antipov2014-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
| * Use SAFE_ALLOCA etc. to avoid unbounded stack allocation.Paul Eggert2014-09-071-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on the recent thread in emacs-devel on alloca; see: http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00042.html This patch also cleans up alloca-related glitches noted while examining the code looking for unbounded alloca. * alloc.c (listn): * callproc.c (init_callproc): Rewrite to avoid need for alloca. * buffer.c (mouse_face_overlay_overlaps) (report_overlay_modification): * buffer.h (GET_OVERLAYS_AT): * coding.c (make_subsidiaries): * doc.c (Fsnarf_documentation): * editfns.c (Fuser_full_name): * fileio.c (Ffile_name_directory, Fexpand_file_name) (search_embedded_absfilename, Fsubstitute_in_file_name): * fns.c (Fmake_hash_table): * font.c (font_vconcat_entity_vectors, font_update_drivers): * fontset.c (fontset_pattern_regexp, Ffontset_info): * frame.c (Fmake_terminal_frame, x_set_frame_parameters) (xrdb_get_resource, x_get_resource_string): * ftfont.c (ftfont_get_charset, ftfont_check_otf, ftfont_drive_otf): * ftxfont.c (ftxfont_draw): * image.c (xbm_load, xpm_load, jpeg_load_body): * keyboard.c (echo_add_key, menu_bar_items, tool_bar_items): * keymap.c (Fdescribe_buffer_bindings, describe_map): * lread.c (openp): * menu.c (digest_single_submenu, find_and_call_menu_selection) (find_and_return_menu_selection): * print.c (PRINTFINISH): * process.c (Fformat_network_address): * scroll.c (do_scrolling, do_direct_scrolling, scrolling_1): * search.c (search_buffer, Fmatch_data, Fregexp_quote): * sound.c (wav_play, au_play): * syntax.c (skip_chars): * term.c (tty_menu_activate, tty_menu_show): * textprop.c (get_char_property_and_overlay): * window.c (Fset_window_configuration): * xdisp.c (safe__call, next_overlay_change, vmessage) (compute_overhangs_and_x, draw_glyphs, note_mouse_highlight): * xfaces.c (face_at_buffer_position): * xmenu.c (x_menu_show): Use SAFE_ALLOCA etc. instead of plain alloca, since the allocation size isn't bounded. * callint.c (Fcall_interactively): Redo memory_full check so that it can be done at compile-time on some platforms. * coding.c (MAX_LOOKUP_MAX): New constant. (get_translation_table): Use it. * callproc.c (call_process): Use SAFE_NALLOCA instead of SAFE_ALLOCA, to catch integer overflows on size calculation. (exec_failed) [!DOS_NT]: New function. (child_setup) [!DOS_NT]: Use it. * editfns.c (Ftranspose_regions): Hoist USE_SAFE_ALLOC + SAFE_FREE out of 'if'. * editfns.c (check_translation): Allocate larger buffers on the heap. * eval.c (internal_lisp_condition_case): Check for MAX_ALLOCA overflow. * fns.c (sort_vector): Use SAFE_ALLOCA_LISP rather than Fmake_vector. (Fbase64_encode_region, Fbase64_decode_region): Avoid unnecessary calls to SAFE_FREE before 'error'. * buffer.c (mouse_face_overlay_overlaps): * editfns.c (Fget_pos_property, check_translation): * eval.c (Ffuncall): * font.c (font_unparse_xlfd, font_find_for_lface): * ftfont.c (ftfont_drive_otf): * keyboard.c (echo_add_key, read_decoded_event_from_main_queue) (menu_bar_items, tool_bar_items): * sound.c (Fplay_sound_internal): * xdisp.c (load_overlay_strings, dump_glyph_row): Use an ordinary auto buffer rather than alloca, since the allocation size is fixed and small. * ftfont.c: Include <c-strcase.h>. (matching_prefix): New function. (get_adstyle_property): Use it, to avoid need for alloca. * keyboard.c (echo_add_key): * keymap.c (describe_map): Use ptrdiff_t, not int. * keyboard.c (echo_add_key): Prefer sizeof to strlen. * keymap.c (Fdescribe_buffer_bindings): Use SBYTES, not SCHARS, when counting bytes. * lisp.h (xlispstrdupa): Remove, replacing with ... (SAFE_ALLOCA_STRING): ... new macro with different API. This fixes a portability problem, namely, alloca result passed to another function. All uses changed. (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Check for MAX_ALLOCA, not MAX_ALLOCA - 1. * regex.c (REGEX_USE_SAFE_ALLOCA, REGEX_SAFE_FREE) (REGEX_ALLOCATE): New macros. (REGEX_REALLOCATE, REGEX_ALLOCATE_STACK, REGEX_REALLOCATE_STACK) (REGEX_FREE_STACK, FREE_VARIABLES, re_match_2_internal): Use them. * xdisp.c (message3): Use SAFE_ALLOCA_STRING rather than doing it by hand. (decode_mode_spec_coding): Store directly into buf rather than into an alloca temporary and copying the temporary to the buf. Fixes: debbugs:18410
* | Increase 'level' in glyph struct; convert bad type aborts into assertions.Eli Zaretskii2014-10-141-6/+3
|/
* Fix a couple of recent inadvertent breaks of the MSDOS port.Reuben Thomas2014-08-101-0/+4
| | | | | src/msdos.c: include required menu.h src/term.c: set correct menu_show_hook on MSDOS.
* Fix handling of menu bar line on TTY frames (Bug#18136) (Bug#18196).Martin Rudalics2014-08-101-15/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dispnew.c (handle_window_change_signal): * keyboard.c (Fsuspend_emacs): Call change_frame_size with frame's menu bar lines subtracted from height. * frame.c (frame_inhibit_resize): Inhibit resizing of TTY frames. (adjust_frame_size): Count in menu bar when setting FrameRows. (make_terminal_frame): When setting up the frame's lines and text height don't count in the menu bar. (Fmake_terminal_frame): Call adjust_frame_size with menu bar lines subtracted from height. (do_switch_frame): Set tty's FrameRows to number of total lines of frame. (Fframe_pixel_height, Fframe_pixel_width): If no window system is used, return total number of lines and columns. * menu.c (emulate_dialog_with_menu): Use FRAME_TOTAL_LINES instead of FRAME_LINES. * term.c (OUTPUT, tty_set_terminal_modes) (tty_set_terminal_window, tty_set_scroll_region) (tty_clear_to_end, tty_write_glyphs, tty_write_glyphs_with_face) (tty_ins_del_lines, tty_menu_display, tty_menu_activate): Use FRAME_TOTAL_LINES instead of FRAME_LINES. (Fresume_tty): Use FRAME_TOTAL_LINES instead of FRAME_LINES. Call change_frame_size with frame's menu bar lines subtracted from height. * w32console.c (w32con_clear_to_end, w32con_clear_frame) (w32con_ins_del_lines): Use FRAME_TOTAL_LINES instead of FRAME_LINES.