* lisp/eshell/esh-mode.el (eshell-mode-unload-hook):
* lisp/eshell/esh-module.el (eshell-module-unload-hook): Make
obsolete.
* lisp/eshell/em-ls (eshell-ls-enable-in-dired,
eshell-ls-disable-in-dired): New functions...
(eshell-ls-use-in-dired): ... use them.
* lisp/eshell/esh-module.el (eshell-module--feature-name,
eshell-unload-modules): New functions.
(eshell-unload-extension-modules): Use 'eshell-unload-modules'.
* lisp/eshell/em-hist.el: Stop requiring 'eshell' and 'em-pred'
(extension modules shouldn't require each other so they can be
independent).
(eshell-hist-parse-modifier): Ensure this can only be called when
'em-pred' is in use, and declare the relevant function.
* lisp/eshell/eshell.el (eshell-non-interactive-p): Move from here...
* lisp/eshell/esh-mode.el (eshell-non-interactive-p): ... to here.
Robert Pluim [Wed, 15 Feb 2023 13:31:43 +0000 (14:31 +0100)]
New option 'diff-ignore-whitespace-switches'
Allows specifying the switches to use when ignoring whitespace for
those of us who don't like "-b".
* lisp/vc/diff-mode.el (diff-ignore-whitespace-switches): New defcustom.
(diff-refresh-hunk): Use it when ignoring whitespace.
* doc/emacs/files.texi (Diff Mode): Describe the new option.
* etc/NEWS: Announce the new option.
Robert Pluim [Tue, 10 Jan 2023 18:55:50 +0000 (19:55 +0100)]
Teach 'diff-ignore-whitespace-hunk' how to regenerate all hunks
This implements the request from Bug#58516.
* lisp/vc/diff-mode.el (diff--ignore-whitespace-all-hunks): New
function. Iterate over all hunks, regenerate ignoring whitespace
changes.
(diff-ignore-whitespace-hunk): Call `diff--ignore-whitespace-all-hunks'
when called with a prefix arg.
* doc/emacs/files.texi (Diff Mode): Describe new functionality.
* etc/NEWS: Announce the change.
Randy Taylor [Thu, 9 Feb 2023 02:43:04 +0000 (21:43 -0500)]
Fix rust-ts-mode type and module highlighting (Bug#61302)
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Specify import queries to avoid clashing with scoped identifiers in
the code. Highlight attributes with font-lock-preprocessor-face.
Dmitry Gutov [Tue, 14 Feb 2023 17:29:30 +0000 (19:29 +0200)]
rust-ts-mode: Highlight variable reassignments
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode):
New treesit font-lock feature: 'assignment' (bug#61302).
(rust-ts-mode--fontify-pattern): Remove the node lookup step.
(rust-ts-mode--font-lock-settings): Update variable declaration
queries to match the 'pattern' child node right away. Add
highlights for 'assignment.
Gregory Heytings [Tue, 14 Feb 2023 20:22:50 +0000 (20:22 +0000)]
Improve backward compatibility of save-restriction
* src/editfns.c (save_restriction_save_1): Renamed from
'save_restrictions_save'. Make it static.
(save_restriction_restore_1): Renamed from
'save_restriction_restore'. Make it static.
(save_restriction_restore): New function, combining
'save_restriction_save_1' and 'narrowing_locks_save'.
(save_restriction_save): New function, combining
'save_restriction_restore_1' and 'narrowing_locks_restore'.
(Fsave_restriction): Restore the previous code.
(narrowing_locks_save, narrowing_locks_restore): Make them static.
* src/lisp.h: Remove two functions that are not externally visible
anymore.
* src/comp.c (helper_save_restriction): Restore the previous code.
* src/bytecode.c (exec_byte_code): Restore the previous code.
Jonas Bernoulli [Wed, 1 Feb 2023 19:25:16 +0000 (20:25 +0100)]
Rewrite emoji's usage of transient
* lisp/international/emoji.el:
(emoji--done-derived): Remove variable.
(emoji-insert, emoji-recent, emoji-search, emoji-list-select):
Define using 'transient-define-prefix'. Use a base suffix group
whose value is calculated dynamically.
(emoji--setup-prefix, emoji--setup-suffixes, emoji-group-description):
New functions used to dynamically calculate suffixes.
(emoji--narrow): New suffix class, used to pass state to recursive,
narrowed invocations of the prefix command the user initially invoked.
(emoji-insert-glyph): New suffix command that is used for all glyphs
that have no derivations. Previously a separate command was define
for each glyph.
(emoji--fontify-glyph): Replace 'inhibit-derived' argument with
'done-derived' argument.
(emoji--define-transient): Remove function.
(emoji--layout): New function, replacing 'emoji--define-transient'.
Return the suffixes in 'define-transient-prefix' format. Unlike
the replaced function, do not define any new commands, instead use
either the current prefix command or 'emoji-insert-glyph'.
(emoji--recent-transient): Remove function.
(emoji--char-sequence): New function.
(emoji--add-recent): Remove all text properties from glyph.
(emoji--choose-emoji): Remove function.
F. Jason Park [Wed, 30 Nov 2022 06:53:44 +0000 (22:53 -0800)]
; Prepare to update ERC version to 5.5
* doc/misc/erc.texi: Mention in various places that ERC is also
available from GNU ELPA.
* etc/ERC-NEWS: Mention Compat dependency and shorten title for
auth-source section.
* lisp/erc/erc-backend.el: (erc-server-reconnect-function,
erc-tags-format): Update package version to 5.5.
(erc--parse-message-tags): Downcase warning "type" to remain
consistent with all other ERC warnings.
* lisp/erc/erc-button.el: (erc-button-alist): Change package-version
to 5.5.
* lisp/erc/erc-match.el (erc-match-quote-when-adding): Update package
version to 5.5.
* lisp/erc/erc-sasl.el: Mention actual info node in Commentary.
(erc-sasl): Update package version to 5.5.
(erc-sasl-password): Reword doc string.
(erc-sasl-auth-source-function): Capitalize "info" in doc string.
* lisp/erc/erc-services.el (erc-auth-source-services-function): Update
package version to 5.5. Capitalize "info" in doc string. Change
choice type from const to function-item.
* lisp/erc/erc.el (erc-password): Capitalize "info" in doc string.
(erc-inhibit-multiline-input, erc-ask-about-multiline-input,
erc-prompt-hidden, erc-hide-prompt, erc-unhide-query-prompt,
erc-join-buffer, erc-reconnect-display, erc-kill-server-hook,
erc-kill-channel-hook, erc-kill-buffer-hook,
erc-url-connect-function): Update package version to 5.5.
(erc-auth-source-server-function, erc-auth-source-join-function):
Update package version to 5.5. Change choice type from const to
function-item. Capitalize "info" in doc string.
(erc-tls): Capitalize "info" in doc string.
Paul Eggert [Mon, 13 Feb 2023 20:32:11 +0000 (12:32 -0800)]
Fix insert-file-contents on /proc files
This should fix Bug#9800 (2011-10-19).
* src/fileio.c (Finsert_file_contents):
Do not trust st_size even on regular files, as the file might
be a Linux /proc file, or it might be growing.
Instead, always read to EOF when END is nil.
Paul Eggert [Mon, 13 Feb 2023 16:51:45 +0000 (08:51 -0800)]
Don’t scan text twice to guess coding system
* src/fileio.c (Finsert_file_contents): If the file shrank
below 4 KiB, don’t read duplicate text into READ_BUF.
This also removes a use of SEEK_END, which Linux /proc
file systems do not support (not that we should get here
with /proc).
Paul Eggert [Mon, 13 Feb 2023 01:52:46 +0000 (17:52 -0800)]
Improve insert-file-contents on non-regular files
* src/fileio.c (Finsert_file_contents):
If the file is not a regular file, check REPLACE and VISIT
before doing further syscalls that won’t matter in this case.
Hoisting stack reduction ops allows them to coalesce and/or cancel out
pushing ops, and for useful operations to sink and combine, such as
not + goto-if-[not-]nil.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode):
Add the rule
Ulrich Müller [Sun, 12 Feb 2023 19:57:49 +0000 (20:57 +0100)]
Fix spurious display of eclipses in Calendar
* lisp/calendar/lunar.el (eclipse-check): Don't show an eclipse
unless the phase is new moon or full moon. (bug#61460)
* test/lisp/calendar/lunar-tests.el (lunar-test-eclipse-check)
(lunar-test-phase-list): Update tests.
Stefan Kangas [Mon, 13 Feb 2023 05:30:12 +0000 (06:30 +0100)]
Merge from origin/emacs-29
eb2b0931cf1 Add lambda_expression to c-ts-common-indent-type-regexp-a... 2da05876edb ; Use the right name when specifying VC packages d4fc7012978 Tolerate missing elpa-packages.eld files 8bc1b7d0b27 Avoid warning about 'load-path' in non-interactive sessions 3d17aee13d9 ; Fix installation of dependencies for VC packages 86ca7df6a34 ; Mention Hunspell private-dictionary misfeature in doc s... 7287b7b53a1 Support webkit2gtk-4.1 048a2dabfc4 ; Fix typo
* lisp/emacs-lisp/package-vc.el
(package-vc--download-and-read-archives): Replace
'condition-case-unless-debug' with a regular 'condition-case'.
It appears a few people using third-party archives that don't serve
package specifications have been having issues with package-vc, when
toggle-on-error is enabled. In their case, package-vc would raise an
error in its first invocation, but it would go on working normally
afterwards. As this behaviour is confusing and the user can't do much
about a missing elpa-packages.eld to begin with, we satisfy ourselves
with printing out a message and continuing on.
Po Lu [Sun, 12 Feb 2023 11:55:28 +0000 (19:55 +0800)]
Support input method ``text conversion'' on X Windows
* configure.ac (HAVE_TEXT_CONVERSION): Define on X.
* etc/NEWS: Announce new change.
* src/emacs.c (main): Always call init_xterm.
* src/frame.c (do_switch_frame): Use `fset_selected_window'.
* src/insdel.c (struct safe_del_range_context): New structure.
(safe_del_range_1, safe_del_range_2, safe_del_range): New
functions.
* src/lisp.h: Export new functions.
* src/window.c (run_window_change_functions): Report selected
window and buffer changes so that the input method can be reset.
* src/xfns.c (XICCallback, Xxic_preedit_caret_callback)
(Xxic_preedit_done_callback, Xxic_preedit_start_callback)
(Xxic_preedit_draw_callback): Fix coding style.
(Xxic_string_conversion_callback): New callback.
(create_frame_xic): Register string conversion callback.
(struct x_xim_text_conversion_data): New field `size'.
(x_encode_xim_text_1, x_encode_xim_text): New functions.
(xic_string_conversion_callback): New function.
* src/xterm.c (x_reset_conversion): New function.
(text_conversion_interface): New variable.
(init_xterm): Initialize text conversion interface.
Jim Porter [Sat, 11 Feb 2023 20:37:32 +0000 (12:37 -0800)]
Make sure core Eshell modules are loaded
Previously, if you removed all (or most) extension modules from
Eshell, it failed to load esh-var.el, meaning that you couldn't use
variable expansions. To avoid this issue, we now explicitly load the
core modules in esh-mode.el.
Michael Albinus [Sat, 11 Feb 2023 17:11:56 +0000 (18:11 +0100)]
Support Tramp user name completion
* lisp/net/tramp.el (tramp-build-completion-file-name-regexp)
(tramp-completion-handle-expand-file-name)
(tramp-completion-handle-file-name-directory): Support user name
completion.
This rule hoists stack reduction to where it is more likely to be
exploited further, may reduce the op size through smaller
immediates, and sometimes removes either or both operations
outright.
The rule is inhibited by an immediately following `return` op
because other rules will produce better code in that case.
- Add the rule
(discardN-preserve-tos|dup) OP return --> OP return
where OP is a unary operation such as `not` or `car`.
- Generalise a previous rule to
NOEFFECT PRODUCER return --> PRODUCER return
where PRODUCER is now any op that pushes a value without looking at
the stack: const, varref, point etc.
Alan Mackenzie [Sat, 11 Feb 2023 10:45:31 +0000 (10:45 +0000)]
Make edebug see unused variables when lexical-binding is non-nil
This fixes bug #59213.
* lisp/emacs-lisp/cconv.el (cconv-dont-trim-unused-variables): New variable.
(cconv-fv, cconv-make-interpreted-closure): Add/amend doc strings.
(cconv-make-interpreted-closure): Test cconv-dont-trim-unused-variables, and
if non-nil, don't "optimize" the lexical environment.
* lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Compile a binding of
cconv-dont-trim-unused-variables to t around the call of edebug-enter.
* lisp/emacs-lisp/testconver.el (testcover-analyze-coverage): Add a new arm to
the pcase form to handle the new form of edebug-enter.
Eli Zaretskii [Sat, 11 Feb 2023 09:48:48 +0000 (11:48 +0200)]
; Remove extraneous local variables from image-dired-*.el files
These cause annoying prompts when visiting these files, and evidently
belong to a third-party package.
* lisp/image/image-dired-external.el:
* lisp/image/image-dired-tags.el:
* lisp/image/image-dired-dired.el:
* lisp/image/image-dired-util.el: Remove unsafe local-variables.
Gregory Heytings [Fri, 10 Feb 2023 20:55:47 +0000 (20:55 +0000)]
Save and restore the absence of narrowing locks
* src/editfns.c (narrowing_locks_save): Return the buffer with a
empty locks list when the current buffer has no narrowing locks.
(narrowing_locks_restore): Remove the narrowing locks if the
buffer had no narrowing locks.
* lisp/progmodes/bug-reference.el (bug-reference-fontify): Wrap call
to syntax-ppss in save-match-data since it can clobber our
match-data (bug#61395).
Jim Porter [Mon, 6 Feb 2023 05:37:08 +0000 (21:37 -0800)]
Ensure that Eshell users can run lines of command output as input
Previously, this failed to work properly because any additional input
the user entered would have no 'field' property, confusing
'eshell-get-old-input'. To fix this, we simply ensure that any
user-entered text in the output field retains said output field
(bug#61310).
* lisp/eshell/esh-util.el (eshell-command-output-properties): New
variable.
(eshell--mark-as-output, eshell--mark-yanked-as-output): New
functions, mostly copied from comint.
* lisp/eshell/esh-proc.el (eshell-interactive-process-filter):
* lisp/eshell/esh-mode.el (eshell-interactive-print): Call
'eshell--mark-as-output'.
(eshell-get-old-input): Remove properties from the returned string
just to be safe.
* test/lisp/eshell/eshell-tests.el (eshell-test-value): New variable.
(eshell-test/get-old-input/rerun-command)
(eshell-test/get-old-input/run-output): New tests.
* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test/field-properties)
(em-prompt-test/field-properties/no-highlight): Use
'eshell-command-output-properties'.
Jim Porter [Wed, 25 Jan 2023 01:14:54 +0000 (17:14 -0800)]
Ensure that deferred commands don't make Eshell forget let-bound values
* lisp/eshell/esh-cmd.el (Command evaluation macros): Expand this
documentation to list allowed special forms and caveats for working
with 'if' and 'while'.
(eshell-do-eval): Provide more detail in docstring. Handle
'eshell-defer' inside 'let' forms.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/let-rebinds-after-defer): New test (bug#59469).
Juri Linkov [Thu, 9 Feb 2023 18:08:15 +0000 (20:08 +0200)]
* lisp/icomplete.el (icomplete-exhibit): Check validity of the current buffer.
This function is applicable only in buffers where functions like
icomplete--field-beg can be called, and they expects either non-nil
completion-in-region--data or window-minibuffer-p (bug#61308).
lisp-mode: add docstring recognition for more common lisp symbols
* lisp/emacs-lisp/lisp-mode.el (define-compiler-macro)
(define-setf-expander, deftype): Add the 'doc-string-elt'
property for proper docstring highlighting in Common Lisp.
Eli Zaretskii [Thu, 9 Feb 2023 14:06:55 +0000 (16:06 +0200)]
; Improve discoverability of empty file names handling
* doc/lispref/files.texi (Relative File Names)
(Testing Accessibility, File Name Expansion): Document and index
the behavior with empty strings as file names.