Previously, a weak-key hash table would consider its values reachable
until the key became unreachable; this loses in cases like
(puthash x x weak-hash-table)
where the desired behavior is to remove the entry as soon as 'x' can
no longer be reached from other data.
This change switches to a more complicated implementation that uses
extra dependencies (a kind of hidden plist associated with each
object) to record whether another object needs to be kept alive by
this object because it is, for example, a key in a weak-key hash table
which needs to keep its value alive.
Unfortunately, the old behavior is still required to implement the new
behavior correctly.
* src/fns.c (keep_entry_p): Adjust for the unlikely case that the new
weakness value makes it here.
(allocate_weak_hash_table_parts): Adjust by making both keys and
values weak in the usual case.
(weak_hash_put): Declare "static".
(hash_table_weakness_symbol): Adjust for the unlikely case that
Weak_Key_Strong_Value makes it here.
(Fputhash): Adjust for weak hash tables.
* src/igc.c (fix_weak_hash_table_strong_part):
(fix_weak_hash_table_weak_part):
(igc_make_weak_hash_table_strong_part):
(igc_make_weak_hash_table_weak_part): Adjust allocation and scanning
methods.
(igc_dump_finish_obj): Avoid putting an extended header into the dump.
(Figc__add_extra_dependency): Create internal hash table as
Weak_Key_Strong_Value.
(syms_of_igc): Make Vigc__dependency_replacements a
Weak_Key_Strong_Value table.
* test/src/fns-tests.el (ft--gc): Always run two GC cycles.
(ft-ephemeron-table):
(ft-weak-equal-table): Mark as expected successes.
Currently for MPS-internal use only, this weakness value indicates
that the keys are held weakly but values are held strongly even if
they only correspond to otherwise unreachable keys. This means that
using the same object as key and value in these hash tables will keep
the object alive indefinitely.
* src/lisp.h (hash_table_weakness_t): Add Weak_Key_Strong_Value.
(struct Lisp_Hash_Table): Expand weakness bitfield.
a24b081602 ; Fix last change
e33e9f7e85 Document 'margin' face as base for margin display strings...
cff9c8bc00 Improve prompting for mail sending by by 'report-emacs-bug'
# Conflicts:
# etc/NEWS
* etc/NEWS:
* doc/lispref/frames.texi (Font and Color Parameters):
* doc/lispref/display.texi (Displaying Faces, Basic Faces):
Improve indexing of faces and wording of the description of the
'margin' face and its implications.
* doc/lispref/display.texi (Displaying Faces): Note that the
underlying-text rule does not apply to strings displayed in the
display margins, and reword the margin-face bullet to describe
'margin' as the base.
(Basic Faces): Note that the 'margin' face also provides the base
attributes for strings displayed in the margins.
(Display Margins): Drop a sentence that restated the preceding one
about unspecified attributes inheriting from 'margin'.
* etc/NEWS: Document the change for margin strings.
Suggested by F. Jason Park <jp@neverwas.me>.
* lisp/calendar/time-date.el (format-seconds): Document that the arg
can be any time value, and need not be a number.
This has been true for some time, but has not been documented.
Avoid some (but not all) rounding errors internally, and add a
comment about the remaining rounding error.
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/org/org-timer.el (org-timer-show-remaining-time):
* lisp/org/ox.el (org-export--stack-generate):
* lisp/time.el (emacs-uptime): Omit unnecessary conversion of time
value that can increase rounding error.
* test/lisp/calendar/time-date-tests.el (test-format-seconds):
Test that format-seconds works on time values that are not numbers.
The two -respondsToSelector: guards in -[EmacsWindow
setParentChildRelationships] tested @selector(toggleFullScreen) without
the trailing colon, but the method is -toggleFullScreen:. The colon-less
selector matches nothing, so the guarded code was always skipped. This
is inert on modern builds (MAC_OS_X_VERSION_MIN_REQUIRED >= 1070, where
the check is #if'd out), but on a binary targeting pre-10.7 yet running
on 10.7+ it would wrongly skip taking a child frame out of native
fullscreen.
* src/nsterm.m ([EmacsWindow setParentChildRelationships]): Add the
missing colon to both @selector(toggleFullScreen:) checks.
On the NS port, -[EmacsWindow setParentChildRelationships] reattaches
every child frame to its parent via -addChildWindow:ordered:, which also
orders the child window onto the screen. This runs whenever the
parent/child relationships are rebuilt, e.g., when entering non-native
fullscreen, which allocates a fresh EmacsWindow whose initializer
rebuilds the relationships. A child frame that Emacs had made invisible
(e.g. a corfu/company completion popup) was thereby brought back as a
stale, non-responsive child frame. Emacs never repaints to clear it
because frame_redisplay_p trusts FRAME_VISIBLE_P on the NS port and
avoids dealing with the child frame when it is marked as invisible.
Native fullscreen does not trigger this: -toggleFullScreen: hands off to
AppKit without allocating a new window, so the rebuild never runs.
A hidden child frame is normally detached from its parent already: Emacs
hides it with -orderOut: (ns_make_frame_invisible), which per Apple's
documentation removes a child window from its parent before ordering it
out. The fix is therefore not to re-attach a child while it is
invisible; ns_make_frame_visible already reinstates the parent/child link
when the frame is shown again.
* src/nsterm.m ([EmacsWindow setParentChildRelationships]): Only
re-attach a child window when the frame is marked visible.
(ns_make_frame_visible): Explain, with a reference to Apple's
documentation, why the parent/child link must be reinstated on show.
Remove hard-coded state range, now a monotonically increasing
integer.
* lisp/subr.el (progress-reporter-update-functions): Update
docstring.
(progress-reporter-echo-area): Use
'progress-reporter--pulse-characters' length.
(progress-reporter-do-update): Increase 'state' by 1 each pass.
*
lisp/system-taskbar.el (system-taskbar--progress-reporter-update):
Make steps independent of 'progress-reporter-echo-area' steps.
* make-dist (info_files): Include "*.png" images, which are used
in the doc/lispintro/ directory, and should be in the tarball.
This makes sure eintr.info will not need to be rebuilt on the
end-users' systems when a release tarball is being built, due to
the fact that PNG files are copied from doc/lispintro/ and are
thus newer than eintr.info that came with the tarball. We don't
want to force rebuilding Info files when a release tarball is
built because users are not required to have Texinfo installed.
The new FOR_EACH_TAIL code detects simple cycles sooner than the old
code did, leading to integer overflows.
* src/fns.c (Fnthcdr): Avoid integer overflow if cycle is detected
early.
* src/lisp.h (struct for_each_tail_internal): Reduce to two words.
(FOR_EACH_TAIL_BASIC): Add compiler hint to indicate that tail is most
likely Qnil after the loop and a non-nil non-cons is unlikely.
(FOR_EACH_TAIL_STEP_CYCLEP): Rewrite.
* src/process.c (glib_installs_sigchld_handler): New variable.
(init_process_emacs): Set it when GLib overrides Emacs's SIGCHLD
handler.
* src/process.h (glib_installs_sigchld_handler): Declare.
* src/xwidget.c (Fmake_xwidget): Skip the "about:blank"
workaround when glib_installs_sigchld_handler is false.