Po Lu [Mon, 31 Jan 2022 10:37:09 +0000 (18:37 +0800)]
Fix accesses to GTK structures on tooltip frames
* src/xfns.c (xic_set_preeditarea): Don't set the GTK context on
tooltip frames.
(x_set_alpha_background): Don't make tooltip frames paintable.
* src/xterm.c (x_xr_ensure_picture): Get rid of GDK visual code.
This is now done in a better way inside xg_create_frame_widgets.
(bug#53654)
Po Lu [Mon, 31 Jan 2022 09:59:12 +0000 (17:59 +0800)]
Improve portability of alpha channel handling on TrueColor visuals
* src/xfns.c (select_visual): Always ask for a TrueColor visual.
* src/xfont.c (xfont_draw):
* src/xftfont.c (xftfont_draw): Test `alpha_bits' instead of
n_planes.
* src/xterm.c (x_fill_rectangle, x_clear_rectangle): Likewise.
(x_query_colors, x_alloc_nearest_color): Remove code that
hard-coded alpha mask.
(x_term_init): Calculate alpha bits and offset and populate
field appropriately.
* src/xterm.h (struct x_display_info): New fields `alpha_bits'
and `alpha_offset'.
(x_make_truecolor_pixel): Stop hardcoding the value of the alpha
mask.
Stefan Kangas [Mon, 31 Jan 2022 06:42:50 +0000 (07:42 +0100)]
Factor out function to check for clang in tests
This also stops a flymake test from failing on my machine.
* lisp/emacs-lisp/ert-x.el (ert-gcc-is-clang-p): New function
factored out from ...
* test/lisp/progmodes/flymake-tests.el (flymake-tests--gcc-is-clang):
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): ... here.
* test/lisp/progmodes/flymake-tests.el (different-diagnostic-types)
(included-c-header-files):
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): Use above new function.
Po Lu [Mon, 31 Jan 2022 02:15:47 +0000 (10:15 +0800)]
Implement `alpha-background' on non-Cairo builds
* src/frame.c (gui_set_alpha_background): Recompute basic faces
so xft face ext info gets reset.
* src/gtkutil.c (xg_create_frame_widgets): Attach to style
updated signal.
(xg_update_frame_menubar): Set menu bar visual correctly.
(xg_widget_style_updated): New function.
* src/xfns.c (x_set_alpha_background): New function.
(x_frame_parm_handlers): Use x_set_alpha_background instead.
* src/xterm.c (x_xr_ensure_picture): Export function.
(x_update_opaque_region): New function.
(x_fill_rectangle): New parameter `respect_alpha_background'.
All callers changed.
(handle_one_xevent): Set opaque region on ConfigureNotify.
(x_drop_xrender_surfaces): Set opaque region.
(x_xrender_color_from_gc_foreground):
(x_xrender_color_from_gc_background): Premultiply alpha with
components if asked for.
* src/xterm.h (struct x_display_info): New atom
`Xatom_net_wm_opaque_region'.
(clone-frame): Use frame-internal-parameters.
(undelete-frame--handle-delete-frame): Instead of using frameset-save,
save frame-parameters except frame-internal-parameters and 'display'
on non-graphic display. Also save window-state from window-state-get.
(undelete-frame): Instead of using frameset-restore,
set default-frame-alist for make-frame (like in clone-frame),
and restore window-state with window-state-put.
* lisp/frameset.el (frameset-session-filter-alist): Append
parameters from frame-internal-parameters with the filter :never.
Remove :name that is now in frame-internal-parameters.
(frameset-persistent-filter-alist): Remove outer-window-id,
parent-id, window-id that are now in frame-internal-parameters,
included here via frameset-session-filter-alist.
* src/frame.c (frame-internal-parameters): New variable.
Stefan Kangas [Sun, 30 Jan 2022 05:31:11 +0000 (06:31 +0100)]
Merge from origin/emacs-28
e81e375539 ; Yet another minor fix of Malayalam composition rules. 94f38cbec4 Fix last change of Malayalam composition rules ed3bbeb80d Fix rendering of Malayalam script 5ef3a52342 Improve documentation of Occur mode
Eli Zaretskii [Sat, 29 Jan 2022 19:56:53 +0000 (21:56 +0200)]
Fix last change of Malayalam composition rules
* lisp/language/indian.el (malayalam-composable-pattern):
Reinstate. Instead of removing it, add any sequence of
Malayalam characters to the existing patterns, so as not
to lose the patterns that use ZWJ and ZWNJ. (Bug#53625)
Eli Zaretskii [Sat, 29 Jan 2022 19:22:02 +0000 (21:22 +0200)]
Fix rendering of Malayalam script
* lisp/language/indian.el (malayalam-composable-pattern): Remove.
(script-regexp-alist): Remove 'malayalam-composable-pattern'.
Instead, pass any sequence of Malayalam codepoints to the shaping
engine. (Bug#53625)
Allow redirecting `message' output to a different buffer
* doc/lispref/display.texi (Logging Messages): Document it.
* src/xdisp.c (message_dolog): Add sanity checking.
(syms_of_xdisp): Make Vmessages_buffer_name into a defvar
(bug#27170).
Eli Zaretskii [Sat, 29 Jan 2022 15:54:43 +0000 (17:54 +0200)]
Don't require mouse for prompting via dialog boxes
* lisp/subr.el (use-dialog-box-p): Don't require mouse support,
and allow dialog boxes when invoked via the TTY menus without a
mouse.
(from--tty-menu-p): New internal variable.
* lisp/menu-bar.el (popup-menu): Bind 'from--tty-menu-p' when
invoking a command from the menu.
Make revert-buffer ('g') keep point in VC diff buffers
* lisp/vc/vc.el (vc-diff-restore-buffer): New function.
(vc-diff-finish): Update its calling convention to include an
optional 'oldbuf' parameter, and handle it.
(vc-diff-internal): Pass a clone of the incumbent vc-diff
buffer to 'vc-diff-finish' (bug#28852).
Po Lu [Sat, 29 Jan 2022 10:53:28 +0000 (18:53 +0800)]
Fix unrelated help text tooltips if a popup is shown during the delay
* doc/lispref/frames.texi (Pop-Up Menus): Document new hook.
* etc/NEWS: Announce `x-pre-popup-menu-hook'.
* lisp/tooltip.el (tooltip-mode): Make sure `tooltip-hide' is
run before any popup menu is displayed to prevent unrelated help
text from obscuring the popup menu if it pops up during the
tooltip delay.
* src/menu.c (x_popup_menu_1): Run said hook right before the
popup menu is displayed.
(syms_of_menu): New hook `x-pre-popup-menu-hook'.
Michael Albinus [Sat, 29 Jan 2022 10:45:38 +0000 (11:45 +0100)]
Fix error in filelock.c
* src/filelock.c (lock_file): Move call of file name handler to
`Flock_file'. Determine lock_filename only in case
create_lockfiles is non-nil. Adapt the rest of the function accordingly.
(Flock_file): Do not check for create_lockfiles. Call file name
handler if appropriate. (Bug#53207)
Eli Zaretskii [Sat, 29 Jan 2022 09:55:02 +0000 (11:55 +0200)]
Fix native-compilation at startup
* lisp/startup.el (normal-top-level): Set up the initial value of
'native-comp-eln-load-path' early into startup, then amend it
after calling 'command-line'. (Bug#53497)
Po Lu [Sat, 29 Jan 2022 05:06:02 +0000 (05:06 +0000)]
Implement real menu help-echo text on Haiku
* lisp/tooltip.el (tooltip-show-help): Remove Haiku-specific
conditional since that's now taken care of by C code.
* src/haiku_io.c (haiku_read_size):
(haiku_read_with_timeout):
(haiku_write_without_signal): Add parameter `popup_p'. All
callers changed.
(port_popup_menu_to_emacs): New variable.
* src/haiku_support.cc (struct be_popup_menu_data): New
structure.
(be_popup_menu_thread_entry): New function.
(class EmacsMenuItem): New field `menu_ptr'.
(Highlight): Send help text to the popup port if this item
isn't for a menu bar.
(BMenu_add_item): Set menu_ptr appropriately.
(BMenu_run): Complete rewrite that allows to read help text from
the menu bar port.
* src/haiku_support.h (struct haiku_menu_bar_help_event): New
fields for popup menus.
* src/haikumenu.c (digest_menu_items): Only set help tooltip on
popup menus when system tooltips are enabled.
(haiku_menu_show_help):
(haiku_process_pending_signals_for_menu): New functions.
(haiku_menu_show): Pass new callbacks.
Stefan Monnier [Fri, 28 Jan 2022 18:19:11 +0000 (13:19 -0500)]
Reduce code duplication in parts of (auto)load&defalias
* src/data.c (defalias): New function, extracted from `Fdefalias`.
(Fdefalias): Use it.
(Ffset): Don't handle `Vautoload_queue` here, handle it in
`defalias` instead.
* src/comp.c (comp--register-subr): Use `defalias` instead of
duplicating its code.
* src/eval.c (load_with_autoload_queue): New function, extracted from
`Fautoload_do_load`.
(Fautoload_do_load): Use it.
(un_autoload): Mark it as static.
* src/fns.c (Frequire): Use it as well.
* src/lisp.h (defalias, load_with_autoload_queue): New declarations.
(un_autoload): Remove declaration.
Sebastian Urban [Fri, 28 Jan 2022 16:12:35 +0000 (17:12 +0100)]
Fix manual points about tex-latex-block/latex-insert-block
* doc/emacs/text.texi (LaTeX Editing):
(LaTeX Editing): Update documentation of
tex-latex-block/latex-insert-block to what they really point to
(bug#37325).
Michael Albinus [Fri, 28 Jan 2022 15:32:15 +0000 (16:32 +0100)]
Clarify where the shell-command output goes
* lisp/simple.el (shell-command):
* doc/emacs/misc.texi (Single Shell): Clarify where the output
goes if the specified buffer isn't the current one (bug#40896).
Lele Gaifax [Fri, 28 Jan 2022 07:41:51 +0000 (08:41 +0100)]
Fix copyright-fix-years, use a dash to separate years in a range
Commit 7a46fa9c751f7c3147cd9b27fe84c1ce25419d3b, allowing en-dash as
years separator, changed the way the years range is composed taking the
separator from the `sep' variable instead of always using an hardwired
hyphen. Since the code explicitly avoid to touch (that is, extend)
existing ranges, that `sep' variable is almost always a space, or
whatever character precedes the last parsed year, thus generating a
range like "2020 2022" instead of "2020-2022".
* lisp/emacs-lisp/copyright.el (copyright-fix-years): Always use an dash
to separate years in a range.
* test/lisp/emacs-lisp/copyright-tests.el (with-copyright-fix-years-test):
(copyright-fix-years-tests--data):
(text-copyright-fix-years): New test cases (bug#53597).
Po Lu [Fri, 28 Jan 2022 08:38:02 +0000 (16:38 +0800)]
Use the real cursor beneath the pointer on xwidgets
* src/xwidget.c (define_cursors): Make manual cursor definition
code PGTK-only.
(xw_update_cursor_for_view):
(xw_last_crossing_cursor_cb): New functions.
(xw_maybe_synthesize_crossing): Attach and disconnect cursor
signal handler where appropriate.
(xwidget_init_view): Set the default cursor to the nontext
cursor.
(Fxwidget_delete_view): Disconnect last crossing signal if
appropriate.
* src/xwidget.h (struct xwidget_view): New field
`last_crossing_cursor_signal'.
Po Lu [Fri, 28 Jan 2022 03:08:20 +0000 (11:08 +0800)]
Clear xwidget passive grab whenever a drag begins
* src/xwidget.c (xv_drag_begin_cb): New function.
(xwidget_view_from_window): Attach said function to grab widget
when a grab starts.
* src/xwidget.h (struct xwidget_view): New field
`passive_grab_drag_signal'.
Po Lu [Fri, 28 Jan 2022 02:41:03 +0000 (10:41 +0800)]
Implement xwidget passive grabs
* src/xwidget.c (find_widget_at_pos): New parameters for
controlling whether to respect grabs. All callers changed.
(window_coords_from_toplevel): Make work when the widget is
the toplevel.
(find_widget): Fix coding style.
(xwidget_button_1): Set and clear passive grabs if appropriate.
(xw_maybe_synthesize_crossing): Allow current_window to be NULL
if the mode is XW_CROSSING_LEFT.
* doc/emacs/cmdargs.texi (Initial Options): Mention it.
* lisp/startup.el (normal-top-level): Move the eln init to after
we've processed the command line arguments.
(command-line): Interpret the --init-directory switch.
Andrea Corallo [Thu, 27 Jan 2022 17:18:13 +0000 (18:18 +0100)]
Fix potential native compiler circular dependencies during load
* lisp/startup.el (startup--require-comp-safetly): New function.
(startup--honor-delayed-native-compilations): Make use of
`startup--require-comp-safetly'.
* src/comp.c (CALL0I): New define.
(maybe_defer_native_compilation): Make use of
`startup--require-comp-safetly'.
* lisp/files.el (files--buffers-needing-to-be-saved): Separated
out into its own function...
(save-some-buffers): ... from here.
(save-buffers-kill-emacs): Check that we have anything to save
before prompting the user.
Eli Zaretskii [Thu, 27 Jan 2022 18:35:22 +0000 (20:35 +0200)]
Improve detection of glyphless characters on TTY frames
* src/term.c (produce_glyphs): If the terminal can report for
which characters it has glyphs, use that to determine whether
a given character should be displayed as glyphless.
Daniel Nicolai [Thu, 27 Jan 2022 16:03:38 +0000 (17:03 +0100)]
Add support for EPUB, CBZ, FB2 and (O)XPS extension to doc view
* doc/emacs/misc.texi (Document View): Add requirements for new
extensions (i.e. mutool).
* lisp/doc-view.el (doc-view): Additionally update preliminary comment
(doc-view-custom-set-epub-font-size): redraw image after setting
(doc-view-unoconv-program): Put code all on one line
(doc-view-doc-type): Update docstring.
(doc-view-kill-proc): Fix comment indentation
(doc-view-mode-p):
Add check for new extensions and alternative check for PDF
(doc-view-pdf/ps->png): Associate new extension with png converter
(doc-view-convert-current-doc): Handle new extensions like PDF's
(doc-view-set-doc-type): Set correct doc-type for new extensions.
* lisp/files.el (auto-mode-alist):
Associate new extension types with doc-view.
Po Lu [Thu, 27 Jan 2022 13:36:52 +0000 (21:36 +0800)]
Improve xwidget window ancestry calculations
* src/xwidget.c (xw_find_common_ancestor):
(xw_notify_virtual_upwards_until)
(xw_notify_virtual_downwards_until): New functions.
(xw_maybe_synthesize_crossing): Synthesize virtual events like
GTK does for non-linear changes.