summaryrefslogtreecommitdiff
path: root/src/term.c
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
|
* Pacify GCC 10.3 -Wmaybe-uninitializedPaul Eggert2021-10-071-1/+1
| | | | | | Problem reported by Basil L. Contovounesios (Bug#51075). * src/term.c (encode_terminal_code): Add an UNINIT to pacify GCC 10 bug.
* Remove encode_terminal_code UNINITsPaul Eggert2021-10-031-3/+4
| | | | | | | * src/term.c (encode_terminal_code): Clarify by removing a couple of UNINITs and testing the local variable ‘cmp’ instead of retesting src->u.cmp.automatic. This pacifies gcc 11.2.1 -Wanalyzer-null-dereference.
* Merge branch 'feature/tab-bar-events'Juri Linkov2021-09-091-15/+2
|\
| * Redesign tab-bar event processing (bug#41342, bug#41343)Juri Linkov2021-08-181-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of emitting menu-item keys like [tab-1], emit normal mouse events like [mouse-1] and [down-mouse-3] for all mouse clicks issued on the tab-bar. * lisp/mouse.el (mouse-posn-property): Handle 'tab-bar' posn-area. * lisp/tab-bar.el (tab--key-to-number): New internal function. (tab-bar-handle-mouse): Use tab key to select/close tab. (tab-bar-mouse-select-tab, tab-bar-mouse-close-tab) (tab-bar-mouse-context-menu): New commands. (tab-bar-map): Bind [down-mouse-1] to tab-bar-mouse-select-tab, [down-mouse-2] to tab-bar-mouse-close-tab, [down-mouse-3] to tab-bar-mouse-context-menu. (tab-bar-keymap-cache): Remove. (tab-bar-make-keymap): Don't use cache. (tab-bar--format-tab): Remove default bindings from menu items. (tab-bar-make-keymap-1): Prepend tab-bar-map. * src/keyboard.c (make_lispy_event): Append event->arg to position for Qtab_bar. * src/term.c (handle_one_term_event): Simplify to set event arg. * src/w32inevt.c (do_mouse_event): Set emacs_ev->arg to the value returned from tty_handle_tab_bar_click. * src/w32term.c (w32_handle_tab_bar_click): Return value from handle_tab_bar_click. (w32_read_socket): Set tab_bar_key to value returned from w32_handle_tab_bar_click, and set event arg from it. * src/xdisp.c (handle_tab_bar_click): Instead of emitting event, return a list with Qtab_bar and tab caption with text properties that contain Qmenu_item with key and binding. (tty_handle_tab_bar_click): Simplify to return a list of Qtab_bar, key and close_p, instead of emitting event. * src/xterm.c (handle_one_xevent): Set tab_bar_key to value returned from handle_tab_bar_click, and set event arg from it.
* | Disable auto compositions on the Linux console onlyLars Ingebrigtsen2021-08-181-3/+10
|/ | | | | | | | | | | | | | | | * lisp/term/linux.el (terminal-init-linux): Disable auto compositions on "linux" consoles (bug#21363). * src/composite.c (inhibit_auto_composition): New function to implement this. (composition_compute_stop_pos, composition_adjust_point) (Ffind_composition_internal): Use it. (syms_of_composite): Document it. * src/lisp.h: Export tty_type_name. * src/term.c (tty_type_name): Factored out. (Ftty_type): Use it.
* Major rewrite of adjust_frame_sizeMartin Rudalics2021-04-271-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Have adjust_frame_size pass native frame sizes to backends instead of text sizes. Expand frame size history management. Drop PIXELWISE argument from change_frame_size and convert native to text sizes only when calling adjust_frame_size. Use convention in arguments that -1 instead of 0 means that no size change is required. When adjusting frame sizes pick up delayed size changes (Bug#46827). * lisp/frame.el (frame-notice-user-settings, make-frame): Don't set frame size history. (frame--size-history): Rewrite doc-string. Handle new formats of `frame-size-history' entries. * src/dispextern.h (delayed_size_change): Extern it. (change_frame_size): Drop last argument from extern. * src/dispnew.c (delayed_size_change): Make it global. (handle_window_change_signal): Reformat. Drop last argument from change_frame_size call. (do_pending_window_change, init_display_interactive): Drop last argument from change_frame_size call. (change_frame_size_1): NEW_WIDTH and NEW_HEIGHT now specify native sizes. Drop last argument PIXELWISE. Queue a change when it either differs from F's current pixel sizes or F's previously queued sizes. Inject frame_size_history_extra call when queuing. Adopt convention that for queued sizes -1 means that no size change is required. Convert from native to text sizes when calling adjust_frame_size. (change_frame_size): Drop last argument PIXELWISE and drop it also in change_frame_size_1 calls. * src/frame.c (frame_size_history_add): Remove. (frame_inhibit_resize): Remove call to frame_size_history_add. (set_menu_bar_lines, set_tab_bar_lines): Simplify. Drop last argument from change_frame_size call. (frame_windows_min_size): No more static. (keep_ratio): Minor rewrite using macros. (frame_size_history_adjust, frame_size_history_plain) (frame_size_history_extra): New functions. (adjust_frame_size): Major rewrite. Adopt new convention that negative values for new sizes mean no change. Pick up delayed size changes from F's new_width and new_height slots (Bug#46827). Call set_window_size_hook with native instead of text sizes. Do not sanitize window sizes any more. Call frame_size_history_adjust instead of frame_size_history_add. Always set F's resized_p slot to true. (make_frame): Initialize new_width and new_height slots to -1. Simplify setup of initial sizes and an adjust_frame_size call. (Fframe_parameters): Drop processing F's new_pixelwise slot. (check_frame_pixels): Reorder to make declarations appear first. (Fset_frame_height, Fset_frame_width, Fset_frame_size): Pass explicit width and height values to adjust_frame_size instead of -1. (gui_set_frame_parameters): Minor rewrite making sure that explicit sizes and the corresponding parameter are passed to adjust_frame_size. Remove frame_size_history_add call. (gui_figure_window_size): Drop last two arguments. Simplify assignment of initial size. Set new_height and new_width slots to -1. Use adjust_frame_size to set sizes instead of returning them to caller. (syms_of_frame): Drop symbols used by frame size history; these are now built on-the-fly. Also drop some menu bar related symbols in favor of Qmenu_bar_lines. * src/frame.h (struct frame): Remove new_pixelwise. (SET_FRAME_COLS, SET_FRAME_LINES, SET_FRAME_WIDTH) (SET_FRAME_HEIGHT): Remove macros. (frame_size_history_add): Remove externs. (frame_windows_min_size, frame_size_history_plain) (frame_size_history_extra): Add externs. (FRAME_WINDOWS_WIDTH, FRAME_WINDOWS_HEIGHT): Rename to FRAME_INNER_WIDTH and FRAME_INNER_HEIGHT. (gui_figure_window_size): Drop last two arguments from extern. * src/gtkutil.c (xg_frame_resized): Rename arguments to WIDTH and HEIGHT. Consult delayed_size_change to handle case where WIDTH and HEIGHT do not match F's new_width and new_height values. Call change_frame_size with native sizes and without PIXELWISE argument. Instead of frame_size_history_add call frame_size_history_extra. (xg_frame_set_char_size): WIDTH and HEIGHT are native sizes now; fix adjust_frame_size call accordingly. Instead of frame_size_history_add call frame_size_history_extra. (style_changed_cb): Call xg_frame_set_char_size with native instead of text sizes. (tb_size_cb): Remove frame_size_history_add call. Call adjust_frame_size with INHIBIT 5. (free_frame_tool_bar, xg_change_toolbar_position): Remove frame_size_history_add call. (update_frame_tool_bar): Call adjust_frame_size with INHIBIT 2 and let it handle frame_inhibit_implied_resize and fullheight/-width. Remove frame_size_history_add call. * src/keyboard.c (Fsuspend_emacs): Call change_frame_size with native sizes. * src/nsfns.m (ns_set_tool_bar_lines): Call adjust_frame_size with INHIBIT 2 and let it handle frame_inhibit_implied_resize and fullheight/-width. Remove frame_size_history_add call. (Fx_create_frame): Drop two last arguments in gui_figure_window_size call. Do not SET_FRAME_WIDTH and SET_FRAME_HEIGHT, the adjust_frame_size in gui_figure_window_size did that already. * src/nsterm.m (ns_set_window_size): Drop PIXELWISE argument and its processing; WIDTH and HEIGHT represent native pixel sizes now. Call change_frame_size with native sizes. Remove call to frame_size_history_add. ([EmacsView viewDidResize:]): Call change_frame_size with native sizes. * src/term.c (Fresume_tty): Call change_frame_size with native sizes. * src/termhooks.h (*set_window_size_hook): Drop last argument PIXELWISE. * src/w32fns.c (w32_change_tab_bar_height) (w32_change_tool_bar_height): Fix handling of these in the initial phase before they have been resized at least once. (Fx_create_frame, w32_create_tip_frame): Drop two last arguments in gui_figure_window_size call. Do not SET_FRAME_WIDTH and SET_FRAME_HEIGHT (or SET_FRAME_COLS and SET_FRAME_LINES), the adjust_frame_size in gui_figure_window_size did that already. * src/w32inevt.c (resize_event, maybe_generate_resize_event): Pass native sizes to change_frame_size. * src/w32term.c (w32_read_socket): When WM_WINDOWPOSCHANGED pass native sizes to change_frame_size. (w32_new_font): Recalculate FRAME_TAB_BAR_HEIGHT. Simplify code. (w32fullscreen_hook): Call change_frame_size with native sizes. (w32_set_window_size): Drop argument PIXELWISE and its processing; WIDTH and HEIGHT are native sizes now. Remove frame_size_history_add calls. Pass native sizes to change_frame_size. * src/widget.c (set_frame_size): Set width and height of widget directly. Call frame_size_history_plain instead of frame_size_history_add. (update_from_various_frame_slots): Call frame_size_history_extra. (EmacsFrameRealize): Call frame_size_history_plain. (EmacsFrameResize): Call change_frame_size with native sizes. Call frame_size_history_extra instead of frame_size_history_add. (EmacsFrameSetCharSize): Call frame_size_history_extra. Drop PIXELWISE argument in x_set_window_size call and specify pixels. (pixel_to_text_size): Remove function. * src/xdisp.c (resize_mini_window): Replace FRAME_WINDOWS_HEIGHT with FRAME_INNER_HEIGHT. (redisplay_tab_bar): Don't set tab_bar_redisplayed when we did not redisplay it. (redisplay_tool_bar): Don't call it for external tool bar. Don't set tool_bar_redisplayed when we did not redisplay it. (redisplay_window): When the tool bar is external call update_frame_tool_bar directly. * src/xfns.c (x_set_menu_bar_lines): Call adjust_frame_size only if number of menu bar lines changed and fix 6th argument. (x_change_tab_bar_height, x_change_tool_bar_height): Fix handling of these in the initial phase before they have been resized at least once. (Fx_create_frame, x_create_tip_frame): Drop two last arguments in gui_figure_window_size call. Do not SET_FRAME_WIDTH and SET_FRAME_HEIGHT (or SET_FRAME_COLS and SET_FRAME_LINES), the adjust_frame_size in gui_figure_window_size did that already. * src/xmenu.c (update_frame_menubar): Fix 6th arg of adjust_frame_size call. (free_frame_menubar): For Motif frames fix fullscreen and `frame-inhibit-implied-resize' handling. Fix 6th arg of adjust_frame_size calls. * src/xterm.c (x_net_wm_state): Remove call to frame_size_history_add. (handle_one_xevent): For PropertyNotify and UnmapNotify events add frame_size_history_plain calls. For MapNotify and ConfigureNotify events add a frame_size_history_extra call. For ConfigureNotify events also handle delayed size changes and call change_frame_size with native sizes. (x_new_font): Recalculate FRAME_TAB_BAR_HEIGHT. Simplify code. (x_handle_net_wm_state): Remove frame_size_history_add call. (x_check_fullscreen): Remove frame_size_history_add call. Call change_frame_size with native height. (x_set_window_size_1): WIDTH and HEIGHT are now native. Remove some frame_size_history_add calls and add frame_size_history_extra calls instead. If the frame is not visible call adjust_frame_size directly instead of calling change_frame_size. (x_set_window_size): Drop PIXELWISE argument. WIDTH and HEIGHT represent native sizes now. (x_make_frame_visible, x_make_frame_invisible): Call frame_size_history_plain. * src/xterm.h (x_set_window_size): Drop last argument from extern declaration.
* Fix last change for DOS_NT systemsEli Zaretskii2021-01-221-1/+9
| | | | | | * src/term.c (tty_draw_row_with_mouse_face) (tty_write_glyphs_with_face): Don't define on MSDOS and WINDOWSNT, as those have their own implementations of that.
* Enable TTY mouse-face support when built without GPM supportJoão Távora2021-01-221-19/+16
| | | | | | | * src/term.c (tty_write_glyphs_with_face): Move definition out of ifdef block. * src/xdisp.c (draw_row_with_mouse_face): Now called unconditionally on all platforms.
* Make mouse-related calls be more consistent on all frame typesJared Finder2021-01-161-3/+1
| | | | | | | | | | | | * src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call Fselect_frame and appropriate mouse_moveto function on all non-GUI frame types, independent of #ifdef's. * src/term.c (init_tty): Initialize mouse_face_window for all non-GUI frame types. (term_mouse_moveto) [HAVE_GPM]: Make available even if HAVE_WINDOW_SYSTEM is defined. * src/xdisp.c (try_window_id): Call gui_clear_window_mouse_face in all cases.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Migrate usage of GPM_CLICK_EVENT to MOUSE_CLICK_EVENT.Jared Finder2020-11-211-4/+4
| | | | | | | * src/termhooks.h (enum event_kind): * src/term.c (term_mouse_click, handle_one_term_event): * src/keyboard.c (discard_mouse_events, make_lispy_event): Migrate usage of GPM_CLICK_EVENT to MOUSE_CLICK_EVENT.
* Face-changing text properties and help-echo now work with xterm-mouse.Jared Finder2020-11-141-38/+14
| | | | | | | | | | | | | * src/dispnew.c (update_mouse_position): New function for mouse movement logic in 'handle_one_term_event' that can be shared across different mouse backends. (display--update-for-mouse-movement): New lisp function, call it. * lisp/xt-mouse.el (xterm-mouse--handle-mouse-movement): New function that calls 'display--update-for-mouse-movement'. (xterm-mouse-translate-1): Call it. * src/term.c (handle_one_term_event): Inline logic from 'term_mouse_movement' and call 'update_mouse_position'. (term_mouse_movement): Delete.
* * src/term.c (handle_one_term_event): Simplify.Stefan Monnier2020-11-041-45/+41
| | | | | | | | Remove the `hold_quit` argument which was never used. Streamline the control flow. Thanks to Jared Finder <jared@finder.org> for pointing it out. * src/keyboard.c (tty_read_avail_input): Simplify accordingly.
* Make TTY menus work with xterm-mouse-modeJared Finder2020-10-241-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/term.c (mouse_get_xy): Call 'mouse_position' passing it the value of 'tty-menu-calls-mouse-position-function' as the argument. (syms_of_term) <tty-menu-calls-mouse-position-function>: New DEFVAR_BOOL. * src/frame.c (mouse_position): New function, with most of the code from Fmouse_position, but call 'mouse-position-function' only if called with non-zero argument. (Fmouse_position): Call 'mouse_position' to do the job. * lisp/xt-mouse.el (xterm-mouse-translate-1): Respect 'track-mouse'. (xterm-mouse-mode): Set 'tty-menu-calls-mouse-position-function' when setting 'mouse-position-function'. (xterm-mouse-tracking-enable-sequence): Use SET_ANY_EVENT_MOUSE (0x1003) so that mouse movement can be reported even if no buttons are pressed. Doc fix. * lisp/menu-bar.el (menu-bar-define-mouse-key): New function. (tty-menu-navigation-map): Call it. * doc/lispref/frames.texi (Mouse Position): Document 'tty-menu-calls-mouse-position-function'. * etc/NEWS: Announce 'tty-menu-calls-mouse-position-function'.
* Merge from origin/emacs-27Glenn Morris2020-10-101-1/+3
|\ | | | | | | | | | | | | | | c00606171f (origin/emacs-27) A better fix for bug#43886 3196fd44c3 Avoid crashes when a theme is loaded with one frame suspended 0407b15500 Removed an incorrectly placed extra word in the semantic docs 040dcbe53e Fix current-line hscrolling when overlays change c56eeba2ce Extend tests for shell-command-dont-erase-buffer
| * A better fix for bug#43886Eli Zaretskii2020-10-101-1/+3
| | | | | | | | | | * src/xfaces.c (load_color2, Fcolor_distance): Revert last change. * src/term.c (clear_tty_hooks): Don't clear defined_color_hook.
* | ; Fix typosStefan Kangas2020-09-211-1/+1
| |
* | Minor cleanup of last changeEli Zaretskii2020-09-181-7/+16
| | | | | | | | | | * src/termchar.h (struct tty_display_info): * src/term.c (turn_on_face, tty_capable_p): Reformat new code.
* | TTY Support for ECMA-48 strike-through graphic renditionMike Hamrick2020-09-181-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * term.c: Support strike-through in capable terminals. (no_color_bit): Replace unused NC_INVIS with NC_STRIKE_THROUGH. (turn_on_face): Output via TS_enter_strike_through_mode if available. (turn_off_face): Handle strike-through case. (tty_capable_p, init_tty): Support strike-through. * termchar.h (struct tty_display_info): Add field for strike-through. * xfaces.c (tty_supports_face_attributes_p, realize_tty_face): Handle strike-through case. * dispextern.h: Add TTY_CAP_STRIKE_THROUGH definition. (struct face): Add field tty_strike_through_p.
* | Add fallback for 24-bit terminal color via COLORTERM=truecolorJan Beich2020-06-201-0/+9
|/ | | | | | | | | | | | | * src/term.c (init_tty): When COLORTERM=truecolor is defined, override setaf/setab/colors terminfo capabilities with 24-bit color support. * doc/misc/efaq.texi (Colors on a TTY): Mention the possibility to enable 24-bit color via the COLORTERM environment variable. (Bug#41846) Copyright-paperwork-exempt: yes
* Avoid crashes on TTY frames with over-long compositionsEli Zaretskii2020-04-281-1/+1
| | | | | | | | * src/term.c (encode_terminal_code): Each character from an automatic composition is a multibyte character, so its multibyte representation can take up to MAX_MULTIBYTE_LENGTH bytes. Account for that when allocating storage for characters to be encoded. (Bug#40913)
* Handle tab-bar clicks on a GPM-capable console.Juri Linkov2020-01-131-0/+8
| | | | | | | | | | * src/term.c (handle_one_term_event): Call tty_handle_tab_bar_click. * src/xdisp.c (tty_handle_tab_bar_click): Force reset of up_modifier bit from the event modifiers. * lisp/tab-line.el (tab-line-tab-current): No need to use inverse-video on console/xterm because the selected tab already uses inverse-video.
* Update copyright year to 2020Paul Eggert2020-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
* Merge branch 'feature/tabs'Juri Linkov2019-10-011-1/+2
|\
| * Remove unused code and reformat to 70 columns.feature/tabsJuri Linkov2019-10-011-1/+2
| |
| * Take into account FRAME_TAB_BAR height in more places.Juri Linkov2019-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/dispnew.c (handle_window_change_signal, init_display_interactive): * src/frame.c (make_terminal_frame, Fmake_terminal_frame): * src/keyboard.c (Fsuspend_emacs): * src/term.c (Fresume_tty): * src/xterm.c (x_check_fullscreen): Subtract FRAME_TAB_BAR_LINES. * src/xterm.c (x_new_font): Set FRAME_TAB_BAR_HEIGHT. (x_new_font, x_check_fullscreen, x_set_window_size_1) (x_set_window_size, x_wm_set_size_hint): Add FRAME_TABBAR_HEIGHT.
* | Remove obsolete Lint directivesPaul Eggert2019-09-161-1/+0
|/ | | | | | | | | | | | | Most of the directives were wrong anyway. Apparently traditional lint hasn’t been used to check Emacs for years. * src/callint.c (Finteractive): * src/cm.c (evalcost): * src/emacs.c (main): * src/eval.c (call1, call2, call3, call4, call5, call6, call7, call8): * src/fns.c (concat2, concat3, nconc2): * src/term.c (calculate_ins_del_char_costs): Omit ARGSUSED comments. * src/eval.c (call1): Omit VARARGS comment.
* Fix two mouse drag and drop issues (Bug#28620, Bug#36269)Martin Rudalics2019-08-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow 'mouse-drag-and-drop-region' to move/copy text from one frame to another (Bug#28620). Prevent mouse avoidance mode from interfering with 'mouse-drag-and-drop-region' (Bug#36269). * lisp/avoid.el (mouse-avoidance-ignore-p): Suspend avoidance when 'track-mouse' equals 'dropping'. * lisp/mouse.el (mouse-drag-and-drop-region): Set 'track-mouse' to 'dropping'. Continue reading events also when switching frames. * src/keyboard.c (Finternal_track_mouse): Rename from Ftrack_mouse. (some_mouse_moved): Return NULL also when mouse is not tracked. (show_help_echo, readable_events, kbd_buffer_get_event): Don't check whether mouse is tracked, some_mouse_moved does it now. (track_mouse): Rename variable from do_mouse_tracking. Adjust all users. In doc-string explain meanings of special values 'dragging' and 'dropping'. * src/nsterm.m (ns_mouse_position): During drag and drop consider last mouse frame only when there is no currently focused frame. * src/w32fns.c (w32_wnd_proc): Don't set mouse capture during a drag and drop operation. * src/w32term.c (w32_mouse_position): Track frame under mouse during mouse drag and drop. (mouse_or_wdesc_frame): New function. (w32_read_socket): Call mouse_or_wdesc_frame on mouse events. * src/xdisp.c (define_frame_cursor1): Don't change mouse cursor shape during mouse drag and drop. (syms_of_xdisp): New symbol Qdropping. * src/xterm.c (XTmouse_position): Allow mouse drag and drop move to another frame (mouse_or_wdesc_frame): New function. (handle_one_xevent): Use mouse_or_wdesc_frame for mouse events.
* Use fewer locks when accessing stdioPaul Eggert2019-07-081-25/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/emacs-module.c, src/pdumper.c: * src/regex-emacs.c, src/unexhp9k800.c, src/unexmacosx.c: * src/widget.c, src/xdisp.c, src/xselect.c, src/xterm.c: Include sysstdio.h instead of stdio.h, to avoid locking stdio streams in many cases. * src/alloc.c (test_setjmp): * src/bidi.c (bidi_dump_cached_states): * src/cm.c (calccost): * src/dispnew.c (init_display_interactive): * src/emacs.c (main): * src/image.c (convert_mono_to_color_image): * src/minibuf.c (read_minibuf_noninteractive): * src/nsfont.m (ns_descriptor_to_entity) (ns_dump_glyphstring): * src/nsterm.h (NSTRACE_MSG_NO_DASHES): * src/nsterm.m (ns_mouse_position) (sendEvent:, keyDown:, performDragOperation:): * src/pdumper.c (dump_fingerprint, print_paths_to_root_1): * src/print.c (debug_print): * src/regex-emacs.c (debug_putchar, print_fastmap) (print_partial_compiled_pattern, print_compiled_pattern) (print_double_string, regex_compile): * src/term.c (vfatal): * src/unexhp9k800.c (read_header): * src/unexmacosx.c (unexec_error): * src/widget.c (EmacsFrameInitialize): * src/xdisp.c (message_to_stderr, vmessage, dump_glyph_row) (Fdump_glyph_matrix, Fdump_frame_glyph_matrix, dump_glyph_string): * src/xfaces.c (Fdump_colors, Fdump_face): * src/xselect.c (x_clipboard_manager_error_2): * src/xterm.c (x_initialize): * src/xwidget.c (WEBKIT_FN_INIT): Prefer unlocked calls like fputs to locked calls like fprintf. * src/charset.c (read_hex): * 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/emacs-module.c (module_abort): * src/fileio.c (Fdo_auto_save): * 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_stdio, read1): * src/minibuf.c (read_minibuf_noninteractive): * src/print.c (printchar_to_stream, strout) (Fredirect_debugging_output): * src/sysdep.c (reset_sys_modes, close_output_streams) (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): Simplify by using ordinary calls like putc to explicitly-unlocked calls like putc_unlocked, since the ordinary calls are now unlocked anyway. * src/emacs.c (main, Fdump_emacs): * src/pdumper.c (Fdump_emacs_portable): Coalesce adjacent printfs. * src/nsterm.h: Include sysstdio.h as this file’s macros rely on it. * src/regex-emacs.c (print_compiled_pattern): Omit redundant fflush. * src/sysstdio.h: Include unlocked-io.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_unlocked): Remove these macros; now done by unlocked-io.h. * src/xwidget.c: Include sysstdio.h.
* Avoid some strlen work, primarily via strnlenPaul Eggert2019-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add strnlen. * lib-src/etags.c (find_entries): * src/emacs.c (main): * src/nsmenu.m (parseKeyEquiv:): * src/nsterm.m (ns_xlfd_to_fontname): * src/term.c (vfatal): Prefer !*X to !strlen (X). * lib-src/etags.c (pfnote, add_regex): * lib-src/pop.c (pop_open): * lib-src/update-game-score.c (main): * lwlib/lwlib.c (lw_separator_p): * src/doprnt.c (doprnt): * src/emacs.c (main): * src/inotify.c (inotifyevent_to_event): * src/keyboard.c (menu_separator_name_p, parse_tool_bar_item): * src/sysdep.c (get_current_dir_name_or_unreachable): * src/xdisp.c (store_mode_line_string): Use strnlen to avoid unnecessary work with strlen. * lib-src/etags.c (Prolog_functions, prolog_pr) (Erlang_functions, erlang_func): Prefer ptrdiff_t to size_t when either will do. (prolog_pr, erlang_func): New arg LASTLEN, to avoid unnecessary strlen call. All callers changed. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lib/strnlen.c, m4/strnlen.m4: New files, copied from Gnulib. * lwlib/lwlib.c (lw_separator_p): * src/json.c (json_has_prefix): Use strncmp to avoid unecessary work with strlen + memcmp. * src/process.c (set_socket_option): Use SBYTES instead of strlen.
* Remove no-longer-needed fflushes of stderrPaul Eggert2019-06-201-1/+0
| | | | | | * src/gmalloc.c (mabort) [GC_MCHECK && !__GNU_LIBRARY__]: * src/term.c (vfatal): Remove fflush (stderr) when it is now a no-op because newline automatically flushes stderr.
* Add terminal hook defined_color_hookAlexander Gramiak2019-04-261-0/+2
| | | | | | | | | | | | | | | * src/termhooks.h (defined_color_hook): New terminal hook. * src/xterm.c: * src/nsterm.m: * src/term.c: * src/w32term.c: Set defined_color_hook. * src/xfaces.c: Use defined_color_hook. (defined_color): Remove. * src/image.c: Remove redefinitions of x_defined_color, and use defined_color_hook.
* Mark _Noreturn error functions as coldPaul Eggert2019-04-181-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On my platform this made ‘make compile-always’ 1.3% faster. Suggested by Alex Gramiak in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00684.html * configure.ac (nw): Don’t use -Wsuggest-attribute=cold. * lib-src/make-docfile.c (write_globals): Mark noreturn functions as cold. * src/callproc.c (exec_failed): * src/data.c (wrong_length_argument, wrong_type_argument): * src/emacs-module.c (module_abort): * src/emacs.c (terminate_due_to_signal): * src/eval.c (unwind_to_catch): * src/image.c (my_png_error, my_error_exit): * src/json.c (json_out_of_memory, json_parse_error): * src/keyboard.c (quit_throw_to_read_char, user_error): * src/lisp.h (die, wrong_type_argument, wrong_choice) (args_out_of_range, args_out_of_range_3, circular_list) (buffer_overflow, memory_full, buffer_memory_full) (string_overflow, xsignal, xsignal0, xsignal1, xsignal2) (xsignal3, signal_error, overflow_error, error, verror) (nsberror, report_file_errno, report_file_error) (report_file_notify_error, terminate_due_to_signal) (emacs_abort, fatal): * src/lread.c (load_error_old_style_backquotes) (end_of_file_error, invalid_syntax): * src/pdumper.c (error_unsupported_dump_object): * src/puresize.h (pure_write_error): * src/search.c (matcher_overflow): * src/sound.c (sound_perror, alsa_sound_perror): * src/sysdep.c (handle_arith_signal): * src/systime.h (time_overflow): * src/term.c (maybe_fatal, vfatal): * src/textprop.c (text_read_only): * src/timefns.c (invalid_time_zone_specification) (time_error, invalid_hz): * src/xterm.c (x_connection_closed): Use AVOID instead of _Noreturn void, so that it’s marked cold. * src/conf_post.h (__has_attribute_cold) [!__has_attribute]: New macro. (ATTRIBUTE_COLD): New macro. * src/frame.h (WINDOW_SYSTEM_RETURN): Add ATTRIBUTE_COLD. * src/lisp.h (AVOID): New macro. * src/xterm.c: Omit unnecessary static decls, so that we needn’t worry about which functions should be marked cold. (x_io_error_quitter): Mark as cold.
* DEFVAR_INT variables are now intmax_tPaul Eggert2019-02-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formerly they were fixnums, which led to problems when dealing with values that might not fit on 32-bit platforms, such as string-chars-consed or floats_consed. 64-bit counters should be good enough for these (for a while, anyway...). While we’re at it, fix some unlikely integer overflow bugs that have been in the code for a while. * lib-src/make-docfile.c (write_globals): * src/data.c (do_symval_forwarding, store_symval_forwarding): * src/eval.c (restore_stack_limits, call_debugger): * src/frame.h (struct frame.cost_calculation_baud_rate): * src/keyboard.c (last_auto_save, bind_polling_period, read_char): * src/lisp.h (struct Lisp_Intfwd.intvar): * src/lread.c (defvar_int): * src/pdumper.c (dump_fwd_int): * src/thread.h (struct thread_state.m_lisp_eval_depth): * src/undo.c (truncate_undo_list): * src/xselect.c (wait_for_property_change) (x_get_foreign_selection): * src/xterm.c (x_emacs_to_x_modifiers): DEFVAR_INT variables now have the C type intmax_t, not EMACS_INT. * src/data.c (store_symval_forwarding): * src/gnutls.c (Fgnutls_boot): * src/keyboard.c (bind_polling_period): * src/macros.c (pop_kbd_macro, Fexecute_kbd_macro): * src/undo.c (truncate_undo_list): Allow any integer that fits into intmax_t, instead of requiring it to be a Lisp fixnum. * src/dispnew.c (update_window): * src/frame.c (x_figure_window_size): * src/gnutls.c (init_gnutls_functions) (emacs_gnutls_handle_error): * src/keyboard.c (make_lisp_event): * src/nsterm.m (ns_dumpglyphs_image): * src/profiler.c (make_log): * src/scroll.c (calculate_scrolling) (calculate_direct_scrolling): * src/termcap.c (tputs): * src/xterm.c (x_draw_image_relief): Avoid implementation-defined behavior on conversion of out-of-range integers. * src/eval.c (when_entered_debugger): Now intmax_t. (max_ensure_room): New function, that avoids signed integer overflow. (call_debugger, signal_or_quit): Use it. * src/fileio.c (Fdo_auto_save): * src/keyboard.c (make_lisp_event): * src/term.c (calculate_costs): * src/xdisp.c (build_desired_tool_bar_string) (hscroll_window_tree, try_scrolling, decode_mode_spec) (x_produce_glyphs): Avoid signed integer overflow. * src/lisp.h (clip_to_bounds): Generalize to intmax_t. * src/pdumper.c (dump_emacs_reloc_immediate_emacs_int): Remove, ... (dump_emacs_reloc_immediate_intmax_t): ... replacing with this function. All uses changed. * src/profiler.c (make_log): Omit args. All callers changed. * src/termcap.c: Include stdlib.h, for atoi. Include intprops.h. * src/window.c (sanitize_next_screen_context_lines): New function. (window_scroll_pixel_based, window_scroll_line_based): Use it to avoid signed integer overflow.
* Don’t assume timersub and gettimeofdayPaul Eggert2019-02-231-13/+7
| | | | | | | | | | | | | POSIX does not specify timersub, and marks gettimeofday as obsolescent. Avoid porting problems by using timespec.h functions instead. * src/editfns.c: Include systime.h instead of sys/time.h. (EXTRA_CONTEXT_FIELDS): Replace start and max_secs with time_limit. All uses changed. This removes the need to call gettimeofday or timersub. * src/term.c (timeval_to_Time): Remove. Replace all uses with ... (current_Time): ... this new function, removing the need to call gettimeofday.
* Rename CANNOT_DUMP to HAVE_UNEXECPaul Eggert2019-02-011-1/+2
| | | | | | | * configure.ac (CANNOT_DUMP): Remove. All uses removed, or changed to the negative of with_unexec. (HAVE_UNEXEC): New macro. All uses of CANNOT_DUMP changed to the negative of this macro.
* Merge from origin/emacs-26Paul Eggert2018-12-311-1/+1
|\ | | | | | | | | | | 2fcf2df Fix copyright years by hand 26bed8b Update copyright year to 2019 2814292 Fix value of default frame height. (Bug#33921)
| * Update copyright year to 2019Paul Eggert2019-01-011-1/+1
| | | | | | | | Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
* | Add make_vector and make_nil_vectorPaul Eggert2018-12-091-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the callers a bit easier to read, and doubtless improves efficiency very slightly. It also simplifies possible future changes to allow bignum indexes to buffers. * src/alloc.c (allocate_vectorlike): Prefer ptrdiff_t to size_t when either will do. (make_vector): New function. (Fmake_vector): Use it. * src/buffer.c (syms_of_buffer): * src/bytecode.c (syms_of_bytecode): * src/category.c (Fmake_category_table, init_category_once): * src/ccl.c (syms_of_ccl): * src/character.c (syms_of_character): * src/charset.c (Fdefine_charset_internal) (Ffind_charset_region, Ffind_charset_string): * src/chartab.c (copy_char_table): * src/coding.c (Fdefine_coding_system_internal, syms_of_coding): * src/composite.c (get_composition_id, Fcomposition_get_gstring): * src/composite.h (LGLYPH_NEW): * src/fns.c (concat, Flocale_info, make_hash_table): * src/font.c (font_otf_ValueRecord, font_otf_anchor) (build_style_table, syms_of_font): * src/fontset.c (RFONT_DEF_NEW, fontset_find_font) (dump_fontset, syms_of_fontset): * src/image.c (xpm_make_color_table_v): * src/keyboard.c (modify_event_symbol, menu_bar_items) (parse_menu_item, parse_tool_bar_item, init_tool_bar_items) (syms_of_keyboard): * src/keymap.c (Fdefine_key, describe_map, describe_vector): * src/lread.c (read_vector): * src/macfont.m (macfont_shape): * src/menu.c (init_menu_items): * src/nsfns.m (ns_make_monitor_attribute_list): * src/process.c (conv_sockaddr_to_lisp, network_interface_info): * src/profiler.c (make_log): * src/window.c (Fcurrent_window_configuration): * src/xdisp.c (with_echo_area_buffer_unwind_data) (format_mode_line_unwind_data): * src/xfaces.c (Finternal_make_lisp_face) (Fface_attributes_as_vector): * src/xfns.c (x_make_monitor_attribute_list) (Fx_display_monitor_attributes_list): * src/xfont.c (syms_of_xfont): * src/xselect.c (x_handle_dnd_message): * src/xwidget.c (save_script_callback): Prefer make_nil_vector (N) to Fmake_vector (make_fixnum (N), Qnil). * src/callint.c (Fcall_interactively): * src/charset.c (load_charset_map): * src/chartab.c (Fmake_char_table, uniprop_encode_value_numeric): * src/composite.c (get_composition_id) * src/dispnew.c (Fframe_or_buffer_changed_p) (syms_of_display): * src/fns.c (make_hash_table, maybe_resize_hash_table): * src/font.c (font_style_to_value): * src/fontset.c (FONTSET_ADD, fontset_add): * src/json.c (json_to_lisp): * src/keymap.c (syms_of_keymap): * src/lread.c (init_obarray): * src/profiler.c (make_log, Fprofiler_cpu_log): * src/term.c (term_get_fkeys_1): Prefer make_vector (N, V) to Fmake_vector (make_fixnum (N), V). * src/font.c (build_style_table): * src/macfont.m (macfont_shape): * src/process.c (conv_sockaddr_to_lisp, network_interface_info): Prefer make_uninit_vector if the vector will be initialized soon. * src/lisp.h (make_nil_vector): New function.
* | Merge from origin/emacs-26Glenn Morris2018-10-031-0/+1
|\ \ | |/ | | | | | | | | | | | | | | 7296b6f Improve cl-do, cl-do* docstrings d416109 Avoid returning early in 'while-no-input' due to subprocesses e8a4d94 Cleanup when opening a new terminal fails. (Bug#32794) # Conflicts: # etc/NEWS
| * 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)
* | More macro renamings for bignumTom Tromey2018-08-071-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/buffer.c, src/buffer.h, src/bytecode.c, src/callint.c, src/callproc.c, src/casefiddle.c, src/casetab.c, src/category.c, src/ccl.c, src/character.c, src/character.h, src/charset.c, src/charset.h, src/chartab.c, src/cmds.c, src/coding.c, src/composite.c, src/composite.h, src/data.c, src/dbusbind.c, src/decompress.c, src/dired.c, src/dispextern.h, src/dispnew.c, src/disptab.h, src/doc.c, src/dosfns.c, src/editfns.c, src/emacs-module.c, src/emacs.c, src/eval.c, src/fileio.c, src/floatfns.c, src/fns.c, src/font.c, src/font.h, src/fontset.c, src/frame.c, src/frame.h, src/fringe.c, src/ftcrfont.c, src/ftfont.c, src/gfilenotify.c, src/gnutls.c, src/gtkutil.c, src/image.c, src/indent.c, src/insdel.c, src/intervals.c, src/json.c, src/keyboard.c, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/syntax.h, src/sysdep.c, src/term.c, src/termhooks.h, src/textprop.c, src/undo.c, src/w32.c, src/w32console.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32term.h, src/w32uniscribe.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xml.c, src/xrdb.c, src/xselect.c, src/xsettings.c, src/xterm.c, src/xwidget.c Rename XINT->XFIXNUM, XFASTINT->XFIXNAT, XUINT->XUFIXNUM.
* | Rename integerp->fixnum, etc, in preparation for bignumsTom Tromey2018-07-121-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c, src/textprop.c, src/undo.c, src/w16select.c, src/w32.c, src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM, make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP, NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
* | Tune SAFE_FREEPaul Eggert2018-06-281-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On my platform (Fedora 28 x86-64, AMD Phenom II X4 910e) this sped up a SAFE_FREE-using microbenchmark (string-distance "abc" "abc") by about 18%, and shrank the Emacs text size by about 0.1%. * src/callint.c (Fcall_interactively): * src/callproc.c (call_process): * src/doc.c (get_doc_string, Fsnarf_documentation): * src/editfns.c (Freplace_buffer_contents): * src/emacs-module.c (funcall_module): * src/eval.c (Flet): * src/process.c (Fmake_process): * src/term.c (tty_menu_show): * src/xdisp.c (safe__call): * src/xmenu.c (x_menu_show): Use SAFE_FREE_UNBIND_TO. * src/data.c (wrong_choice): No need to call SAFE_FREE here. * src/lisp.h (USE_SAFE_ALLOCA): * src/regex.c (REGEX_USE_SAFE_ALLOCA): Do not declare sa_must_free local; no longer needed. All uses removed. (SAFE_FREE): Rewrite in terms of safe_free. (safe_free): New function, optimized to use xfree. (SAFE_FREE_UNBIND_TO): New macro. (safe_free_unbind_to): New function.
* | Use record_unwind_protect_ptr to avoid allocationPaul Eggert2018-06-141-7/+13
| | | | | | | | | | | | | | | | | | | | | | * src/term.c (struct tty_pop_down_menu): New type. (tty_pop_down_menu, tty_menu_show): Use it, along with record_unwind_protect_ptr, to avoid allocating a Lisp_Misc. * src/xmenu.c (struct pop_down_menu): New type. (pop_down_menu, x_menu_show): Use it, likewise. * src/xterm.c (x_cr_destroy, x_cr_export_frames): Use record_unwind_protect_pointer to avoid possibly allocating a Lisp_Misc.
* | Add support for per-window face remappingDaniel Colascione2018-06-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend face specifications to support the notion of filtering to a specific context and add a filter that limits a face specification to windows having a certain parameter. * src/xfaces.c: (evaluate_face_filter,filter_face_ref): New functions. (merge_face_ref): Ignore filtered face specifications. (Fx_list_fonts,get_lface_attributes,merge_face_vectors) (merge_named_face,merge_face_ref,merge_face_ref) (Finternal_merge_in_global_face,Fface_font,lookup_named_face) (lookup_basic_face,Fface_attributes_as_vector) (x_supports_face_attributes_p) (Fdisplay_supports_face_attributes_p,realize_named_face) (compute_char_face,face_at_buffer_position) (face_at_buffer_position,face_at_buffer_position) (face_at_buffer_position) (face_for_overlay_string,face_at_string_position,merge_faces): Pass window to face machinery. (syms_of_xfaces): Add :window and :filtered * src/xdisp.c (init_iterator, handle_face_prop) (handle_single_display_spec, merge_escape_glyph_face) (merge_glyphless_glyph_face, get_next_display_element) (next_element_from_display_vector, append_space_for_newline) (extend_face_to_end_of_line,highlight_trailing_whitespace) (maybe_produce_line_number) (display_line, calc_line_height_property): Pass window to face machinery. * src/term.c (tty_menu_activate): Adjust to new face core function signature. * src/msdos.c (XMenuActivate): Adjust to new face core function signature. * src/fringe.c (draw_fringe_bitmap_1, Fset_fringe_bitmap_face): Pass window to face machinery. * src/font.c (font_range, Finternal_char_font): Pass window to face machinery. * src/dispnew.c (spec_glyph_lookup_face): Pass window to face machinery. * src/dispextern.h: (lookup_named_face,lookup_basic_face) (lookup_derived_face,merge_faces): Add struct window arguments to prototypes.
* | Port --enable-gcc-warnings to GCC 8Paul Eggert2018-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Do not use GCC 8’s new -Wcast-align flag. * lib-src/ebrowse.c (xmalloc): * lib-src/emacsclient.c (xmalloc, xstrdup): * lib-src/etags.c (xmalloc): * lib-src/make-docfile.c (xmalloc): * lib-src/movemail.c (xmalloc): * src/dispnew.c (new_glyph_pool): * src/regex.c (xmalloc): * src/term.c (tty_menu_create): * src/tparam.h (tparam): Use ATTRIBUTE_MALLOC. Also see GCC bug 85562. * lib-src/emacsclient.c (fail): Do not dereference a null pointer. * src/frame.c (delete_frame): Add a decl with UNINIT to work around GCC bug 85563. * src/menu.h (finish_menu_items): Do not use attribute const. * src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
* | Fix display of TABs in hscrolled windows with line numbersEli Zaretskii2018-03-071-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.