Dmitry Gutov [Tue, 11 Jun 2024 18:02:57 +0000 (21:02 +0300)]
read_and_insert_process_output: Insert before markers
* src/insdel.c (adjust_markers_for_insert): Make non-static.
* src/lisp.h: Add declaration for it.
* src/process.c (read_and_insert_process_output): Use it here.
And also call insert_1_both with BEFORE_MARKERS=t, for
compatibility with internal-default-process-filter (bug#66020).
Michael Albinus [Tue, 11 Jun 2024 12:43:28 +0000 (14:43 +0200)]
Refactor tramp-*-process-file functions
* lisp/net/tramp-adb.el (tramp-adb-handle-make-process):
* lisp/net/tramp-sh.el (tramp-sh-handle-make-process): Don't compute
process name, this is done in `tramp-skeleton-make-process'.
Robert Pluim [Fri, 7 Jun 2024 10:07:50 +0000 (12:07 +0200)]
Use 'char-to-name'
* lisp/international/emoji.el (emoji--name): Lookup name using 'char-to-name'.
* lisp/international/textsec.el (textsec-domain-suspicious-p): And here.
* lisp/simple.el (what-cursor-position): And here.
Robert Pluim [Fri, 7 Jun 2024 10:05:34 +0000 (12:05 +0200)]
Add 'char-to-name' convenience function
* lisp/international/mule-cmds.el (char-to-name): New function. This is
the inverse of 'char-from-name'.
* doc/lispref/nonascii.texi (Character Codes): Document it.
* etc/NEWS: Announce it.
Dmitry Gutov [Tue, 11 Jun 2024 02:54:57 +0000 (05:54 +0300)]
fast-read-process-output: Make safer
* src/process.c (read_process_output): Move the call to
'read_and_insert_process_output' from here.
(read_and_dispose_of_process_output): To here (bug#66020). So
that any Lisp code invoked through modification hook from the
former function also benefit from safety guards like
running_asynch_code, saved match data, inhibit_quot, etc.
* src/process.c (read_process_output_set_last_coding_system):
New function, extracted from read_and_dispose_of_process_output.
(read_and_dispose_of_process_output): Update accordingly.
(read_and_insert_process_output): Use it here instead of just
transferring carryover (bug#66020, also mentioned in bug#71452).
Po Lu [Tue, 11 Jun 2024 02:04:16 +0000 (10:04 +0800)]
Provide for negative PIDs on MS Windows
* src/filelock.c (pid_t, getpid_for_lock, pidintmax, EPRIdMAX):
New macros; define to unsigned long or corresponding values if
WINDOWSNT.
(lock_file_1, current_lock_owner): Replace intmax_t, getpid,
pid_t and the like with the aforementioned macros. (bug#71477)
Stefan Monnier [Mon, 10 Jun 2024 14:43:14 +0000 (10:43 -0400)]
(rng-do-some-validation): Fix dangerous use of `with-silent-modifications`
* lisp/nxml/rng-valid.el (rng-do-some-validation): Don't let-bind
`inhibit-modification-hooks` around code which can wait.
(rng-cache-state): Bind it here instead.
Harald Jörg [Mon, 10 Jun 2024 10:19:04 +0000 (12:19 +0200)]
cperl-mode.el: Update for the current Perl version 5.040
* etc/NEWS: Announce new features of cperl-mode.
* lisp/progmodes/cperl-mode.el (cperl-menu): Add toggle for extra
paired delimiters.
(defconst): new rx expressions `cperl--sub-name-generated-rx' and
`cperl--field-declaration-rx'
(cperl--imenu-entries-rx): Use the new expressions
(cperl--extra-paired-delimiters): New variable holding the paired
delimiters for Perl 5.36 and newer
(cperl-imenu-sub-keywords): Add autogenerated methods to imenu
(cperl-init-faces): Add the __CLASS__ token, builtin constants,
and attributes for field declarations.
(cperl-short-docs): Add __CLASS__ to one-line docs.
(cperl-extra-paired-delimiters-mode): new minor mode to handle
non-ASCII paired delimiters.
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-fontify-builtin-constants): new test.
(cperl-test-fontify-class): New test clauses for attributes.
(cperl-test-field-declaration-rx): new test.
(cperl-test-autogenerated-reader-rx): new unit test for the rx
expression.
(cperl-test-extra-delimiters): new test.
(cperl-test-imenu-index): new clauses for imenu capture of
autogenerated methods.
* test/lisp/progmodes/cperl-mode-resources/grammar.pl: Add
examples for Perl 5.40 syntax.
* test/lisp/progmodes/cperl-mode-resources/extra-delimiters.pl:
New resource for non-ASCII paired delimiters.
Juri Linkov [Mon, 10 Jun 2024 06:34:15 +0000 (09:34 +0300)]
* lisp/outline.el: Improve new feature of preserving outlines after revert.
(outline-minor-mode): Move adding hook 'outline-revert-buffer-rehighlight'
to the same code branch that calls 'outline-minor-mode-highlight-buffer'.
(outline-revert-buffer-rehighlight): Remove same conditions
already existing in 'outline-minor-mode'.
(outline-hidden-headings-regexp): Remove function.
(outline-hidden-headings-paths)
(outline-hidden-headings-restore-paths): New functions
that save and restore complete paths instead of flat regexps.
(outline-revert-buffer-restore-visibility): Use
'outline-hidden-headings-paths' and
'outline-hidden-headings-restore-paths'.
Jim Porter [Sun, 9 Jun 2024 22:21:08 +0000 (15:21 -0700)]
Improve correctness of 'eshell-quote-argument'
* lisp/eshell/esh-arg.el (eshell-quote-argument): Mention that this
function is for use within Eshell buffers.
(eshell-quote-backslash): Properly quote newlines.
* lisp/eshell/em-unix.el (eshell/cat, eshell/du): Throw
'eshell-external' instead; that's what it's here for.
Jim Porter [Sun, 9 Jun 2024 20:17:53 +0000 (13:17 -0700)]
Remove empty Eshell commands when parsing
This improves the logic for copying/stealing handles when constructing
the command form: now, we should always steal the handles for the last
real command, even if there were some trailing semicolons.
* lisp/eshell/esh-arg.el (eshell-parse-delimiter): Be stricter about
parsing so that things like "& &" aren't parsed as a single "&&" token.
* lisp/eshell/esh-cmd.el (eshell-parse-command): Get the commands in
reverse, and remove any nil commands.
(eshell-split-commands): Always return the trailing terms (except when
there were no terms to begin with).
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/empty-background-command): New test.
Juri Linkov [Sun, 9 Jun 2024 18:18:28 +0000 (21:18 +0300)]
* lisp/buff-menu.el: Support a function value of Buffer-menu-group-by.
(Buffer-menu-group-by): Add a choice for a function that
returns names of all levels.
(list-buffers--refresh): If Buffer-menu-group-by is a function,
then use it directly.
kobarity [Tue, 4 Jun 2024 12:51:32 +0000 (21:51 +0900)]
Specify Python 3 in some ERTs on Mac
* test/lisp/progmodes/python-tests.el
(python-tests-with-temp-buffer-with-shell): Remove setting
'python-shell-interpreter'.
(python-tests-shell-interpreter): Removed.
(python-tests-shell-interpreters): New variable.
(python-tests-with-shell-interpreter)
(python-tests-with-temp-buffer-with-shell-interpreter): New macros.
(python-tests-get-shell-interpreter): Add an optional PRED
argument to allow ERts to specify Python interpreter version.
(python-tests--get-interpreter-info): New function.
(python-tests-interpreter-3-p): New function to be used as the
PRED argument of 'python-tests-get-shell-interpreter'.
(python-shell-make-comint-1)
(python-shell-make-comint-2)
(python-shell-make-comint-4)
(python-shell-get-process-1)
(python-shell-internal-get-or-create-process-1)
(python-shell-prompt-detect-1)
(python-shell-prompt-detect-2)
(python-shell-prompt-detect-3)
(python-shell-prompt-detect-4)
(python-shell-prompt-detect-5)
(python-shell-prompt-detect-6)
(python-shell-prompt-set-calculated-regexps-6)
(python-shell-completion-at-point-jedi-completer)
(python-completion-at-point-pdb-1)
(python-completion-at-point-while-running-1)
(python-ffap-module-path-1)
(python-ffap-module-path-while-running-1)
(python-eldoc--get-doc-at-point-1)
(python-eldoc--get-doc-at-point-while-running-1)
(python-tests--run-python-selects-window)
(python-test--shell-send-block): Use the new macro.
(python-shell-completion-at-point-ipython): Remove setting
'python-tests-shell-interpreter'.
(python-shell-completion-at-point-1)
(python-completion-at-point-1)
(python-completion-at-point-2)
(python-completion-at-point-native-1)
(python-completion-at-point-native-2)
(python-completion-at-point-native-with-ffap-1)
(python-completion-at-point-native-with-eldoc-1): Use the new
macro and specify Python 3 on Mac to avoid errors. (Bug#70815)
kobarity [Sat, 25 May 2024 14:20:10 +0000 (23:20 +0900)]
Fix hiding a Python block ending with a comment
* lisp/progmodes/python.el (python-hideshow-forward-sexp-function): Move
point to the end of the line.
* test/lisp/progmodes/python-tests.el (python-hideshow-hide-block-2):
New test. (Bug#71170)
Eli Zaretskii [Sun, 9 Jun 2024 13:12:11 +0000 (16:12 +0300)]
A better fix for esh-proc-tests on MS-Windows
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test-quote-argument): New function.
(esh-proc-test/emacs-command): Use it instead of
'shell-quote-argument', which allows to go back to
system-independent code.
Po Lu [Sun, 9 Jun 2024 12:40:17 +0000 (20:40 +0800)]
Amend last change
* lisp/loadup.el: Load touch-screen.el on MS-Windows.
* src/w32fns.c (Emacs_GESTURECONFIG): New structure.
(SetGestureConfig_fn): New variable.
(w32_createwindow): Disable emulated mouse and gesture events
for the frame's window.
(w32_wnd_proc) <WM_LBUTTONDOWN, WM_RBUTTONDOWN, WM_LBUTTONUP>
<WM_RBUTTONUP>: Ignore mouse events which are marked as emulated
pointer events.
(globals_of_w32fns): Load SetGestureConfig from user32.dll.
* src/w32term.c (w32_read_socket): Correct utilization of
GetTouchInputInfo, coordinate spaces, &c.
Po Lu [Sun, 9 Jun 2024 09:44:25 +0000 (17:44 +0800)]
Report touch events on MS-Windows
* etc/NEWS: Announce change.
* src/w32fns.c (RegisterTouchWindow_fn): New function.
(w32_createwindow): Assign a base value for touch event
identifiers to the frame, and register for touch input.
(w32_wnd_proc): Forward WM_TOUCH/WM_TOUCHMOVE messages to the
main thread.
(globals_of_w32fns): Load RegisterTouchWindow from user32.dll.
* src/w32term.c (w32_read_socket) <WM_TOUCH>: Detect WM_TOUCH
events, compare and record their touch points with and into the
frame's record of their prior state, and report the same to Lisp.
(pfnCloseTouchInputHandle, pfnGetTouchInputInfo): New variables.
(w32_initialize): Load the above functions from user32.dll.
* src/w32term.h (MAX_TOUCH_POINTS): New definition.
(struct w32_output) <touch_ids, touch_x, touch_y, touch_base>:
New fields.
Jared Finder [Sun, 9 Jun 2024 00:23:58 +0000 (17:23 -0700)]
Add documentation for window-tool-bar package
Also change window-tool-mode to not pay attention to if
tool-bar-map has a buffer local value or not as that made the
documentation complicated. Documentation added in Emacs manual,
Elisp manual, package commentary, and docstrings. Also extend
window-tool-bar support to Emacs 27 and newer. (bug#68765)
* doc/emacs/emacs.texi (Top):
* doc/emacs/frames.texi (Menu Bars):
* doc/emacs/glossary.texi (Glossary):
* doc/emacs/modes.texi (Minor Modes):
* doc/emacs/windows.texi (Windows, Tab Line): Mention Window
Tool Bar.
(Window Tool Bar): New documentation.
* doc/lispref/elisp.texi (Top):
* doc/lispref/modes.texi (Mode Line Format, Mode Line Basics)
(Mode Line Data): Mention Tab Lines.
(Tab Lines): New documentation.
* etc/NEWS: Mention newly added variable and package.
* lisp/window-tool-bar.el (window-tool-bar-mode): Don't display
tool bar when tool-bar-map is nil.
* lisp/window-tool-bar.el (tool-bar-always-show-default): Define
variable for older Emacs versions.
Eli Zaretskii [Sun, 9 Jun 2024 07:56:39 +0000 (10:56 +0300)]
Fix Eshell tests on MS-Windows
* lisp/eshell/esh-util.el (eshell-get-path): Don't add "." if it
is already there.
* test/lisp/eshell/esh-var-tests.el
(esh-var-test/path-var/preserve-across-hosts): Skip on MS-Windows.
(esh-var-test/path-var/set, esh-var-test/path-var/set-locally):
Quote the PATH value, for MS-Windows.
* test/lisp/eshell/esh-util-tests.el (esh-util-test/path/get): No
need to add ".": it is already done by 'eshell-get-path'.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/kill-pipeline): Accept empty string as valid
output.
(esh-proc-test/sigpipe-exits-process): Skip on MS-Windows: no
SIGPIPE.
(esh-proc-test/emacs-command): Quote correctly for MS-Windows.
* test/lisp/eshell/em-unix-tests.el
(em-unix-test/compile/interactive): Fix test on MS-Windows.
* test/lisp/eshell/em-script-tests.el (em-script-test/batch-file):
Skip on MS-Windows.
* test/lisp/eshell/eshell-tests-helpers.el
(eshell-command-result--equal): Compare strings (file names)
case-insensitively on MS-Windows.
Stefan Monnier [Tue, 4 Jun 2024 15:00:32 +0000 (11:00 -0400)]
(hack-dir-local-get-variables-functions): New hook
Make it possible to provide more dir-local variables, such as
done by the Editorconfig package.
* lisp/files.el (hack-dir-local--get-variables): Make arg optional.
(hack-dir-local-get-variables-functions): New hook.
(hack-dir-local-variables): Run it instead of calling
`hack-dir-local--get-variables`.
* doc/lispref/variables.texi (Directory Local Variables):
Document the new hook.
Stefan Monnier [Tue, 4 Jun 2024 14:58:29 +0000 (10:58 -0400)]
(find-auto-coding): Provide filename to `auto-coding-functions`
Allow `auto-coding-functions` to know the file name.
Motivated by the needs of Editorconfig support.
* lisp/international/mule.el (auto-coding-file-name): New var.
(find-auto-coding): Let-bind it for `auto-coding-functions`.
Document the expectation that the arg be an absolute file name.
* test/lisp/international/mule-util-resources/test.utf-16le: New file.
* test/lisp/international/mule-tests.el (mule-tests--dir): New var.
(mule-tests--auto-coding): New fun.
(mule-tests--auto-coding-functions): New test.
Add typescript-ts-mode indentation for multi-assignment decls
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Add indentation rules for
lexical and variable declarations with multiple assignments.
* test/lisp/progmodes/typescript-ts-mode-resources/indent.erts:
Add indent test for variable declarations (bug#68054).
mikpom [Sun, 9 Jun 2024 02:32:57 +0000 (05:32 +0300)]
Support Ibuffer in project-list-buffers
* lisp/progmodes/project.el (project-buffers-viewer): New option.
(project-list-buffers): Dispatch using it.
(project-list-buffers-buffer-menu, project-list-buffers-ibuffer):
New functions (bug#71290).
Dmitry Gutov [Sat, 8 Jun 2024 23:51:47 +0000 (02:51 +0300)]
Remember the value of read_process_output_max when process is created
* src/process.h (Lisp_Process): Add field readmax.
* src/process.c (read_process_output): Use it.
(create_process): Save the value of read_process_output_max to
it when the process is created (bug#66020). Use for pipe size.
Go around calling the default process filter (reducing GC churn)
Instead of allocating strings and passing them to the filter, pass
the char buffer to a C function implementing the same logic.
* src/process.c (read_process_output_before_insert)
(read_process_output_after_insert):
New functions, extracted from internal-default-process-filter.
(Finternal_default_process_filter): Use them.
(read_and_insert_process_output): New function. Use them.
(read_process_output_fast): New variable.
(read_process_output): Use it to choose how to insert (bug#66020).
Stefan Monnier [Sat, 8 Jun 2024 21:34:30 +0000 (17:34 -0400)]
(pcase--app-subst-match): Try and fix performance regression (bug#71398)
* lisp/emacs-lisp/pcase.el (pcase--app-subst-match): Optimize matches
against (quote VAL).
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-quote-optimization):
Add new test case.
Jim Porter [Tue, 4 Jun 2024 05:06:49 +0000 (22:06 -0700)]
Improve implementations of some Eshell output filter functions
* lisp/eshell/esh-mode.el (eshell-postoutput-scroll-to-bottom): Use
'get-buffer-window-list' for simplicity.
(eshell-handle-control-codes): Use 're-search-forward'; this way is much
faster.
Jim Porter [Tue, 4 Jun 2024 05:01:48 +0000 (22:01 -0700)]
Be more efficient when buffering output in Eshell
This makes the built-in 'eshell/cat' 5-10x faster on large files in my
(somewhat limited) tests. In addition, this change periodically
redisplays when using the Eshell buffered output so that users can see
some progress.
* lisp/eshell/esh-io.el (eshell-print-queue-size, eshell-print-queue,
eshell-print-queue-count): Make obsolete in favor of...
(eshell-buffered-print-size, eshell--buffered-print-queue)
(eshell--buffered-print-current-size): ... these.
(eshell-buffered-print-redisplay-throttle): New user option.
(eshell--buffered-print-next-redisplay): New variable.
(eshell-init-print-buffer): Make obsolete.
(eshell-flush): Add new REDISPLAY-NOW argument in favor of CLEAR (which
only 'eshell-init-print-buffer' should have used).
(eshell-buffered-print): Compare queued output length to
'eshell--buffered-print-current-size'.
(eshell-with-buffered-print): New macro.
F. Jason Park [Sat, 8 Jun 2024 00:08:08 +0000 (17:08 -0700)]
; Improve erc-format-privmessage documentation
* etc/ERC-NEWS: Mention that `erc-format-privmessage' has been removed
from the default client's primary code path. Revise various headlines.
* lisp/erc/erc.el: Bump Compat version to 29.1.4.5.
(erc-format-privmessage): Make appeal for users to contact the mailing
list if they need to modify speaker-message formatting.
F. Jason Park [Wed, 5 Jun 2024 07:22:28 +0000 (00:22 -0700)]
Restore deferred date-stamp insertions in ERC
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect): Treat
`erc-stamp--deferred-date-stamp' as a permanent-local variable.
(erc-stamp--date): Document expected possible values for `fn' slot.
(erc-stamp--defer-date-insertion-on-post-modify): Use the function
`ignore' to mean a new `erc-timer-hook' member has been requested.
Use nil to mean one has already run. Deferred date stamps are new in
ERC 5.6 and Emacs 30.
(erc-stamp--date-mode): Improve doc string.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--date-mode/reconnect): New test.