]> git.eshelyaron.com Git - emacs.git/log
emacs.git
16 months agoRemove harmful and redundant bindings from the byte compiler.
Alan Mackenzie [Wed, 9 Aug 2023 11:27:28 +0000 (11:27 +0000)]
Remove harmful and redundant bindings from the byte compiler.

This fixes bug#65017.  Binding symbols-with-pos-enabled in two
macro handling functions was harmful; one of these caused
cl--labels-convert to fail.  Binding print-symbols-bare in many
places in the byte compiler was redundant.

* lisp/emacs-lisp/bytecomp.el (byte-compile-recurse-toplevel)
(byte-compile-initial-macro-environment)
(byte-compile-output-file-form, byte-compile-output-docform)
(byte-compile-preprocess): Remove bindings of
print-symbols-bare.

* lisp/emacs-lisp/macroexp.el (macroexp--compiler-macro)
(internal-macroexpand-for-load): Remove bindings of
symbols-with-pos-enabled.
(internal-macroexpand-for-load): Remove binding of
print-symbols-bare.

16 months agoFaster NSString to Lisp string conversion
Mattias Engdegård [Wed, 9 Aug 2023 10:34:06 +0000 (12:34 +0200)]
Faster NSString to Lisp string conversion

Since we know that the value from [NSString UTF8String] is valid
UTF-8, using make_string is wastefully slow.

* src/nsfns.m (count_utf8_chars): New function, at least twice as fast
as parse_str_as_multibyte used by make_string for this purpose.
([NSString lispString]): Use count_utf8_chars.  We now always make a
multibyte string because there is no reason not to.

16 months agoRemove a DEFSYM that no longer needs to be in the C core.
Eric S. Raymond [Wed, 9 Aug 2023 10:05:24 +0000 (06:05 -0400)]
Remove a DEFSYM that no longer needs to be in the C core.

* src/fileio.c (syms_of_fileio): Remove Qmove_file_to_trash.

16 months agoFix crashes runninging android-emacs with bad LD_LIBRARY_PATH
Po Lu [Wed, 9 Aug 2023 06:23:25 +0000 (14:23 +0800)]
Fix crashes runninging android-emacs with bad LD_LIBRARY_PATH

* doc/emacs/input.texi (Touchscreens, On-Screen Keyboards): Fix
section titles.

* src/android-emacs.c (main): If EMACS_LD_LIBRARY_PATH is set,
make it LD_LIBRARY_PATH.

* src/android.c (JNICALL): Set LD_LIBRARY_PATH as well as
EMACS_LD_LIBRARY_PATH.

16 months agoImprove Emacsbug output
Po Lu [Wed, 9 Aug 2023 04:21:03 +0000 (12:21 +0800)]
Improve Emacsbug output

* lisp/mail/emacsbug.el (report-emacs-bug--os-description):
Handle `android'.
(emacs-build-description): Don't print the Android build
fingerprint here.

16 months agoAdd a string check to delete-file-internal.
Eric S. Raymond [Wed, 9 Aug 2023 04:02:22 +0000 (00:02 -0400)]
Add a string check to delete-file-internal.

* src/fileio.c (delete-file-internal): Argument should be a string.

16 months ago* lisp/ldefs-boot.el: Restore no-byte-compile cookie.
Po Lu [Wed, 9 Aug 2023 01:50:35 +0000 (09:50 +0800)]
* lisp/ldefs-boot.el: Restore no-byte-compile cookie.

16 months ago* doc/misc/calc.texi (Musical Notes): Fix build with Texinfo 4.13.
Po Lu [Wed, 9 Aug 2023 01:21:36 +0000 (09:21 +0800)]
* doc/misc/calc.texi (Musical Notes): Fix build with Texinfo 4.13.

16 months agoRun Git hooks within xcu4
Po Lu [Wed, 9 Aug 2023 01:20:15 +0000 (09:20 +0800)]
Run Git hooks within xcu4

* build-aux/git-hooks/pre-commit (LC_ALL):
* build-aux/git-hooks/prepare-commit-msg (SHA1): Run using xcu4
tools.

16 months ago; Minor adjustments to configury, loaddefs and gitignore
Po Lu [Wed, 9 Aug 2023 01:19:11 +0000 (09:19 +0800)]
; Minor adjustments to configury, loaddefs and gitignore

* .gitignore: Add exec/aclocal.m4.

* configure.ac (bitmapdirs): Circumvent shell substitution that
isn't supported by the Bourne shell.

* lisp/ldefs-boot.el: Update from loaddefs.el.

16 months ago; * .gitignore: Add exec/aclocal.m4.
Stefan Kangas [Wed, 9 Aug 2023 01:35:18 +0000 (03:35 +0200)]
; * .gitignore: Add exec/aclocal.m4.

16 months agoAdd calling convention to face-attr-construct
Stefan Kangas [Wed, 9 Aug 2023 01:30:56 +0000 (03:30 +0200)]
Add calling convention to face-attr-construct

* lisp/faces.el (face-attr-construct): Add
advertised-calling-convention declaration.

16 months agoDon't depend on Automake to generate exec/aclocal.m4
Po Lu [Wed, 9 Aug 2023 00:26:45 +0000 (08:26 +0800)]
Don't depend on Automake to generate exec/aclocal.m4

* autogen.sh (do_git): Generate exec/aclocal.m4 by hand.
(bug#65160)

16 months agoFix all my attributions to be correct and consistent...
Eric S. Raymond [Wed, 9 Aug 2023 00:02:17 +0000 (20:02 -0400)]
Fix all my attributions to be correct and consistent...

...in case people are trying to track me down for questions.

.mailmap, ChangeLog.1, admin/notes/copyright, doc/emacs/ChangeLog.1,
doc/emacs/ack.texi, doc/lispref/ChangeLog.1, doc/misc/gnus.texi,
etc/ChangeLog.1, lib-src/ChangeLog.1, lisp/ChangeLog.13,
lisp/ChangeLog.14, lisp/ChangeLog.15, lisp/ChangeLog.17,
lisp/ChangeLog.3, lisp/ChangeLog.4, lisp/ChangeLog.5,
lisp/ChangeLog.6, lisp/ChangeLog.7, lisp/emacs-lisp/lisp-mnt.el,
lisp/finder.el, lisp/loadhist.el, lisp/play/cookie1.el,
lisp/progmodes/asm-mode.el, lisp/progmodes/gud.el,
lisp/progmodes/make-mode.el, lisp/term/AT386.el, src/ChangeLog.3

16 months agoFix percentage sizes in SVG display (bug#64908)
Alan Third [Sat, 5 Aug 2023 09:39:31 +0000 (10:39 +0100)]
Fix percentage sizes in SVG display (bug#64908)

* src/image.c (svg_css_length_to_pixels): Make percent units always
return zero and handle font size based units better.
(svg_load_image): Don't rely on the width and height values from the
SVG actually having any useful data, even if they're explicitly set.

16 months ago; Fix thinko
Stefan Kangas [Tue, 8 Aug 2023 17:53:22 +0000 (19:53 +0200)]
; Fix thinko

16 months agoMake news-path variable obsolete
Stefan Kangas [Tue, 8 Aug 2023 17:16:23 +0000 (19:16 +0200)]
Make news-path variable obsolete

* lisp/gnus/nnspool.el (news-path): Make obsolete.
(nnspool-spool-directory): Don't use above obsolete variable.

16 months ago; Fix typo
Stefan Kangas [Tue, 8 Aug 2023 17:08:56 +0000 (19:08 +0200)]
; Fix typo

16 months agoMake ffap compat aliases obsolete
Stefan Kangas [Tue, 8 Aug 2023 17:07:00 +0000 (19:07 +0200)]
Make ffap compat aliases obsolete

* lisp/ffap.el (ffap-newsgroup-regexp, ffap-newsgroup-heads)
(ffap-newsgroup-p): Make compatibility aliases obsolete.

16 months agoMake lm-verify footer checking more strict
Stefan Kangas [Tue, 8 Aug 2023 17:04:48 +0000 (19:04 +0200)]
Make lm-verify footer checking more strict

* lisp/emacs-lisp/lisp-mnt.el (lm-verify): Make file footer regexp
more strict to match requirement in old versions of package.el (now
only a warning).

16 months agoOpen Pipfile and flake8 config files in conf-mode
Stefan Kangas [Tue, 8 Aug 2023 17:01:18 +0000 (19:01 +0200)]
Open Pipfile and flake8 config files in conf-mode

* lisp/progmodes/python.el (auto-mode-alist): Open Pipfile and flake8
configuration files in conf-mode.

16 months agoCheck keyword args of make-pipe-process (bug#65030)
Mattias Engdegård [Tue, 8 Aug 2023 16:33:50 +0000 (18:33 +0200)]
Check keyword args of make-pipe-process (bug#65030)

* lisp/emacs-lisp/bytecomp.el (make-pipe-process): Add check.

16 months agoBetter error for missing or bad :name arg in make-process etc
Mattias Engdegård [Tue, 8 Aug 2023 16:09:08 +0000 (18:09 +0200)]
Better error for missing or bad :name arg in make-process etc

Improve on the famously bad error message given when the :name keyword
parameter is missing or of the wrong type in calls to make-process,
make-pipe-process and make-network-process (bug#65030).

* src/process.c (get_required_string_keyword_param): New function.
(Fmake_process, Fmake_pipe_process, Fmake_network_process): Use it.

16 months agoCheck keyword args of make-process
Helmut Eller [Thu, 3 Aug 2023 06:33:40 +0000 (08:33 +0200)]
Check keyword args of make-process

The functions make-process and make-network-process have many
keyword args and it's easy to misspell some of them.

Use a compiler macro to warn about some possible mistakes.

* lisp/emacs-lisp/bytecomp.el (bytecomp--check-keyword-args): New
  helper.
  (make-process, make-network-process): Define a compiler macro that
  performs some checks but doesn't anything else.

* test/lisp/emacs-lisp/bytecomp-tests.el: Add some tests.

* test/lisp/emacs-lisp/bytecomp-resources/:
  (warn-make-process-missing-keyword-arg.el,
   warn-make-process-missing-keyword-value.el,
   warn-make-process-repeated-keyword-arg.el,
   warn-make-process-unknown-keyword-arg.el): New test files

16 months agoDisable json and tree-sitter with --without-all
Ulrich Müller [Tue, 8 Aug 2023 06:34:43 +0000 (08:34 +0200)]
Disable json and tree-sitter with --without-all

* configure.ac (OPTION_DEFAULT_IFAVAILABLE): Disable the option if
--without-all was specified.  (Bug#65142)

16 months ago; Update pdumper dump_buffer hash (bug#65146).
Basil L. Contovounesios [Tue, 8 Aug 2023 12:57:34 +0000 (14:57 +0200)]
; Update pdumper dump_buffer hash (bug#65146).

16 months ago; .mailmap: Flip entry.
Basil L. Contovounesios [Tue, 8 Aug 2023 12:43:22 +0000 (14:43 +0200)]
; .mailmap: Flip entry.

Earl Hyatt's canonical info was the wrong way around (bug#49407).

16 months ago* lisp/tooltip.el (tooltip-cancel-delayed-tip): Fix missing argument.
David Ponce [Tue, 8 Aug 2023 10:47:13 +0000 (12:47 +0200)]
* lisp/tooltip.el (tooltip-cancel-delayed-tip): Fix missing argument.

This resurrects tooltips, see bug#65147.

16 months agoRepair test failures stemming from Android merge
Po Lu [Tue, 8 Aug 2023 12:20:02 +0000 (20:20 +0800)]
Repair test failures stemming from Android merge

* lisp/kmacro.el (kmacro-step-edit-query)
(kmacro-step-edit-pre-command): Use `dummy-event' instead of
[nil] to continue a kbd macro; this is because nil now has a
function key map.
* src/androidfns.c (Fx_hide_tip): Allow calling this as a stub.
* src/fileio.c (Finsert_file_contents): In adherence to the
documentation, forbid supplying a BEG offset even for seekable
files, i.e. /dev/urandom on Linux kernel based systems.

