Stefan Monnier [Thu, 13 Jul 2023 23:00:51 +0000 (19:00 -0400)]
cl-print: Put buttons on ellipses
Currently, in *Backtrace* we have a nice behavior for cl-printed objects
where they're truncated by default to a manageable size but we can click
on the "..." to expand them when needed.
The patch below moves that functionality to `cl-print.el` such
that it can be enjoyed "everywhere" (bug#64536). It also has the
benefit of simplifying the code since `backtrace.el` had to look for
ellipses in order to add buttons to them, whereas now we can put
the ellipses right when we write them.
* lisp/emacs-lisp/cl-print.el (cl-print-object-contents): Improve docstring.
(cl-print-expand-ellipsis-function): New var.
(cl-print--default-expand-ellipsis): New function.
(cl-print-expand-ellipsis): New command.
(cl-print-insert-ellipsis): Allow nil instead of 0 to mean "this elides
the whole object".
(cl-print-ellipsis): Move button type from `backtrace.el`.
(cl-print-propertize-ellipsis): Put a button.
(cl-print--expand-ellipsis): Rename from `cl-print-expand-ellipsis`.
(cl-print-to-string-with-limit): Allow new value t for `limit`.
* lisp/emacs-lisp/backtrace.el (backtrace--font-lock-keywords): Simplify.
(backtrace--match-ellipsis-in-string): Delete function.
(backtrace--change-button-skip): Adjust to new button type name.
(backtrace--expand-ellipsis): New function, extracted from
`backtrace-expand-ellipsis`.
(backtrace-expand-ellipsis): Delete function.
(backtrace-ellipsis): Move button type to `cl-print.el`.
(backtrace--print-to-string): Don't look for cl-print ellipses any more.
(backtrace-mode): Use `backtrace--expand-ellipsis`.
* lisp/ielm.el (ielm--expand-ellipsis): New function.
(inferior-emacs-lisp-mode): Use it to fill the data when expanded.
* test/lisp/emacs-lisp/cl-print-tests.el
(cl-print-tests-check-ellipsis-expansion)
(cl-print-tests-check-ellipsis-expansion-rx): Adjust to new internal
function name.
Don't recalculate the buffer basename inside uniquify
Previously, uniquify--create-file-buffer-advice would use the filename
of the buffer to calculate what the buffer's basename should be. Now
that gets passed in from create-file-buffer, which lets us fix several
bugs:
1. before this patch, if a buffer happened to be named the same thing
as directory in its default-directory, the buffer would get renamed
with a directory separator according to uniquify-trailing-separator-p.
2. buffers with a leading space should get a leading |, as described
by create-file-buffer's docstring; before this patch, uniquify would
remove that leading |.
* lisp/dired.el (dired-internal-noselect): Pass a directory name to
create-file-buffer.
* lisp/files.el (create-file-buffer): Do uniquify-trailing-separator-p
handling if passed a directory filename. (bug#62732)
* lisp/uniquify.el (uniquify-item):
(uniquify-rationalize-file-buffer-names, uniquify-rationalize,
uniquify-get-proposed-name, uniquify-rationalize-conflicting-sublist):
Remove uniquify-trailing-separator-p handling.
(uniquify--create-file-buffer-advice): Take new basename argument and
use it, instead of recalculating the basename from the filename.
Paul Eggert [Thu, 13 Jul 2023 21:26:29 +0000 (14:26 -0700)]
Port NaN, infinity handling better to VAX
Nowadays .elc files routinely contain tokens like 1.0e+INF and
0.0e+NaN that do not work on antiques like the VAX that lack IEEE fp.
Port Emacs to these platforms, by treating infinities as extreme
values and NaNs as strings that trap if used numerically.
* src/lread.c (INFINITY): Default to HUGE_VAL if non-IEEE.
(not_a_number) [!IEEE_FLOATING_POINT]: New static array.
(syms_of_lread) [!IEEE_FLOATING_POINT]: Initialize it.
(read0): Report invalid syntax for +0.0e+NaN on platforms
that lack NaNs.
(string_to_number): On non-IEEE platforms, return HUGE_VAL
for infinity and a string for NaN. All callers changed.
Fix flymake mode line scrolling with pixel-scroll-precision-mode
When pixel-scroll-precision-mode is enabled, scrolling the mouse
wheel will yield wheel-{up,down} events. Flymake now binds the
new events in addition to the old mouse-wheel-{up,down}-event.
* lisp/progmodes/flymake.el:(flymake--mode-line-counter-scroll-prev)
(flymake--mode-line-counter-scroll-next)
flymake--mode-line-counter-map): New.
(flymake--mode-line-counter): Use new keymap and include
'flymake--diagnostic-type' as a property in the mode-line.
(Bug#64428)
Robert Pluim [Thu, 22 Jun 2023 14:59:19 +0000 (16:59 +0200)]
Autodetect coding system when yanking media
Some browers send eg 'text/html' selections formatted as UTF-8, but
with a type of STRING, which actually means iso-latin-1. Autodetect
the correct coding system to use by calling 'gui-get-selection'.
* lisp/yank-media.el (yank-media--get-selection): Call
'gui-get-selection' instead of 'gui-backend-get-selection'.
Po Lu [Thu, 13 Jul 2023 11:19:57 +0000 (19:19 +0800)]
Add a Doc View tool bar
* etc/NEWS: Announce the new tool bar.
* etc/images/last-page.xpm:
* etc/images/last-page.pbm: New images. Mirrored from
next-page.xpm.
* lisp/doc-view.el (doc-view-menu): Use `doc-view-new-search'
instead of an anonymous function.
(doc-view-tool-bar-map): New keymap.
(doc-view-search): Update the tool bar after initiating a
search.
(doc-view-new-search): New command.
(doc-view-mode): Set the tool bar map appropriately.
Po Lu [Thu, 13 Jul 2023 10:17:59 +0000 (18:17 +0800)]
Improve workaround for partial texture updates on Android
* java/AndroidManifest.xml.in:
* java/org/gnu/emacs/EmacsDialog.java (toAlertDialog): Don't
change hardware acceleration state.
* java/org/gnu/emacs/EmacsNative.java (notifyPixelsChanged): New
function.
* java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView):
New field `bitmapChanged'.
(copyToFrontBuffer): Signal that the bitmap has changed.
(onDraw): If the bitmap has changed, increment the generation
ID.
* src/android.c (JNICALL): Implement new function.
Avoid saying that 'project-current' asks specifically for a
directory, as it can also ask for a project's directory by other
identifiers, such as the project's name, when 'project-prompter'
is set to a different value than the default
'project-prompt-project-dir'. (Bug#64266)
Po Lu [Thu, 13 Jul 2023 04:05:50 +0000 (12:05 +0800)]
Disable hardware acceleration on Android
It serves no purpose and causes tearing. Uploading the bitmap
to the GPU takes about as long as it does to incrementally
update the surface in software.
Po Lu [Wed, 12 Jul 2023 10:07:53 +0000 (18:07 +0800)]
Minor correction to X error handling
* src/xterm.c (x_error_handler): Clear fail->selection_serial
after reporting an error during selection transfer, in case any
other outstanding requests within the protected section also
report errors.
Po Lu [Wed, 12 Jul 2023 08:45:24 +0000 (16:45 +0800)]
Update Android port
* src/android.c (android_run_select_thread): Correctly return
the set of ready read and write descriptors on __ANDROID_API__ <
16 systems.
(android_select): Clear the set of ready file descriptors if
events from the event queue are present despite pselect failing.
Po Lu [Wed, 12 Jul 2023 01:45:58 +0000 (09:45 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsWindow.java (whatButtonWasIt): Handle
back and forward buttons along with styluses.
* src/doc.c (close_file_unwind_android_fd): New function.
(get_doc_string, Fsnarf_documentation): Don't create a temporary
fd if it can be avoided.
Po Lu [Tue, 11 Jul 2023 08:47:13 +0000 (16:47 +0800)]
Fix doc file generation on Android
* .gitignore: Ignore cross/etc/DOC.
* configure.ac: Make the directory `cross/etc'.
* cross/Makefile.in (CLEAN_SUBDIRS): Clean files inside `etc' as
well.
* java/Makefile.in (install_temp): Copy cross/etc/DOC to the
package if it is available.
* src/Makefile.in (SOME_MACHINE_OBJECTS): Add androidselect.c,
sfntfont-android.c and sfntfont.c.
(libemacs.so): Depend on $(etc)/DOC.
Po Lu [Tue, 11 Jul 2023 02:22:03 +0000 (10:22 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsView.java (onGenericMotionEvent): Call
onGenericMotionEvent.
* java/org/gnu/emacs/EmacsWindow.java (Coordinate): New fields
`button' and `id'.
(<init>): Add new arguments to the construtor.
(whatButtonWasIt): Return 0 if the button state has not changed.
(buttonForEvent): New function.
(figureChange): Return the Coordinate object associated to
EVENT. Determine whether or not EVENT was accompanied by a
change to the button state, and ascertain which button that was.
(motionEvent): New function.
(onGenericMotionEvent, onTouchEvent): Factor out touch and mouse
event delivery to motionEvent.
* lisp/net/tramp.el (tramp-handle-file-remote-p): Handle CONNECTED
value of 'never'.
* lisp/eshell/esh-ext.el (eshell-explicit-remote-commands): New
option.
(eshell-ext-initialize): Apply 'eshell-handle-remote-command' when
requested.
(eshell-handle-remote-command): New function.
(eshell-remote-command): Reimplement this function and dispatch to
'eshell-external-command', which can handle remote processes on its
own.
* test/lisp/eshell/esh-ext-tests.el
(esh-ext-test/explicitly-remote-command)
(esh-ext-test/explicitly-local-command): New tests.
Paul Eggert [Mon, 10 Jul 2023 16:53:07 +0000 (09:53 -0700)]
Further simplify configure-time locale testing
* configure.ac (gl_STDLIB_H): Replace this, not gt_LOCALE_FR_UTF8,
as this lets us also omit MB_CUR_MAX checking that will never be
executed, and also lets us remove testing for ecvt, fcvt, gcvt
that Emacs doesn’t need.
(AC_C_RESTRICT): Invoke explicitly, as Emacs uses ‘restrict’
directly. Also, simplifies the replacement for gl_STDLIB_H, which
would otherwise need to AC_REQUIRE AC_C_RESTRICT.
* lib/gnulib.mk.in: Regenerate via admin/merge-gnulib.
Po Lu [Mon, 10 Jul 2023 05:31:57 +0000 (13:31 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsService.java (browseUrl): New argument
SEND. Choose from a list of applications that want to share the
URL if true.
* lisp/net/browse-url.el (browse-url-android-share): New user
option.
(browse-url-default-android-browser): Respect said user option.
* src/android.c (android_init_emacs_service)
(android_browse_url): Expose new option.
* src/android.h: Update prototypes.
* src/androidselect.c (Fandroid_browse_url): Likewise.
Paul Eggert [Sun, 9 Jul 2023 20:27:54 +0000 (13:27 -0700)]
Simplify ‘configure’ check for MB_CUR_MAX
* admin/merge-gnulib: Remove m4/locale-fr.m4.
* configure.ac (gt_LOCALE_FR_UTF8): Replace Gnulib’s
definition with a near no-op, as Emacs doesn’t care
about the Solaris 10 MB_CUR_MAX bug.
* lib/gnulib.mk.in: Regenerate.
* m4/locale-fr.m4: Remove; no longer needed due
to above changes.
Po Lu [Sun, 9 Jul 2023 05:13:53 +0000 (13:13 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsWindow.java (eventModifiers)
(motionEventModifiers): New functions.
(onKeyDown, onKeyUp, onFocusChanged, onSomeKindOfMotionEvent):
Don't record the previous modifier mask; instead, always use the
modifier state specified in the event.
* src/androidterm.c (handle_one_android_event): Don't dispatch
button release events when a popup is active.
Po Lu [Sun, 9 Jul 2023 04:50:15 +0000 (12:50 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsService.java (onStartCommand): Fix
typo in notification message.
* java/org/gnu/emacs/EmacsWindow.java (onFocusChanged): Reset
the recorded modifier state upon a change to the window focus.
Po Lu [Sun, 9 Jul 2023 02:05:08 +0000 (10:05 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsDrawPoint.java (perform): Don't fill
an extra pixel.
* java/org/gnu/emacs/EmacsService.java (onCreate): Make sure
scaledDensity is always at least 160 dpi.
Stefan Monnier [Sun, 9 Jul 2023 00:19:02 +0000 (20:19 -0400)]
cl-print.el: Reduce code duplication
While at it, fix a bug in `cl-print-object-contents` for strings,
where we forgot to pass `stream` to `princ` at one place and simplify
a `substring` call using a negative offset.
* lisp/emacs-lisp/cl-print.el (cl-print--cons-tail)
(cl-print--vector-contents, cl-print--struct-contents)
(cl-print--string-props): New functions, extracted from
`cl-print-object-contents`.
(cl-print-object, cl-print-object-contents): Use them.
* lisp/treesit.el (treesit-fontify-with-override): Fix docstring
grammar. Remove redundant precondition (bug#64052).
* src/treesit.c (Ftreesit_parser_set_included_ranges): Fix typo in
commentary.
(treesit_predicate_equal, treesit_predicate_match)
(treesit_predicate_pred): Avoid fixnum roundtrip by using
list_length in place of Flength. Make error messages more accurate.
(treesit_eval_predicates): Quote predicate names in error message.
* src/search.c: Move commentary that used to precede search_buffer
to that location once more. Update it for the current arglist.
(search_command, search_buffer_non_re, search_buffer):
* src/lisp.h (search_buffer): Turn RE flag/argument from an int into
a bool. All callers changed (bug#64049).
Michael Albinus [Sat, 8 Jul 2023 14:48:20 +0000 (16:48 +0200)]
Rearrange setting date and modes in Tramp
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file): Set date
and modes if appropriate.
(tramp-do-copy-or-rename-file-via-buffer)
(tramp-do-copy-or-rename-file-directly)
(tramp-do-copy-or-rename-file-out-of-band): Do not set date and modes.
Po Lu [Sat, 8 Jul 2023 13:49:21 +0000 (21:49 +0800)]
Fix EmacsDrawLine again
* java/org/gnu/emacs/EmacsDrawLine.java (perform): Symmetrically
adjust coordinates to cover the last pixel. Then, fill the left
most pixel of the line.
Mention minibuffer-next-completion in completion-help
Now that it's not necessary to switch to the *Completions* buffer to
switch between and choose completions, we should make that clear in
the help text. Let's also make the bindings uniform both in and
outside the *Completions* buffer so users don't have to think about
the difference.
In working with new users, they've assumed that since the help text in
*Completions* says "Click on a completion to select it", that that's
the only way to select a completion. This text should help clarify
that.
* doc/emacs/mini.texi (Completion Commands): Document new bindings.
* lisp/simple.el (completion-list-mode-map): Bind
minibuffer-{next,previous,choose}-completion.
(completion-setup-function): Mention bindings for
minibuffer-{next,previous,choose}-completion. (Bug#64425)
Disambiguate mode line indication for utf-8 and utf-16
* lisp/international/mule-conf.el (utf-7):
* lisp/language/cyrillic.el (koi8-u): Change mnemonic letters to
?u and ?\N{cyrillic capital letter u}, respectively.
Vladimir Sedach [Tue, 27 Jun 2023 04:32:07 +0000 (22:32 -0600)]
Fix 'shell-dirtrack-mode' showing as enabled in unrelated buffers
* lisp/shell.el (shell-dirtrack-mode): Reverse the alias.
(shell-dirtrack-mode): Move before first use of the variable. Add
:interactive keyword.
(shell-directory-tracker, shell-cd): Use 'shell-dirtrack-mode'
instead of 'shell-dirtrackp'. (Bug#64311)
Po Lu [Sat, 8 Jul 2023 02:15:38 +0000 (10:15 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsService.java (DEBUG_IC)
(DEBUG_THREADS): Improve commentary.
* src/androidterm.c (handle_one_android_event): Signal
completion of IME events that have lost their frames.
(requestCursorUpdates): Don't set an edit counter as this event
won't be passed to the text conversion machinery.
Mark failing icalendar test as unstable (bug#56241)
* test/lisp/calendar/icalendar-tests.el
(icalendar-export-bug-56241-dotted-pair):
This test started failing early July 2023 in multiple branches at
once without any change to the code and is likely sensitive to the
current date. Tag it to keep it quiet for now.
Juri Linkov [Fri, 7 Jul 2023 07:18:43 +0000 (10:18 +0300)]
* lisp/tab-bar.el: Fix tab-bar-tab-name-current for active minibuffer.
(tab-bar-tab-name-current): Use get-mru-window in the active minibuffer
when minibuffer-selected-window is nil after switching to another tab.
(tab-bar-tab-name-current-with-count)
(tab-bar-tab-name-truncated): Use tab-bar-tab-name-current.
(tab-bar-select-tab): Set tab-bar-minibuffer-restore-tab and
minibuffer-exit-hook minibuffer-locally to handle recursive minibuffers
for non-nil read-minibuffer-restore-windows.
(tab-bar-minibuffer-restore-tab): No need to reset minibuffer-local values.
Po Lu [Fri, 7 Jul 2023 06:22:38 +0000 (14:22 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsSurfaceView.java (copyToFrontBuffer):
Use fallback bit blit function on Android 7.0 as well, as
crashes have been observed in drawBitmap.
Po Lu [Fri, 7 Jul 2023 02:00:56 +0000 (10:00 +0800)]
Update Android port
* lisp/tool-bar.el (modifier-bar-modifier-list): New variable.
(modifier-bar-button): New function.
(tool-bar-event-apply-alt-modifier)
(tool-bar-event-apply-super-modifier)
(tool-bar-event-apply-hyper-modifier)
(tool-bar-event-apply-shift-modifier)
(tool-bar-event-apply-control-modifier)
(tool-bar-event-apply-meta-modifier): Factor out modifier bar
logic to that function, and redisplay the tool bar where
necessary.
(modifier-bar-available-p): New function.
(modifier-bar-mode): Disable tool bar items corresponding to
modifier keys that've already been pressed.
* etc/images/shift.pbm: Regenerate from correct font.
Harald Jörg [Thu, 6 Jul 2023 15:29:42 +0000 (17:29 +0200)]
; cperl-mode: Refine syntax of attributes
Attributes may start with underscore, and must be separated.
Thanks to Mattias Engdegård for pointing out a regex mistake.
* lisp/progmodes/cperl-mode.el (defconst): Fix bad grouping and
allow attributes to start with an underscore in
cperl--single-attribute-rx. Adjust cperl--attribute-list-rx
accordingly.
(cperl-find-sub-attrs): Allow attributes to start with an underscore.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-attribute-list-rx): Add new test cases for valid and
invalid attribute lists.
Eli Zaretskii [Thu, 6 Jul 2023 08:50:41 +0000 (11:50 +0300)]
Use 'emacs-lisp-compilation-mode' in native compilation buffers
* lisp/emacs-lisp/comp.el (comp-log-to-buffer)
(comp-run-async-workers): Use 'emacs-lisp-compilation-mode' in the
buffers where we log the results of native compilation. Suggested
by No Wayman <iarchivedmywholelife@gmail.com>. (Bug#64452)
This is a step in the direction of making ediff behave better by
default under tiling window managers and fixing Bug#62164.
* lisp/vc/ediff-wind.el (ediff-floating-control-frame): Add
defcustom.
(ediff-frame-make-utility, ediff-setup-control-frame): Allow setting
the control frame up as a utility window under X. (Bug#62164)
Hugo Heagren [Sat, 1 Apr 2023 21:27:25 +0000 (22:27 +0100)]
Support right-align in mode-line
* lisp/bindings.el (mode-line-right-align-edge): New custom
variable, controls where `mode-line-format-right-align' should
align to.
(mode-line-format-right-align): New function. If the symbol
`mode-line-format-right-align' appears in `mode-line-format',
then return return a padding string which aligns everything
after that symbol to the right. Padding width is altered with
the display property and depends on the value of
`mode-line-right-align-edge'.
(mode-line-format-right-align): New variable. Convenience
definition for including right alignment in `mode-line-format'.
* doc/lispref/modes.texi (Mode Line Variables): Document new
alignment functionality and user option. (Bug#62606)
Wang Diancheng [Fri, 30 Jun 2023 07:08:18 +0000 (15:08 +0800)]
Fix target-async and background execution in gdb-mi.el
* lisp/progmodes/gdb-mi.el (gdb-target-async-checked): New
variable.
(gdb-non-stop-setting): Change the value back to default to
non-nil on systems other than MS-Windows.
(gdb-non-stop-handler): Try to set mi-async first, falling back to
target-async by calling 'gdb-set-mi-async-handler'.
(gdb-set-mi-async-handler, gdb-try-check-target-async-support):
New functions.
(gdb-check-target-async): Set 'gdb-non-stop' here...
(gdb-starting): ...and here.
(gdb-stopped): Call 'gdb-try-check-target-async-support' when the
program stops for the first time. (Bug#64186) (Bug#63084)