Po Lu [Mon, 11 Mar 2024 13:40:47 +0000 (21:40 +0800)]
Implement notification callbacks on Android
* doc/lispref/os.texi (Desktop Notifications): Document that
:on-cancel, :on-action and :actions are now supported on
Android.
* java/org/gnu/emacs/EmacsActivity.java (onNewIntent): New
function.
* java/org/gnu/emacs/EmacsDesktopNotification.java
(NOTIFICATION_ACTION, NOTIFICATION_TAG, NOTIFICATION_DISMISSED):
New constants. <actions, titles>: New fields.
(insertActions): New function.
(display1, display): Insert actions on Jelly Bean and up, and
arrange to be notified when the notification is dismissed.
(CancellationReceiver): New class.
* java/org/gnu/emacs/EmacsNative.java (sendNotificationDeleted)
(sendNotificationAction): New functions.
* src/androidgui.h (struct android_notification_event): New
structure.
(union android_event): New member for notification events.
* src/androidselect.c (android_init_emacs_desktop_notification):
Update JNI signatures.
(android_notifications_notify_1, Fandroid_notifications_notify):
New arguments ACTIONS, ACTION_CB and CANCEL_CB. Convert and
record them as appropriate.
(android_notification_deleted, android_notification_action): New
functions.
(syms_of_androidselect): Prepare a hash table of outstanding
notifications.
<QCactions, QCon_action, QCon_cancel> New defsyms.
* src/androidterm.c (handle_one_android_event)
<ANDROID_NOTIFICATION_DELETED>
<ANDROID_NOTIFICATION_ACTION>: Dispatch event contents to
androidselect.c for processing.
* src/androidterm.h:
* src/androidvfs.c (java_string_class): Export.
* src/keyboard.c (kbd_buffer_get_event) <NOTIFICATION_EVENT>:
Call callback specified by the event.
* src/termhooks.h (enum event_kind) [HAVE_ANDROID]: New
enum NOTIFICATION_EVENT.
Remove trailing period as per "(elisp) Error Symbols".
Relates to the following discussion:
https://lists.gnu.org/r/emacs-devel/2023-10/msg00473.html
https://lists.gnu.org/r/emacs-devel/2024-03/msg00340.html
Paul Eggert [Mon, 11 Mar 2024 07:03:39 +0000 (00:03 -0700)]
Change bare-symbol back to match intent
Also, attempt to document the intent better.
Problem reported by Alan Mackenzie (Bug#69684).
* src/data.c (Fbare_symbol): Do not signal if the SYM is a symbol
with position and symbols-with-pos-enabled is nil. Instead,
ignore symbols-with-pos-enabled, as that was the intent.
* test/src/data-tests.el (data-tests-bare-symbol):
New test, to help prevent this bug from reoccurring.
Improve pp-emacs-lisp-code backquote form printing
* lisp/emacs-lisp/pp.el (pp--quoted-or-unquoted-form-p): New helper
function.
(pp--insert-lisp): Take care of quoted, backquoted and
unquoted expressions; print using an recursive call.
(pp--format-list): Exclude more cases from printing as a function call
by default. Print lists whose second-last element is an (un)quoting
symbol using dotted list syntax; e.g. (a b . ,c) instead of (a b \, c).
Jim Porter [Fri, 8 Mar 2024 05:55:45 +0000 (21:55 -0800)]
Let 'browse-url-interactive-arg' return more values for NEW-WINDOW-FLAG
Previously it always returned t or nil for NEW-WINDOW-FLAG, but now it
can return the actual prefix arg when appropriate. This lets functions
for 'browse-url-browser-function' consult it and do more things than
just open a new window or not (for example, you could use "C--" as the
prefix arg to do something special in a custom function).
* lisp/net/browse-url.el (browse-url-interactive-arg): Use 'xor' to
adjust the value of 'current-prefix-arg'.
(browse-url): Update docstring.
Stefan Monnier [Sun, 10 Mar 2024 19:12:00 +0000 (15:12 -0400)]
syncdoc-type-hierarchy.el: Sort and remove `comp` dependency
* admin/syncdoc-type-hierarchy.el: Delay loading `org-table` so as
not to "pollute" the table with Org-specific types.
(syncdoc-all-types): Sort the types topologically from the root.
(syncdoc-hierarchy): Use `cl--class-parents` instead if
`comp--direct-supertypes` so we don't depend on `comp-cstr`.
(syncdoc-make-type-table): Sort the table so supertypes always come before
their subtypes.
(syncdoc-make-type-table): Require `org-table` here.
Tim Ruffing [Sat, 9 Mar 2024 11:29:39 +0000 (12:29 +0100)]
* lisp/calc/calc-prog.el: Switch to new method of detecting end of kbd macro
'read-char' will no longer return -1 as of ac82baea1c41ec974ad49f2861ae6c06bda2b4ed. This switches to a cleaner
method of detecting whether the end of a keyboard macro has been
reached.
* lisp/calc/calc-prog.el (calc--at-end-of-kmacro-p): New function.
(calc-kbd-skip-to-else-if): Use the function.
Tim Ruffing [Wed, 27 Dec 2023 13:32:09 +0000 (14:32 +0100)]
Remove workarounds for solved 'read-event' bug
* lisp/subr.el (read-char-choice-with-read-key):
* lisp/net/dbus.el (dbus-call-method):
Remove workarounds for the bug fixed in the previous commit ac82baea1c41ec974ad49f2861ae6c06bda2b4ed, where 'read-event',
'read-char' and 'read-char-exclusively' could return wrongly -1.
In the case of lisp/dbus.el, this reverts commit 7177393826c73c87ffe9b428f0e5edae244d7a98.
Tim Ruffing [Wed, 27 Dec 2023 13:32:09 +0000 (14:32 +0100)]
Continue reading in 'read-event' etc. at the end of a keyboard macro
This fixes a bug that could make 'read-event', 'read-char', and
'read-char-exclusive' erroneously return -1, an internal magic return
value of 'read_char' leaked from C to lisp. Instead of returning -1, the
aforementioned lisp functions now transparently continue reading
available input (e.g., from the keyboard) when reaching the end of a
keyboard macro.
* src/keyboard.c (read_char, read_key_sequence): Move handling
of the end of a keyboard macro from 'read_char' to its caller
'read_key_sequence', which is the only caller that can
meaningfully deal with this case.
* src/macros.c (Fexecute_kbd_macro): Document how the end of keyboard
macro is processed.
* etc/NEWS: Announce this change.
Tim Ruffing [Wed, 27 Dec 2023 13:29:34 +0000 (14:29 +0100)]
* src/keyboard.c (requeued_events_pending_p): New function
* src/keyboard.c, src/keyboard.h (requeued_events_pending_p): Add
function 'requeued_events_pending_p' (whose name was made available in
the previous commit). As opposed to the previous function with the same
name, the new function covers both command and other events.
* src/keyboard.c (Finput_pending_p): Use the new function.
Tim Ruffing [Wed, 27 Dec 2023 13:29:34 +0000 (14:29 +0100)]
* src/keyboard.c (requeued_events_pending_p): Improve name and fix comment
* src/keyboard.c, src/keyboard.h (requeued_events_pending_p): Rename to
'requeued_command_events_pending_p' to clarify that the function covers
only command events. Fix wrong comment that claimed that the function
was unused.
* src/process.c (wait_reading_process_output): Update caller to use the
new name.
F. Jason Park [Sun, 10 Mar 2024 13:08:30 +0000 (06:08 -0700)]
Fix faulty decoded-time adjustment in erc-stamp
* lisp/erc/erc-stamp.el (erc-stamp--lr-date-on-pre-modify): Remove
disruptive assertion for now.
(erc-stamp--time-as-day): Attempt to fix date being rewound by a whole
day when daylight saving time is in effect. Do this by forcing the
`dst' slot of the `decoded-time' object to -1 and the `zone' to nil.
F. Moukayed [Fri, 8 Mar 2024 08:39:03 +0000 (08:39 +0000)]
Redefine erc-spoiler-face to indicate revealed text
* lisp/erc/erc-goodies.el (erc-spoiler-face): Redefine role and redo
definition to inherit from `erc-control-default-face'.
(erc-controls-propertize): Include `cursor-face' in the applied hover
properties for spoiler text, and ensure they aren't clobbered by other
built-in modules, like `button'.
(Bug#69597)
F. Jason Park [Fri, 8 Mar 2024 05:53:23 +0000 (21:53 -0800)]
Make important text props more resilient in ERC
* lisp/erc/erc-button.el (erc-button-remove-old-buttons): Restore
original `mouse-face' values in areas marked as important after
clobbering.
* lisp/erc/erc.el (erc--reserve-important-text-props): New function.
(erc--restore-important-text-props): New function.
* test/lisp/erc/erc-tests.el (erc--restore-important-text-props): New
test.
(Bug#69597)
F. Jason Park [Fri, 8 Mar 2024 05:53:11 +0000 (21:53 -0800)]
Leverage inverse-video for erc-inverse-face
* lisp/erc/erc-goodies.el (erc-inverse-face): Specify face attribute
`:inverse-video' (née :reverse-video) to swap foreground and
background colors over affected intervals, as per
https://modern.ircdocs.horse/formatting#reverse-color.
(erc-control-default-fg erc-control-default-bg): New faces for IRC
color-code number 99. Ignore the ERC convention of prefixing
control-code-derived faces with "fg:" and "bg:" because it doesn't
comport with modern sensibilities, which demand identifiers normally
be namespaced.
(erc-get-bg-color-face, erc-get-fg-color-face): Return new, dedicated
faces instead of `default', and don't nest them in a list.
* test/lisp/erc/erc-goodies-tests.el
(erc-controls-highlight--inverse): Redo completely, asserting behavior
described in the spec linked to above.
(erc-controls-highlight--spoilers): New test based on the body of the
old `erc-controls-highlight--inverse', except without shadowing
`erc-insert-modify-hook' with an unrealistic, idealized value. Adjust
expected buffer state to reflect the new role of
`erc-spoiler-face'. (Bug#69597)
* lisp/progmodes/gud.el (gud-tooltip-activate-mouse-motions-if-enabled):
Take into account the modes hierarchy.
(gud-tooltip-modes): Don't bother listing TS alternatives.
Stefan Monnier [Fri, 8 Mar 2024 17:58:11 +0000 (12:58 -0500)]
Add non-TS modes as extra parent of TS modes (bug#68246)
Record the fact that TS modes are alternatives to the non-TS
modes using the new `derived-mode-add-parents` functionality.
Do the same for long standing similar issues with CPerl-mode.
Po Lu [Sat, 9 Mar 2024 08:12:40 +0000 (16:12 +0800)]
Enable stack overflow recovery on Android
* src/sysdep.c (handle_sigsegv): Return after restoring the
original signal handler, which should proceed to call debuggerd
to generate a tombstone.
(init_sigsegv): Save the original signal handler on Android, to
be restored after a signal is received.
(init_signals): Call init_sigsegv on Android.
Eli Zaretskii [Sat, 9 Mar 2024 08:09:36 +0000 (10:09 +0200)]
Fix case-sensitivity in 'complete-tag'
* lisp/progmodes/etags.el (complete-tag): Bind
'completion-ignore-case', so that 'completion-in-region' is
affected by it. This fixes a bug made in 30 Apr 2010, when this
function was refactored to use
'tags-completion-at-point-function'. Reported by Morgan Willcock
<morgan@ice9.digital>.
Stefan Monnier [Fri, 8 Mar 2024 16:24:18 +0000 (11:24 -0500)]
EIEIO: Fix regession (bug#69631)
Not sure why earlier tests did not catch it, but there are more
places where we bump into problems because `eieio--class-precedence-list`
now returns also non-EIEIO classes.
Stefan Monnier [Fri, 8 Mar 2024 15:47:01 +0000 (10:47 -0500)]
eieio-core.el: Try and fix bug#69631
* lisp/emacs-lisp/eieio-core.el (eieio--class-precedence-c3)
(eieio--class-precedence-dfs, eieio--class-precedence-bfs): Use
`cl--class-parents` since some of the parents aren't EIEIO classes.
Stefan Monnier [Fri, 8 Mar 2024 06:48:59 +0000 (01:48 -0500)]
Simplify type hierarchy operations
Now that built-in types have classes that describe their
relationships exactly like struct/eieio/oclosure classes,
we can the code that navigates that DAG.
* lisp/emacs-lisp/cl-generic.el (cl--generic-struct-tag): Move to
`eieio-core.el`.
(cl--generic-type-specializers): Rename from
`cl--generic-struct-specializers`. Make it work for any class.
(cl--generic-typeof-generalizer, cl--generic-oclosure-generalizer): Use it.
(cl--generic-struct-generalizer): Delete generalizer.
(cl-generic-generalizers :extra "cl-struct"): Delete method.
(prefill 0 cl--generic-generalizer): Move to after the typeof.
(cl-generic-generalizers :extra "typeof"): Rewrite to use
classes rather than `cl--all-builtin-types`.
(cl-generic--oclosure-specializers): Delete function.
* lisp/emacs-lisp/comp-cstr.el (comp--typeof-builtin-types):
Delete constant.
(comp--cl-class-hierarchy): Simplify.
(comp--compute-typeof-types): Simplify now that
`comp--cl-class-hierarchy` and `comp--all-classes` work for built-in
types as well.
(comp--direct-supertypes): Just use `cl--class-parents`.
(comp-supertypes): Simplify since typeof-types should now be complete.
* lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload):
Use `superclasses` argument, so we can find parents before it's loaded.
(eieio--class-precedence-c3, eieio--class-precedence-dfs):
Don't add a `eieio-default-superclass` parent any more.
(eieio--class/struct-parents): Delete function.
(eieio--class-precedence-bfs): Use `eieio--class-parents` instead.
Don't stop when reaching `eieio-default-superclass`.
(cl--generic-struct-tag): Move from `cl-generic.el`.
Stefan Monnier [Thu, 7 Mar 2024 22:45:41 +0000 (17:45 -0500)]
eieio-core.el: Always put a parent in the parents of a class
* lisp/emacs-lisp/eieio-core.el (eieio-defclass-internal):
Always put a parent in the `parents` slot of the class.
* lisp/emacs-lisp/eieio.el (eieio-class-parents): Remove the
`eieio-default-superclass` if it's the only parent.
(child-of-class-p): Handle all classes in the parents.
(eieio-default-superclass): Adjust docstring.
Stefan Monnier [Thu, 7 Mar 2024 21:58:15 +0000 (16:58 -0500)]
Make "parentless" structs inherit from their builtin type
* lisp/emacs-lisp/cl-preloaded.el (cl--struct-register-child):
Register child only in struct parents.
(cl-struct-define): Put the "type" as parent of parentless :type structs.
Copy slots only from struct parent classes.
(cl-structure-object): Set (manually) its parent to `record`
and remove assertion that it has no parents.
Stefan Monnier [Wed, 6 Mar 2024 21:32:35 +0000 (16:32 -0500)]
cl-preloaded.el (built-in-class): New type
Add classes describing the built-in types.
* lisp/emacs-lisp/cl-preloaded.el (built-in-class): New type.
(cl--define-built-in-type): New aux macro.
(all built-in types): "Define" them with it.
(cl--builtin-type-p): New aux function.
(cl--struct-name-p): Use it.
(cl--direct-supertypes-of-type, cl--typeof-types, cl--all-builtin-types):
Move the definitions to after the built-in classes are defined,
and rewrite to make use of those classes.
* lisp/emacs-lisp/cl-extra.el (cl-describe-type):
Accept two (unused) optional args, for use with `describe-symbol-backends`.
(describe-symbol-backends): Simplify accordingly and
add ourselves at the end.
(cl--class-children): New function.
(cl--describe-class): Use it. Also don't show a silly empty list of slots
for the built-in types.
Stefan Monnier [Thu, 7 Mar 2024 21:56:42 +0000 (16:56 -0500)]
comp-cstr.el: Fix a minor error and prepare for upcoming changes
* lisp/emacs-lisp/comp-cstr.el (comp--cl-class-hierarchy): Add `atom`
and `t` only to those types whose "allparents" is clearly not complete.
(comp--compute--pred-type-h): Store the cstr rather than the type
in the hash-table, as expected by `comp--pred-to-cstr`.
Po Lu [Fri, 8 Mar 2024 02:58:17 +0000 (10:58 +0800)]
Declare 124 new Android permissions
* doc/emacs/android.texi (Android Environment): Document new
permissions and delete recently introduced permissions from the
list for Android 5.1 and earlier.
* java/AndroidManifest.xml.in: Declare 124 new permissions to
enable invoking features they protect from code running inside
Emacs.
Jim Porter [Wed, 6 Mar 2024 21:27:07 +0000 (13:27 -0800)]
Support expanding Eshell globs for remote file names
* lisp/eshell/em-glob.el (eshell-glob-chars-regexp): New function...
(eshell-glob-regexp): ... use it.
(eshell-glob-p): New function...
(eshell-glob-convert): ... use it, and return the deepest start
directory possible.
* lisp/eshell/esh-util.el (eshell-split-path): Rename to...
(eshell-split-path): ... this, and account for remote file names.
* test/lisp/eshell/em-glob-tests.el
(em-glob-test/convert/current-start-directory)
(em-glob-test/convert/relative-start-directory)
(em-glob-test/convert/absolute-start-directory)
(em-glob-test/convert/remote-start-directory): New tests (bug#69592).
Single string literal in body is return value only, not doc string
A function or macro body consisting of a single string literal now only
uses it as a return value. Previously, it had the dual uses as return
value and doc string, which was never what the programmer wanted and
had some inconvenient consequences (bug#69387).
This change applies to `lambda`, `defun`, `defsubst` and `defmacro`
forms; most other defining forms already worked in the sensible way.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda):
Don't use a lone string literal as doc string.
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defun.el
(foo): Update docstring warning test.
* doc/lispref/functions.texi (Function Documentation): Update.
* etc/NEWS: Announce.
Eli Zaretskii [Thu, 7 Mar 2024 08:11:44 +0000 (10:11 +0200)]
; Improve documentation of image properties
* lisp/image.el (create-image, image-property): Add to do strings
link to description of image properties in ELisp manual.
* doc/lispref/display.texi (Defining Images): Fix example and add
cross-reference to where image properties are described.
(Image Descriptors): Add index entry.
Jim Porter [Sun, 18 Feb 2024 04:49:15 +0000 (20:49 -0800)]
When navigating through history in EWW, don't keep adding to 'eww-history'
This resolves an issue where navigating back and then forward kept
adding new history entries so you could never hit the "end" (bug#69232).
* lisp/net/eww.el (eww-before-browse-history-function): New option.
(eww-history-position): Add docstring.
(eww-mode-map, eww-context-menu): Use correct predicates for when to
enable back/forward.
(eww-save-history): Save history entry in its original place when
viewing a historical page.
(eww--before-browse): New function...
(eww, eww-follow-link, eww-readable): ... call it.
(eww-render): Don't set 'eww-history-position' here...
(eww--before-browse): ... instead, set it here.
(eww-back-url): Set 'eww-history-position' based on the result of
'eww-save-history'.
(eww-forward-url): Set 'eww-history-position' directly, since
'eww-save-history' no longer adds a new entry in this case.
(eww-delete-future-history, eww-clone-previous-history): New functions.
* lisp/net/tramp-androidsu.el (tramp-default-host-alist):
Don't add an entry; `tramp-default-host' is set properly.
(tramp-androidsu-maybe-open-connection): Don't set connection
property "remote-namespace" to nil, this is the default anyway.
Don't set connection property "remote-path", we use
connection-local values instead. Unset environment variable PS2.
Dump shell options after setting all of them.
(tramp-androidsu-handle-make-process): Don't use hard-coded user "root".
(tramp-androidsu-connection-local-default-variables): New defvar.
Add it to connection-local profiles.
Andrea Corallo [Wed, 6 Mar 2024 14:41:37 +0000 (15:41 +0100)]
* Update syncdoc to dump all preloaded type hierarchy
* admin/syncdoc-type-hierarchy.el (syncdoc-file)
(syncdoc-emacs-repo-dir): New constants.
(syncdoc-lispref-dir): Make use of.
(syncdoc-all-types): New function.
(comp--direct-supertypes): Declare.
(syncdoc-hierarchy): Update.
(syncdoc-update-type-hierarchy0): Rename from
'syncdoc-update-type-hierarchy' and make non interactive.
(syncdoc-update-type-hierarchy): New function.
Po Lu [Wed, 6 Mar 2024 02:48:28 +0000 (10:48 +0800)]
Don't report files from read-only adb partitions as writable
* lisp/net/tramp-adb.el (tramp-adb-handle-file-writable-p):
Ignore the file-attributes cache, since file mode is not a
reliable indicator of writability.
Juri Linkov [Tue, 5 Mar 2024 16:50:51 +0000 (18:50 +0200)]
New property 'context-menu-functions' (bug#62250)
* lisp/iimage.el (iimage-mode-buffer): Set context-menu-functions
text property to '(image-context-menu)'.
* lisp/image.el (image-context-menu): New function.
(put-image): Set context-menu-functions overlay property
to '(image-context-menu)'.
(insert-image, insert-sliced-image): Set context-menu-functions
text property to '(image-context-menu)'.
* lisp/mouse.el (context-menu-map): Use mouse-posn-property
'context-menu-functions' and call its funs at the end.
Juri Linkov [Tue, 5 Mar 2024 16:42:49 +0000 (18:42 +0200)]
* lisp/net/dictionary.el: More fixes for dictionary-new-matching (bug#69312)
(dictionary-new-matching): Change the order of standard calls
to be the same as in 'dictionary-new-search'.
Use new function 'dictionary-new-matching-internal'.
(dictionary-new-matching-internal): New function based on
'dictionary-new-search-internal'.
Stefan Monnier [Tue, 5 Mar 2024 04:12:29 +0000 (23:12 -0500)]
cl-preloaded.el: Further fine-tuning
* lisp/emacs-lisp/cl-preloaded.el (cl--direct-supertypes-of-type):
Fix some left over issues:
- Remove redundant `number-or-marker` from `marker`s parents.
- Add `function` to the types, since it was missing.
(cl--typeof-types): Add a warning for missing type info.
* admin/syncdoc-type-hierarchy.el (syncdoc-hierarchy): Fix parent of
`oclosure`.
Po Lu [Tue, 5 Mar 2024 03:23:27 +0000 (11:23 +0800)]
Rearrange Android splash screen messages
* lisp/startup.el (fancy-startup-tail, fancy-startup-screen)
(normal-splash-screen): Adjust for function renaming; move the
storage permissions notice to the top of the splash screen.
* lisp/term/android-win.el (android-after-splash-screen): Rename
from android-before-splash-screen and adjust layout lightly.
* src/android.c (android_wc_lookup_string): Terminate character
composition after a character is returned, whether it contain a
Unicode character or not.
Stefan Monnier [Mon, 4 Mar 2024 18:24:34 +0000 (13:24 -0500)]
syncdoc-type-hierarchy.el: Adjust to changes in `cl-preloaded.el`
* admin/syncdoc-type-hierarchy.el (syncdoc-lispref-dir):
Use `macroexp-file-name`.
(syncdoc-hierarchy): New var.
(syncdoc-insert-dot-content, syncdoc-make-type-table): Use it.
(syncdoc-update-type-hierarchy): Don't crash if `dot` is absent.
Michael Albinus [Mon, 4 Mar 2024 14:44:24 +0000 (15:44 +0100)]
tramp-androidsu.el code cleanup
* lisp/net/tramp-androidsu.el (tramp-androidsu-generate-wrapper):
Prefer #' notation for function names.
(tramp-androidsu-handle-copy-file)
(tramp-androidsu-handle-file-local-copy)
(tramp-androidsu-handle-make-symbolic-link)
(tramp-androidsu-handle-rename-file)
(tramp-androidsu-handle-write-region): Don't use a wrapper.
(tramp-adb-connection-local-default-ps-profile): Don't initialize,
this happens in tramp-db.el.
While it did simplify code, there aren't much in the way of technical
benefits the change at this time, and there were protest against the
unwarranted style change.
Martin Rudalics [Mon, 4 Mar 2024 09:33:49 +0000 (10:33 +0100)]
Fix 'set-window-configuration' and 'window-state-put'
Fix some bugs with 'window-state-put' (Bug#69093). Add new
hook 'window-kept-windows-functions' (Bug#68235).
* doc/lispref/windows.texi (Window Configurations): Mention
'window-kept-windows-functions'.
(Window Hooks): Describe new abnormal hook
'window-kept-windows-functions'.
* src/marker.c (Fmarker_last_position): New function to return
the last position of a marker even if its buffer is now dead.
* src/window.c (Fset_window_configuration): If
'window-kept-windows-functions' is non-nil, do not delete any
window whose buffer is now dead but remember all such windows in
a list to pass to 'window-kept-windows-functions'. Run
'window-kept-windows-functions' if it is non-nil.
(Vwindow_kept_windows_functions): New abnormal hook run by
Fset_window_configuration and 'window-state-put' with two
arguments - the frame whose configuration is restored and a list
of entries for each window whose buffer was found dead during
restoration. Each entry is a list of four elements, the window,
the dead buffer, and the last know positions of the start and
point of that window.
* lisp/window.el (window-state-put-kept-windows)
(window-state-put-selected-window): New variables.
(window--state-put-2): Make sure buffer is live before restoring
its state. Set 'window-state-put-selected-window' to state's
selected window. If 'window-kept-windows-functions' is non-nil,
do not delete any windows whose buffer is found dead but
remember all such windows in a list to pass to
'window-kept-windows-functions'.
(window-state-put): Run 'window-kept-windows-functions' if it is
non-nil. Select window recorded in
'window-state-put-selected-window'.
Stefan Monnier [Mon, 4 Mar 2024 04:08:16 +0000 (23:08 -0500)]
(major-mode-remap(-defaults)): New var and function (bug#69191)
While `major-mode-remap-alist` provides a way for users to indicate the
major mode of their choice, we need a similar variable for the
use of packages.
This patch adds a new `major-mode-remap-defaults` and changes various
packages to obey it or make use of it.
I think it nicely cleans the regexp duplication between CC-mode and
`c-ts-mode.el` and also makes it easier/cleaner for users to override
the changes made by `*-ts-mode.el`.
* lisp/files.el (major-mode-remap-defaults): New variable.
(major-mode-remap): New function.
(set-auto-mode-0): Use it.
* doc/lispref/modes.texi (Auto Major Mode): Document them.
* lisp/textmodes/tex-mode.el (tex--redirect-to-submode):
Use `major-mode-remap`.
(major-mode-remap-defaults): Set it to remap AUCTeX modes by default.
* lisp/progmodes/ruby-ts-mode.el (auto-mode-alist): Leave it alone.
(major-mode-remap-defaults): Set this one instead.
* lisp/progmodes/c-ts-mode.el (c-or-c++-ts-mode): Use `major-mode-remap`.
(auto-mode-alist): Leave it alone.
(major-mode-remap-defaults): Set this one instead.
* lisp/org/ox.el (org-export-to-buffer): Modernize docstring accordingly.
* lisp/progmodes/cc-mode.el (c-or-c++-mode):
* lisp/org/ox-latex.el (org-latex-export-as-latex):
* lisp/org/ox-koma-letter.el (org-koma-letter-export-as-latex):
* lisp/org/ox-beamer.el (org-beamer-export-as-latex):
Use `major-mode-remap` when available.
Stefan Monnier [Sun, 3 Mar 2024 23:08:50 +0000 (18:08 -0500)]
(cl--typeof-types): Rework to fix some regressions
Initialize the variables directly in their declaration, so
there no time where they exist but aren't yet initialized.
This also allows us to mark `cl--typeof-types` as a `defconst` again.
More importantly, specify the DAG by direct supertypes rather
than direct subtypes. This is slightly less compact, but it's
necessary to let us specify the *order* of the supertypes,
which is necessary for example to preserve the desired ordering
of methods when several methods can be applied.
Fix a few more regressions, such as removing `atom` from the parents
of `function` since some lists are considered as functions,
adding `number-or-marker` as supertype of `integer-or-marker`,
and re-adding `native-comp-unit`.
I carefully compared all elements of `cl--typeof-types` to make
sure they are the same as before (with one exception for `null`).
* lisp/emacs-lisp/cl-preloaded.el (cl--type-hierarchy): Delete var.
(cl--direct-supertypes-of-type, cl--typeof-types):
Initialize directly in the declaration.
(cl--supertypes-lane, cl--supertypes-lanes-res): Delete vars.
(cl--supertypes-for-typeof-types-rec)
(cl--supertypes-for-typeof-types): Delete functions.
Stefan Monnier [Sat, 2 Mar 2024 19:48:29 +0000 (14:48 -0500)]
ox-texinfo:: Require only TEXINFO_DIR_CATEGORY
Until now @dircategory/@direntry entries were added only if
both TEXINFO_DIR_CATEGORY and TEXINFO_DIR_TITLE were set.
And the setting of TEXINFO_DIR_TITLE had to be careful to
provide exactly the right syntax.
This patch changes various things in this regard:
- Only require TEXINFO_DIR_CATEGORY in order to generate
`@dircategory` and `@direntry`.
- Use the document title by default if TEXINFO_DIR_DESC is missing.
- Use the filename by default when TEXINFO_DIR_TITLE is missing.
- Try and make it harder to provide a direntry that does not
have the right format or refers to a different filename than
the one we're outputting to.
* lisp/org/ox-texinfo.el: Remove redundant `:group` arguments.
Prefer #' to quote function names.
(org-texinfo-template): Use sane defaults for `@direntry`.
* doc/misc/org.org (Texinfo specific export settings): Adjust accordingly.
This is necessary to prepare the dictionary buffer for further processing
that also includes setting buffer-read-only to nil to be able to insert text.
(bug#69312)
Juri Linkov [Sat, 2 Mar 2024 17:31:07 +0000 (19:31 +0200)]
* lisp/net/dictionary.el: Better handling of messages and errors.
(dictionary-do-search, dictionary-do-matching): Insert formatted
messages to the top of the output buffer instead of displaying
transient messages in the echo area (bug#69312).
(dictionary-do-matching, dictionary-lookup-definition)
(dictionary-popup-matching-words): Use 'user-error'
instead of 'error' for non-technical errors.
Juri Linkov [Sat, 2 Mar 2024 17:22:30 +0000 (19:22 +0200)]
* lisp/replace.el (perform-replace): Accept default bindings in lookup-key.
Set ACCEPT-DEFAULT arg of lookup-key to t (bug#69342).
This will allow the users to ignore unbound keys with
‘(define-key query-replace-map [t] 'ignore)’.