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.
* 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.
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).
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.
* src/editfns.c:
(narrowing_locks): Explain why an alist is used instead of a
buffer-local variable.
(reset_outermost_narrowings): Point to recipes that demonstrate
why it is necessary to restore the user narrowing bounds when
redisplay starts.
(Fwiden): Update docstring.
(Fnarrow_to_region): Update docstring.
(Finternal__lock_narrowing): Update docstring.
(Finternal__unlock_narrowing): Update docstring.
(Fsave_restriction): Update docstring.
* etc/NEWS: Mention the 'long-line-optimizations-region-size' and
'long-line-optimizations-bol-search-limit' options.
Announce the 'with-narrowing' and 'without-narrowing' forms.
* doc/lispref/positions.texi (Narrowing): Update the documentation
of 'narrow-to-region', 'widen' and 'save-restriction'. Document
the 'with-narrowing' and 'without-narrowing' special forms.
* doc/lispref/display.texi (Auto Faces): Update the documentation.
* doc/lispref/commands.texi (Command Overview): Document the fact
that the buffer is narrowed around 'pre-command-hook' and
'post-command-hook' when the buffer text includes very long lines.
Make 'narrowing-lock' and 'narrowing-unlock' internal
* src/editfns.c (Finternal__lock_narrowing): Renamed from
'narrowing-lock'.
(Finternal__unlock_narrowing): Renamed from 'narrowing-unlock'.
(unwind_narrow_to_region_locked):
(narrow_to_region_locked):
(syms_of_editfns): Use the new names.
* lisp/subr.el (internal--with-narrowing): Use the new name.
Yuan Fu [Mon, 6 Feb 2023 03:32:24 +0000 (19:32 -0800)]
Fix c-ts-mode indentation
Sign, ok, there's another edge case: else if statements. Because
"else if" is usually implemented as just another if statement nested
in the else branch, this creates additional levels that indentation
needs to ignore.
I converted c-ts-common-indent-block-type-regexp +
c-ts-common-indent-bracketless-type-regexp into a new, more flexible
variable, c-ts-common-indent-type-regexp-alist, to avoid adding yet
more variables in order to recognize else and if statements.
* lisp/progmodes/c-ts-common.el:
(c-ts-common-indent-type-regexp-alist): New variable.
(c-ts-common-indent-block-type-regexp)
(c-ts-common-indent-bracketless-type-regexp): Remove variables.
(c-ts-common--node-is): New function.
(c-ts-common-statement-offset): Use the new variable, and add the
"else if" special case. Also merge the code of
c-ts-mode--fix-bracketless-indent, because now the code is much more
succinct.
(c-ts-mode--fix-bracketless-indent): Merge into
c-ts-common-statement-offset.
Dmitry Gutov [Mon, 6 Feb 2023 22:28:25 +0000 (00:28 +0200)]
(eglot-completion-at-point): Return correct values in :company-kind
* lisp/progmodes/eglot.el (eglot-completion-at-point): Return the
correct values in :company-kind for "EnumMember" and "TypeParameter".
The convention is to use kebab case rather than plain downcasing.
Reported in https://github.com/company-mode/company-mode/issues/1370.
* lisp/progmodes/bug-reference.el (bug-reference-auto-setup-functions):
Add clarification to docstring that this variable is for packages, not
for users.
Use c-ts-common-statement-offset in java-ts-mode (bug#61142)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Add new
matchers to enable c-ts-common machinery.
(java-ts-mode): Add regexps.
* lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset): Fix
typo in documentation and use the new if statement helpers.
(c-ts-common-if-statement-regexp): New defvar.
(c-ts-common-nestable-if-statement-p): New defvar.
(c-ts-common--fix-nestable-if-statement): New helper.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add test for
complicated bracket matching indentation.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add indent
rules for bracketless statements.
Dmitry Gutov [Mon, 6 Feb 2023 02:12:25 +0000 (04:12 +0200)]
go-ts-mode: Fix highlighting of function name in call_expression
* lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings):
Remove :override from the 'property' rules and move them above
'variable' (bug#61302). Just like in rust-ts-mode.
Dmitry Gutov [Sun, 5 Feb 2023 21:42:18 +0000 (23:42 +0200)]
rust-ts-mode: Fix highlighting of function name in call_expression
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Remove :override from the 'property' rules and move them above
'variable' (bug#61302).
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings):
Remove the rule that highlighted scope identifier in a function call
as type. The existing rules will handle it when it does look like a
type (capitalized).
Tassilo Horn [Sun, 5 Feb 2023 18:54:17 +0000 (19:54 +0100)]
Add to bug-reference-auto-setup-functions after its declaring defvar
If it's the init-value of the defvar, add-hook from a third-party
package will suppress the default functions if it takes place before
bug-reference is loaded.
* lisp/progmodes/bug-reference.el (bug-reference-auto-setup-functions):
Add to bug-reference-auto-setup-functions after its declaring defvar.
Dmitry Gutov [Sun, 5 Feb 2023 17:06:47 +0000 (19:06 +0200)]
Fix inability to turn show-paren-local-mode on manually (bug#61098)
* lisp/paren.el (show-paren-local-mode): Don't kill the local
value when both local and global are t. Because the
show-paren-predicate check in show-paren-function also checks
whether a local (non-nil) value of this variable exists.
Dmitry Gutov [Sun, 5 Feb 2023 16:49:24 +0000 (18:49 +0200)]
rust-ts-mode: Highlight variable declarations
(rust-ts-mode--font-lock-settings): Change scoped_type_identifier
highlight to match similar cases. Highlight variable declarations
inside all kinds of destructuring patterns, not just function
definitions.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode--fontify-pattern):
Rename from 'rust-ts-mode--fontify-parameter'. Check the id node's
parent to avoid touching type identifiers.
Jonas Bernoulli [Wed, 1 Feb 2023 19:25:15 +0000 (20:25 +0100)]
No longer use transient in isearch-emoji-by-name
* lisp/isearch.el (isearch-emoji-by-name): Use 'emoji--read-emoji'
and if that returns derivations, 'completing-read' to select one
of them. This fixes bug#60740.
* lisp/international/emoji.el (emoji--init): Autoload.
(emoji--read-emoji): New function, which doesn't use transient
and returns a list of the glyph and all derivations, if any.
(emoji--choose-emoji): Use 'emoji--read-emoji'.
Dmitry Gutov [Sun, 5 Feb 2023 13:46:28 +0000 (15:46 +0200)]
Make highlighting more regular across TS modes (bug#61205)
* doc/emacs/display.texi (Parser-based Font Lock):
Update description of treesit-font-lock-level, moving 'property' to
level 4.
* lisp/treesit.el (treesit-font-lock-level): Likewise, in docstring.
* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Do that here.
* lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): Add a comment.
* lisp/progmodes/go-ts-mode.el (go-ts-mode): Add 'definition' to
level 1. Move 'function', 'property' and 'variable' to level 4.
(go-ts-mode--font-lock-settings): Move a bunch of existing rules
to 'definition'. Add highlighting of function parameters.
* lisp/progmodes/rust-ts-mode.el (rust-ts-mode)
(rust-ts-mode--font-lock-settings): Same. And also change "scoped
identifiers" highlights to only match capitalized names.
Yuan Fu [Sat, 4 Feb 2023 02:35:33 +0000 (18:35 -0800)]
Make c-ts-mode-set-style's effect local (bug#61245)
Now c-ts-mode-set-style's effect is local, and there is a new function
c-ts-mode-set-global-style that changes the global setting.
* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-style-setter): Use c-ts-mode-set-style.
(c-ts-mode-indent-style)
(c-ts-mode--prompt-for-style): Minor change in docstring.
(c-ts-mode-set-global-style): New function (from c-ts-mode-set-style).
(c-ts-mode-set-local-style): Remove function (became c-ts-mode-set-style).
(c-ts-mode-set-style): Renamed from c-ts-mode-set-local-style.
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts:
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: Use
c-ts-mode-set-style.
Dmitry Gutov [Sat, 4 Feb 2023 20:46:41 +0000 (22:46 +0200)]
c-ts-mode: Highlight name in parameter declarations
* lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings):
Uncomment parameter declaration highlighting (bug#61275).
(c-ts-mode--fontify-declarator): Check that identifier was found.
Some declarations can miss identifier name.
Davide Masserut [Thu, 2 Feb 2023 20:00:02 +0000 (21:00 +0100)]
Fix switch statement indentation for go-ts-mode (bug#61238)
* lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add
indentation for type switch and select case blocks
* test/lisp/progmodes/go-ts-mode-resources/indent.erts: New .erts file
to test indentation of Go constructs and prevent regression of bug
fixes.
* test/lisp/progmodes/go-ts-mode-tests.el: New file with go-ts-mode
tests.