16 months ago; Fix dired-aux-tests failure (bug#65143)
Mattias Engdegård [Tue, 8 Aug 2023 10:24:27 +0000 (12:24 +0200)]
; Fix dired-aux-tests failure (bug#65143)

* lisp/dired-aux.el (dired-do-create-files): Preserve the return value
that isn't documented but used by dired-test-bug30624 in
dired-aux-tests.  Change suggested by Po Lu.

16 months ago; Fix bad bytecomp-tests cases
Mattias Engdegård [Tue, 8 Aug 2023 10:05:48 +0000 (12:05 +0200)]
; Fix bad bytecomp-tests cases

* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Repair broken test cases.

16 months agoTeach byte-compiler about Aristotelian identity
Mattias Engdegård [Mon, 7 Aug 2023 16:14:42 +0000 (18:14 +0200)]
Teach byte-compiler about Aristotelian identity

* lisp/emacs-lisp/byte-opt.el (byte-optimize-equal, byte-optimize-eq):
Optimise (eq X X) -> t where X is a variable; idem for eql and equal.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.

16 months ago; * src/fileio.c (Ffile_selinux_context): Avoid unused variable.
Po Lu [Tue, 8 Aug 2023 08:21:45 +0000 (16:21 +0800)]
; * src/fileio.c (Ffile_selinux_context): Avoid unused variable.

16 months agoAvoid caching file status when they are about to change
Po Lu [Tue, 8 Aug 2023 08:17:10 +0000 (16:17 +0800)]
Avoid caching file status when they are about to change

* java/org/gnu/emacs/EmacsSafThread.java (EmacsSafThread)
(cacheFileStatus): New argument NO_CACHE.
(cacheDirectoryFromCursor, statDocument1):
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(statDocument): Plumb that argument through each of these wrapper
functions.
* src/android.c (android_init_emacs_service): Adjust JNI
function signatures to agree with statDocument1.
* src/androidvfs.c (android_saf_stat): Plumb that argument
through here.
(android_saf_tree_stat, android_saf_file_open): And don't cache
file status if a write is imminent.

16 months agoMinor improvements to write-region heuristic
Po Lu [Tue, 8 Aug 2023 08:02:49 +0000 (16:02 +0800)]
Minor improvements to write-region heuristic

* src/androidvfs.c (android_saf_stat): Set STATB->st_dev.
(android_fstat): Likewise.
(NATIVE_NAME): Seek to start of file after truncation.
* src/fileio.c (write_region): Use stat instead of open+fstat
to obtain updated mtime.

16 months ago* src/androidvfs.c (android_saf_file_open): Improve commentary.
Po Lu [Tue, 8 Aug 2023 06:05:43 +0000 (14:05 +0800)]
* src/androidvfs.c (android_saf_file_open): Improve commentary.

16 months agoFix truncation for the Android internal storage provider
Po Lu [Tue, 8 Aug 2023 06:04:36 +0000 (14:04 +0800)]
Fix truncation for the Android internal storage provider

* java/org/gnu/emacs/EmacsSafThread.java (openDocument1): If
truncate is specified while resorting to `w', try truncating the
file by hand.

16 months agoMerge remote-tracking branch 'savannah/master' into master-android-1
Po Lu [Tue, 8 Aug 2023 05:39:45 +0000 (13:39 +0800)]
Merge remote-tracking branch 'savannah/master' into master-android-1

16 months agoUtilize more frequently supported file access modes
Po Lu [Tue, 8 Aug 2023 05:39:16 +0000 (13:39 +0800)]
Utilize more frequently supported file access modes

* java/org/gnu/emacs/EmacsSafThread.java (openDocument1): Use
plain r or w where possible, as the fileio stuff is now better
prepared for FIFOs.
(openDocument): New argument READ.
* java/org/gnu/emacs/EmacsService.java (openDocument): New
argument READ.
* src/android.c (android_init_emacs_service): Adjust
correspondingly.
* src/androidvfs.c (android_saf_file_open): Don't support
O_APPEND.  Pass read as well as trunc and write.

16 months agoEnable visiting FIFOs as files
Po Lu [Tue, 8 Aug 2023 05:37:00 +0000 (13:37 +0800)]
Enable visiting FIFOs as files

* doc/lispref/files.texi (Reading from Files): Document new
`if-regular' value of REPLACE.

* etc/NEWS: Announce the new value.

* lisp/files.el (basic-save-buffer-2): Demote errors saving
backup files, since FIFOs cannot be copied.
(revert-buffer-insert-file-contents--default-function): Supply
`if-regular' instead of t as REPLACE.

* src/fileio.c (selinux_enabled_p): New function.
(Fcopy_file, Ffile_selinux_context, Fset_file_selinux_context):
Call that function to ascertain if SELinux applies to a file.
(read_non_regular): Don't assume `emacs_fd_read' always returns
int.
(Finsert_file_contents): If REPLACE is if-regular and FILENAME
is a special non-seekable file, fall back to erasing the buffer
before inserting the contents of that file.
(syms_of_fileio) <Qif_regular>: New symbol.

16 months agoAdd calling convention to x-compose-font-name
Stefan Kangas [Tue, 8 Aug 2023 04:11:51 +0000 (06:11 +0200)]
Add calling convention to x-compose-font-name

* lisp/international/fontset.el (x-compose-font-name): Add
advertised-calling-convention for argument ignored since 22.1.

16 months agoMake x-font-name-charset-alist obsolete
Stefan Kangas [Tue, 8 Aug 2023 03:52:31 +0000 (05:52 +0200)]
Make x-font-name-charset-alist obsolete

* lisp/international/fontset.el (x-font-name-charset-alist): Make
obsolete.  It has been a no-op since Emacs 22.

16 months agoFix some emacs_fopen confusion
Paul Eggert [Tue, 8 Aug 2023 04:23:28 +0000 (21:23 -0700)]
Fix some emacs_fopen confusion

Problem reported by Po Lu in:
https://lists.gnu.org/r/emacs-devel/2023-08/msg00195.html
* src/comp.c (comp_hash_source_file, Fcomp__release_ctxt):
* src/sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory):
Be more systematic about using emacs_fclose on streams that were
opened with emacs_fopen or emacs_fdopen.  Do this even if not
Android, as this simplifies checking that it's done consistently.
* src/lisp.h (emacs_fclose): If it’s just fclose,
make it a macro rather than a function, to avoid confusing gcc
-Wmismatched-dealloc.
(emacs_fopen): Move decl here from sysstdio.h, because sysstdio.h
is included from non-Emacs executables and emacs_fopen is good
only inside Emacs.
* src/sysdep.c (emacs_fclose): Define as a function only if Android.

16 months agoMake XEmacs compat aliases for timers obsolete
Stefan Kangas [Tue, 8 Aug 2023 02:53:08 +0000 (04:53 +0200)]
Make XEmacs compat aliases for timers obsolete

* lisp/emacs-lisp/timer.el (disable-timeout, add-timeout): Make
XEmacs compat aliases obsolete.  Update all callers.

16 months agoFix listing of directory contents after "cd" in Eshell
Jim Porter [Sun, 6 Aug 2023 20:34:18 +0000 (13:34 -0700)]
Fix listing of directory contents after "cd" in Eshell

* lisp/eshell/em-dirs.el (eshell/cd): Ensure we don't close the I/O
handles prematurely.  Additionally, don't clobber the "cd" command's
last-command info.

* test/lisp/eshell/em-dirs-tests.el (em-dirs-test/cd):
(em-dirs-test/cd/list-files-after-cd): New tests (bug#65110).

16 months agoMake Emacs 21 compat aliases easy-mmode-* obsolete
Stefan Kangas [Tue, 8 Aug 2023 02:03:17 +0000 (04:03 +0200)]
Make Emacs 21 compat aliases easy-mmode-* obsolete

* lisp/emacs-lisp/easy-mmode.el (easy-mmode-define-minor-mode)
(easy-mmode-define-global-mode): Make Emacs 21 compatibility aliases
obsolete.
* doc/lispref/loading.texi (Autoload):
* doc/lispref/modes.texi (Defining Minor Modes): Don't document
above obsolete aliases.

16 months agoMake describe-keymap tests more robust
Stefan Kangas [Tue, 8 Aug 2023 01:45:19 +0000 (03:45 +0200)]
Make describe-keymap tests more robust

* test/lisp/help-fns-tests.el
(help-fns-test-describe-keymap/symbol)
(help-fns-test-describe-keymap/value)
(help-fns-test-describe-keymap/not-keymap)
(help-fns-test-describe-keymap/let-bound)
(help-fns-test-describe-keymap/dynamically-bound-no-file): Make
tests independent of minibuffer-local-must-match-map.

16 months agoDelete useless conditional in describe-keymap
Stefan Kangas [Tue, 8 Aug 2023 01:37:54 +0000 (03:37 +0200)]
Delete useless conditional in describe-keymap

* lisp/help-fns.el (describe-keymap): Delete useless
conditional.  (Bug#65128)

16 months ago; * configure.ac: Fix typo in commentary.
Po Lu [Tue, 8 Aug 2023 00:55:23 +0000 (08:55 +0800)]
; * configure.ac: Fix typo in commentary.

16 months agoEschew linking Gnulib files to cross unless building for Android
Po Lu [Tue, 8 Aug 2023 00:55:02 +0000 (08:55 +0800)]
Eschew linking Gnulib files to cross unless building for Android

* configure.ac: Don't link Gnulib files to cross unless building
for Android.

16 months agoSimplify lockfile name calculation
Paul Eggert [Mon, 7 Aug 2023 20:57:13 +0000 (13:57 -0700)]
Simplify lockfile name calculation

* src/filelock.c (get_boot_time):
Move ‘counter’ decl to simplify #ifdef nesting.
(lock_file_1): Refactor two snprintf calls into one.
Don’t assume INT_MAX < SIZE_MAX.

16 months agoPacify --enable-gcc-warnings with emacs_fdopen
Paul Eggert [Mon, 7 Aug 2023 16:17:56 +0000 (09:17 -0700)]
Pacify --enable-gcc-warnings with emacs_fdopen

* src/lisp.h (emacs_fdopen): Now ATTRIBUTE_MALLOC
ATTRIBUTE_DEALLOC (emacs_fclose, 1), to pacify gcc
-Wsuggest-attribute=malloc on non-Android platforms.

16 months agoFix configuring with --enable-checking on non-Android platforms
Eli Zaretskii [Mon, 7 Aug 2023 14:43:33 +0000 (17:43 +0300)]
Fix configuring with --enable-checking on non-Android platforms

* configure.ac (ENABLE_CHECKING): Fix test for --with-android.

16 months agoFix mouse face display bug on MS-DOS
Po Lu [Mon, 7 Aug 2023 13:14:53 +0000 (21:14 +0800)]
Fix mouse face display bug on MS-DOS

* src/msdos.c (tty_draw_row_with_mouse_face): Tweak coordinates to
reflect the number of glyphs used within the margin area.

16 months ago* nt/gnulib-cfg.mk: Excise unneeded entries.
Po Lu [Mon, 7 Aug 2023 12:18:46 +0000 (20:18 +0800)]
* nt/gnulib-cfg.mk: Excise unneeded entries.

16 months ago* nt/gnulib-cfg.mk: Excise unneeded entries.
Po Lu [Mon, 7 Aug 2023 12:17:55 +0000 (20:17 +0800)]
* nt/gnulib-cfg.mk: Excise unneeded entries.

16 months agoStop tracking exec/config.h.in
Po Lu [Mon, 7 Aug 2023 12:15:33 +0000 (20:15 +0800)]
Stop tracking exec/config.h.in

* .gitignore: Add exec/config.h.in.

* exec/config.h.in: Remove from Git.

16 months ago; * src/fileio.c (internal_delete_file): Call internal_condition_case_1.
Eli Zaretskii [Mon, 7 Aug 2023 11:07:43 +0000 (14:07 +0300)]
; * src/fileio.c (internal_delete_file): Call internal_condition_case_1.

16 months ago* msdos/sed1v2.inp: Fix last change.
Po Lu [Mon, 7 Aug 2023 08:45:27 +0000 (16:45 +0800)]
* msdos/sed1v2.inp: Fix last change.

16 months agoFix the DJGPP build halfway
Po Lu [Mon, 7 Aug 2023 08:40:27 +0000 (16:40 +0800)]
Fix the DJGPP build halfway

* msdos/sed1v2.inp (abs_top_builddir): Edit to .., and explain
why this is okay.
($(abs_top_builddir)/src/lisp.mk): Edit to plain lisp.mk.

16 months agoFix the DJGPP build
Po Lu [Mon, 7 Aug 2023 08:25:25 +0000 (16:25 +0800)]
Fix the DJGPP build

* msdos/sedlibmk.inp (OMI_GNULIB_MODULE_crypto/md5): Delete
extraneous escape character.

16 months agoPort to the Android NDK r10b
Po Lu [Mon, 7 Aug 2023 05:01:56 +0000 (13:01 +0800)]
Port to the Android NDK r10b

* src/androidvfs.c (android_saf_stat, android_saf_file_open)
(android_fstat): Eschew accessing POSIX timespec fields in
struct stat, employing accessors supplied in Gnulib stat-time.h
in their place.

16 months agoRepair hang in android_fdopen
Po Lu [Mon, 7 Aug 2023 02:18:49 +0000 (10:18 +0800)]
Repair hang in android_fdopen

* src/androidvfs.c (android_fdopen): Do not neglect to
update next when iterating through open_parcel_fds.

16 months agoIntroduce an Android window system port for GNU Emacs
Po Lu [Mon, 7 Aug 2023 00:51:11 +0000 (08:51 +0800)]
Introduce an Android window system port for GNU Emacs

* src/xterm.h: New fields `quit_keysym' and `quit_keysym_time'.
* src/xterm.c (handle_one_xevent): Check for the quit keysym, and
set Vquit_flag upon witnessing two clicks in rapid succession.
(x_term_init): Set `quit_keysym'.
(init_xterm): Fix typo in name of `register_textconv_interface'.
(syms_of_xterm) <Vx_toolkit_scroll_bars>: Describe its default
value on android.

* src/xfns.c (xic_string_conversion_callback): Pass `0' as the
last argument to textconv_query.
(Fx_server_vendor, Fx_server_version): Document return values on
Android.

* src/xfaces.c (Fx_family_fonts, set_lface_from_font): Use
FRAME_RES instead of FRAME_RES_Y, respecting user preferences on
window systems that have distinct display and font scaling
factors.
(Fx_load_color_file): Call `emacs_fclose', not fclose.

* src/xdisp.c (tab_bar_item_info): Allow `close_p' to be NULL.
(get_tab_bar_item): Update commentary to reflect that change.
(get_tab_bar_item_kbd): New function, resembling get_tab_bar_item.
(build_desired_tool_bar_string): Clear `f->tool_bar_wraps_p';
insert new line characters if a QCwrap item is encountered, and
set f->tool_bar_wrap_p.  Replace characters beyond the end of the
tool bar with spaces.
(display_tool_bar_line): Move iterator to the next line if in
contact with an explicit line-wrap item.
(redisplay_internal): If there are newline characters in the tool
bar, refrain from coercing each row into being identically tall.
Don't call `set_tty_color_mode' on Android.
(mark_window_display_accurate_1): Report changes to the point and
mark to input methods.
(display_menu_bar): Adjust ifdefs to allow non-X window systems to
use the built-in menu bar.
(draw_row_with_mouse_face): Don't call TTY functions on Android.
(note_mouse_highlight): Call `popup_activated' on Android.
(expose_frame): Correctly work on the menu bar window.
(gui_union_rectangles): New function.

* src/window.h (struct window): New fields for recording the last
window and point positions, along with an ephemeral position used
during IM text conversion.
(WINDOW_MENU_BAR_P): Correct definition for non-X window systems
without external menu bars.

* src/window.c (replace_buffer_in_windows): Call
Qreplace_buffer_in_windows only when bound.

* src/w32proc.c (sys_spawnve): Pass extra argument to openp.

* src/w32font.c (fill_in_logfont): Use font scaling factor, not
the display scaling factor.

* src/w32.c (check_windows_init_file): Pass extra argument to
openp.

* src/verbose.mk.in (AM_V_JAVAC, AM_V_DX, AM_V_AAPT)
(AM_V_ZIPALIGN, AM_V_SILENT): New variables.

* src/textconv.h (struct textconv_interface): New `point_changed',
`compose_region_changed' and `notify_conversion'.
Add declarations for new functions.

* src/textconv.c (TEXTCONV_DEBUG): New macro.
(suppress_conversion_count): New variable.
(enum textconv_batch_edit_flags): New flag.
(copy_buffer): Don't overwrite text before the gap with the text
after.
(get_mark, select_window): New functions.
(textconv_query): New argument FLAGS.  Contingent upon its value,
use the previous point or mark or skip the conversion region.
(sync_overlay, record_buffer_change, reset_frame_state)
(detect_conversion_events, restore_selected_window)
(really_commit_text, really_finish_composing_text)
(really_set_composing_region, really_delete_composing_text)
(really_request_point_update, really_set_point_and_mark)
(complete_edit): New functions.
(struct complete_edit_check_context): New structure; store in it
the result of editing operations.
(complete_edit_check, handle_pending_conversion_events_1)
(decrement_inside, handle_pending_conversion_events)
(start_batch_edit, end_batch_edit, commit_text)
(set_composing_text, textconv_set_point_and_mark)
(request_point_update, textconv_barrier, get_extracted_text)
(get_surrounding_text, conversion_disabled_p)
(report_selected_window_change, report_point_change)
(disable_text_conversion, resume_text_conversion)
(register_textconv_interface, check_postponed_buffers)
(postponed_buffers, Fset_text_conversion_style)
(syms_of_textconv) <Qaction, Qtext_conversion, Qpush_mark,
Qunderline, Qoverriding_text_conversion_style,
Vtext_conversion_edits, Voverriding_text_conversion_style,
Vtext_conversion_face>: New functions, symbols and variables.

* src/terminal.c (Fterminal_live_p): Return Qandroid if type is
output_android.

* src/termhooks.h (enum output_method): Add `output_android'.
(struct terminal) <display_info>: Add union constituent field for
`android'.
<query_colors>: Define on Android as well.
(TERMINAL_FONT_CACHE) [HAVE_ANDROID]: Return the inappropriately
named font cache field on Android.

* src/term.c (string_cost, string_cost_one_line, per_line_cost)
(calculate_costs, produce_glyphs, produce_glyphs, tty_capable_p)
(tty_capable_p, device, init_tty, maybe_fatal)
(delete_tty) [HAVE_ANDROID]: Exclude or turn these functions into
vestiges.
(Fsuspend_tty, Fresume_tty): Call `emacs_fclose' and always signal
on Android.
(Fresume_tty): Call `emacs_fdopen'.
(Ftty__set_output_buffer_size) [HAVE_ANDROID]: Remove this
function.
(encode_terminal_code): Replace with a stub.
(init_tty, delete_tty, maybe_fatal): Call `emacs_fclose'.
(syms_of_term): Remove most unnecessary code on Android.
<system_uses_terminfo>: Always set this option on Android.

* src/sysdep.c (init_standard_fds): Call emacs_fopen.
(reset_sigio, widen_foreground_group): Define out on Android.
(reset_sys_modes): Don't call either function on Android.
(init_sigbus, handle_sigbus): New functions.
(init_signals): Don't add user signals on Android.  Register
signal handlers for SIGBUS, and refrain from handling SIGSEGV.
(emacs_fstatat): Wrap android_fstatat on Android.
(sys_fstat, sys_faccessat): New function.
(emacs_openat): Exclude this function when building libemacs.so.
(emacs_open, emacs_open_noquit, emacs_fopen, emacs_close): Wrap
functions defined in the Android filesystem emulation code.
(emacs_fdopen, emacs_fclose, emacs_unlink, emacs_symlink)
(emacs_rmdir, emacs_mkdir, emacs_renameat_noreplace, emacs_rename)
(emacs_fchmodat): New wrappers for more of those functions.
(close_output_streams): Placate the file descriptor sanitizer
that's included with android.

* src/sound.c (Fplay_sound_internal): Pass extra argument to openp.

* src/sfntfont.h:
* src/sfntfont.c:
* src/sfntfont-android.c:
* src/sfnt.h:
* src/sfnt.c: New files.
* src/scroll.c: Exclude the entire file on Android.

* src/process.c: (allocate_pty): Call sys_faccessat, not
faccessat.
(Fmake_process): Call openp with an extra argument.
(wait_reading_process_output): Call android_select.
(Fprocess_send_eof): Don't call tcdrain if not present.
(handle_child_signal): Write a comment describing a small, seldom
encountered issue.

* src/print.c (print_vectorlike): Don't print FONT_EXTRA_INDEX for
font entities.

* src/pdumper.c (Fdump_emacs_portable): Allow dumping in
interactive Emacs's on Android, as this is performed within
loadup.el.
(dump_discard_mem): Use madvise if posix_advise is not present.
(pdumper_load): Call sys_fstat, not fstat.
(syms_of_pdumper) <Vpdumper_fingerprint>: Calculate the
fingerprint for this Emacs executable and store it there.

* src/menu.c (have_boxes): Android has boxes.
(push_submenu_start, push_submenu_end): Define on Android.
(single_menu_item): Produce submenus on Android as well.
(x_popup_menu_1): Call EVENT_START, in contrast to duplicating its
old functionality with calls to Fcar and XCDR.
(Fx_popup_menu): Update documentation to reflect that touch screen
events are now accepted as POSITION.

* src/marker.c (set_marker_internal): Redisplay buffers when their
mark changes, enabling changes to be reported to the IME.

* src/lread.c (lread_fd, lread_fd_cmp, lread_fd_p, lread_close)
(lread_fstat, lread_read_quit, lread_lseek, file_stream)
(file_seek, file_stream_valid_p, file_stream_close)
(file_stream_invalid, getc): New macros.  Define to an
implementation with file descriptors and file streams on systems
other than Android 2.3+, and one using Android file descriptors on
those systems.
(USE_ANDROID_ASSETS): Define on Android 2.3+;
(file_get_char): New function.
(infile, skip_dyn_bytes, skip_dyn_eof, readbyte_from_stdio)
(read_filtered_event, safe_to_load_version, close_infile_unwind):
Implement in terms of those macros.
(close_file_unwind_android_fd): New function.
(Fload): Pass extra argument to `openp' and use Android file
descriptors where possible.
(Flocate_file_internal): Pass extra argument to `openp'.
(maybe_swap_for_eln1): Call sys_fstat, not fstat.
(openp): New arg PLATFORM; if supplied and opening a
platform-specific file descriptor replacement is possible, place
one there.
(build_load_history): Fix typos in comments.
(skip_lazy_string): Implement in terms of the aformentioned
macros.

* src/lisp.h: Add declarations for new functions.
* src/keyboard.h (reading_key_sequence): Declare here.
(EVENT_START): Treat touch screen events specially by returning
the posn of their touch point.

* src/keyboard.c (reading_key_sequence, menu_bar_touch_id): New
variables.
(command_loop_1):
(read_menu_command): Pass false to read_key_sequence.
(read_char): Update commentary.
(readable_events): If text conversion events (edits from an input
method) are queued, return 1.
(kbd_buffer_get_event): If text conversion events exist, carry out
the edits contained within.  Then, generate a Qtext_conversion
event.
(lispy_function_keys, FUNCTION_KEY_OFFSET): Define function key
array on Android.
(coords_in_tab_bar_window): New function.
(make_lispy_event) <TOUCHSCREEN_BEGIN_EVENT>: Keep track of
touches that fall into the confines of the tab bar, and include
the tab bar item in their position lists.  Moreover, retain and
track the touch in C code if it's taking place within the menu
bar.
<TOUCHSCREEN_END_EVENT>: Likewise for the tab bar; generate menu
bar events if the touch ends on a menu item and was previously
singled out for tracking.
<TOUCHSCREEN_UPDATE_EVENT>: Don't deliver this event if the frame
is dead, or if it was identified for tracking since the only touch
sequence that changed begun inside the menu bar.
(handle_async_input): Call android_check_query_urgent.
(handle_input_available_signal): Add memory fence.
(parse_tool_bar_item): Handle `wrap' properties within tool bar
items moving subsequent items onto a new row.
(access_keymap_keyremap): New arguments START, END, KEYBUF.
Set Qcurrent_key_remap_sequence around calls to the remap
function.
(keyremap_step): Pass the necessary information to
access_keymap_keyremap.
(restore_reading_key_sequence): New function.
(read_key_sequence): Set `reading_key_sequence'.  New arg
DISABLE_TEXT_CONVERSION_P, which causes text conversion to be
disabled as long as the key sequence is being read.  Disable text
conversion as well if a menu or function key prefix is read,
insert imaginary prefix keys before touchscreen events within
special areas of a frame.  Don't insert prefix keys if input is
being mocked, which transpires if the input is in actuality
originating from a key translation map.
(read_key_sequence_vs): New argument DISABLE_TEXT_CONVERSION.
(Fread_key_sequence): New argument DISABLE_TEXT_CONVERSION.
(Fopen_dribble_file): Use emacs_fclose.
(head_table): Make touchscreen-begin and touchscreen-end events
touchscreen events.
(syms_of_keyboard) <QCwrap, Qtouchscreen, Qtext_conversion>: New
symbols.
<disable_inhibit_text_conversion, Vcurrent_key_remap_sequence>:
New variables.

* src/inotify.c (Finotify_add_watch): Detect and avoid watching
special files that don't exist from the POV of inotify.

* src/image.c (image_create_bitmap_from_data)
(image_create_bitmap_from_file, free_bitmap_record)
(prepare_image_for_display, image_clear_image_1)
(image_clear_image_1, image_size_in_bytes, image_set_transform):
(Create_Pixmap_From_Bitmap_Data, lookup_rgb_color)
(image_to_emacs_colors, image_from_emacs_colors)
(image_pixmap_draw_cross, image_disable_image): Implement on
Android, reusing much of the X11 code.
(matrix_identity, matrix_rotate, matrix_mirror_horizontal)
(matrix_translate): New functions.
(x_check_image_size, x_create_x_image_and_pixmap)
(x_destroy_x_image, image_check_image_size)
(image_create_x_image_and_pixmap_1, image_destroy_x_image)
(gui_put_x_image, image_get_x_image, image_unget_x_image):
Implement on Android.
(image_find_image_fd): Return an Android file descriptor if
possible.
(close_android_fd): New function.
(slurp_file): Accept `image_fds', defined to Android file
descriptors.
(xpm_load): Enable built-in XPM support on Android.
(xbm_load, pbm_load, png_load_body, jpeg_load_body, gif_load)
(webp_load, imagemagick_load_image, svg_load): Use image file
descriptors on Android; these file descriptors may in fact
represent compressed asset streams, and obviate the necessity of
creating a new file descriptor for each asset image opened.
(Fimage_transforms_p): Report rotate90 on Android.
(image_types, syms_of_image): Enable built-in XPM support on
Android.

* src/fringe.c (init_fringe_bitmap): Bit swap bitmaps on Android,
as on X.

* src/frame.h (enum text_conversion_operation): New enumerator.
(struct text_conversion_action, struct text_conversion_state): New
variable.
(struct frame): New fields `tool_bar_wraps_p' and `conversion'.
Increase the width of `output_method'.
<output_data>: Add `android' field.
<wait_event_type>: Define on Android as well.
(fset_menu_bar_window): Define correctly, so that it's declared on
non-X builds without external menu bars.
(FRAME_ANDROID_P): Define macro.
(FRAME_WINDOW_P) [HAVE_ANDROID]: Define to FRAME_ANDROID_P.
(FRAME_RES): New macro.
(MOUSE_HL_INFO): Define without referencing tty output data on
Android, which doesn't have them.

* src/frame.c (Fframep): Return `android' on Android systems.
(Fwindow_system): Likewise.
(make_frame): Clear text conversion state and `tool_bar_wraps_p'.
(Fmake_terminal_frame): Signal that Android doesn't support text
terminals.
(delete_frame): Reset text conversion state prior to deleting the
frame.
(gui_display_get_resource): Don't call the resource hook on
Android.
(Fx_parse_geometry): Pacify compiler warning.
(make_monitor_attribute_list): Don't always use SOURCE if nil.
(syms_of_frame) <Qandroid>: New symbol.
<Vdefault_frame_scroll_bars>: Don't default scroll bars to an
enabled state on Android.

* src/fontset.c (fontset_find_font): Tackle an unusual problem.
* src/font.h (struct font_entity): New field `is_android'.
(PT_PER_INCH): Define to 160.00 on Android.

* src/font.c (font_make_entity): New function.
(font_make_entity_android): New variant that sets `is_android' to
true.
(font_pixel_size, font_find_for_lface, font_open_for_lface)
(Ffont_face_attributes, Fopen_font): Respect the distinction
between frame text and display scales.

* src/fns.c (Flocale_info): Silence compiler warning.

* src/filelock.c (BOOT_TIME): Undefine BOOT_TIME when building
libemacs.so
(get_boot_time, rename_lock_file, create_lock_file)
(current_lock_owner, make_lock_file_name, unlock_file): Employ
wrappers for Android filesystem operations.

* src/fileio.c (emacs_fd, emacs_fd_open, emacs_fd_close)
(emacs_fd_read, emacs_fd_lseek, emacs_fd_fstat, emacs_fd_valid_p):
New type and macros; define them to suitable values, akin to those
in lread.c
(check_vfs_filename): New function.
(file_access_p): Call `sys_faccessat'.
(close_file_unwind_emacs_fd): New function.
(fclose_unwind): Call `emacs_fclose', not fclose.
(file_name_directory): Export this function.
(user_homedir): If PW->pw_dir is not set and its uid is the
current user, call `android_get_home_directory'.
(get_homedir): Call `android_get_home_directory' if PW->pw_dir is
not set.
(Fcopy_file, Fmake_directory_internal, Fdelete_directory_internal)
(Fdelete_file, Frename_file, Fmake_symbolic_link, Faccess_file)
(file_directory_p, file_accessible_directory_p, Fset_file_modes)
(Fset_file_times, Ffile_newer_than_file_p, read_non_regular)
(Finsert_file_contents, write_region)
(Fverify_visited_file_modtime, Fset_visited_file_modtime)
(do_auto_save_unwind): Make use of Android filesystem wrappers and
file descriptors where possible.
(Fadd_name_to_file): Prohibit creating links to and from files
residing on Android special directories.
(Ffile_system_info): Avoid compilation failure on Android, where
Gnulib can't find out how to implement statfs.

* src/epaths.in [HAVE_ANDROID && !ANDROID_STUBIFY]: Deface this
file, so Makefile cannot change the hard-coded values within.

* src/emacs.c (using_utf8): Correctly initialize mbstate_t on
Android.
(init_cmdargs): Pass extra argument to openp.
(load_pdump): When building libemacs.so, use solely the file
provided on the command line or as an argument to
`android_emacs_init'.
(load_seccomp): Call sys_fstat, not fstat.
(main, android_emacs_init): Name `main' `android_emacs_init' when
building libemacs.so, and accept an argument designating the dump
file.
(main): Initialize text conversion and Android.  Don't presume
that argv is NULL terminated.
(Fkill_emacs, shut_down_emacs): Properly implement RESTART on
Android.
(syms_of_emacs) <Vsystem_type>: Describe the possible value
`android'.

* src/emacs-module.c (MODULE_HANDLE_NONLOCAL_EXIT): Cease relying
on GCC clean-up attribute extension.
(MODULE_INTERNAL_CLEANUP): New macro.
(module_make_global_ref, module_free_global_ref)
(module_make_function, module_get_function_finalizer)
(module_make_interactive, module_funcall, module_extract_integer)
(module_extract_float, module_copy_string_contents)
(module_get_user_ptr, module_set_user_ptr)
(module_get_user_finalizer, module_set_user_finalizer)
(module_vec_set, module_vec_size, module_process_input)
(module_extract_big_integer, module_make_big_integer): Carry out
necessary clean-up tasks using MODULE_HANDLE_NONLOCAL_EXIT.

* src/editfns.c (Fuser_full_name): Call `android_user_full_name',
as USER_FULL_NAME doesn't always work.

* src/doc.c (doc_fd, doc_fd_p, doc_open, doc_read_quit)
(doc_lseek): New types and macros, resembling those in lread.c.
(get_doc_string, Fsnarf_documentation): Implement in terms of
those macros, so as to use Android asset streams directly.

* src/dispnew.c (clear_current_matrices, clear_desired_matrices)
(allocate_matrices_for_window_redisplay, free_glyphs)
(redraw_frame, update_frame, scrolling, update_frame_line):
Disable support for text terminals when building for Android.
(Fopen_termscript): Use emacs_fclose.
(init_display_interactive): Set Vinitial_window_system to
Qandroid, and lose if Emacs needs to create a text terminal.

* src/dispextern.h (No_Cursor, Emacs_Rectangle, struct gui_box):
New definitions.
(struct glyph_string) <gc>: Define to the Android GC type.
(HAVE_NATIVE_TRANSPHORMS): Define on Android.
(struct image): New fields `ximg', `mask_img', as on X.
(enum tool_bar_item_idx): New tool bar item property
TOOL_BAR_ITEM_WRAP.

* src/dired.c (emacs_dir, emacs_closedir, emacs_readdir): New
typedef and definitions.
(open_directory): Return emacs_dir; use android_opendir on
Android, instead of at-funcs.
(directory_files_internal_unwind): Call emacs_closedir.
(read_dirent): Call emacs_readdir.
(directory_files_internal, file_name_completion)
(file_name_completion_dirp): Use Android wrappers for directories
and files.
(file_attributes): Abstain from openat on Android.

* src/conf_post.h (MB_CUR_MAX): Define to REPLACEMENT_MB_CUR_MAX
if necessary to counteract inept LLVM headers.

* src/coding.h (from_unicode_buffer): Define if HAVE_ANDROID as
well.

* src/coding.c (from_unicode_buffer): Define on Android, creating
a variant that understands UCS-16 extended into wchar_t.
(syms_of_coding) <Qutf_16le>: Define on Android.

* src/charset.c (load_charset_map_from_file): Supply extra
argument to openp, and call Emacs wrappers for fdopen and fclose.

* src/callproc.c (get_current_directory): Return the home
directory if ENCODED is a special directory.
(delete_temp_file): Call emacs_unlink in lieu of unlink.
(call_process): Use openp.
(emacs_spawn): Use Android executable loader binary if needed and
enabled.
(init_callproc): Set Vshell_file_name to /system/bin/sh if
libemacs.so.
(syms_of_callproc) <Vctags_program_name, Vetags_program_name,
Vhexl_program_name, Vemacsclient_program_name,
Vmovemail_program_name>: New variables.  Define to the names of
the programs they respectively stand for.

* src/callint.c (Fcall_interactively): Supply new argument in
calls to Fread_key_sequence and Fread_key_sequence_vector.

* src/buffer.h (struct buffer) <text_conversion_style_>: New bvar.
(bset_text_conversion_style): New bvar setter.

* src/buffer.c (init_buffer_once): Set the text conversion style.
(syms_of_buffer) <BVAR (current_buffer, text_conversion_style)>:
Define new BLV.

* src/androidvfs.c:
* src/androidterm.h:
* src/androidterm.c:
* src/androidselect.c:
* src/androidmenu.c:
* src/androidgui.h:
* src/androidfont.c:
* src/androidfns.c:
* src/android.h:
* src/android.c:
* src/android-emacs.c:
* src/android-asset.h: New function.

* src/alloc.c (cleanup_vector): Finalize Android font entities.
(find_string_data_in_pure) [__i386__ && !__clang__]: On Android,
compensate for a bug in the latest NDK GCC.
(mark_pinned_symbols, android_make_lisp_symbol): Elude another
bug in debuginfo generation with an almost nonsensical fix.
(garbage_collect): Mark androidterm and sfntfont.
(mark_frame): Mark text conversion actions and info.

* src/Makefile.in (XCONFIGURE): New variable.  If set, add srcdir
to vpath.
(hostlib): New variable, always defined to libgnu.a on the build
machine.
(GIF_CFLAGS, JPEG_CFLAGS, TIFF_CFLAGS, SQLITE3_CFLAGS)
(LIBSELINUX_CFLAGS, ANDROID_OBJ, ANDROID_LIBS, ANDROID_LDFLAGS)
(ANDROID_BUILD_CFLAGS, LIBGMP_CFLAGS): New variables.
(CM_OBJ): Update commentary.
(EMACS_CFLAGS): Add new compiler flags variables.
(base_obj): Add ANDROID_OBJ.
(SOME_MACHINE_OBJECTS): Add Android-related objects.
(lisp.mk): Generate from its absolute file name.
($(lispsource)/international/charprop.el): Don't generate when
building libemacs.so.
($(libsrc)/make-docfile$(EXEEXT)
$(libsrc)/make-fingerprint$(EXEEXT)): Depend on libgnu.a on the
build machine.
(mostlyclean): Remove libemacs.so.
(build-counter.c, libemacs.so, android-emacs): New targets.  These
targets are made from this Makefile copied to a subdirectory of
`cross', and provide the Emacs library and an ancillary binary
used by the Android port.

* nt/mingw-cfg.site:
* nt/gnulib-cfg.mk: Impede building Gnulib's vasnprintf* code.

* msdos/sedlibmk.inp:
* msdos/sedlibcf.inp:
* msdos/sed3v2.inp:
* msdos/sed1v2.inp: Fix the DJGPP build.

* make-dist (possibly_non_vc_files): Add exec/configure and
exec/config.h.in.

* m4/ndk-build.m4: New file.

* m4/getline.m4:
* m4/getdelim.m4:
* m4/asm-underscore.m4: Update from Gnulib.

* lisp/wid-edit.el (widget-event-point): Treat touch screen events
correctly.
(widget-keymap): Map touchscreen-begin to widget-button-click.
(widget-event-start): New function.
(widget-button--check-and-call-button):
(widget-button-click): Behave correctly when confronted by touch
screen events.

* lisp/version.el (android-read-build-system)
(android_read_build_time): New functions.
(emacs-build-system, emacs-repository-version-android)
(emacs-repository-get-version):
(emacs-repository-get-branch): Implement properly on Android, by
reading a file generated during the packaging process.

* lisp/touch-screen.el: New file, supplying support for
translating raw touch screen events into gestures.

* lisp/tool-bar.el (secondary-tool-bar-map): New defvar.
(tool-bar--cache-key, tool-bar--secondary-cache-key): Make
defsubsts.
(tool-bar--flush-key): Flush caches for the secondary tool bar as
well.
(tool-bar-make-keymap, tool-bar-make-keymap-1): Append the
secondary tool bar map below the primary tool bar map.
(modifier-bar-modifier-list): New variable.
(tool-bar-apply-modifiers, modifier-bar-button)
(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, modifier-bar-available-p)
(modifier-bar-mode): New functions.

* lisp/textmodes/text-mode.el (text-mode): Set
text-conversion-style to t.

* lisp/textmodes/reftex-global.el (reftex-create-tags-file): Use
etags-program-name to provide the name of the etags program.
* lisp/textmodes/conf-mode.el (conf-mode-initialize): Enable text
conversion.
* lisp/textmodes/artist.el (artist-figlet-get-font-list): Use
/system/bin/sh on Android.

* lisp/term/android-win.el: New file.

* lisp/term.el (term-mode): Always display the on screen keyboard.
(term-exec-1): Use /system/bin/sh on Android.

* lisp/tab-line.el (tab-line-tab-map)
(tab-line-new-tab)
(tab-line-select-tab)
(tab-line-close-tab)
(tab-line-track-tap)
(tab-line-event-start): Improve support for touch screen events.

* lisp/tab-bar.el (tab-bar-mouse-context-menu):
(tab-bar-map): Likewise.
(tab-bar-handle-timeout, tab-bar-touchscreen-begin): New
functions.

* lisp/subr.el (event-start): Don't return nonsense if EVENT is a
touchscreen event.
(event-end): Likewise.
(read-key): Disable text conversion within
read-key-sequence-vector.
(read-char-choice-with-read-key): Display the on screen keyboard.
(read-char-from-minibuffer): Disable text conversion.
(use-dialog-box-p): Prefer dialog boxes on Android.
(y-or-n-p): Disable text conversion properly under all three modes
of operation.

* lisp/startup.el (android-fonts-enumerated): New variable.
(normal-top-level): Load system fonts on Android.

* lisp/speedbar.el (speedbar-fetch-etags-command): Use
etags-program-name instead of hard-coding `etags'.

* lisp/simple.el (normal-erase-is-backspace-setup-frame): Return
true on Android.
(event-apply-modifier): Correctly apply Shift and Control
modifiers to keys with other modifiers.
(undo-auto-amalgamate): Mention analyze-text-conversion wrt being
an amalgamating command.

* lisp/shell.el (shell--command-completion-data): Don't lose
if PATH contains an inaccessible directory.

* lisp/progmodes/prog-mode.el (prog-mode): Enable text conversion.
* lisp/progmodes/cperl-mode.el (cperl-etags): Don't hard-code
etags, employ etags-program-name instead.

* lisp/progmodes/cc-mode.el (c-initialize-cc-mode): Initialize
text conversion hook.
* lisp/progmodes/cc-cmds.el (c-post-text-conversion): New
function.  Do electric characters.

* lisp/play/gamegrid.el (gamegrid-setup-default-font): Don't crash
if the display resolution is too high.

* lisp/play/dunnet.el (text-conversion-style):
* lisp/play/doctor.el (doctor-mode): Enable text conversion.

* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down-page)
(pixel-scroll-precision-scroll-Up-page): Make autoloads.

* lisp/org/org-ctags.el (org-ctags-path-to-ctags): Use
ctags-program-name, not ctags.

* lisp/obsolete/terminal.el (terminal-emulator): Start
/system/bin/sh, not /bin/sh.

* lisp/net/tramp.el (tramp-encoding-shell): Use /system/bin/sh on
Android.

* lisp/net/eww.el (eww-form-submit, eww-form-file)
(eww-form-checkbox, eww-form-select): Define these faces on
Android as well.

* lisp/net/browse-url.el (browse-url-default-browser)
(browse-url--browser-defcustom-type): Specify on Android.
(browse-url-android-share, browse-url-default-android-browser):
New option and function.

* lisp/mwheel.el (mouse-wheel-down-event, mouse-wheel-up-event)
(mouse-wheel-left-event, mouse-wheel-right-event): Define suitably
on Android.

* lisp/mouse.el (minor-mode-menu-from-indicator): New argument
EVENT.  Use it for positioning the menu.
(mouse-minor-mode-menu): Pass EVENT to that function.

* lisp/minibuffer.el (clear-minibuffer-message): Don't clear the
message if `touch-screen-preview-select' may be underway.
(minibuffer-mode): Enable text conversion.
(minibuffer-setup-on-screen-keyboard)
(minibuffer-exit-on-screen-keyboard): New functions.

* lisp/menu-bar.el (menu-bar-close-window): New option.
(menu-bar-edit-menu): Bind execute-extended-command to a menu
item.
(kill-this-buffer, kill-this-buffer-enabled-p): Respect
menu-bar-close-window.

* lisp/mail/rmail.el (rmail-autodetect, rmail-insert-inbox-text):
Don't hard-code the name of movemail; rather, use
movemail-program-name.
* lisp/mail/emacsbug.el (emacs-build-description): Insert the
Android version and manufacturer.

* lisp/ls-lisp.el (ls-lisp-use-insert-directory-program): Default
to off on Android.

* lisp/loadup.el: Set load-list to empty load list after startup;
dump the first time Emacs starts, and load Android related
miscellanea.

* lisp/isearch.el (isearch-text-conversion-style): New variable.
(isearch-mode, isearch-done): Display the OSK, then temporarily
disable and restore the on screen keyboard.

* lisp/international/mule-cmds.el (set-coding-system-map): Update
menu definition for Android.

* lisp/international/fontset.el (script-representative-chars)
(setup-default-fontset): Improve detection of CJK fonts.

* lisp/image/wallpaper.el: Fix compiler warning.

* lisp/ielm.el (inferior-emacs-lisp-mode): Don't hard-code name of
hexl, replacing that with hexl-program-name.

* lisp/htmlfontify.el (hfy-etags-bin): Replace hard-coded Emacs
with etags-program-name.

* lisp/hexl.el (hexl-program): Replace hard-coded hexl.

* lisp/help-macro.el (make-help-screen): Display the on screen
keyboard and disable text conversion prior to reading options.

* lisp/gnus/mail-source.el (mail-source-movemail-program): Replace
hard-coded movemail with movemail-program-name.

* lisp/gnus/gnus-score.el (gnus-read-char): New function.
(gnus-summary-increase-score): Use a dialog box to display
these options on Android.

* lisp/frame.el (frame-geometry, frame-edges)
(mouse-absolute-pixel-position, set-mouse-absolute-pixel-position)
(frame-list-z-order, frame-restack, display-mouse-p)
(display-popup-menus-p, display-graphic-p, display-symbol-keys-p)
(display-screens, display-pixel-height, display-pixel-width)
(display-mm-height, display-mm-width, display-backing-store)
(display-save-under, display-planes, display-color-cells)
(display-visual-class, display-monitor-attributes-list): Implement
window system specific functions on Android.

* lisp/files.el (basic-save-buffer): Allow files to exist without
a parent directory.

* lisp/faces.el (tool-bar): Use default definition on Android.

* lisp/emacs-lisp/eldoc.el (eldoc-add-command-completions): Add
touch-screen-handle-touch and analyze-text-conversion.

* lisp/elec-pair.el (electric-pair-analyze-conversion): New
function.

* lisp/doc-view.el (doc-view-menu): Improve menu.
(doc-view-tool-bar-map): Add a new tool bar for Doc View.
(doc-view-new-search): New command.
(doc-view-mode): Enable that new tool bar.

* lisp/dired-aux.el (dired-do-chxxx, dired-do-chmod)
(dired-do-print, dired-do-shell-command, dired-do-compress-to)
(dired-do-create-files, dired-do-rename, dired-do-isearch)
(dired-do-isearch-regexp, dired-do-search)
(dired-do-query-replace-regexp, dired-do-find-regexp)
(dired-vc-next-action): Disable ``click to select'' after
running this command.
* lisp/dired.el (dired-insert-set-properties): Attach
click-to-select keymap to file names if necessary.
(dired-mode-map): Bind `touchscreen-hold' to click to select
mode.
(dired-post-do-command): New function.
(dired-do-delete): Call it.
(dired-mark-for-click, dired-enable-click-to-select-mode): New
functions.
(dired-click-to-select-mode): New minor mode.

* lisp/cus-edit.el (custom-button-mouse, custom-button-pressed)
(custom-display): Define faces to their default values on Android.

* lisp/comint.el (comint-mode): Enable text conversion.

* lisp/cedet/semantic/db-ebrowse.el
(semanticdb-create-ebrowse-database): Replace fixed ebrowse with
ebrowse-program-name.

* lisp/calc/calc.el (calc-mode): Display the on screen keyboard.
(calc): Insist on displaying the on screen keyboard.

* lisp/button.el (button-map): Bind touch screen events to
push-button.
(push-button): Deal with touch screen events.

* lisp/bindings.el (cut, paste, cut, text-conversion): New
bindings.

* lisp/battery.el (battery-status-function): Use
`battery-android'.
(battery-android): New function.

* lib/gnulib.mk.in:
* lib/getline.c:
* lib/getdelim.c:
* lib/Makefile.in: Update from Gnulib.

* lib-src/emacsclient.c (decode_options): Set `alt_display' to
`android'.

* lib-src/asset-directory-tool.c: New file.

* lib-src/Makefile.in: Adapt for cross-compilation.

* java/res/xml/preferences.xml:
* java/res/values/style.xml:
* java/res/values/strings.xml:
* java/res/values/bool.xml:
* java/res/values-v29/style.xml:
* java/res/values-v24/bool.xml:
* java/res/values-v19/bool.xml:
* java/res/values-v14/style.xml:
* java/res/values-v11/style.xml:
* java/org/gnu/emacs/EmacsWindowAttachmentManager.java:
* java/org/gnu/emacs/EmacsWindow.java:
* java/org/gnu/emacs/EmacsView.java:
* java/org/gnu/emacs/EmacsThread.java:
* java/org/gnu/emacs/EmacsSurfaceView.java:
* java/org/gnu/emacs/EmacsService.java:
* java/org/gnu/emacs/EmacsSdk8Clipboard.java:
* java/org/gnu/emacs/EmacsSdk7FontDriver.java:
* java/org/gnu/emacs/EmacsSdk23FontDriver.java:
* java/org/gnu/emacs/EmacsSdk11Clipboard.java:
* java/org/gnu/emacs/EmacsSafThread.java:
* java/org/gnu/emacs/EmacsPreferencesActivity.java:
* java/org/gnu/emacs/EmacsPixmap.java:
* java/org/gnu/emacs/EmacsOpenActivity.java:
* java/org/gnu/emacs/EmacsNoninteractive.java:
* java/org/gnu/emacs/EmacsNative.java:
* java/org/gnu/emacs/EmacsMultitaskActivity.java:
* java/org/gnu/emacs/EmacsLauncherPreferencesActivity.java:
* java/org/gnu/emacs/EmacsInputConnection.java:
* java/org/gnu/emacs/EmacsHolder.java:
* java/org/gnu/emacs/EmacsHandleObject.java:
* java/org/gnu/emacs/EmacsGC.java:
* java/org/gnu/emacs/EmacsFontDriver.java:
* java/org/gnu/emacs/EmacsFillRectangle.java:
* java/org/gnu/emacs/EmacsFillPolygon.java:
* java/org/gnu/emacs/EmacsDrawable.java:
* java/org/gnu/emacs/EmacsDrawRectangle.java:
* java/org/gnu/emacs/EmacsDrawPoint.java:
* java/org/gnu/emacs/EmacsDrawLine.java:
* java/org/gnu/emacs/EmacsDocumentsProvider.java:
* java/org/gnu/emacs/EmacsDirectoryEntry.java:
* java/org/gnu/emacs/EmacsDialogButtonLayout.java:
* java/org/gnu/emacs/EmacsDialog.java:
* java/org/gnu/emacs/EmacsCursor.java:
* java/org/gnu/emacs/EmacsContextMenu.java:
* java/org/gnu/emacs/EmacsClipboard.java:
* java/org/gnu/emacs/EmacsApplication.java:
* java/org/gnu/emacs/EmacsActivity.java:
* java/debug.sh:
* java/README:
* java/Makefile.in:
* java/INSTALL:
* java/AndroidManifest.xml.in:
* exec/trace.c:
* exec/test.c:
* exec/mipsfpu.h:
* exec/mipsfpu.c:
* exec/mipsel-user.h:
* exec/loader-x86_64.s:
* exec/loader-x86.s:
* exec/loader-mipsel.s:
* exec/loader-mips64el.s:
* exec/loader-armeabi.s:
* exec/loader-aarch64.s:
* exec/install-sh:
* exec/exec1.c:
* exec/exec.h:
* exec/exec.c:
* exec/deps.mk:
* exec/configure.ac:
* exec/config.sub:
* exec/config.h.in:
* exec/config.guess:
* exec/config-mips.m4.in:
* exec/README:
* exec/Makefile.in:
* etc/images/last-page.xpm: New files.

* etc/PROBLEMS: Expound upon problems with font instructing on
Android.

* etc/NEWS: Announce changes.

* etc/MACHINES: Describe support for Android.

* etc/DEBUG: Illustrate the steps to debug Emacs on Android.

* doc/lispref/processes.texi (Subprocess Creation):
* doc/lispref/os.texi (System Environment):
* doc/lispref/keymaps.texi (Translation Keymaps):
(Extended Menu Items):
(Tool Bar):
* doc/lispref/frames.texi (Frames):
(Frame Layout):
(Font and Color Parameters):
(Pop-Up Menus):
(Window System Selections):
* doc/lispref/elisp.texi (Top):
* doc/lispref/display.texi (Defining Faces):
(Window Systems):
* doc/lispref/commands.texi (Touchscreen Events):
(Touchscreen Events):
(Misc Events):
(Key Sequence Input):
* doc/emacs/windows.texi (Tab Line):
* doc/emacs/input.texi:
* doc/emacs/frames.texi (Tool Bars):
(Tab Bars):
* doc/emacs/emacs.texi (Top):
* doc/emacs/dired.texi (Marks vs Flags):
* doc/emacs/android.texi:
* doc/emacs/Makefile.in (EMACSSOURCES): Update the documentation
to properly describe changes effected.

* cross/verbose.mk.android:
* cross/ndk-build/ndk-resolve.mk:
* cross/ndk-build/ndk-prebuilt-static-library.mk:
* cross/ndk-build/ndk-prebuilt-shared-library.mk:
* cross/ndk-build/ndk-clear-vars.mk:
* cross/ndk-build/ndk-build.mk.in:
* cross/ndk-build/ndk-build-static-library.mk:
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-executable.mk:
* cross/ndk-build/README:
* cross/ndk-build/Makefile.in:
* cross/langinfo.h:
* cross/README:
* cross/Makefile.in: New files.
* configure.ac: Configure Emacs for cross-compilation on Android.

* build-aux/ndk-module-extract.awk:
* build-aux/ndk-build-helper.mk:
* build-aux/ndk-build-helper-4.mk:
* build-aux/ndk-build-helper-3.mk:
* build-aux/ndk-build-helper-2.mk:
* build-aux/ndk-build-helper-1.mk:
* build-aux/makecounter.sh: New file.
* autogen.sh: Autogen in exec as well.

* admin/merge-gnulib (GNULIB_MODULES): Add getline, stpncpy and
strnlen.  Clean lib.

* README:
* Makefile.in:
* INSTALL: Update for Android.
* .dir-locals.el (c-mode): Add a few new types.

16 months ago; ChangeLog.android: Update.
Po Lu [Mon, 7 Aug 2023 00:30:42 +0000 (08:30 +0800)]
; ChangeLog.android: Update.

16 months ago* nt/mingw-cfg.site: Remove additions for Gnulib printf.
Po Lu [Mon, 7 Aug 2023 00:19:40 +0000 (08:19 +0800)]
* nt/mingw-cfg.site: Remove additions for Gnulib printf.

16 months agoUpdate from Gnulib, remove printf-posix
Po Lu [Mon, 7 Aug 2023 00:14:38 +0000 (08:14 +0800)]
Update from Gnulib, remove printf-posix

* m4, lib: Update from Gnulib.

* msdos/sedlibmk.inp: Remove variables deleted as part of previous
change.

* admin/merge-gnulib (GNULIB_MODULES): Remove vasprintf and
printf-posix.

16 months agoMerge remote-tracking branch 'origin/master' into feature/android
Po Lu [Sun, 6 Aug 2023 23:56:44 +0000 (07:56 +0800)]
Merge remote-tracking branch 'origin/master' into feature/android

16 months agoMark Emacs 21 compat aliases `lm-*-mark` obsolete
Stefan Kangas [Sun, 6 Aug 2023 18:39:10 +0000 (20:39 +0200)]
Mark Emacs 21 compat aliases `lm-*-mark` obsolete

* lisp/emacs-lisp/lisp-mnt.el (lm-section-mark, lm-code-mark)
(lm-commentary-mark, lm-history-mark): Mark Emacs 21 compatibility
aliases obsolete.  Update all callers to use the new name.

16 months ago; Pacify new nadvice-tests byte-compiler warnings.
Basil L. Contovounesios [Sun, 6 Aug 2023 18:10:16 +0000 (20:10 +0200)]
; Pacify new nadvice-tests byte-compiler warnings.

16 months agoStop using printf %n
Paul Eggert [Sun, 6 Aug 2023 16:08:56 +0000 (09:08 -0700)]
Stop using printf %n

* src/emacs.c (shut_down_emacs): Don’t use printf’s "%n" format.
Android, MS-Windows, and OpenBSD don’t support it, and it’s easy
enough to do its equivalent by hand.

16 months agoFix last change of 'delete-file'
Eli Zaretskii [Sun, 6 Aug 2023 14:03:26 +0000 (17:03 +0300)]
Fix last change of 'delete-file'

* src/fileio.c (Fdelete_file_internal): Expand file name here, as
all primitives must.
(internal_delete_file): Adjust to the fact that Fdelete_file was
renamed.

* lisp/files.el (delete-file): Don't expand-file-name here, as
the called primitives already do.  Fix typo in doc string.

16 months ago; ChangeLog.android: update.
Po Lu [Sun, 6 Aug 2023 13:53:44 +0000 (21:53 +0800)]
; ChangeLog.android: update.

16 months agoUpdate Android port
Po Lu [Sun, 6 Aug 2023 13:53:13 +0000 (21:53 +0800)]
Update Android port

* java/org/gnu/emacs/EmacsService.java (readDirectoryEntry): Fix
potential NULL dereference.

16 months agoMerge remote-tracking branch 'origin/master' into feature/android
Po Lu [Sun, 6 Aug 2023 13:45:44 +0000 (21:45 +0800)]
Merge remote-tracking branch 'origin/master' into feature/android

16 months agoUpdate Android port
Po Lu [Sun, 6 Aug 2023 13:45:29 +0000 (21:45 +0800)]
Update Android port

* java/org/gnu/emacs/EmacsNative.java: Declare ftruncate.

* java/org/gnu/emacs/EmacsSafThread.java (openDocument1): If
initially opening with rwt, verify the file descriptor is really
writable; if not, resort to rw and truncating the file descriptor
by hand instead.

* src/androidvfs.c (NATIVE_NAME (ftruncate)): New function.
Truncate file descriptor and return whether that was successful.

16 months agoSeparate filename-deletion mechanism from policy.
Eric S. Raymond [Sun, 6 Aug 2023 11:00:22 +0000 (07:00 -0400)]
Separate filename-deletion mechanism from policy.

src/fileio.c: (delete-file-internal) Renamed from delete-file,
              parallel to delete-directory-internal; policy
      code moved to Lisp.
src/files.el: (delete-file) New function, holds policy logic.
              calls delete-file-internal.

This is a pure refactoring step, delete-file's behavior is
unchanged. But the C core is a little simpler now.

16 months ago; Fix last patch
Michael Albinus [Sun, 6 Aug 2023 11:50:11 +0000 (13:50 +0200)]
; Fix last patch

16 months ago; Silence byte-compiler
Stefan Kangas [Sun, 6 Aug 2023 10:14:40 +0000 (12:14 +0200)]
; Silence byte-compiler

* test/src/treesit-tests.el (treesit-pattern-expand): Declare.

16 months agoMerge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Michael Albinus [Sun, 6 Aug 2023 09:44:43 +0000 (11:44 +0200)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs

16 months agoSuppress some Tramp tests for OpenBSD
Michael Albinus [Sun, 6 Aug 2023 09:43:48 +0000 (11:43 +0200)]
Suppress some Tramp tests for OpenBSD

* test/lisp/net/tramp-tests.el (tramp--test-openbsd-p): New defun.
(tramp-test41-special-characters, tramp-test42-utf8): Use it.
(Bug#64935)

16 months agoMark Emacs 20 color support compat aliases obsolete
Stefan Kangas [Sun, 6 Aug 2023 09:35:02 +0000 (11:35 +0200)]
Mark Emacs 20 color support compat aliases obsolete

* lisp/faces.el (x-defined-colors, x-color-defined-p)
(x-color-values, x-display-color-p): Make Emacs 20 compat aliases
obsolete.  Update one caller to use the new names.
* doc/lispref/frames.texi (Color Names): Do not document above
obsolete aliases.

16 months agoMark unused macro defun-gmm obsolete
Stefan Kangas [Sun, 6 Aug 2023 09:19:27 +0000 (11:19 +0200)]
Mark unused macro defun-gmm obsolete

* lisp/gnus/gmm-utils.el (defun-gmm): Mark as obsolete.

16 months ago; * admin/notes/unicode (char-width-table): Update instructions.
Eli Zaretskii [Sun, 6 Aug 2023 09:10:37 +0000 (12:10 +0300)]
; * admin/notes/unicode (char-width-table): Update instructions.

16 months agoMerge from origin/emacs-29
Jim Porter [Sun, 6 Aug 2023 04:26:14 +0000 (21:26 -0700)]
Merge from origin/emacs-29

1e8322bb26e Fix handling of 'byte-compile-ignore-files' when nil

16 months agoUpdate Android port
Po Lu [Sun, 6 Aug 2023 03:46:15 +0000 (11:46 +0800)]
Update Android port

* src/androidvfs.c (android_saf_tree_chmod): Repair file access
permissions allowed within FLAGS.

16 months agoMerge remote-tracking branch 'origin/master' into feature/android
Po Lu [Sat, 5 Aug 2023 23:38:10 +0000 (07:38 +0800)]
Merge remote-tracking branch 'origin/master' into feature/android

16 months agoFix handling of 'byte-compile-ignore-files' when nil
Jim Porter [Fri, 4 Aug 2023 20:01:35 +0000 (13:01 -0700)]
Fix handling of 'byte-compile-ignore-files' when nil

Before this fix, when 'byte-compile-ignore-files' was nil,
'byte-recompile-directory' would ignore every file (bug#64985).

* lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Handle case
when 'byte-compile-ignore-files' is nil.

16 months ago* test/lisp/align-resources/c-mode.erts: Make test agree with Emacs
Mattias Engdegård [Sat, 5 Aug 2023 16:22:07 +0000 (18:22 +0200)]
* test/lisp/align-resources/c-mode.erts: Make test agree with Emacs

This eliminates a failure in align-tests.  There doesn't seem to be
anything obviously wrong with Emacs's behaviour in this case.

16 months ago; Merge from origin/emacs-29
Michael Albinus [Sat, 5 Aug 2023 16:18:31 +0000 (18:18 +0200)]
; Merge from origin/emacs-29

The following commit was skipped:

2695af297e8 Sync with Tramp 2.6.2-pre

16 months agoMerge from origin/emacs-29
Michael Albinus [Sat, 5 Aug 2023 16:18:30 +0000 (18:18 +0200)]
Merge from origin/emacs-29

f2b2c752a59 Fix documentation of saveplace facilities for Dired
4ed9d61c89a ; * lisp/tab-bar.el: Autoload cl--set-substring, as that ...
30976ecd8d8 ; * lisp/bindings.el (mode-line-modes): Fix typo (bug#650...
8574ef314c4 Fix loaddef generation with ";;;foo-autoload" cookies in ...
8cbd4a02a2b Delete comment saying that project.el is experimental

16 months agoSync with Tramp 2.6.2-pre
Michael Albinus [Sat, 5 Aug 2023 16:07:58 +0000 (18:07 +0200)]
Sync with Tramp 2.6.2-pre

* doc/misc/tramp.texi (Overview): Use "scp" in example.
(Obtaining @value{tramp}): Prefer https: to git: URIs on Savannah.
(Ssh setup): Extend for MS Windows and ssh.  Explain
tramp-use-ssh-controlmaster-options value `suppress'.
(File name completion): Remove completion styles restrictions.
(Ad-hoc multi-hops): Describe tramp-show-ad-hoc-proxies.
(Remote processes): Add reference to "Using ssh connection sharing".

* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Set to "2.6.2-pre".

* lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions):
* lisp/net/tramp-archive.el
(tramp-archive-handle-file-name-all-completions):
* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions):
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions):
* lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions):
* lisp/net/tramp-sudoedit.el
(tramp-sudoedit-handle-file-name-all-completions): Return nil when
DIRECTORY is missing.  (Bug#61890)

* lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT
anymore, default it to 0.  When the connection uses a shared
socket possibly, accept also the output from other processes over
the same connection.  (Bug#61350)
(tramp-handle-file-notify-rm-watch, tramp-action-process-alive)
(tramp-action-out-of-band, tramp-process-one-action)
(tramp-interrupt-process):
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
* lisp/net/tramp-smb.el (tramp-smb-action-get-acl)
(tramp-smb-action-set-acl, tramp-smb-wait-for-output):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees.

* lisp/net/tramp.el (tramp-get-process, tramp-message)
(tramp-handle-make-process, tramp-handle-file-notify-valid-p)
(tramp-process-actions, tramp-accept-process-output)
(tramp-process-sentinel, tramp-read-passwd)
(tramp-interrupt-process, tramp-signal-process):
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
* lisp/net/tramp-crypt.el (tramp-crypt-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
(tramp-gvfs-monitor-process-filter)
(tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-gio-monitor-process-filter)
(tramp-sh-inotifywait-process-filter)
(tramp-barf-if-no-shell-prompt, tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sshfs.el (tramp-sshfs-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection)
(tramp-sudoedit-send-command): Prefix internal process properties
with "tramp-".

* lisp/net/tramp.el (tramp-skeleton-file-exists-p): New defmacro,
which also handles host name completion.
(tramp-handle-file-exists-p):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p): Use it.

* lisp/net/tramp.el (tramp-wrong-passwd-regexp):
* lisp/net/tramp-adb.el (tramp-adb-prompt):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection): Unify regexps.

* lisp/net/tramp.el:
* lisp/net/tramp-cmds.el:
* lisp/net/tramp-crypt.el:
* lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-smb.el: Fix error messages.

* lisp/net/tramp-cmds.el (tramp-cleanup-connection):
Protect `delete-process'.

* lisp/net/tramp.el (tramp-prefix-format, tramp-prefix-regexp)
(tramp-method-regexp, tramp-postfix-method-format)
(tramp-postfix-method-regexp, tramp-prefix-ipv6-format)
(tramp-prefix-ipv6-regexp, tramp-postfix-ipv6-format)
(tramp-postfix-ipv6-regexp, tramp-postfix-host-format)
(tramp-postfix-host-regexp, tramp-remote-file-name-spec-regexp)
(tramp-file-name-structure, tramp-file-name-regexp)
(tramp-completion-method-regexp)
(tramp-completion-file-name-regexp):
* lisp/net/tramp-compat.el (tramp-syntax):
* lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-event-vector):
Rearrange declarations.

* lisp/net/tramp-compat.el (ansi-color): Require.
(ls-lisp): Don't require.  (Bug#64124)
(tramp-compat-replace-regexp-in-region): Move up.
(tramp-compat-length<, tramp-compat-length>)
(tramp-compat-length=): New defaliases.
(tramp-compat-file-name-unquote, tramp-compat-take)
(tramp-compat-ntake): Use them.

* lisp/net/tramp-container.el (tramp-container--completion-function):
Rename from `tramp-docker--completion-function'.  Add argument
PROGRAM.  Use it for "docker" and "podman" host name completion.

* lisp/net/tramp-crypt.el (tramp-crypt-handle-file-exists-p):
New defun.
(tramp-crypt-file-name-handler-alist): Add it.

* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.
(tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing
mount points.
(tramp-fuse-mounted-p): The mount-spec could contain an optional
trailing slash.  (Bug#64278)

* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file)
* lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file):
Improve stability for WebDAV.
(tramp-rclone-handle-file-system-info): Check return code of
command.

* lisp/net/tramp-gvfs.el (while-no-input-ignore-events):
Add `dbus-event' for older Emacs versions.
(tramp-gvfs-parse-device-names): Ignore errors.

* lisp/net/tramp-sh.el (tramp-display-escape-sequence-regexp)
(tramp-device-escape-sequence-regexp): Delete.
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-use-ssh-controlmaster-options): Allow new value `suppress'.
(tramp-ssh-option-exists-p): New defun.
(tramp-ssh-controlmaster-options): Implement `suppress' actions.
Should never return nil, but empty string.
(tramp-perl-file-name-all-completions): Don't print status message.
(tramp-sh-handle-file-name-all-completions): Return nil when check
fails.  (Bug#61890)
(tramp-run-test): Add VEC argument.
(tramp-sh-handle-file-executable-p)
(tramp-sh-handle-file-readable-p)
(tramp-sh-handle-file-directory-p)
(tramp-sh-handle-file-writable-p): Adapt callees.
(tramp-sh-handle-insert-directory):
(tramp-sh-handle-insert-directory): Test whether -N is understood
by ls since that option is used along with --dired.  Remove -N
when we remove --dired.  (Bug#63142)
(tramp-sh-handle-insert-directory, tramp-barf-if-no-shell-prompt)
(tramp-wait-for-output): Use `ansi-color-control-seq-regexp'.
(tramp-sh-handle-expand-file-name): `null-device' could be nil.
Reported by Richard Copley <rcopley@gmail.com>.
(tramp-sh-handle-make-process): Improve handling of
connection-type `pipe'.  (Bug#61341)

* lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-symbolic-link):
Flush TARGET file properties.

* lisp/net/tramp-smb.el (tramp-smb-handle-copy-file): Flush proper
file properties.
(tramp-smb-handle-file-acl, tramp-smb-handle-set-file-acl):
Remove superfluous `unwind-protect'.

* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.
(tramp-sshfs-handle-insert-file-contents): Move result out of
unwindform.

* lisp/net/tramp.el (tramp-string-empty-or-nil-p): New defsubst.
Use it everywhere when appropriate.

* lisp/net/tramp.el (tramp-methods) <->: Add.
(tramp-completion-file-name-handler-alist):
Add `expand-file-name', `file-exists-p', `file-name-directory' and
`file-name-nondirectory'.
(tramp-dissect-file-name): Do not extra check for
`tramp-default-method-marker'.
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-exists-p)
(tramp-completion-handle-file-name-directory)
(tramp-completion-handle-file-name-nondirectory): New defuns.
(tramp-completion-handle-file-name-all-completions): Remove duplicates.
(tramp-show-ad-hoc-proxies): New defcustom.
(tramp-make-tramp-file-name): Use it.
(tramp-make-tramp-hop-name): Don't add hop twice.
(tramp-shell-prompt-pattern): Remove escape characters.
(tramp-process-one-action, tramp-convert-file-attributes):
Use `ansi-color-control-seq-regexp'.  (Bug#63539)
(tramp-wrong-passwd-regexp): Add "Authentication failed" string
(from doas).
(tramp-terminal-type): Fix docstring.
(tramp-process-one-action): Delete ANSI control escape sequences
in buffer.  (Bug#63539)
(tramp-build-completion-file-name-regexp): Support user name
completion.
(tramp-make-tramp-file-name): Keep hop while in file
(tramp-set-completion-function): Check, that cdr of FUNCTION-LIST
entries is a string.
(tramp-completion-file-name-handler): Run only when
`minibuffer-completing-file-name' is non-nil.
(tramp-skeleton-write-region): Fix scoping.  (Bug#65022)
(tramp-handle-memory-info): Work on newly created objects, or use
non-destructive operations.
(tramp-accept-process-output): Use `with-local-quit'.
(tramp-call-process, tramp-call-process-region):
Let-bind `temporary-file-directory'.

* test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs28-p):
New defun.
(tramp-archive-test16-directory-files): Don't mutate.
(tramp-archive-test47-auto-load): Adapt test.

* test/lisp/net/tramp-tests.el (tramp-display-escape-sequence-regexp):
Dont't declare.
(tramp-action-yesno): Suppress run in tests.
(tramp-test02-file-name-dissect):
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate): Adapt tests.
(tramp-test21-file-links):
(tramp-test21-file-links, tramp-test26-file-name-completion)
(tramp-test28-process-file, tramp-test29-start-file-process)
(tramp-test30-make-process, tramp-test33-environment-variables)
(tramp-test38-find-backup-file-name, tramp-test47-auto-load)
(tramp-test39-detect-external-change, tramp-test42-utf8)
(tramp-test47-auto-load, tramp-test47-delay-load)
(tramp-test48-unload): Adapt tests.
(tramp-test26-file-name-completion-with-perl):
(tramp-test26-file-name-completion-with-ls)
(tramp-test26-interactive-file-name-completion): New tests.
(tramp-test44-asynchronous-requests): Mark as :unstable.

16 months agoSimplify rng-substq with cl-substitute
Stefan Kangas [Sat, 5 Aug 2023 15:58:19 +0000 (17:58 +0200)]
Simplify rng-substq with cl-substitute

* lisp/nxml/rng-util.el (rng-substq): Simplify.
(cl-lib): Require.

16 months agoMake eshell-redisplay into alias for redisplay
Stefan Kangas [Sat, 5 Aug 2023 12:56:27 +0000 (14:56 +0200)]
Make eshell-redisplay into alias for redisplay

* lisp/eshell/esh-util.el (eshell-redisplay): Make into obsolete
function alias for 'redisplay'.  This removes a workaround for some
obscure bug apparently found in Emacs 21.  Update all callers.

16 months agoUse file-size-human-readable in eshell
Stefan Kangas [Sat, 5 Aug 2023 12:49:26 +0000 (14:49 +0200)]
Use file-size-human-readable in eshell

* lisp/eshell/esh-util.el (eshell-printable-size): Simplify using
file-size-human-readable.

16 months agoFix eshell "ls" command for files larger than 1TiB
Stefan Kangas [Sat, 5 Aug 2023 10:54:26 +0000 (12:54 +0200)]
Fix eshell "ls" command for files larger than 1TiB

* lisp/eshell/esh-util.el (eshell-printable-size): Fix displaying file
sizes larger than 1 TiB or 1 TB.
* test/lisp/eshell/esh-util-tests.el
(esh-util-test/eshell-printable-size)
(esh-util-test/eshell-printable-size/zero)
(esh-util-test/eshell-printable-size/terabyte)
(esh-util-test/eshell-printable-size/use-colors)
(esh-util-test/eshell-printable-size/block-size)
(esh-util-test/eshell-printable-size/human-readable-arg): New tests.

16 months ago; * lisp/eshell/esh-util.el: Delete redundant autoload.
Stefan Kangas [Sat, 5 Aug 2023 08:59:11 +0000 (10:59 +0200)]
; * lisp/eshell/esh-util.el: Delete redundant autoload.

16 months agoSimplify pcomplete-uniquify-list
Stefan Kangas [Sat, 5 Aug 2023 08:55:27 +0000 (10:55 +0200)]
Simplify pcomplete-uniquify-list

* lisp/pcomplete.el (pcomplete-uniquify-list): Improve docstring.
Simplify.

16 months agoAdd crossref to set-default-file-modes docstring
Stefan Kangas [Fri, 4 Aug 2023 13:27:18 +0000 (15:27 +0200)]
Add crossref to set-default-file-modes docstring

* src/fileio.c (Fset_default_file_modes): Doc fix; add to the
docstring a cross-reference to with-file-modes.

16 months agoimage-dired: Fix gallery directory permissions
Stefan Kangas [Fri, 4 Aug 2023 13:24:46 +0000 (15:24 +0200)]
image-dired: Fix gallery directory permissions

* lisp/image/image-dired.el (image-dired-gallery-generate): Set
umask to 077 before creating gallery directory.