Martin Rudalics [Sun, 23 Jun 2024 08:26:57 +0000 (10:26 +0200)]
Fix a bug in 'switch-to-buffer'
* lisp/window.el (switch-to-buffer): When asked to switch to the
buffer of the selected window,
'switch-to-buffer-obey-display-actions' is non-nil and
'pop-to-buffer' uses the selected window, don't try to restore
window start and point from 'window-prev-buffers' (Bug#71616).
Jim Porter [Thu, 20 Jun 2024 03:59:59 +0000 (20:59 -0700)]
Fix zooming images in SHR
Previously, for images with no alt-text, the zoomed image wouldn't get
properly inserted. For images with alt-text, both the zoomed and
unzoomed image would be displayed at once (bug#71666).
* lisp/net/shr.el (shr-sliced-image): New face.
(shr-zoom-image): Reimplement using
'next/previous-single-property-change', and don't bother deleting any of
the text.
(shr-image-fetched): Clean up any overlays when deleting the old region.
(shr-put-image): Ensure we always have a non-empty string to put the
image on. For sliced images, just use "*", since we'll repeat it, so we
can't preserve the original buffer text exactly anyway. Apply an
overlay to sliced images to prevent unsightly text decorations.
(shr-tag-img): Move the placeholder space insertion where it should be
and explain what it's doing.
* test/lisp/net/shr-tests.el (shr-test--max-wait-time)
(shr-test-wait-for): New helper functions.
(shr-test/zoom-image): New test.
Vincenzo Pupillo [Sat, 22 Jun 2024 21:11:17 +0000 (23:11 +0200)]
Colorize CSS property value like `css--fontify-region'
If the value of a property is text representing a CSS color,
it will be fontified such that its background is the color
itself. 'php-ts-mode-css-fontify-colors' can be used to
disable this behaviour.
* lisp/progmodes/php-ts-mode.el (php-ts-mode-css-fontify-colors):
New custom var.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--colorize-css-value):
New function.
* lisp/progmodes/php-ts-mode.el (php-ts-mode): Use the new
function. (Bug#71724)
Stefan Kangas [Sat, 22 Jun 2024 22:16:42 +0000 (00:16 +0200)]
Add assignment form as `etc/copyright-assign.txt`
This change was discussed in:
https://lists.gnu.org/r/emacs-devel/2023-12/msg00326.html
* etc/copyright-assign.txt: New file copied from
https://www.gnu.org/s/gnulib/Copyright/request-assign.future
* doc/emacs/trouble.texi (Copyright Assignment):
* etc/TODO: Point to above new file.
Michael Albinus [Sat, 22 Jun 2024 17:52:06 +0000 (19:52 +0200)]
Minor changes in tramp-tests.el
* test/lisp/net/tramp-tests.el (tramp--test-shell-file-name):
Use connection-local value.
(tramp--test-shell-command-switch): New defun.
(tramp-test28-process-file)
(tramp-test34-explicit-shell-file-name): Use it.
(tramp--test-supports-processes-p): Simplify.
(tramp--test-check-files): Use `tramp-compat-seq-keep'.
(tramp-test45-asynchronous-requests): Don't let-bind `shell-file-name'.
(tramp-test45-asynchronous-requests): Adjust timer.
(tramp-test45-asynchronous-requests): Add another test message.
Michael Albinus [Sat, 22 Jun 2024 17:49:45 +0000 (19:49 +0200)]
Tramp: Fix bug#71709, and other minor changes
* lisp/net/tramp-message.el (tramp-backtrace): Print also in batch mode.
* lisp/net/tramp.el (tramp-skeleton-file-exists-p): Check for
property only.
(tramp-skeleton-make-process): Don't set `default-directory'.
(tramp-handle-make-process): Set it. (Bug#71709)
Vincenzo Pupillo [Sat, 22 Jun 2024 14:22:16 +0000 (16:22 +0200)]
Fix for grammar change of keyword "virtual" in tree-sitter-cpp
The new rule works with both the new (>= 0.22.1) and the
old (<= 0.22.0) grammar libraries.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--keywords): Removed
the keyword "virtual".
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
New font lock rule. (Bug#71518)
Stefan Kangas [Sat, 22 Jun 2024 16:42:06 +0000 (18:42 +0200)]
Replace literal whitespace with `\s`
* test/lisp/vc/log-edit-tests.el (log-edit-fill-entry-confinement)
(log-edit-fill-entry-space-substitution)
(log-edit-fill-entry-initial-wrapping): Replace literal space character
with '\s', to avoid tripping up merge scripts.
* lisp/editorconfig.el (editorconfig--get-indentation-python-mode):
New function.
(editorconfig-indentation-alist): Use it.
(editorconfig-indent-size-vars): Improve docstring.
(editorconfig--default-indent-size-function): Add docstring.
Ihor Radchenko [Fri, 21 Jun 2024 13:45:25 +0000 (15:45 +0200)]
org-link-expand-abbrev: Do not evaluate arbitrary unsafe Elisp code
* lisp/org/ol.el (org-link-expand-abbrev): Refuse expanding %(...)
link abbrevs that specify unsafe function. Instead, display a
warning, and do not expand the abbrev. Clear all the text properties
from the returned link, to avoid any potential vulnerabilities caused
by properties that may contain arbitrary Elisp.
Stefan Kangas [Sat, 22 Jun 2024 14:50:12 +0000 (16:50 +0200)]
Use UTC when generating man page timestamps
* doc/man/ebrowse.1:
* doc/man/emacs.1.in:
* doc/man/emacsclient.1:
* doc/man/etags.1: Add 'time-stamp-time-zone' to local variables to
prefer UTC when generating timestamp.
Vincenzo Pupillo [Fri, 21 Jun 2024 21:24:33 +0000 (23:24 +0200)]
Support for indentation of PHP alternative syntax control structures
For some control structures, PHP provides an alternative syntax.
A new rule has been added to handle this syntax.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--indent-styles):
New rule for PHP alternative syntax. (Bug#71710)
Vincenzo Pupillo [Sun, 16 Jun 2024 14:32:53 +0000 (16:32 +0200)]
Fix font lock regex for user defined constant in PHP
The old regex also captured functions with two or more
uppercase characters. This new regex fixes that issue.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--font-lock-settings):
New regex that match only user-defined constants. (Bug#71593)
Make Compilation mode recognize non-legacy Kotlin/Gradle errors
The Compilation mode recognizes Kotlin/Gradle errors but only in
the now legacy format. The current format, which has been in wide
use for about a year, is not supported. This change adds support
for the current format.
* etc/compilation.txt: (symbols): Add examples of non-legacy
Kotlin/Gradle warnings and errors.
* lisp/progmodes/compile.el: (compilation-error-regexp-alist-alist):
Rename 'gradle-kotlin' to 'gradle-kotlin-legacy' and add
'grade-kotlin' that matches the errors and warnings outputted by
the current (non-legacy) Kotlin/Gradle. (Bug#70797)
* test/lisp/progmodes/compile-tests.el
(compile-tests--test-regexps-data): Rename 'gradle-kotlin' to
'gradle-kotlin-legacy' and add two test cases for the newly added,
non-legacy Kotlin/Gradle warnings and errors.
Po Lu [Fri, 21 Jun 2024 07:12:07 +0000 (15:12 +0800)]
Fix execution of tool-bar commands read within minibuffer-error-handler
* src/keyboard.c (read_char): Arrange that the original event be
recorded when a posn is promoted to a prefix key and an END_TIME
is suppressing additions to this_command_keys.
Jim Porter [Fri, 14 Jun 2024 04:26:53 +0000 (21:26 -0700)]
Ensure navigating by paragraphs in Eshell stops at prompts and paragraphs
The previous implementation in 6ae2b74ed20 only stopped at prompts,
which isn't the right behavior (bug#61545).
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-backward-paragraph): Reimplement to handle prompts and
paragraphs (the latter by calling the original 'forward-paragraph').
* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test/next-previous-prompt/multiline): Rename.
(em-prompt-test/forward-backward-paragraph-1): New function.
(em-prompt-test/forward-backward-paragraph)
(em-prompt-test/forward-backward-paragraph/multiline): New tests.
Jim Porter [Sat, 15 Jun 2024 18:03:33 +0000 (11:03 -0700)]
Limit the amount of text we examine when looking for password prompts
Both Comint and Eshell do this, and it can significantly slow down
commands that write a lot of output (bug#71576).
* lisp/comint.el (comint-password-prompt-max-length): New variable...
(comint-watch-for-password-prompt): ... use it. Additionally, use the
matched result for the Emacs-based password prompt.
* lisp/eshell/esh-mode.el (eshell-password-prompt-max-length): New
variable...
(eshell-watch-for-password-prompt): ... use it.
* lisp/net/net-utils.el (ping): With a prefix argument, prompt the user
for flags to pass to the "ping" command. (Bug#71438)
* etc/NEWS: Document the above change.
Stefan Kangas [Thu, 20 Jun 2024 11:30:11 +0000 (13:30 +0200)]
Remove more references to Windows 95
* doc/lispref/frames.texi (Window System Selections):
* doc/misc/ediff.texi (Patch and Diff Programs):
* doc/misc/efaq-w32.texi (Third-party multibyte, Swap Caps NT)
(Subprocesses and floppy drive):
* etc/PROBLEMS:
* lisp/printing.el (pr-path-alist, pr-command):
* lisp/ps-print.el: Remove more references to Windows 95, which is not
supported by Emacs.
Eli Zaretskii [Thu, 20 Jun 2024 10:42:04 +0000 (13:42 +0300)]
Fix last change
* src/xdisp.c (handle_line_prefix): Set the 'align_visually_p'
only after pushing the iterator.
(pop_it): Reset the 'align_visually_p' flag. (Bug#71605)
Eli Zaretskii [Thu, 20 Jun 2024 09:52:06 +0000 (12:52 +0300)]
Fix use of ':align-to' in 'wrap-prefix'
* src/dispextern.h (struct it): New flag 'align_visually_p'.
* src/xdisp.c (handle_line_prefix): Set the 'align_visually_p'
flag for 'wrap-prefix'.
(produce_stretch_glyph): If 'align_visually_p' flag is set, count
the :align-to offset from the beginning of the screen line, not
from BOL. (Bug#71605)
* doc/lispref/display.texi (Truncation, Specified Space): Document
the special handling of ':align-to' in 'wrap-prefix'.
* src/w32fns.c (unwind_create_frame, Fx_create_frame)
(w32_create_tip_frame): Remove adjustments of the frame image
cache's reference count rendered redundant by the assignment of
image caches to individual frames rather than terminals.
* src/dispextern.h (struct image_cache) <scaling_col_width>: New
field.
* src/frame.c (gui_set_font): In lieu of clearing F's image
cache unconditionally, establish whether the column width as
considered by compute_image_size has changed, and if so, adjust
or reassign the frame's image cache.
(make_frame): Clear F->image_cache.
* src/frame.h (struct frame) <image_cache>: New field.
(FRAME_IMAGE_CACHE): Return F->image_cache.
* src/image.c (make_image_cache): Clear C->scaling_col_width.
(cache_image): Adjust to new means of assigning image caches to
frames.
* lisp/window.el (display-buffer-override-next-command):
display-buffer-overriding-action's car can be either a function or a
list of functions. When a function,
(push action (car display-buffer-overriding-action)) will create a
cons-cell (action . function) instead of a list. In the clear-fun
callback, trying to
(delq action (car display-buffer-overriding-action)) causes an
wrong-type-argument error.
Stefan Monnier [Wed, 19 Jun 2024 18:08:35 +0000 (14:08 -0400)]
(editorconfig-indentation-alist): Sync with upstream
The upstream version `editorconfig-indentation-alist` is a lot
more complete than what we got from the
copyright-covered commits. The changes come from contributors
who (may) have not signed paperwork. I have not tracked all of
the corresponding commits (there are many) but from what I can
tell, most of those are the sole (and "trivial") contribution
of its author, and in any case there is very little creativity
involved since it just lists the variables used by the
corresponding mode, so I believe it's perfectly OK to include
those here. Many of them would be covered by our default
heuristic (which looks for vars of the form like `<mode>-basic-offset`),
but it's preferable to reduce changes with upstream.
* lisp/editorconfig.el (editorconfig-indentation-alist):
Synchronize with upstream. Remove obsolete `sh-indentation`.
(editorconfig--get-indentation-web-mode): Update based on upstream
changes to `editorconfig-indentation-alist`.
Stefan Monnier [Tue, 18 Jun 2024 22:16:10 +0000 (18:16 -0400)]
editorconfig-core-handle.el: Reduce allocation in parser
* lisp/editorconfig-core-handle.el (editorconfig-core-handle--parse-file):
Return a `editorconfig-core-handle`.
(editorconfig-core-handle): Simplify accordingly.
(editorconfig-core-handle--parse-file): Push `sections` and `props`
in reverse order to avoid the usual O(N²) complexity.
Work directly in the buffer instead of extracting "lines" from it, so
as to reduce memory allocation. Similarly, use careful regexps so we
can extract trimmed strings without an explicit trim operation.
Use `eobp`.
(editorconfig-core-handle--string-trim): Delete function, not used any more.
* lisp/editorconfig-fnmatch.el (editorconfig-fnmatch--do-translate):
Accumulate partial results in reverse order to pay a single O(N)
reverse at the end instead of N times O(N) concatenations.
Stefan Monnier [Tue, 18 Jun 2024 21:11:34 +0000 (17:11 -0400)]
editorconfig-core-handle.el: Don't use file names as glob pattern
Match relative file names against the glob pattern instead of
trying to construct a glob pattern that matches the absolute
file name (where the code failed to escape the possible
special chars).
* lisp/editorconfig-core-handle.el
(editorconfig-core-handle-section-get-properties): Delete `dir` arg.
(editorconfig-core-handle-get-properties-hash)
(editorconfig-core-handle-get-properties): Adjust call accordingly.
Use `declare` to mark it obsolete.
(editorconfig-core-handle--fnmatch-p): Delete `dir` arg.
Stefan Monnier [Tue, 18 Jun 2024 14:51:48 +0000 (10:51 -0400)]
editorconfig.el: Miscellaneous minor changes
* lisp/editorconfig.el: Drop redundant `require`s of pcase, nadvice, rx.
Remove unnecessary (and incorrect) `defvar`s in `eval-when-compile`.
(find-library-name, lm-version): Move declarations to right after
the corresponding `require` so we have a reason to believe they're defined.
(editorconfig-version): Use `package-get-version` when available.
In Emacs<30, we can't use `auto-coding-functions`, but we can get
almost the same result by advising `find-auto-coding`.
* lisp/editorconfig.el (editorconfig-merge-coding-systems): Return nil
if there's no setting. Don't merge if there's no need.
(editorconfig-set-coding-system-revert); Adjust accordingly.
(editorconfig--filename-codingsystem-hash): Delete var.
(editorconfig--advice-insert-file-contents): Delete function.
(editorconfig--advice-find-file-noselect); Simplify.
(editorconfig--advice-find-auto-coding): New function.
(editorconfig-mode): Use it.
Stefan Monnier [Mon, 10 Jun 2024 21:18:13 +0000 (17:18 -0400)]
lisp/editorconfig: Use new Emacs-30 hooks
* lisp/editorconfig.el (editorconfig--get-coding-system)
(editorconfig--get-dir-local-variables): New functions.
(editorconfig-mode): Use them if possible.
(editorconfig-hack-properties-functions only)
(editorconfig-after-apply-functions): Define only when the old advice
is used, since the new hooks don't support them.
Stefan Monnier [Mon, 10 Jun 2024 20:58:27 +0000 (16:58 -0400)]
(editorconfig-set-local-variables): Get first, set later
In preparation for the use of Emacs-30's
`hack-dir-local-get-variables-functions`, split the job of
`editorconfig-set-local-variables` into getting an alist of settings
and then applying them.
Rename the `editorconfig-set-*` functions to `editorconfig--get-*`
and make them return an alist of settings rather than applying them
(except for `editorconfig-set-coding-system-revert` which arguably
belongs in `editorconfig-tools.el` anyway).
* lisp/editorconfig.el (editorconfig-indentation-alist): Flesh out the doc.
Use the new `editorconfig--get-indentation-*-mode` functions.
(editorconfig--get-indentation-web-mode): New function extracted from
`editorconfig-indentation-alist`.
(editorconfig--get-indentation-*-mode): Don't `boundp`-test the vars.
(editorconfig--default-indent-size-function): New function.
Test `boundp` here.
(editorconfig-indent-size-vars): New var.
(editorconfig--get-indentation, editorconfig--get-trailing-nl): Rewrite.
(editorconfig--add-hook-safe-p): New function.
Add it to the `safe-local-eval-function` property of `add-hook`.
(editorconfig-get-local-variables-functions): New hook.
(editorconfig--get-local-variables): Rewrite using it.
(editorconfig-set-local-variables): Test `editorconfig--should-set` here.
Rewrite it using `editorconfig--get-local-variables`.
Stefan Monnier [Wed, 12 Jun 2024 22:27:15 +0000 (18:27 -0400)]
lisp/editorconfig: Don't hook into `read-only-mode-hook`
Don't re-set variables just because `read-only-mode` is (de)activated,
and with Emacs-30's hooks it would be even less natural to do.
Also `buffer-read-only` can change without calling `read-only-mode`,
so better test it dynamically when we try to trim whitespace.
* lisp/editorconfig.el (editorconfig--delete-trailing-whitespace):
New function.
(editorconfig-set-trailing-ws): Use it. Use `pcase`.
Also prefer `before-save-hook` and use `add/remove-hook` to
manipulate hooks, like god intended.
Don't test `buffer-read-only` any more.
(editorconfig-mode): Don't hook into `read-only-mode-hook` any more.
Stefan Monnier [Wed, 12 Jun 2024 22:05:43 +0000 (18:05 -0400)]
(editorconfig--should-set): Eliminate `lisp-indent-offset` special case
Instead of treating `lisp-indent-offset` specially in
`editorconfig--should-set` (to obey `editorconfig-lisp-use-default-indent`),
use a new function `editorconfig-set-indentation-lisp-mode`
for Lisp modes.
* lisp/editorconfig.el (editorconfig--should-set): Remove `size` argument.
(editorconfig-set-indentation): Adjust calls accordingly.
(editorconfig-set-indentation-lisp-mode): New function.
(editorconfig-indentation-alist): Use it.
Prefer #' to quote function names.
Remove redundant :groups.
Silence compiler warnings.
* lisp/editorconfig.el: Remove post-trailer.
The var is already set via `.dir-locals.el` anyway.
(editorconfig-call-get-properties-function): Use condition-case-unless-debug.