Robert Pluim [Mon, 3 Jun 2024 12:52:05 +0000 (14:52 +0200)]
Improve key binding documentation.
* doc/emacs/custom.texi (Init Rebinding): Explain how to bind a key to a
string and how to use non-ASCII characters.
* lisp/keymap.el (keymap-global-set, keymap-local-set): Mention
'key-description'.
Robert Pluim [Mon, 3 Jun 2024 12:00:56 +0000 (14:00 +0200)]
Add common pairs to defcustom for electric-quote-chars
* lisp/electric.el (electric--print-list-of-chars): New function to
display chars as chars instead of integers in a custom widget.
(electric-char-pair): New widget for displaying a pair of characters.
(electric-quote-chars-pairs): New widget. Contains presets for common
combinations of left/right quotation characters
(electric-quote-chars): Update to use 'electric-quote-chars-pairs'.
Po Lu [Mon, 3 Jun 2024 12:37:41 +0000 (20:37 +0800)]
Small followup change
* lisp/image.el (create-image): Remove supererogatory instances
of pcase. Recognize new `lambda' values and refrain from
specifying a default transform-smoothing when it is returned.
(image--default-smoothing): Return lambda if scaling is default.
* lisp/tool-bar.el (tool-bar--image-expression): Revert this
portion of last change.
Robert Pluim [Thu, 16 May 2024 14:25:24 +0000 (16:25 +0200)]
Improve support for entering quotation marks
* lisp/international/iso-transl.el (iso-transl-char-map): Add entries
for "low" single and double quotation marks.
(iso-transl-language-alist): Add convenient support for the official
German quoting style to the German language entry. It uses "low" double
quotes on the left, and *left* double quotes on the right. Add support
for single guillemets to the French language entry.
* lisp/leim/quail/latin-post.el ("latin-postfix"): Add entries for
single, double and "low" Unicode quotation marks. Add entries for
single guillemets.
* lisp/leim/quail/latin-pre.el ("latin-prefix"): And here.
Po Lu [Mon, 3 Jun 2024 08:34:51 +0000 (16:34 +0800)]
Maintain relationship between tool bar image and default font width
* doc/lispref/display.texi (Image Descriptors): Document new
value of QCscale.
* lisp/cus-start.el (standard) <image-scaling-factor>: New
definition.
* lisp/image.el (image-scaling-factor): Move to C.
(create-image): Provide `default' as the default scaling factor.
(image--default-smoothing): Accept non-integer scaling factors.
(image-compute-scaling-factor): Document that this function
is no longer invoked by Emacs.
* lisp/tool-bar.el (tool-bar--image-expression): Disable
transform smoothing for tool-bar icons.
* src/dispextern.h (clear_image_cache): New definition.
* src/frame.c (gui_set_font): Clear such image cache entries as
derive their scales from the default font width.
* src/image.c (clear_image_cache): Export function.
(compute_image_size): Implement `default' by reading
Vimage_scaling_factor and/or computing a scale factor from the
frame's column width, as the case may be.
New argument F. All callers changed.
(syms_of_image) <Vimage_scaling_factor>: Move from image.el.
Yuan Fu [Mon, 3 Jun 2024 04:52:48 +0000 (21:52 -0700)]
Use parser notifier to set parser ranges
This is a continuation from an earlier commit where I added
treesit-parser-changed-ranges and friends. Dmitry raised an concern
about the edge case where the parser re-parses multiple times before
treesit--pre-redisplay has a chance to run and process changed ranges.
Instead of making treesit-parser-changed-ranges DTRT and become more
complicated, it's agreed that using parser notifier is a better
solution (and treesit-parser-changed-ranges can probably be removed).
So, I took out the code that does the work from treesit--pre-redisplay
and put them into treesit--font-lock-mark-ranges-to-fontify. This
function will be called on each parser re-parse. And in
treesit--pre-redisplay, to ensure that treesit--f-l-m-r-to-f gets
called, we force the primary parser to re-parse.
I also added a new variable that major modes need to set,
treesit-primary-parser. I also added code that makes Emacs guess the
primary parser if that variable isn't set.
Documentation fot treesit-primary-parser will come later.
For futher reference, the message id for the message that prompted
this change is <dc94733b-df75-446c-980e-1c8ea65826cf@gutov.dev>
* lisp/treesit.el (treesit-primary-parser): New variable.
(treesit--font-lock-mark-ranges-to-fontify): New function.
(treesit--guess-primary-parser): New function.
(treesit--pre-redisplay): Extract out.
(treesit--pre-syntax-ppss): Add comments.
(treesit-major-mode-setup): Guess and set treesit-primary-parser; add
treesit--font-lock-mark-ranges-to-fontify as a notifier to the primary
parser.
* doc/misc/tramp.texi (Inline methods): Be more specific with containers.
(Remote processes): New subsection "Managing remote shell history".
Explain shell-history-file-name.
(Frequently Asked Questions): Add items to Tramp speedup. Remove
entry about history file.
* etc/NEWS: New user option 'shell-history-file-name'.
* lisp/shell.el (shell-history-file-name): New defcustom.
(shell-mode): Use it. (Bug#71049)
Spencer Baugh [Sun, 26 May 2024 13:26:09 +0000 (09:26 -0400)]
In rgrep, check matching files before excluding files
There are a lot of excluding globs, and checking them all is expensive.
The files glob (i.e. the glob for files we actually want) is usually
just one or two entries, so it's quite fast to check.
If find checks the files glob first and then the excluding glob, it has
to do much less checking (since the files glob will substantially narrow
down the set of files on its own), and find performance is much better.
In my benchmarking, this takes (rgrep "foo" "*.el" "~/src/emacs/trunk/")
from ~410ms to ~130ms.
Further optimizations are possible now that the ignores and matched
files are in the same <F> argument which can be rearranged more easily
without compatibility issues; I'll do those optimizations in later
commits.
* lisp/progmodes/grep.el (rgrep-find-ignores-in-<f>): Add.
* lisp/progmodes/grep.el (rgrep-default-command): Check
rgrep-find-ignores-in-<f> and move the excluded files glob to part of
the "files" argument. (Bug#71179)
Vincenzo Pupillo [Sun, 26 May 2024 19:07:50 +0000 (21:07 +0200)]
Make comment-indent-new-line conform better to CC Mode (bug#71225)
* lisp/progmodes/c-ts-common.el: (c-ts-common-comment-indent-new-line):
Single line comment and block comment now behave more like the
c-indent-new-comment-line.
Michael Albinus [Sat, 1 Jun 2024 17:22:21 +0000 (19:22 +0200)]
Minor Tramp changes
* lisp/net/tramp-adb.el:
* lisp/net/tramp-container.el: Add myself as maintainer.
* lisp/net/tramp-compat.el (connection-local-default-application):
Define if not bound.
(tramp-compat-connection-local-p, tramp-compat-connection-local-value):
Use it.
Dmitry Gutov [Sat, 1 Jun 2024 15:03:42 +0000 (18:03 +0300)]
shell-command-mode: New major mode for async-shell-command
* etc/NEWS: Mention the additions.
* lisp/shell.el (shell-command-mode): New major mode (bug#71049).
* lisp/simple.el (async-shell-command-mode):
New variable, with default value pointing to that mode.
(shell-command): Refer to it here.
(async-shell-command): Update docstring.
* lisp/net/tramp.el (tramp-handle-shell-command):
Use the new variable when available.
Noah Peart [Sun, 26 May 2024 12:34:34 +0000 (05:34 -0700)]
Add font-locking for variables in go-ts-mode range clauses (bug#71209)
* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Add font-locking rule for variable names in range clauses.
* test/lisp/progmodes/go-ts-mode-tests.el (go-ts-test-font-lock):
Add font-locking test for go-ts-mode.
* test/lisp/progmodes/go-ts-mode-resources/font-lock.go: New file
for go-ts-mode font-locking tests.
Eli Zaretskii [Sat, 1 Jun 2024 13:43:18 +0000 (16:43 +0300)]
Fix misc problems with thumbnails on MS-Windows
* lisp/image/image-dired-external.el (image-dired-pngcrush-thumb):
Fix deletion of intermediate file.
(image-dired-cmd-pngcrush-options)
(image-dired-cmd-create-standard-thumbnail-options): Use %u for
file:// URI.
(image-dired--file-URI): New function.
(image-dired-create-thumb-1, image-dired-create-thumb-2)
(image-dired-set-exif-data): Use it to generate correct URI on
MS-Windows.
* src/w32image.c (Fw32image_create_thumbnail): Copy the file names
before mirroring their slashes.
Po Lu [Sat, 1 Jun 2024 13:27:51 +0000 (21:27 +0800)]
Improve touch-screen support on PGTK
* lisp/touch-screen.el (touch-screen-translate-touch): Do not
prepend posn if the symbol is such that keyboard.c will do so
immediately after returning.
* src/pgtkterm.c (pgtk_toolkit_position): Remove mistakenly
ported code.
(pgtk_create_terminal): Remove toolkit_position hook.
(motion_notify_event, button_event): Ignore emulated pointer
events, and apply an additional test to circumvent a GDK
oversight.
(touch_event_cb): Correct return type, and provide touch
sequence initialization and removal events as
`last_click_event's.
* src/pgtkterm.c (pgtk_free_frame_resources): Free touch points
linked to this frame.
(pgtk_link_touch_point, pgtk_unlink_touch_point)
(pgtk_unlink_touch_points, pgtk_find_touch_point): New
functions, ported from X.
(touch_event_cb): New event callback.
(pgtk_set_event_handler): Register `touch_event_cb' as handler
for `touch-event'.
(pgtk_delete_display): Free residual touch points on this
display.
* src/pgtkterm.h (struct pgtk_touch_point): New structure.
(struct pgtk_display_info) <touchpoints>: New field.
Po Lu [Sat, 1 Jun 2024 05:53:37 +0000 (13:53 +0800)]
On X, avoid reporting unrepresentable touch IDs to Lisp
* src/xterm.c (xi_link_touch_point): Assign a Lisp-representable
identifier to the new touch point and return the same.
(xi_unlink_touch_point): New arg LOCAL_DETAIL. Return such an
identifier if there is a matching touch point record.
(handle_one_xevent): Adjust as is proper.
* src/xterm.h (struct xi_touch_point_t) <local_detail>:
New field. Reorder fields for alignment.
Michael Albinus [Fri, 31 May 2024 14:27:47 +0000 (16:27 +0200)]
Make Tramp error handling more precise
* lisp/net/tramp-container.el (tramp-actions-copy-out-of-band)
(tramp-container-no-container-regexp): Remove. Do not register them.
(tramp-distrobox-no-container-regexp): New defcustom.
(tramp-enable-distrobox-method): Add it to
`'tramp-actions-before-shell. (Bug#71200)
Juri Linkov [Fri, 31 May 2024 06:34:28 +0000 (09:34 +0300)]
Limit matches of treesit-thing-settings in js-ts-mode (bug#71244)
* lisp/progmodes/js.el (js-ts-mode): Use 'js--regexp-opt-symbol'
for 'js--treesit-sexp-nodes', 'js--treesit-sentence-nodes' and 'text'
that wraps the regexp in \_< and \_> delimiters to avoid false positives
such as "expression" used for "expression_statement".
(js--treesit-sexp-nodes): Add more useful nodes "parenthesized_expression",
"formal_parameters", "statement_block", "object", "object_pattern",
"named_imports", "class_body".
Juri Linkov [Fri, 31 May 2024 06:25:52 +0000 (09:25 +0300)]
* lisp/man.el (Man-getpage-in-background): Don't set buffer before display.
Call 'Man-notify-when-ready' before switching the current buffer.
This will avoid possible messing with the current buffer by
'Man-notify-when-ready' where display-buffer functions might change
the current buffer, thus breaking the subsequent setting of buffer-local
variables like Man-arguments in the wrong buffer (bug#71271).
Po Lu [Fri, 31 May 2024 01:54:49 +0000 (09:54 +0800)]
; Fix coding style in w32image.c
* src/w32image.c (get_encoder_clsid): Insert space between
identifier and param type list.
(struct thumb_data_type, struct cached_encoder): Break before
opening bracket at top-level.
Stefan Monnier [Thu, 30 May 2024 23:00:23 +0000 (19:00 -0400)]
track-changes.el: Keep a bit more info when logging an error
* lisp/emacs-lisp/track-changes.el (track-changes--recover-from-error):
Add arg `info`.
(track-changes-fetch, track-changes--after): Use it to preserve a bit
more information about errors.
Stefan Monnier [Thu, 30 May 2024 22:28:02 +0000 (18:28 -0400)]
server.el: Avoid nested runs of process filters (bug#71223)
In case we have a "storm" of emacsclient requests coming at the
same time, our process filters ended up running nested within
each other, eating up the stack and causing errors. Try and be
more careful with our use of `sit-for` in the process filter,
and make sure our process filters are run one at a time.
* lisp/server.el (server--message-sit-for): New function.
(server--process-filter-1): New function, extracted from
`server-process-filter`. Use `server--message-sit-for` to display the
messages and use `run-with-timer` to delay the `delete-process`.
(server--process-filter-pending, server--process-filter-active): New vars.
(server--process-filter-all-pending): New function.
(server-process-filter): Use them.
* lisp/image/image-dired.el
(image-dired-thumbnail-display-external): Add a fallback for
MS-Windows.
* lisp/image/image-dired-external.el
(image-dired--probe-thumbnail-cmd): New function.
(image-dired--check-executable-exists): Call it to verify that
"convert" is indeed an Imagemagick program. New argument FUNC
specifies a function that can be used as an alternative to running
EXECUTABLE.
(image-dired-create-thumb-1): Don't call
'image-dired--check-executable-exists' here, ...
(image-dired-thumb-queue-run): ...call it here, with
'w32image-create-thumbnail' as the alternative function. If on
MS-Windows and no "convert" command, call
'image-dired-create-thumb-2' instead.
(image-dired-create-thumb-2): New function.
Jakub Ječmínek [Thu, 30 May 2024 08:54:57 +0000 (10:54 +0200)]
Show all date options when adding Gnus scores interactively
* lisp/gnus/gnus-score.el (gnus-summary-increase-score): Rename
'char-to-type' variable to 'char-to-types' and bind all legal types
for date header.
* lisp/gnus/gnus-score.el (gnus-summary-score-entry): Provide better
default values for each scoring type and cast 'match' to number only
if necessary.
Jakub Ječmínek [Wed, 29 May 2024 18:37:37 +0000 (20:37 +0200)]
Update TUTORIAL.cs and TUTORIAL.translators
* etc/tutorials/TUTORIAL.cs: Update TUTORIAL.cs according to its
English counterpart.
* etc/tutorials/TUTORIAL.translators: Update maintaner of
TUTORIAL.cs.
Jim Porter [Thu, 30 May 2024 02:21:09 +0000 (19:21 -0700)]
Make Eshell's "which" command extensible
Since 'eshell-named-command-hook' already makes execution of commands
extensible, "which" should be too. This makes sure that "which" returns
the right result for quoted commands like "/:cat".
* lisp/eshell/em-alias.el (eshell-aliases-file): Allow it to be nil.
(eshell-read-aliases-list, eshell-write-aliases-list): Check if
'eshell-aliases-file' is nil.
(eshell-maybe-replace-by-alias--which): New function...
(eshell-maybe-replace-by-alias): ... use it.
* lisp/eshell/esh-cmd.el (eshell-named-command-hook): Update docstring.
(eshell/which): Make extensible.
(eshell--find-plain-lisp-command, eshell-plain-command--which): New
functions.
(eshell-plain-command): Use 'eshell--find-plain-lisp-command'.
* lisp/eshell/esh-ext.el (eshell-explicit-command--which): New
function...
(eshell-explicit-command): ... unise it.
(eshell-quoted-file-command--which): New function...
(eshell-quoted-file-command): ... use it.
(eshell-external-command--which): New function.
* test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell-settings):
Don't load or save aliases.
(eshell-command-result--match,eshell-command-result--match-explainer)
(eshell-command-result-match): New functions.
Jim Porter [Mon, 20 May 2024 15:59:02 +0000 (08:59 -0700)]
Fix calling Eshell scripts outside of Eshell
* lisp/eshell/em-script.el (eshell-source-file): Make obsolete.
(eshell--source-file): Adapt from 'eshell-source-file'...
(eshell-script-initialize, eshell/source, eshell/.): ... use it.
(eshell-princ-target): New struct.
(eshell-output-object-to-target, eshell-target-line-oriented-p): New
implementations for 'eshell-princ-target'.
(eshell-execute-file, eshell-batch-file): New functions.
* lisp/eshell/esh-mode.el (eshell-mode): Just warn if we can't create
the Eshell directory.
* test/lisp/eshell/em-script-tests.el (em-script-test/execute-file):
(em-script-test/execute-file/args), em-script-test/batch-file): New
tests.
* test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell-settings):
New function...
(with-temp-eshell): ... use it.
Jim Porter [Thu, 23 May 2024 21:55:59 +0000 (14:55 -0700)]
Rework how 'eshell-ensure-newline-p' adds newlines
This allows for other output targets (see the following commit) to be
"line-oriented".
* lisp/eshell/esh-io.el (eshell-ensure-newline-p): Move from esh-cmd.el.
(eshell-target-line-oriented-p, eshell--output-maybe-n)
(eshell-print-maybe-n, eshell-error-maybe-n)
(eshell-maybe-output-newline): New functions.
* lisp/eshell/esh-cmd.el (eshell-lisp-command): Don't print a newline
in this function directly; instead, use 'eshell-print-maybe-n' and
'eshell-error-maybe-n'.
(eshell-ensure-newline-p): Move to esh-io.el.
* lisp/eshell/em-unix.el (eshell/cat): Remove now-unnecessary override
of 'eshell-ensure-newline-p'.
Jim Porter [Thu, 23 May 2024 21:52:07 +0000 (14:52 -0700)]
Add ability for Eshell virtual targets to handle closing the target
This was documented to work by calling the output function with 'nil',
but that was never actually implemented. Instead, for compatibility,
we now support a new (optional) close function.
* lisp/eshell/esh-io.el (eshell-virtual-targets): Update docstring.
(eshell-generic-target): New struct...
(eshell-function-target): ... inherit from it, and rename from
'eshell-virtual-target'.
(eshell-get-target): Handle already-created 'eshell-generic-target'.
(eshell-close-target): Call the target's close function if present.
* test/lisp/eshell/esh-io-tests.el (esh-io-test/virtual/device-close):
New test.
* doc/misc/eshell.texi (Redirection): Document the new behavior.
* lisp/eshell/esh-module.el (eshell-load-modules)
(eshell-initialize-modules): ... here.
(eshell-module-loading-messages): New option.
(eshell-module--feature-name): Improve docstring.
(eshell-unload-modules): Display a real warning if unable to unload a
module.
Juri Linkov [Wed, 29 May 2024 18:05:20 +0000 (21:05 +0300)]
* lisp/imenu.el (imenu-flatten): Add new choice 'group' (bug#70846).
(imenu-flatten): For prefix use the implicit symbol 'prefix'.
(imenu--completion-buffer): Use :group-function
if imenu-flatten is 'group'.
(imenu--flatten-index-alist): Handle the value 'group' of
imenu-flatten in a way similar to the value 'annotation'.
Stefan Monnier [Wed, 22 May 2024 17:45:39 +0000 (13:45 -0400)]
Rename `subr-native-elisp` to `native-comp-function` (bug#71123)
Now that this type name is displayed in *Help*, it is more
important to use a name that is less weird for the unsuspecting user.
* lisp/emacs-lisp/cl-preloaded.el (cl-functionp): Adjust to new name of
native function's type.
(subr-native-elisp-p): Redefine as an obsolete alias.
(native-comp-function): Rename from `subr-native-elisp`