Yuuki Harano [Sat, 28 Nov 2020 12:55:18 +0000 (21:55 +0900)]
Improve smooth scroll
* src/pgtkterm.c (scroll_event): Accumulate deltas and calculate
the number of lines.
(pgtk_term_init): Set smooth scroll parameters.
* src/pgtkterm.h (scroll): New members to store parameters.
Philipp Stephani [Fri, 27 Nov 2020 18:08:55 +0000 (19:08 +0100)]
Fix incorrect handling of module runtime and environment pointers.
We used to store module runtime and environment pointers in the static
lists Vmodule_runtimes and Vmodule_environments. However, this is
incorrect because these objects have to be kept per-thread. With this
naive approach, interleaving module function calls in separate threads
leads to environments being removed in the wrong order, which in turn
can cause local module values to be incorrectly garbage-collected.
The fix isn't completely trivial: specbinding the lists wouldn't work
either, because then the garbage collector wouldn't find the
environments in other threads than the current ones, again leading to
objects being garbage-collected incorrectly. While introducing custom
pseudovector types would fix this, it's simpler to put the runtime and
environment pointers into the specbinding list as new specbinding
kinds. This works since we need to unwind them anyway, and we only
ever treat the lists as a stack. The thread switching machinery
ensures that the specbinding lists are thread-local, and that all
elements of the specbinding lists in all threads are marked during
garbage collection.
Module assertions now have to walk the specbinding list for the
current thread, which is more correct since they now only find
environments for the current thread. As a result, we can now remove
the faulty Vmodule_runtimes and Vmodule_environments variables
entirely.
Also add a unit test that exemplifies the problem. It interleaves two
module calls in two threads so that the first call ends while the
second one is still active. Without this change, this test triggers
an assertion failure.
* src/lisp.h (enum specbind_tag): Add new tags for module runtimes and
environments.
* src/eval.c (record_unwind_protect_module): New function to record a
module object in the specpdl list.
(do_one_unbind): Unwind module objects.
(backtrace_eval_unrewind, default_toplevel_binding, lexbound_p)
(Fbacktrace__locals): Deal with new specbinding types.
(mark_specpdl): Mark module environments as needed.
* src/alloc.c (garbage_collect): Remove call to 'mark-modules'.
Garbage collection of module values is now handled as part of marking
the specpdl of each thread.
* src/emacs-module.c (Fmodule_load, funcall_module): Use specpdl to
record module runtimes and environments.
(module_assert_runtime, module_assert_env, value_to_lisp): Walk
through specpdl list instead of list variables.
(mark_module_environment): Rename from 'mark_modules'. Don't attempt
to walk though current thread's environments only, since that would
miss other threads.
(initialize_environment, finalize_environment): Don't change
Vmodule_environments variable; environments are now in the specpdl
list.
(finalize_environment_unwind, finalize_runtime_unwind): Make 'extern'
since do_one_unbind now calls them.
(finalize_runtime_unwind): Don't change Vmodule_runtimes variable;
runtimes are now in the specpdl list.
(syms_of_module): Remove Vmodule_runtimes and Vmodule_environments.
* test/data/emacs-module/mod-test.c (Fmod_test_funcall): New test
function.
(emacs_module_init): Bind it.
* test/src/emacs-module-tests.el (emacs-module-tests--variable): New
helper type to guard access to state in a thread-safe way.
(emacs-module-tests--wait-for-variable)
(emacs-module-tests--change-variable): New helper functions.
(emacs-module-tests/interleaved-threads): New unit test.
Make the 'cucumber' compilation pattern work without 'omake'
When 'omake' is included in compilation-error-regexp-alist, which it
still is by default, then all other rules are modified to match with
an extra leading 6 spaces as well. The 'cucumber' pattern relied on
this in order to work as intended.
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Extend the 'cucumber' pattern so that it works even when 'omake'
is not included. Move it below the 'gnu' rule so that it doesn't
match anything else.
Juri Linkov [Fri, 27 Nov 2020 09:17:12 +0000 (11:17 +0200)]
Add completion-tab-width to align prefix chars with names in read-char-by-name
* lisp/international/mule-cmds.el (mule--ucs-names-affixation):
Replace mule--ucs-names-annotation to display chars in prefixes
that implements two FIXME items.
(read-char-by-name): Let-bind completion-tab-width to 4.
Use affixation-function instead of annotation-function.
* lisp/minibuffer.el (completion-tab-width): New variable.
(completion--insert-strings): Align colwidth to tab positions
when completion-tab-width is non-nil.
* lisp/simple.el (completion-setup-function): Set tab-width to
completion-tab-width when completion-tab-width is non-nil.
* lisp/cus-edit.el (custom-variable-modified-p): Quote the value when
custom form is 'lisp (or 'mismatch) prior to comparing in order to
accommodate `custom-variable-value-create' (bug#44852).
* etc/tutorials/TUTORIAL: Don't keep referring to EDIT as if it were a
common name for the Meta key; since a few decades back it's labelled
Alt (or Option or ⌥ but those keys usually also have 'alt' engraved on
them). Similarly, CTL is practically extinct and not worth
mentioning.
Yuuki Harano [Thu, 26 Nov 2020 14:44:29 +0000 (23:44 +0900)]
Add support for hyper modifier key
* src/pgtkterm.c (x_find_modifier_meanings): Autodetect key mask.
(pgtk_gtk_to_emacs_modifiers): Use autodetected mask instead of GDK's.
(pgtk_emacs_to_gtk_modifiers): Use autodetected mask instead of GDK's.
(key_press_event): Ignore hyper as well as super.
* src/pgtkterm.h (struct pgtk_display_info): New member for hyper.
Fix replace-regexp-in-string substring match data translation
For certain patterns, re-matching the same regexp on the matched
substring does not produce correctly translated match data
(bug#15107 and bug#44861).
Using a new builtin function also improves performance since the
number of calls to string-match is halved.
Reported by Kevin Ryde and Shigeru Fukaya.
* lisp/subr.el (replace-regexp-in-string): Translate the match data
using match-data--translate instead of trusting a call to string-match
on the matched string to do the job.
* test/lisp/subr-tests.el (subr-replace-regexp-in-string):
Add test cases.
* src/search.c (Fmatch_data__translate): New internal function.
(syms_of_search): Register it as a subroutine.
Keep point in the *eldoc* buffer in eldoc-display-in-echo-area
* lisp/emacs-lisp/eldoc.el (eldoc-display-in-echo-area): Use
'save-excursion' to keep point position in *eldoc* buffer.
Suggested by Andrii Kolomoiets <andreyk.mad@gmail.com>.
Eric Abrahamsen [Wed, 25 Nov 2020 23:26:06 +0000 (15:26 -0800)]
Add "replied" -> "answered" for gnus-search imap searches
* lisp/gnus/gnus-search.el (gnus-search-imap-handle-flag): This allows
"mark:A" to be translated into "ANSWERED" and "-mark:A" to be
translated into "UNANSWERED".
Eric Abrahamsen [Sat, 14 Nov 2020 21:37:08 +0000 (13:37 -0800)]
Assume default imap TEXT search even when not using parsed queries
This behavior both better matches the previous nnir behavior, reducing
confusion for new users, and matches behavior when using parsed
queries.
* lisp/gnus/gnus-search.el (gnus-search-imap-search-keys): Make sure
this variable contains all known IMAP search keys.
(gnus-search-run-search): If the search query doesn't start with a
known search key, prepend "TEXT " to the query.
Michael Albinus [Wed, 25 Nov 2020 11:18:23 +0000 (12:18 +0100)]
Merge from origin/emacs-27
6442cdc0e4 Revert extra focus redirection in do_switch_frame (Bug#24803) fc4379f1ae Minor cleanup of tramp-tests.el on MS Windows dea3d6aa18 Fix handling of defcustom :local tag
Martin Rudalics [Wed, 25 Nov 2020 08:58:21 +0000 (09:58 +0100)]
Revert extra focus redirection in do_switch_frame (Bug#24803)
* src/frame.c (do_switch_frame): Do not also redirect frame
focus when FRAME has its minibuffer window on the selected
frame which was intended to fix Bug#24500. It may cause
Bug#24803 and lead to a nasty state where no active cursor is
shown on any frame, see
https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg01137.html.
* lisp/help-fns.el (help--symbol-completion-table-affixation): New function.
(help--symbol-completion-table): Set affixation-function when
completions-detailed is non-nil.
* lisp/minibuffer.el (completion-metadata): Add affixation-function
to docstring.
(completions-annotations): Inherit from shadow with italic.
(completions-detailed): New defcustom.
(completion--insert-strings): Count string-width on all strings in
completion list. Insert prefix and suffix.
(completion-extra-properties): Add affixation-function to docstring.
(minibuffer-completion-help): Call affixation-function.
(minibuffer-default-prompt-format): Move down closer to its use.
Stefan Kangas [Wed, 25 Nov 2020 02:03:48 +0000 (03:03 +0100)]
Make text-scale-mode optionally adjust the header line
* lisp/face-remap.el
(text-scale-remap-header-line-face): New buffer local variable.
(text-scale-mode): Adjust header line if above variable is non-nil.
(face-remap--clear-remappings, face-remap--remap-face): New defuns.
* lisp/face-remap.el: Arrange to watch text-scale-mode-remapping.
(text-scale--refresh): New function.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode): Use
text-scale-remap-header-line. (Bug#41852)
* doc/lispref/text.texi (Yank Commands): Soften the wording of
yank after another yank.
* lisp/delsel.el: Put 'yank' property on yank-pop and yank-from-kill-ring.
* lisp/isearch.el (isearch-yank-pop): Use with-isearch-suspended
and read-from-kill-ring to read a string from the kill-ring and
append it to the search string.
* lisp/simple.el (yank-pop): Call yank-from-kill-ring and
read-from-kill-ring when last-command is not 'yank' instead of
signaling an error. Remove "*" from interactive spec. Update docstring.
(read-from-kill-ring): New function.
(yank-from-kill-ring): New command.
For discussion, see the following emacs-devel thread:
https://lists.gnu.org/r/emacs-devel/2020-11/msg00734.html
* lisp/custom.el (custom-declare-variable): Delay call to
make-variable-buffer-local until after user option has been
initialized with a value. Otherwise the user option may be
initialized to nil.
* test/lisp/custom-tests.el (custom--test-local-option)
(custom--test-permanent-option): New :local user options.
(custom-test-local-option): New test for defcustom :local keyword.
Mauro Aranda [Tue, 24 Nov 2020 11:31:18 +0000 (08:31 -0300)]
Fix matching of inline choices for the choice widget
A choice widget should be able to match either no inline values or
inline values, upon request. (Bug#44579)
* lisp/wid-edit.el (choice): New property, :inline-bubbles-p. A
predicate that returns non-nil if the choice widget can act as an
inline widget. Document it.
(widget-choice-inline-bubbles-p): New function, for the
:inline-bubbles-p property of the choice widget.
(widget-inline-p): New function. Use the :inline-bubbles-p property
of the widget, if any.
(widget-match-inline): Use the above to see if the widget can act like
an inline widget. Document it.
(widget-choice-value-create): Account for the case of a choice widget
that has inline members.
(widget-checklist-add-item, widget-editable-list-value-create)
(widget-group-value-create): Use widget-inline-p rather than just
checking for a non-nil :inline property, allowing these functions to
pass the complete information to widgets like the choice widget to
create their values.
* test/lisp/wid-edit-tests.el (widget-test-choice-match-no-inline)
(widget-test-choice-match-all-inline)
widget-test-choice-match-some-inline): New tests, to check that choice
widgets can match its choices, inline or not.
(widget-test-inline-p): New test, for the new function
widget-inline-p.
(widget-test-repeat-can-handle-choice)
(widget-test-repeat-can-handle-inlinable-choice)
(widget-test-list-can-handle-choice)
(widget-test-list-can-handle-inlinable-choice)
(widget-test-option-can-handle-choice)
(widget-test-option-can-handle-inlinable-choice): New tests. This
grouping widgets need to be able to create a choice widget regardless
if it has inline choices or not.
Drew Adams [Tue, 24 Nov 2020 11:00:29 +0000 (08:00 -0300)]
Fix finding filelist for :tree fileset (Bug#976)
* lisp/filesets.el (filesets-files-under): New function, used to get
all files for a :tree fileset.
(filesets-get-filelist): Use it. Look for the directory and the
pattern in the right place inside entry.
Allow controlling whether SPC in Gnus goes to the next article
* doc/misc/gnus.texi (Summary Maneuvering): Document it.
* lisp/gnus/gnus-sum.el (gnus-paging-select-next): New variable.
(gnus-summary-prev-page, gnus-summary-next-page): Use it.
* lisp/server.el (server-start): Delete the server directory upon
Emacs exit (bug#44644). This fixes the problem of /tmp/emacs0
directories being left behind when running an Emacs server as root.
Tweak the face of unknown backend indicators in flymake
* lisp/progmodes/flymake.el (flymake--mode-line-format): Don't put
a face on the the "?" unknown backend indicator, because that
looks odd in inactive windows (bug#44689).
Paul W. Rankin [Tue, 24 Nov 2020 05:08:59 +0000 (06:08 +0100)]
Handle outline overlays better when cycling in outline.el
* lisp/outline.el (outline--cycle-state): Only consider outline
overlays that are on outline headings; when subtree end is
point-max, return overlay-end +1 because final subtree overlay
only reaches point-max -1 (bug#41198).
(outline-cycle-buffer): Check that buffer has top-level headings
before calling outline-hide-sublevels 1 thus preventing
disconcerting buffer state of content reduced to single "..."
Yuuki Harano [Wed, 18 Nov 2020 16:20:06 +0000 (01:20 +0900)]
Work around gtk_im_context_filter_keypress() issue with super key
* src/pgtkterm.c (x_find_modifier_meanings): Convert virtual super
to non-virtual one.
(pgtk_gtk_to_emacs_modifiers): Use non-virtual one.
(pgtk_emacs_to_gtk_modifiers): Use non-virtual one.
(key_press_event): Don't call pgtk_im_context_filter_keypress while
super is pressed.
* src/pgtkterm.h (struct pgtk_display_info): New member.
Yuuki Harano [Fri, 16 Oct 2020 18:47:03 +0000 (03:47 +0900)]
Don't use gtk_window_resize to resize offscreen window
* src/xwidget.c (Fmake_xwidget): Use gtk_container_check_resize instead.
(Fxwidget_resize): Use gtk_container_check_resize instead.
; Gtk+3 document says:
; > Applications should not use any API specific to GtkWindow
; > to operate on this object. It should be treated as a GtkBin
; > that has no parent widget.
Yuuki Harano [Mon, 5 Oct 2020 12:18:06 +0000 (21:18 +0900)]
Fix Gtk warnings
* src/gtkutil.c (xg_frame_set_char_size): Call appropriate function
(xg_set_undecorated): Do nothing if child frame.
(xg_set_no_focus_on_map): Do nothing if child frame.
(xg_set_no_accept_focus): Do nothing if child frame.
(xg_set_frame_icon): Do nothing if child frame.
(xg_get_file_name): Do nothing if child frame.
(xg_get_font):
* src/pgtkterm.c (pgtk_focus_frame): Do nothing if child frames.
(x_set_frame_alpha): Select correct widget.
(x_new_focus_frame): Focus only when non-child frames.
(pgtk_set_event_handler): Don't set for child frames.
* src/pgtkfns.c (xg_set_icon): Do nothing if child frames.
(xg_set_icon_from_xpm_data): Do nothing if child frames.
(pgtk_set_sticky): Do nothing if child frames.
(Fx_show_tip): Do nothing if child frames.
(Fpgtk_set_mouse_absolute_pixel_position): Select correct widget.
(Fpgtk_mouse_absolute_pixel_position): Select correct widget.
* src/pgtkmenu.c (pgtk_menu_show):
(pgtk_dialog_show):
* src/pgtkterm.c: New variable to indicate whether any event occurs.
(configure_event): Clear help string on a event.
(leave_notify_event): Clear help string on a event.
(motion_notify_event): Use gen_help_event.
(pgtk_set_event_handler): Hook configure-event for outer widgets.
(pgtk_term_init): Clear the flag.
* src/emacsgtkfixed.c (G_DEFINE_TYPE): Make emacs_fixed_get_type public.
* src/emacsgtkfixed.h (EMACS_TYPE_FIXED): Make emacs_fixed_get_type public.
* src/gtkutil.c (xg_frame_set_char_size): Call appropriate functions
by whether the frame is a child frame or not.
(xg_create_frame_widgets): Use GTK_WINDOW_TOPLEVEL when creating child frame.
(xg_create_frame_outer_widgets): New function.
(xg_set_skip_taskbar): Call only when top-level frame.
(xg_set_no_accept_focus): See appropriate widget.
* src/gtkutil.h: New declaration.
* src/pgtkfns.c (pgtk_set_name_internal): Do only when top-level frame.
(Fx_create_frame): Reparent the frame.
(frame_geometry): Call appropriate functions
(syms_of_pgtkfns): Port from X code.
* src/pgtkterm.c (x_free_frame_resources): Destroy appropriate widget.
(x_calc_absolute_position): Port from X code.
(x_set_offset): Re-port from X code.
(pgtk_set_window_size): Use appropriate widget.
(pgtk_make_frame_visible): Use appropriate widget.
(pgtk_make_frame_invisible): Use appropriate widget.
(x_set_parent_frame): Reparent the frame.
(x_set_z_group): Process only when top-level frame.
(pgtk_text_icon): Process only when top-level frame.
(set_fullscreen_state): Process only when top-level frame.
(frame_highlight): Hold ref.
(frame_unhighlight): Hold ref.
(pgtk_window_is_of_frame_recursive): Prune child frames.
(pgtk_window_is_of_frame): Prune child frames.
(print_widget_tree_recursive): Don't call this when not debugging.
(pgtk_handle_draw): Don't call this when not debugging.
(pgtk_set_event_handler): expect map-event for edit_widget not outer widget.
* src/pgtkterm.h (FRAME_WIDGET): New macro.
Jeff Walsh [Thu, 27 Aug 2020 12:05:15 +0000 (22:05 +1000)]
Add support for x-support-frames
* src/pgtkfns.c (Fx_export_frames):
(syms_of_pgtkfns): port from X11 version
* src/pgtkterm.c (pgtk_cr_accumulate_data):
(pgtk_cr_destroy):
(pgtk_cr_export_frames): port from X11
* src/pgtkterm.h: add defs
Yuuki Harano [Fri, 14 Aug 2020 16:13:52 +0000 (01:13 +0900)]
Self-implement tooltip
* src/gtkutil.c (xg_create_frame_widgets): Use popup for tooltip.
* src/pgtkfns.c (unwind_create_tip_frame): Port X code.
(x_create_tip_frame): Re-port X code.
(x_hide_tip): Re-port X code.
(Fx_show_tip): Re-port X code.
(frame_geometry): Get left_pos and top_pos here.
(syms_of_pgtkfns): Add variables for tooltip.
* src/pgtkterm.c (pgtk_set_event_handler): Set event handler for tooltip.
Jeff Walsh [Thu, 25 Jun 2020 06:17:37 +0000 (16:17 +1000)]
Fix migrating Child frames
* src/pgtkterm.c:
(x_calc_absolute_position): Remove Function that has no effect
(x_set_offset): titlebar off should not be stored as an offset, only
used to calculate final move locations