Eli Zaretskii [Fri, 24 Mar 2023 11:10:30 +0000 (14:10 +0300)]
Fix system time sampling on MS-Windows
* src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally
call tzset to make sure we pick up all the changes of time zone,
working around the MS CRT caching.
Yuan Fu [Fri, 24 Mar 2023 07:17:10 +0000 (00:17 -0700)]
Fix treesit_ensure_parsed (bug#62333)
* src/treesit.c (treesit_ensure_parsed): Check for need_reparse after
treesit_sync_visible_region runs, because as the comment says,
treesit_sync_visible_region might modify need_reparse.
Eli Zaretskii [Thu, 23 Mar 2023 09:30:19 +0000 (11:30 +0200)]
; Improve documentation of :predicate in globalized minor modes
* doc/lispref/modes.texi (Defining Minor Modes):
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Improve documentation of the :predicate keyword in defining
globalized minor modes.
Eli Zaretskii [Thu, 23 Mar 2023 08:31:56 +0000 (10:31 +0200)]
Allow showing prefix commands in Help buffers
* lisp/help.el (describe-bindings-show-prefix-commands): New user
option.
(describe-map): Use it to decide whether to output prefix
commands. Patch by Bob Rogers <rogers@rgrjr.com>. (Bug#62279)
Daniel Martín [Sat, 18 Mar 2023 00:47:32 +0000 (01:47 +0100)]
Fix toolbar item validation in the NS port
* src/nsterm.m ([EmacsView validateToolbarItem:]): Implement this
NSToolbarItemValidation method, which is called by AppKit when it
needs to validate an image item in a toolbar. This solves, in
particular, the problem with having the "Save" icon on the tool
bar enabled at Emacs startup. (Bug#62234)
It's important for a hook in after-change-functions not to change match-data.
Otherwise it breaks functions that make changes in the buffer, such as
for example, successive calls to delete-region in smerge-keep-n, etc.
João Távora [Tue, 21 Mar 2023 09:56:30 +0000 (09:56 +0000)]
Eglot: report window/workDoneProgress capability to language server
In bug#59149, LSP progress reporting was implemented, but Eglot's
'capabilities' statement to the server wasn't changed to include
window/workDoneProgress.
Andrea Corallo [Mon, 20 Mar 2023 16:24:48 +0000 (17:24 +0100)]
Comp fix calls to redefined primtives with op-bytecode (bug#61917)
* lisp/emacs-lisp/comp.el (comp-emit-set-call-subr): Fix compilation
of calls to redefined primtives with dedicated op-bytecode.
* test/src/comp-tests.el (61917-1): New test.
João Távora [Sun, 19 Mar 2023 00:47:55 +0000 (00:47 +0000)]
Improve ergonomics of Eglot's inlay hints
Instead of deleting inlay hints instantly as soon as the affected
changes, make hint overlays span one character (instead of being
length 0). Give the overlays an "evaporate" property.
Given an inlay hints at position POS, its attached to [POS, POS+1] if
it's kind=1 (usually type hints) and [POS-1, POS] otherwise. For
kind=1 hints, the 'cursor position of the first such overlay is also
tweaked, so that's it's less akward to edit around it.
João Távora [Fri, 17 Mar 2023 22:37:27 +0000 (22:37 +0000)]
Don't take over mouse-1 binding on Eglot diagnostics (bug#62157)
It's better to give the user a variable to allow the overlay keymap to
be customized.
* lisp/progmodes/eglot.el (eglot--mouse-call): Accept second arg.
(eglot--mode-line-props): Adapt call to eglot--mouse-call
(eglot-diagnostics-map): New variable.
(eglot-code-actions-at-mouse): New command.
Gregory Heytings [Sat, 18 Mar 2023 10:49:29 +0000 (10:49 +0000)]
Avoid slowdowns in xmltok-scan-attributes
* lisp/nxml/xmltok.el (xmltok-scan-attributes): Limit the search
to 10000 characters, to avoid slowdowns due to the quadratic
complexity of the regexp. Suggested by Stefan Monnier.
Alan Mackenzie [Sat, 18 Mar 2023 10:12:24 +0000 (10:12 +0000)]
CC Mode: Eliminate duplicate function c-list-of-strings
Replace it with the existing c-string-list-p. Also put an autoload cookie in
front of c-string-list-p so that it will not be signalled as undefined by
loaddefs.el.
lisp/progmodes/cc-vars.el (c-string-list-p): Make this autoload.
(c-list-of-strings): Remove.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): In the autoload
cookies, replace c-list-of-strings with c-string-list-p.
Alan Mackenzie [Mon, 13 Mar 2023 16:42:02 +0000 (16:42 +0000)]
CC Mode: Allow lists of strings as safe values for *-font-lock-extra-types
* lisp/progmodes/cc-vars.el (c-list-of-strings): New function.
(c-font-lock-extra-types, c++-font-lock-extra-types)
(objc-font-lock-extra-types, java-font-lock-extra-types)
(idl-font-lock-extra-types, pike-font-lock-extra-types): Add a :safe entry
into each of thes defcustoms for c-list-of-string.
(Top level): Add an autoload entry for each of the above.
Manuel Giraud [Fri, 10 Mar 2023 20:54:00 +0000 (21:54 +0100)]
Fix 'find-ls-option-default-ls' for BSD/MacOS (bug#62096)
* lisp/find-dired.el (find-ls-option-default-ls): Adapt to
a value that works with the default "find" on *BSD and
Darwin/MacOS. Tested on OpenBSD and MacOS. Do not merge
to master.
João Távora [Fri, 17 Mar 2023 11:47:02 +0000 (11:47 +0000)]
Fix Eglot's snippet insertion to follow the manual
The manual states that YASnippet must only be installed to be useful.
Before this change, it would only work if the user happened to have
manually activated it before with 'yas-global-mode' or somesuch.
This makes Eglot's Yasnippet-activating behaviour similar to its
Flymake-activating behaviour.
Eli Zaretskii [Fri, 17 Mar 2023 08:14:41 +0000 (10:14 +0200)]
Fix the documentation of various aspects of adding Xref history
* lisp/progmodes/xref.el (xref-marker-ring-length)
(xref-set-marker-ring-length):
* lisp/progmodes/etags.el (tags-location-ring-length)
(find-tag-marker-ring): Add doc strings saying the variables are
unused.
* etc/NEWS: Enhance the description of the change which made Xref
marker stack unlimited in its length.
* doc/emacs/maintaining.texi (Looking Up Identifiers): Add back
text lost when xref forward history was added in bug#38797.
Explain the difference between 'C-M-,' and 'M-.'. Improve
wording (Bug#62229)
kobarity [Sun, 12 Mar 2023 08:05:54 +0000 (17:05 +0900)]
Fix python-fill-paragraph problems on filling strings (bug#62142)
* lisp/progmodes/python.el (python-syntax--context-compiler-macro)
(python-syntax-context): Add single-quoted-string and
triple-quoted-string as TYPE argument.
(python-info-triple-quoted-string-p): New helper function.
(python-fill-paragraph)
(python-fill-string): Use it.
* test/lisp/progmodes/python-tests.el (python-syntax-context-1)
(python-fill-paragraph-single-quoted-string-1)
(python-fill-paragraph-single-quoted-string-2)
(python-fill-paragraph-triple-quoted-string-1)
(python-info-triple-quoted-string-p-1)
(python-info-triple-quoted-string-p-2)
(python-info-triple-quoted-string-p-3): New tests.
João Távora [Thu, 16 Mar 2023 10:41:53 +0000 (10:41 +0000)]
Emphasize emacs-29-specificity in this version of lisp/progmodes/eglot.el
Do not merge to master.
Before working on bugfixes to Eglot in its non-ELPA form delivered
with Emacs 29, it's important to distinguish between this emacs-29
version and the one in master, which will also get the bugfixes (via
routine gitmerge.el) but with a bumped version number.
* lisp/progmodes/eglot.el (Version): Emphasize Emacs 29, but hint this
is 1.12 + something.
(Package-Requires): Remove. Everything required is already in Emacs
29.
Standards-compliant web browsers should ignore this font-family.
MDN Web Docs says:
https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
Valid family names
Font family names must either be given quoted as strings, or unquoted as
a sequence of one or more identifiers. This means that punctuation
characters and digits at the start of each token must be escaped in
unquoted font family names.
It is a good practice to quote font family names that contain white
space, digits, or punctuation characters other than hyphens.
An unquoted font-family is valid as long as it doesn't start with a digit,
but MDN Web Docs also says:
The following example is technically valid but is not recommended:
font-family: Gill Sans Extrabold, sans-serif;
Document how to construct JSONRPC arrays in Eglot manual
Many language server configuration options are of the JSON array
datatype, for example argument lists for executables, but there wasn't
any example of that in the Eglot manual.
* lisp/emacs-lisp/package-vc.el (require): Do not load `inline' during
compilation.
(package-vc--query-spec): Remove function.
(package-vc--clone): Do not call 'package-vc--query-spec'.
* lisp/emacs-lisp/package-vc.el (package-vc--main-file)
(package-vc--unpack-1): Query 'pkg-spec' instead of
'package-desc-extras'.
(package-vc--unpack): Do not update 'package-desc-extras'.
This simplification is possible due to the change in 2718bbb3bc, since
we now ensure that package specifications are not lost. They are
either provided by a package archive or stored in
'package-vc-selected-packages'.
Use 'package-vc-selected-packages' to store package specs
* doc/emacs/package.texi (Fetching Package Sources): Do not promote
the usage of 'package-vc-selected-packages' to install packages.
* lisp/emacs-lisp/package-vc.el (package-vc-selected-packages): Remove
custom setter and change docstring according to these changes.
(package-vc--desc->spec): Consult 'package-vc-selected-packages' for
package specifications.
(package-vc--unpack): Add unknown package specifications to
'package-vc-selected-packages'
João Távora [Sun, 12 Mar 2023 19:44:53 +0000 (19:44 +0000)]
Update Eglot's manual about eglot-workspace-configuration
There is a possible use for a global setting
eglot-workspace-configuration, which is to (ab)use it to set
user-specific configuration when the server doesn't permit other
methods. Rearrange the "Advanced server configuration" section and
describe that use in the manual.
* doc/misc/eglot.texi (Project-specific configuration): Correct
mistake about global usefulness of eglot-workspace-configuration.
(Advanced server configuration): Swap order of sections.
(User-specific configuration): Mention possibility of globally
setting eglot-workspace-configuration.
João Távora [Sun, 12 Mar 2023 18:19:40 +0000 (18:19 +0000)]
Make eglot-ensure's post-command-hook run a bit later (bug#62065)
'eglot-ensure', typically used in the major-mode-hook, use
'post-command-hook' to schedule an automated, non-interactive
connection attempt to a server. The goal is to connect when the
buffer is ready, i.e. after the user command that found the file.
However, if there are dir-local or buffer-local variables to confirm,
finding the file will cause a minibuffer prompt to appear.
In that case, 'eglot-ensure's addition to the global post-command-hook
runs before it was intended too and a connection is started
prematurely.
In turn, this means that a call to 'hack-dir-local-variables' -- which
is part of the connection process -- which also needs a minibuffer
prompt, collides with the previous one. This generates an error and
confuses the user, who doesn't know if the directory-local variables
have been applied or not.
This commit fixes the clash by having 'eglot-ensure' set
'post-command-hook' buffer-locally. This causes the automated
connection to take place, as intended, after the user's original
file-finding command has ended.
However, the problem reported in bug#62065 is not completely fixed.
If the user answers "no" to the first "confirm local variables"
"prompt, she will be prompted again in the second one. A subsequent
commit will address this separate problem.
* lisp/progmodes/eglot.el (eglot-ensure): Use buffer-local post-command-hook.
Eli Zaretskii [Sun, 12 Mar 2023 17:32:02 +0000 (19:32 +0200)]
Fix display of disabled-command help text
* lisp/novice.el (disabled-command-function): Improve wording, and
make sure the prompt doesn't exceed one screen line, so that the
mini-window is not resized (which gets in the way of fitting the
window to the size of the help text), and the help text is fully
visible when Emacs prompts for input. (Bug#62146)
Eli Zaretskii [Sun, 12 Mar 2023 14:19:49 +0000 (16:19 +0200)]
Fix value history shown for 'gc-cons-percentage'
When Emacs is built, temacs is run in batch mode, so if we enlarge
'gc-cons-percentage' in that case, the enlarged value will be
"remembered" by the dumped Emacs, and will show confusing
information in "C-h v", claiming that the original value was 1.0.
Keeping the value at 0.1 during dumping avoids that.
* src/emacs.c (main): Increase 'gc-cons-percentage' in batch mode
only if we are not initializing (a.k.a. "dumping") Emacs.
Michael Albinus [Sun, 12 Mar 2023 10:01:22 +0000 (11:01 +0100)]
TRework fix for bug#62106
* lisp/files-x.el (connection-local-set-profiles)
(connection-local-set-profile-variables):
Use `custom-set-variables'. It serves the purpose to not keep
unsaved user options, and it is less invasive than
`customize-save-variable'.