Steven Allen [Sat, 6 Jan 2024 17:19:12 +0000 (09:19 -0800)]
Set the 'name' prop in 'define-advice'
In addition to naming the advice function `symbol@name', set
the 'name' property to NAME.
* lisp/emacs-lisp/nadvice.el (define-advice): set the 'name'
property to NAME (requested in Bug#68114). Fixes Bug#68294.
* doc/lispref/functions.texi (Advising Named Functions): Document
that 'define-advice' installs the advice with the specified name.
Po Lu [Sat, 13 Jan 2024 01:51:59 +0000 (09:51 +0800)]
Properly sort results for partial font specs
* src/sfntfont.c (sfntfont_compare_font_entities): New function.
(sfntfont_list): Sort matching font entities by the number of
fields set, and mention why.
Abstract predicate and constant for unused hash keys
Qunbound is used for many things; using a predicate and constant for
the specific purpose of unused hash entry keys allows us to locate
them and make changes much more easily.
* src/fns.c (larger_vecalloc): Remove.
(larger_vector): Simplify.
(alloc_larger_vector): New.
(maybe_resize_hash_table): Use alloc_larger_vector as a simpler and
faster replacement for larger_vecalloc.
The profiler stored data being collected in Lisp hash tables but
relied heavily on their exact internal representation, which made it
difficult and error-prone to change the hash table implementation.
In particular, the profiler has special run-time requirements that are
not easily met using standard Lisp data structures: accesses and
updates are made from async signal handlers in almost any messy
context you can think of and are therefore very constrained in what
they can do.
The new profiler tables are designed specifically for their purpose
and are more efficient and, by not being coupled to Lisp hash tables,
easier to keep safe.
The old profiler morphed internal hash tables to ones usable from Lisp
and thereby made them impossible to use internally; now export_log
just makes new hash table objects for Lisp. The Lisp part of the
profiler remains entirely unchanged.
* src/alloc.c (garbage_collect): Mark profiler tables.
* src/eval.c (get_backtrace): Fill an array of Lisp values instead of
a Lisp vector.
* src/profiler.c (log_t): No longer a Lisp hash table but a custom
data structure: a fully associative fixed-sized cache that maps
fixed-size arrays of Lisp objects to counts.
(make_log): Build new struct.
(mark_log, free_log, get_log_count, set_log_count, get_key_vector)
(log_hash_index, remove_log_entry, trace_equal, trace_hash)
(make_profiler_log, free_profiler_log, mark_profiler): New.
(cmpfn_profiler, hashtest_profiler, hashfn_profiler)
(syms_of_profiler_for_pdumper): Remove.
(approximate_median, evict_lower_half, record_backtrace, export_log)
(Fprofiler_cpu_log, Fprofiler_memory_log, syms_of_profiler):
Adapt to the new data structure.
Stefan Monnier [Fri, 12 Jan 2024 03:12:34 +0000 (22:12 -0500)]
sh-script.el: Add support for `case FOO {...}` (bug#55764)
* lisp/progmodes/sh-script.el (sh-font-lock-paren): Also recognize
`FOO)` after `{`.
(sh-smie-sh-rules): Make `for` rule apply to `case FOO { ...}` as well.
john muhl [Sat, 6 Jan 2024 15:36:33 +0000 (09:36 -0600)]
Support indented continuation lines in lua-ts-mode
* lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules):
Add a rule to indent multi-line assignments and if statements.
(lua-ts-indent-continuation-lines): New user option.
* test/lisp/progmodes/lua-ts-mode-resources/indent.erts: Add
tests. (Bug#68279)
* lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform):
Note that let-binding a buffer local variable leaves it buffer
local, hence to transfer the binding of
byte-compile-dynamic-docstrings to the output buffer, an
intermediate variable is needed. Implement this.
Michael Albinus [Thu, 11 Jan 2024 11:30:05 +0000 (12:30 +0100)]
Support numeric port numbers in auth-source-macos-keychain
* lisp/auth-source.el (auth-source-macos-keychain-search):
Support numeric port numbers (bug#68376).
(auth-source-macos-keychain-search-items): Make regexp more robust.
F. Jason Park [Tue, 9 Jan 2024 22:50:43 +0000 (14:50 -0800)]
; Fix overridden erc--input-split slot definition
* lisp/erc/erc-common.el (erc--input-split): Don't set the
default value to `:read-only'.
* test/lisp/erc/erc-tests.el (erc--channel-modes,
erc--channel-modes/graphic-p): Use `char-displayable-p' instead of
`display-graphic-p' to prevent the first test from failing on Unicode
terminal emulators.
Augusto Stoffel [Wed, 27 Sep 2023 16:35:32 +0000 (18:35 +0200)]
Use auth-info-mode for non-hidden authinfo and netrc files
* files.el (auto-mode-alist): Match non-hidden authinfo and netrc
files, since it is reasonable to store passwords in
~/.emacs.d/authinfo.gpg or a similarly named file. (Bug#66241)
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Translate `lua' and `lua-stack' to rx, and change two unnecessary
non-greedy operators to greedy.
Emacs comes with built-in support for the Lua programming language in
the form of the Lua mode and now also the Lua Tree-sitter mode. This
patch further improves Lua support in Emacs by making the Compilation
mode recognize Lua errors and stack traces.
* lisp/progmodes/compile.el (compilation-error-regexp-alist-alist):
Add regexps to aid Lua development, namely the 'lua' regexp that
matches Lua errors and the 'lua-stack' regexp that matches Lua stack
frames. (Bug#60830)
* etc/compilation.txt (Lua): Add an example of a Lua error message
with a stack trace.
* test/lisp/progmodes/compile-tests.el (compile-tests--test-regexps-data):
(compile-test-error-regexps): Test the new 'lua' and 'lua-stack'
regexps added to the 'compilation-error-regexp-alist-alist'.
* lisp/net/tramp.el (tramp-build-completion-file-name-regexp):
Do not use `tramp-volume-letter-regexp'. (Bug#68320)
(tramp-completion-handle-expand-file-name): Simplify regexp.
* test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion)
(tramp-test26-interactive-file-name-completion): Run also on MS Windows.
Handle package versions that are not version strings
* lisp/emacs-lisp/package.el (package-menu--version-predicate): Ignore
any errors raised by 'version-to-list', thus falling back to the
default version list. (Bug#68317)
Juri Linkov [Wed, 10 Jan 2024 07:34:47 +0000 (09:34 +0200)]
Support :category in completion-extra-properties (bug#68214)
* doc/lispref/minibuf.texi (Completion Variables): Add :category
to the table of completion-extra-properties.
* lisp/minibuffer.el (completion--metadata-get-1): New internal function.
(completion-metadata-get): Use 'completion--metadata-get-1'.
Thanks to Daniel Mendler <mail@daniel-mendler.de>.
(completion-extra-properties): Mention :category in the docstring.
* lisp/calendar/calendar.el (calendar-read-date): Use more
user-friendly let-binding of completion-extra-properties
with :category.
Juri Linkov [Tue, 9 Jan 2024 17:57:50 +0000 (19:57 +0200)]
Support more metadata properties in completion-extra-properties (bug#68214)
* doc/lispref/minibuf.texi (Completion Variables): Add
to the table of completion-extra-properties new items:
`group-function', `display-sort-function', `cycle-sort-function'.
* lisp/icomplete.el (icomplete--augment): Remove unnecessary
plist-get from completion-extra-properties since now
completion-metadata-get does this.
* lisp/minibuffer.el (completion-metadata-get): Use plist-get to
get prop from completion-extra-properties and cache the keyword.
Thanks to Daniel Mendler <mail@daniel-mendler.de>.
(completion-extra-properties): Mention new properties in docstring.
(minibuffer-completion-help): Remove unnecessary
plist-get from completion-extra-properties since now
completion-metadata-get does this.
* lisp/net/eww.el (eww-switch-to-buffer):
* test/lisp/minibuffer-tests.el (completions-affixation-navigation-test):
Unquote lambda in completion-extra-properties.
Juri Linkov [Tue, 9 Jan 2024 17:22:40 +0000 (19:22 +0200)]
* lisp/tab-bar.el: Fixes for point in window configuration (bug#68235)
(tab-bar--tab): Instead of 'point-marker', use 'copy-marker' with the TYPE
argument set to 'window-point-insertion-type'. This will allow point to
follow the output after switching tabs when point is at the end of
a comint/compilation buffer.
(tab-bar-select-tab): Remove ad-hoc rule for the reverted dired buffer.
Harald Jörg [Mon, 8 Jan 2024 15:12:19 +0000 (16:12 +0100)]
cperl-mode.el: Make sure cperl-file-style is set buffer-local
* lisp/progmodes/cperl-mode.el (cperl-file-style): Add description
what the options actually do.
(cperl-menu): Split the menu entry "Indent styles" into "Default
indent styles" and "Indent styles for current buffer"
(cperl--set-file-style): call `cperl-file-style' instead of
`cperl-set-style'. This completes the fix for Bug#17948.
(cperl-set-style): Explain when to use `cperl-file-style'.
Use `set-default-toplevel-value' instead of `set'.
(cperl-set-style-back): Use `set-default-toplevel-value' instead
of `set'.
(cperl-file-style): New command to set the file style for the
current buffer.
* etc/NEWS: Announce the new command cperl-file-style.
Po Lu [Mon, 8 Jan 2024 07:32:07 +0000 (15:32 +0800)]
Properly instruct Italic Arial or BS Mono at small PPEM sizes
* src/sfnt.c (sfnt_read_simple_glyph): Correct alignment errors.
(PUSH2_UNCHECKED): Don't shift negative signed value to the
left.
(SLOOP): Permit LOOP to be set to 0, which inhibits the
execution of instructions it affects.
(sfnt_address_zp2, sfnt_address_zp1, sfnt_address_zp0): Permit X
and Y to be NULL.
(sfnt_dot_fix_14): Guarantee that the final value is rounded to
negative infinity, not zero.
(sfnt_project_zp1_zp0_org): New function.
(sfnt_interpret_mdrp): Avoid rounding issues by computing
original distance from unscaled coordinates, if at all possible.
(sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2):
Set zone->simple.
(all_tests) <LOOP>: Update test.
(sfnt_identify_instruction, main): Adjust tests.
* src/sfnt.h (struct sfnt_interpreter_zone): New field simple.
F. Jason Park [Fri, 5 Jan 2024 15:20:34 +0000 (07:20 -0800)]
Clarify purpose of module aliases in ERC
* doc/misc/erc.texi: Mention that aliases should not be defined for
new modules.
* lisp/erc/erc-common.el (define-erc-module): Refactor slightly for
readability.
(erc-with-all-buffers-of-server): Redo doc string.
* lisp/erc/erc-pcomplete.el: Declare `completion' module's feature and
group as being `erc-pcomplete'.
* test/lisp/erc/erc-tests.el (erc--find-group--real): Assert group
lookup works for "normalized" module name `completion' of
`erc-pcomplete-mode'.
F. Jason Park [Thu, 4 Jan 2024 07:10:55 +0000 (23:10 -0800)]
Make ERC's format catalogs more extensible
* lisp/erc/erc-common.el (erc--define-catalog): Accept a `:parent'
keyword to allow for extending an existing catalog by overriding some
subset of defined entries.
(erc-define-message-format-catalog): Add edebug spec.
* lisp/erc/erc.el (erc-retrieve-catalog-entry): Check parent for
definition before looking to `default-toplevel-value'.
* test/lisp/erc/erc-tests.el (erc-retrieve-catalog-entry): Add test
case for inheritance.
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests-common-pp-propertized-parts): Fix bug in convenience
command. (Bug#67677)
F. Jason Park [Wed, 3 Jan 2024 10:00:45 +0000 (02:00 -0800)]
Allow setting `erc-split-line-length' to zero
* etc/ERC-NEWS: Mention that `erc-flood-protect' no longer affects
line splitting.
* lisp/erc/erc-backend.el (erc-split-line-length): Mention ways for
modules to suppress line splitting entirely.
(erc--split-line): Exit loop instead of asserting progress has been
made.
* lisp/erc/erc.el (erc--split-lines): Don't split input when
option `erc-split-line-length' is zero.
* test/lisp/erc/erc-tests.el (erc--split-line): Assert behavior when
`erc-split-line-length' is 0. (Bug#62947)
F. Jason Park [Tue, 2 Jan 2024 07:18:54 +0000 (23:18 -0800)]
Use global window hook for erc-keep-place-indicator
* lisp/erc/erc-goodies.el
(erc--keep-place-indicator-on-window-buffer-change): Expect a frame
instead of a window argument for the only parameter, which is now
ignored, and exit early when entering a minibuffer.
(erc--keep-place-indicator-setup): Remove function because local
modules don't need a separate setup function.
(erc-keep-place-indicator-mode): Add autoload cookie even though this
is a local module, since this particular one is intended for more
granular, interactive activation. This is mostly a formality because
it only matters in the unlikely event `erc-modules' is missing all
other modules defined in `erc-goodies'.
(erc-keep-place-indicator-mode, erc-keep-place-indicator-enable,
erc-keep-place-indicator-disable): Move functionality from
`erc--keep-place-indicator-setup' into enable body. Use global
instead of local members for `erc-keep-place-mode-hook' and
`window-buffer-change-functions'.
(erc--keep-place-indicator-on-global-module): Perform necessary action
in all ERC buffers, not just the current one, where the user has
ostensibly disabled `erc-keep-place-mode'.
* test/lisp/erc/erc-goodies-tests.el
(erc-goodies-tests--assert-kp-indicator-on,
erc-goodies-tests--assert-kp-indicator-off): Change expected hook
membership for dependencies from global to local.
(erc-goodies-tests--keep-place-indicator): Use new helpers from
the `erc-tests-common' library. (Bug#59943)
F. Jason Park [Mon, 1 Jan 2024 08:34:53 +0000 (00:34 -0800)]
; Make erc--send-input-lines a normal function again
* lisp/erc/erc.el (erc--send-input-lines): Revert portion of 174b3dd9bd78c662ce9fff78404dcfa02259d21b "Make nested input handling
more robust in ERC" that converted this from a function to a method.
Instead, defer change until it's needed, likely for bug#49860. Also,
don't inadvertently allow overloading of `insertp' because user code
can legitimately set that to a function, which we then blindly call.
Instead, hard-code it to the only expected alternate display function.
Juri Linkov [Sun, 7 Jan 2024 18:04:06 +0000 (20:04 +0200)]
Support more metadata properties in completion-category-overrides (bug#68214)
* doc/lispref/minibuf.texi (Completion Variables): Add
to the table of completion-category-overrides new items:
`cycle-sort-function', `group-function', `annotation-function',
`affixation-function'.
* lisp/minibuffer.el (completion-metadata-get): Try also to get
the property from completion-category-overrides by category.
Suggested by Daniel Mendler <mail@daniel-mendler.de>.
(completion-category-defaults): Add new properties to docstring.
(completion-category-overrides): Add customization for new
properties: `cycle-sort-function', `group-function',
`annotation-function', `affixation-function'.
(completion-metadata-override-get): Remove function.
(minibuffer-completion-help): Replace 'completion-metadata-override-get'
with 'completion-metadata-get' for 'display-sort-function'.
João Távora [Sat, 6 Jan 2024 23:56:33 +0000 (17:56 -0600)]
Eglot: careful when invoking code actions on no symbol at all
Invoking code actions without a marked region or over a symbol
will trip certain servers up since BEG and END in eglot-code-actions
will be nil, causing 'eglot--pos-to-lsp-position' to assume point (which
is OK) but the 'flymake-diagnostics' call to return all diagnostics.
This causes an absolutely undecipherable JavaScript backtrace to be
sent back to Eglot from typescript-language-server.
Stefan Monnier [Sat, 6 Jan 2024 23:50:25 +0000 (18:50 -0500)]
(describe-package-1): Fix bug#68288
Fix support for multiple maintainers in `describe-package` and
in `package-report-bug`.
* lisp/emacs-lisp/package.el (describe-package-1): There's no
`:maintainers:`, instead `:maintainer` can hold a list of maintainers.
(package-maintainers): Adapt to the possibility of having
multiple maintainers.
(package-report-bug): Don't burp if the package is not installed.
Eli Zaretskii [Sat, 6 Jan 2024 11:26:29 +0000 (13:26 +0200)]
Fix icons.el when icon does not exist as a file
* lisp/emacs-lisp/icons.el (icons--create): Handle the case when
ICON is a file that doesn't exists or is unreadable. Suggested by
David Ponce <da_vid@orange.fr>. (Bug#66846)
Fix file-name resolution in *compilation* and *grep* buffers
Resolving symlinks in file names could lead to non-existent files
if some leading directory is a symlink to its parent.
In emacs 28 'expand-file-name' was replaced by 'file-truename' to
solve bug #8035.
* lisp/progmodes/compile.el (safe-expand-file-name): New function.
(compilation-find-file-1): Call 'safe-expand-file-name'. (Bug#67930)
Eli Zaretskii [Sat, 6 Jan 2024 09:15:31 +0000 (11:15 +0200)]
; Improve documentation of 'buffer-match-p'
* doc/lispref/buffers.texi (Buffer List):
* doc/lispref/windows.texi (Choosing Window): Add caveats for
calling 'buffer-match-p' too early, when CONDITION is
'derived-mode' or 'major-mode'. (Bug#68081)
When 'isearch-wrap-pause' is 'no' or 'no-ding', let-bind 'isearch-cmds'
to avoid changing it by 'isearch-push-state' in 'isearch-repeat',
so that a later DEL (isearch-delete-char) doesn't stop at the
intermediate failing state (bug#68158).
Eli Zaretskii [Fri, 5 Jan 2024 07:38:58 +0000 (09:38 +0200)]
Improve documentation of derived modes and their parents
* doc/lispref/modes.texi (Derived Modes): Expand documentation of
functions that manipulate parent modes of a derived mode.
Document 'provided-mode-derived-p'. Improve indexing.
Stefan Monnier [Fri, 5 Jan 2024 03:12:14 +0000 (22:12 -0500)]
* lisp/startup.el (startup--load-user-init-file): Fix last change
Use `condition-case-unless-debug` only in the branch when
`--debug-init` is not in use, otherwise it prevents `handler-bind`
from triggering the debugger.
Graham Marlow [Tue, 2 Jan 2024 21:58:22 +0000 (13:58 -0800)]
Improve yaml-ts-mode fill-paragraph (bug#68226)
When using fill-paragraph on a block_scalar (the element within a
block_node) fill the paragraph such that the contents remain
within the block_node. This fixes the previous behavior that would
clobber a block_node.