* 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.
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.
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.
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
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.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-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-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-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-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'.
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.
Eli Zaretskii [Sat, 5 Aug 2023 14:55:56 +0000 (17:55 +0300)]
Allow user control on char-width of "ambiguous" characters
* src/character.c (syms_of_character) <ambiguous-width-chars>: New
char-table.
* lisp/international/characters.el (ambiguous-width-chars): Fill
the table.
(update-cjk-ambiguous-char-widths): New function.
(cjk-ambiguous-chars-are-wide): New defcustom, uses
'update-cjk-ambiguous-char-widths' as its :set function.
(use-cjk-char-width-table): Obey 'cjk-ambiguous-chars-are-wide' by
adding another child char-table for ambiguous-width characters,
where the width is set according to the option.
Jim Porter [Fri, 4 Aug 2023 16:31:59 +0000 (09:31 -0700)]
Fix loaddef generation with ";;;foo-autoload" cookies in external packages
This caused an issue where package-specific autoload cookies weren't
being correctly recognized, so they got dumped into the package's main
"<pkg>-autoloads.el" file, instead of "<pkg>-loaddefs.el" as they
should (bug#65023).
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Save match data when checking syntax.
Manuel Giraud [Tue, 1 Aug 2023 16:56:33 +0000 (18:56 +0200)]
Fix thumbnail update when thumb name is based on image content
* lisp/image/image-dired-util.el
(image-dired-update-thumbnail-at-point): New function to update
thumbnail when original image contents changed.
* lisp/image/image-dired-external.el
(image-dired-rotate-original): Use it.
* lisp/image/image-dired.el (image-dired-display-thumbs): Fix
spacing while here. (Bug#61394)
Stefan Kangas [Fri, 4 Aug 2023 10:25:15 +0000 (12:25 +0200)]
Delete comment saying that project.el is experimental
* lisp/progmodes/project.el (Commentary): Delete comment saying that
the API is "still experimental". It is to be considered stable
starting with the version released with Emacs 29.
Ref: https://lists.gnu.org/r/emacs-devel/2023-07/msg00415.html
Don't allow the `eq` and `unbind` byte-ops to commute (bug#65017)
* lisp/emacs-lisp/byte-opt.el (byte-after-unwind-ops):
Cease sinking `eq` past `unwind`, because that optimised away the
let-binding in
(let ((symbols-with-pos-enabled nil))
(eq x y))
and `eq` is currently sensitive to `symbols-with-pos-enabled`.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp--eq-symbols-with-pos-enabled): New test.
Stefan Kangas [Fri, 4 Aug 2023 07:50:43 +0000 (09:50 +0200)]
; Fix http/https thinko in org manual
* doc/misc/org.org (External Links): Change an HTTPS link back to
HTTP, as it's used as an example to show the supported protocols.
Ref: https://lists.gnu.org/r/emacs-devel/2023-08/msg00018.html
Eli Zaretskii [Fri, 4 Aug 2023 07:17:51 +0000 (03:17 -0400)]
Merge from origin/emacs-29
0f183770c56 Fix byte-compiled files that use 'bind-key' from use-package acfcf7f3690 Fix "Paste from Kill Menu" in non X toolkit builds 04996b21241 Handle tabs in the SQL shown in the column listing 573fcf27122 Add new keyword to 'typescript-ts-mode' db7d70d3cad ; Add commentary to 'describe-function's completion
Eli Zaretskii [Fri, 4 Aug 2023 07:17:50 +0000 (03:17 -0400)]
Merge from origin/emacs-29
6eddbfe33f2 Clarify the meaning of the argument of ':align-to' space ... 5c6a51668b0 ; * doc/misc/eshell.texi (Argument Modifiers): Fix typo i... da5e05a50e8 Fix handling of ".elpaignore" file when compiling packages
Eli Zaretskii [Fri, 4 Aug 2023 06:34:55 +0000 (09:34 +0300)]
Fix "Paste from Kill Menu" in non X toolkit builds
* src/keymap.c (possibly_translate_key_sequence): Don't signal an
error if 'key-valid-p' returns nil. Suggested by Stefan Monnier
<monnier@iro.umontreal.ca>. (Bug#64927)
Po Lu [Fri, 4 Aug 2023 06:29:55 +0000 (14:29 +0800)]
Optimize creation of multibyte menu items on Android
* src/androidvfs.c (android_verify_jni_string): Move to
android.c.
* src/android.c (android_verify_jni_string): New function.
(android_build_string): Forgo encoding menu text if TEXT is a
multibyte string that's also a valid JNI string.
* src/android.h: Update prototypes.
Michael Albinus [Thu, 3 Aug 2023 11:17:02 +0000 (13:17 +0200)]
Improve SELinux handling in Tramp
* lisp/net/tramp-sh.el (tramp-stat-file-attributes-with-selinux)
(tramp-stat-directory-files-and-attributes-with-selinux): New defconst.
(tramp-do-file-attributes-with-ls)
(tramp-do-file-attributes-with-stat)
(tramp-do-directory-files-and-attributes-with-stat): Return also
SELinux context.
(tramp-remote-selinux-p, tramp-do-copy-or-rename-file): Adapt docstring.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file)
(tramp-sudoedit-remote-selinux-p): Adapt docstring.
(tramp-sudoedit-file-attributes-with-selinux): New defconst.
(tramp-sudoedit-handle-file-attributes): Use it.
Helmut Eller [Thu, 20 Jul 2023 14:27:34 +0000 (16:27 +0200)]
Improve interactive prompting for face colors
When displaying the completion candidates, show how the face would
look with the new foreground/background.
* lisp/faces.el (faces--string-with-color): New helper,
factored out from 'defined-colors-with-face-attributes'.
(defined-colors-with-face-attributes): Use it.
(read-color): Add optional argument FACE and pass
it to 'faces--string-with-color.'
(read-face-attribute): Call 'read-color' with more appropriate
foreground and face arguments.
* doc/lispref/minibuf.texi (High-Level Completion): Describe
the intention behind the arguments FOREGROUND and FACE of
'read-color'. (Bug#64725)
Po Lu [Thu, 3 Aug 2023 02:41:40 +0000 (10:41 +0800)]
Update Android port
* java/org/gnu/emacs/EmacsSafThread.java (CacheToplevel):
(EmacsSafThread):
(DocIdEntry):
(getCache):
(pruneCache):
(cacheDirectoryFromCursor):
(run):
(documentIdFromName1):
(statDocument1):
(openDocumentDirectory1):
(openDocument1): Introduce a file status cache and populate
it with files within directories as they are opened.
* java/org/gnu/emacs/EmacsService.java (createDocument):
(createDirectory):
(moveDocument): Invalidate the file status cache wherever
needed.
* src/fileio.c (check_vfs_filename):
(Fset_file_modes): Permit `set-file-modes' to silently fail
on asset and content files.
Harald Jörg [Wed, 2 Aug 2023 21:53:42 +0000 (23:53 +0200)]
cperl-mode.el: Subroutine names are fontified correctly in all places
Subroutine names are fontified as subroutine names even if the name is also
the name of a builtin (fixing an ancient unreported bug). Subroutine name
are just comments in comment and pod (fixing a bug introduced recently)
* lisp/progmodes/cperl-mode.el (cperl-init-faces): Move
fontification of sub declarations before that of builtins. Don't
override existing faces when fontifying subroutine declarations.
Don't fontify method calls even if the sub names match those of
builtins.
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-fontify-sub-names):
New tests with a subroutine name in several surroundings.
* test/lisp/progmodes/cperl-mode-resources/sub-names.pl: New resource
for the new test.
Stefan Kangas [Wed, 2 Aug 2023 19:46:55 +0000 (21:46 +0200)]
Don't hardcode ruby version in interpreter-mode-alist
* lisp/progmodes/ruby-mode.el (interpreter-mode-alist): Don't hardcode
ruby version. This adds support for modern versions of Ruby like
"ruby2.7", instead of the previously hardcoded "ruby1.9".
rx: better not-wordchar and (syntax word) translation
* lisp/emacs-lisp/rx.el:
Add tables of legacy syntax.
(rx--translate-symbol):
Translate the legacy construct `not-wordchar` as (not wordchar), which
is more intuitively obvious.
* lisp/emacs-lisp/rx.el (rx--translate-syntax):
Generate the shorter \w and \W instead of \sw and \Sw.
* test/lisp/emacs-lisp/rx-tests.el (rx-atoms, rx-syntax, rx-not):
Adapt tests.
* lisp/emacs-lisp/rx.el (rx--generate-alt):
Treat the intervals and classes lists separately without joining,
to reduce allocation. Handle special cases first.
(rx--union-intervals):
Implement directly instead of using intersection and complement.
* test/lisp/emacs-lisp/rx-tests.el (rx-any): Adapt test, as some
character alternatives are now slightly different.
(rx--complement-intervals, rx--union-intervals)
(rx--intersect-intervals): New unit tests.