]> git.eshelyaron.com Git - emacs.git/log
emacs.git
15 months ago; (minibuffer-narrow-buffer-completions): Be more cautious.
Eshel Yaron [Thu, 11 Jan 2024 19:34:15 +0000 (20:34 +0100)]
; (minibuffer-narrow-buffer-completions): Be more cautious.

15 months agoOptionally annotate 'M-x' completions with short descriptions
Eshel Yaron [Thu, 11 Jan 2024 19:18:29 +0000 (20:18 +0100)]
Optionally annotate 'M-x' completions with short descriptions

* lisp/simple.el (read-extended-command--affixation): Align
annotations and add documentation one-liners when available.
(read-extended-command-1): Respect 'completions-detailed'.
(suggest-key-bindings): Mention 'completions-detailed'.

* etc/NEWS: Announce.

15 months ago; Clarify detail in Start Emacs maximized FAQ
Stefan Kangas [Wed, 10 Jan 2024 17:19:03 +0000 (18:19 +0100)]
; Clarify detail in Start Emacs maximized FAQ

* doc/misc/efaq.texi (Start Emacs maximized): Explain that the sexp
should be put at the top of the file.

(cherry picked from commit 093ecb2aca1fa6d00f212b2426ddb7601fdbcfd2)

15 months agoEsplain how to turn off GDB display of inferior-events
Richard M. Stallman [Wed, 10 Jan 2024 17:15:36 +0000 (12:15 -0500)]
Esplain how to turn off GDB display of inferior-events

(cherry picked from commit c78e2f341299fd089bd265b9ac26767361f33820)

15 months agoLua compilation-mode rules adjustments (bug#60830)
Mattias Engdegård [Wed, 10 Jan 2024 15:55:14 +0000 (16:55 +0100)]
Lua compilation-mode rules adjustments (bug#60830)

* 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.

(cherry picked from commit d7d9bf1fe35e81e4bd37c326ebe569ab38043640)

15 months ago; Skip commit 492ba5721cbac0a374d785297401a1ac4b9eef37
Eshel Yaron [Wed, 10 Jan 2024 19:19:08 +0000 (20:19 +0100)]
; Skip commit 492ba5721cbac0a374d785297401a1ac4b9eef37

15 months agoMake Compilation mode recognize Lua errors
Rudolf Adamkovič [Tue, 3 Oct 2023 07:07:40 +0000 (09:07 +0200)]
Make Compilation mode recognize Lua errors

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'.

(cherry picked from commit cd0eb055fd4ebc3f7f7f5f5617549f963fe8ecff)

15 months agoFix use after free in androidvfs.c
Stefan Kangas [Wed, 10 Jan 2024 09:24:33 +0000 (10:24 +0100)]
Fix use after free in androidvfs.c

* src/androidvfs.c (android_afs_opendir, android_saf_tree_opendir):
Fix use after free.

(cherry picked from commit 3d412395246599bf633efd3ecd7f33c2bb97f66b)

15 months agoRemove redundant casts from void* with malloc functions
Stefan Kangas [Wed, 10 Jan 2024 07:18:22 +0000 (08:18 +0100)]
Remove redundant casts from void* with malloc functions

* src/msdos.c (IT_menu_make_room):
* src/pgtkterm.c (pgtk_define_fringe_bitmap):
* src/w16select.c (set_clipboard_data):
* src/w32term.c (w32_define_fringe_bitmap):
* src/w32uniscribe.c (uniscribe_shape): Remove redundant cast from
void* with xrealloc.
* admin/coccinelle/alloc_cast.cocci: New semantic patch.

(cherry picked from commit 1a2fa8f413ffacc2490f4c46b3bbfc37b16fbd04)

15 months ago; Adapt TODO list of tramp-compat.el
Michael Albinus [Wed, 10 Jan 2024 11:49:46 +0000 (12:49 +0100)]
; Adapt TODO list of tramp-compat.el

(cherry picked from commit 83ee584052f063cc802fca427c42ece2d5091ca5)

15 months agoFix file name completion with Tramp on MS Windoes
Michael Albinus [Wed, 10 Jan 2024 11:49:08 +0000 (12:49 +0100)]
Fix file name completion with Tramp on MS Windoes

* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Adapt Tramp versions.

* 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.

(cherry picked from commit cf887b7eb08a7ed0859b3fa2e1c4e54d787d2f9d)

15 months agoHandle package versions that are not version strings
Philip Kaludercic [Wed, 10 Jan 2024 08:25:41 +0000 (09:25 +0100)]
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)

(cherry picked from commit eb913c7501489e1eae475cae843fccdf14cc24d8)

15 months agoSupport :category in completion-extra-properties (bug#68214)
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.

(cherry picked from commit 7755f7172748b2d337fa53434c1f678269cc5c45)

15 months ago; Minor edits to PROBLEMS and sfnt.c
Po Lu [Wed, 10 Jan 2024 03:38:54 +0000 (11:38 +0800)]
; Minor edits to PROBLEMS and sfnt.c

* etc/PROBLEMS: Improve description of issues with Droid Sans
Mono.

* src/sfnt.c (sfnt_poly_edges_exact): Remove extraneous undef.

(cherry picked from commit 3f303b9cb51306e1f70e2024a31a48a9901585a0)

15 months ago; cperl-mode-tests.el: Adapt to recent changes in cperl-mode.el
Harald Jörg [Tue, 9 Jan 2024 17:46:41 +0000 (18:46 +0100)]
; cperl-mode-tests.el: Adapt to recent changes in cperl-mode.el

The tests need to use the new command cperl-file-style to make
sure that settings don't bleed out to following tests.

* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-indent-styles, cperl-test-bug-35925)
(cperl-test-bug-64364, cperl-test-bug-65834): use cperl-file-style
instead of cperl-set-style

(cherry picked from commit fccaeabc959f5403ce49744030bd2620352b59f8)

15 months ago; Stop advertising obsolete 'help-follow{,-mouse}'
Eshel Yaron [Wed, 10 Jan 2024 17:32:52 +0000 (18:32 +0100)]
; Stop advertising obsolete 'help-follow{,-mouse}'

* lisp/faces.el (list-faces-display)
* lisp/international/mule-diag.el (list-character-sets): Suggest
'push-button' instead of 'help-follow' and 'help-follow-mouse'.

15 months ago; Fix typos in recent documentation additions
Eshel Yaron [Wed, 10 Jan 2024 17:28:39 +0000 (18:28 +0100)]
; Fix typos in recent documentation additions

* doc/emacs/mini.texi (Narrow Completions)
* doc/lispref/minibuf.texi (Minibuffer Completion): Fix typos.

15 months ago; Add menu entry for 'minibuffer-set-completion-styles'
Eshel Yaron [Wed, 10 Jan 2024 13:04:41 +0000 (14:04 +0100)]
; Add menu entry for 'minibuffer-set-completion-styles'

* lisp/menu-bar.el: Bind 'minibuffer-set-completion-styles'.

15 months agoSupport more metadata properties in completion-extra-properties (bug#68214)
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.

(cherry picked from commit aff1d53cd466b64ded08d5cf12f83e5746704c07)

15 months ago* lisp/tab-bar.el: Fixes for point in window configuration (bug#68235)
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.

(cherry picked from commit 29e59b835c86e1ebac12adcb28ab7e1d0c275b2f)

15 months ago; cperl-mode: Fix a compiler warning caused by my previous commit
Harald Jörg [Tue, 9 Jan 2024 10:44:43 +0000 (11:44 +0100)]
; cperl-mode: Fix a compiler warning caused by my previous commit

* lisp/progmodes/cperl-mode.el (cperl-file-style): Replace
'make-variable-buffer-local' with 'make.local-variable'

(cherry picked from commit 0a5ebd444a820308571a659005d094b2dd93fe3f)

15 months agoUse `min`/`max` macros in a few more places
Stefan Kangas [Tue, 9 Jan 2024 06:55:51 +0000 (07:55 +0100)]
Use `min`/`max` macros in a few more places

* src/bidi.c (bidi_set_sos_type):
* src/coding.c (consume_chars):
* src/dosfns.c (dos_memory_info):
* src/emacs.c (sort_args):
* src/insdel.c (count_combining_before)
(count_combining_after, replace_range, del_range_2):
* src/sort.c (tim_sort):
* src/w32.c (sys_write):
* src/xfaces.c (face_at_buffer_position)
(face_for_overlay_string): Prefer using 'min' and 'max' macros.

(cherry picked from commit 79510d81d87488062c41a27279aaf0815c7933bc)

15 months agoNew command 'minibuffer-set-completion-styles'
Eshel Yaron [Wed, 10 Jan 2024 09:56:09 +0000 (10:56 +0100)]
New command 'minibuffer-set-completion-styles'

Add an interactive command for setting completion styles in the
current minibuffer.

* lisp/minibuffer.el (completion-style)
(completion--matching-style, completion-local-styles): New vars.
(completion--styles): Use 'completion-local-styles' when it's non-nil.
(completion--nth-completion): Set 'completion--matching-style' to the
matching completion style.
(completion-styles-affixation, completion-styles-table): New funs.
(minibuffer-set-completion-styles): New command.
(minibuffer-local-completion-map): Bind it.
(minibuffer-completion-help): Set 'completion-style' in the
"*Completions*" buffer.
* lisp/simple.el (completion-setup-function): Keep 'completion-style'.
(completion-list-mode): Display 'completion-style' in mode line.

* doc/emacs/mini.texi (Completion Commands, Completion Styles):
Document new command.

* doc/lispref/minibuf.texi (Completion Commands)
(Completion Variables): Document new command and variable.

* etc/NEWS: Announce new command.

15 months agocperl-mode.el: Make sure cperl-file-style is set buffer-local
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.

(cherry picked from commit 774c8ec74c98d69d56b2511a613145f2b69fb2eb)

15 months agoMake Tramp more robust
Michael Albinus [Mon, 8 Jan 2024 13:52:25 +0000 (14:52 +0100)]
Make Tramp more robust

* lisp/net/tramp-sh.el (tramp-bundle-read-file-names): Check, that
the command finishes successfully.

(cherry picked from commit d9462e24a967e32d550ee886b5150f0cc78358f6)

15 months ago; Fix a crash in sfnt_read_fvar_table
Po Lu [Mon, 8 Jan 2024 07:40:45 +0000 (15:40 +0800)]
; Fix a crash in sfnt_read_fvar_table

* src/sfnt.c (sfnt_read_fvar_table): Derive padding from correct
type.

(cherry picked from commit e2be1987a2e1206b77d2f11c78bb6e770a661452)

15 months agoProperly instruct Italic Arial or BS Mono at small PPEM sizes
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.

(cherry picked from commit 2656d756851d97434da7846a5a30202baafb2241)

15 months ago; * etc/PROBLEMS: Remove several resolved problems.
Po Lu [Mon, 8 Jan 2024 07:26:50 +0000 (15:26 +0800)]
; * etc/PROBLEMS: Remove several resolved problems.

(cherry picked from commit c946efe7b3778302cd64442b451f806f4be7e78e)

15 months agoRemove redundant conversion from bool to bool
Stefan Kangas [Sun, 7 Jan 2024 21:19:06 +0000 (22:19 +0100)]
Remove redundant conversion from bool to bool

* src/xdisp.c (maybe_produce_line_number): Remove redundant conversion
of the value of an expression from bool to bool.

(cherry picked from commit 267c9b54b16e50f76e5ce88ff153d1a24d093563)

15 months agoSupport string literals in build_string.cocci
Stefan Kangas [Sun, 7 Jan 2024 21:07:45 +0000 (22:07 +0100)]
Support string literals in build_string.cocci

* admin/coccinelle/build_string.cocci: Support string literals.

(cherry picked from commit c21995ff008d37e768a33412cad5fc9f5c3c2dbb)

15 months ago; Delete a superfluous bitwise 'or'
Stefan Kangas [Sun, 7 Jan 2024 20:43:56 +0000 (21:43 +0100)]
; Delete a superfluous bitwise 'or'

* src/xterm.c (x_term_init): Avoid bitwise 'or' using the same
variable as both operands (X | X => X).

(cherry picked from commit 6fdf035f62ed3cdd55a5cafe823a2d749637ce25)

15 months agoClarify purpose of module aliases in ERC
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'.

(cherry picked from commit 50f430ebcd87b77207013f97e6e5d1b8fe93f990)

15 months agoMake ERC's format catalogs more extensible
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)

(cherry picked from commit 37e87bc3eeb8e62e2900d73cf4dd9fc9e942d66d)

15 months agoAllow setting `erc-split-line-length' to zero
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)

(cherry picked from commit d6f9379d1c708dddc0543bf7242ba1ec6aee9746)

15 months agoUse global window hook for erc-keep-place-indicator
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)

(cherry picked from commit fad2d1e2acc12cf8b1770d821738d924105acd8a)

15 months ago; Make erc--send-input-lines a normal function again
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.

(cherry picked from commit 74f022b2797567ab04405af37b877d94cc4fdca2)

15 months ago; doc/misc/erc.texi: Improve SASL intro.
F. Jason Park [Sat, 6 Jan 2024 21:32:42 +0000 (13:32 -0800)]
; doc/misc/erc.texi: Improve SASL intro.

(cherry picked from commit 94f760163e221587fbba08a31e81c19527f037fe)

15 months agoImprove 'read-face-name'
Eshel Yaron [Mon, 8 Jan 2024 21:43:26 +0000 (22:43 +0100)]
Improve 'read-face-name'

* doc/lispref/display.texi (Face Functions): Use '@lisp' for Elisp
example.  Document 'read-face-name' and 'read-face-name-sample-text'.
* etc/NEWS: Announce 'read-face-name-sample-text' as a user option.
* lisp/faces.el (read-face-name-sample-text): Make it a user option.
(completion-face-name-affixation, read-face-name-sort-aliases-last)
(completion-face-name-table): New functions.
(read-face-name): Simplify.

15 months ago; Fix 'crm-change-separator'
Eshel Yaron [Mon, 8 Jan 2024 15:25:36 +0000 (16:25 +0100)]
; Fix 'crm-change-separator'

* lisp/emacs-lisp/crm.el (crm-current-separator): New variable.
(crm-complete-and-exit, crm-change-separator)
(completions-multi-mode): Use it instead of 'crm-separator'.
(completing-read-multiple): Let-bind 'crm-current-separator' to the
current value of 'crm-separator'.

15 months agoSupport more metadata properties in completion-category-overrides (bug#68214)
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'.

(cherry picked from commit 18de131222ee24c4088ac45be1babad26284af5b)

15 months agoHandle local default directory in connection-local-value
Michael Albinus [Sun, 7 Jan 2024 11:39:47 +0000 (12:39 +0100)]
Handle local default directory in connection-local-value

* lisp/files-x.el (connection-local-p, connection-local-value):
Handle local `default-directory'.

* test/lisp/files-x-tests.el (files-x-test-connection-local-value):
Extend test.

(cherry picked from commit aadcb906095e8588ed6302920bf835df20ab320f)

15 months ago(jsonrpc--log-event): Try and fix bug#68072
Stefan Monnier [Sun, 7 Jan 2024 05:02:08 +0000 (00:02 -0500)]
(jsonrpc--log-event): Try and fix bug#68072

* lisp/jsonrpc.el (jsonrpc--log-event): Force the use of
`lisp-indent-function` in `pp-to-string`.

(cherry picked from commit f866c85ac4e32df8061b285b6b44b15346994f3d)

15 months agoEglot: careful when invoking code actions on no symbol at all
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.

Github-reference: https://github.com/joaotavora/eglot/issues/847

* lisp/progmodes/eglot.el (eglot--code-action-bounds): Avoid returning
  (list nil nil)

(cherry picked from commit b5de9ae8010684a5ed0c6f2703077a61d325ccad)

15 months ago(describe-package-1): Fix bug#68288
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.

(cherry picked from commit 73cb931e5bab1b956f0569cd542468cfa7f4c9a7)

15 months agoPacify Ubuntu GCC 13.2 in x_get_local_selection
Paul Eggert [Sat, 6 Jan 2024 21:39:57 +0000 (13:39 -0800)]
Pacify Ubuntu GCC 13.2 in x_get_local_selection

* src/xselect.c: Ignore -Wanalyzer-null-dereference,
to work around GCC bug 102671.

(cherry picked from commit 4411d98c47576d5d47ea17269617b7c5a0f04f3c)

15 months agoPacify Ubuntu GCC 13.2 in set_marker_internal
Paul Eggert [Sat, 6 Jan 2024 21:38:13 +0000 (13:38 -0800)]
Pacify Ubuntu GCC 13.2 in set_marker_internal

* src/marker.c (set_marker_internal): Ignore
-Wanalyzer-deref-before-check, to work around GCC bug 113253.

(cherry picked from commit 0b312e310db2b06113f2b09d90951f82e8edf02f)

15 months agoComplete change of ert-remote-temporary-file-directory
Michael Albinus [Sat, 6 Jan 2024 17:15:23 +0000 (18:15 +0100)]
Complete change of ert-remote-temporary-file-directory

* lisp/emacs-lisp/ert-x.el: Adapt comment.

* test/lisp/net/tramp-tests.el (ert-remote-temporary-file-directory):
Make it a defvar.

(cherry picked from commit 166b10e9f80dc78147601a87b6425f59860bcfe4)

15 months agoMinor change in tramp.texi
Michael Albinus [Sat, 6 Jan 2024 17:14:15 +0000 (18:14 +0100)]
Minor change in tramp.texi

* doc/misc/tramp.texi (Obtaining @value{tramp}): Mention the ELPA
Tramp manual.

(cherry picked from commit 3071f6981d5b93b77abbd5cf4a36e15b0b410f3d)

15 months agoAdapt Tramp version
Michael Albinus [Sat, 6 Jan 2024 17:12:47 +0000 (18:12 +0100)]
Adapt Tramp version

* doc/misc/trampver.texi:
* lisp/net/trampver.el (tramp-version): Adapt Tramp versions.

(cherry picked from commit e48a396d4ba1694e083f900dda1f41cc41d00ead)

15 months agoMake 'advice-remove' interactive
Steven Allen [Fri, 29 Dec 2023 17:53:05 +0000 (09:53 -0800)]
Make 'advice-remove' interactive

`ad-advice-remove' is already interactive, but it doesn't work with
new-style advice.

* lisp/emacs-lisp/nadvice.el (advice-remove): Make it
interactive (Bug#67926).

* doc/lispref/functions.texi (Advising Named Functions): Document that
'advice-remove' is now an interactive command.

(cherry picked from commit 16162e0645d959d824d97e3f9908e46d401e8028)

15 months agoMove buffer name completion to Lisp and add affixation function
Eshel Yaron [Sun, 7 Jan 2024 19:48:40 +0000 (20:48 +0100)]
Move buffer name completion to Lisp and add affixation function

* lisp/minibuffer.el (minibuffer-narrow-buffer-completions): Update
doc string.
(buffers-except-current-if-switching,internal-complete-buffer-except)
(internal-complete-buffer): Replace with...
(completion-buffer-name-table): ...this.  New function.
(completion-buffer-name-affixation): New function.

* src/minibuf.c (Fread_buffer): Use 'completion-buffer-name-table'
instead of...
(Finternal_complete_buffer): ...this.  Remove.
(syms_of_minibuf): Update.

* doc/emacs/mini.texi (Completion Options): Mention buffer name
annotations in the documentation of 'completions-detailed'.

* etc/NEWS: Announce.

15 months ago; * doc/lispref/buffers.texi (Buffer List): Fix merge snafu.
Eli Zaretskii [Sat, 6 Jan 2024 13:25:29 +0000 (15:25 +0200)]
; * doc/lispref/buffers.texi (Buffer List): Fix merge snafu.

(cherry picked from commit 6184e120c0e1b52d9bbf359131dd8da35654cea1)

15 months ago; * doc/emacs/custom.texi (Changing a Variable): Update example (bug#68279).
Eli Zaretskii [Sat, 6 Jan 2024 11:45:33 +0000 (13:45 +0200)]
; * doc/emacs/custom.texi (Changing a Variable): Update example (bug#68279).

(cherry picked from commit bf7034048c16a95263e3f7c121dafbf1824ff28f)

15 months agoFix icons.el when icon does not exist as a file
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)

(cherry picked from commit 466d1c98a9ef7490332469165f63a38c2b07a05d)

15 months ago; Minor copyedits of doc of 'handler-bind'
Eli Zaretskii [Sat, 6 Jan 2024 10:44:26 +0000 (12:44 +0200)]
; Minor copyedits of doc of 'handler-bind'

* doc/lispref/control.texi (Handling Errors): Fix wording and
punctuation.

(cherry picked from commit d9dabcacefad084cccaa32e4f5fffcb78728fa00)

15 months agoFix last change (bug#67930)
Eli Zaretskii [Sat, 6 Jan 2024 10:33:44 +0000 (12:33 +0200)]
Fix last change (bug#67930)

* lisp/progmodes/compile.el (compilation--expand-fn): Renamed from
'safe-expand-file-name'; all callers changed.  Doc fix.

(cherry picked from commit 409985288dc83b20b4af2ce4072177fdc06b6ad7)

15 months agoFix file-name resolution in *compilation* and *grep* buffers
Jurgen De Backer [Thu, 4 Jan 2024 11:10:56 +0000 (11:10 +0000)]
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)

(cherry picked from commit 471cc26002d3f6028252c77998272fccf73722ec)

15 months agoFix use of 'display-buffer-alist' for Info buffers
Martin Rudalics [Wed, 3 Jan 2024 10:35:25 +0000 (11:35 +0100)]
Fix use of 'display-buffer-alist' for Info buffers

* lisp/info.el (info-pop-to-buffer): New function.
(info-other-window, info, Info-find-node, Info-revert-find-node)
(Info-next, Info-prev, Info-up, info-display-manual): Call
'info-pop-to-buffer'.  (Bug#68081)

(cherry picked from commit d3a4fe5694f7bd1a09546d67d2cddc0f444d41ca)

15 months ago; Improve documentation of 'buffer-match-p'
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)

(cherry picked from commit 2a861124e89d7a29b19bb9a6f22e962c37444212)

15 months ago; Skip commit 657275529e31226bbc6c92eb7f7af887474a0bb8
Eshel Yaron [Sat, 6 Jan 2024 16:16:41 +0000 (17:16 +0100)]
; Skip commit 657275529e31226bbc6c92eb7f7af887474a0bb8

15 months agoProperly parse TTC tables with digital signatures
Po Lu [Sat, 6 Jan 2024 07:24:58 +0000 (15:24 +0800)]
Properly parse TTC tables with digital signatures

* src/sfnt.c (sfnt_read_ttc_header): Don't inadvertently
overwrite first two offsets while reading the digital signature.

(cherry picked from commit 2f59052602e71fb818dd5d671be119793864e712)

15 months ago; Skip commit 37889523278fe65733938fb11c3701898309961c
Eshel Yaron [Sat, 6 Jan 2024 16:16:20 +0000 (17:16 +0100)]
; Skip commit 37889523278fe65733938fb11c3701898309961c

15 months ago; Update Android port splash screen message
Po Lu [Fri, 5 Jan 2024 09:51:40 +0000 (17:51 +0800)]
; Update Android port splash screen message

* lisp/term/android-win.el (android-after-splash-screen): Insert
missing newline.

(cherry picked from commit 2740a3cbfde65a899f2fcefceee9c4bc06eebc2d)

15 months agoUse special-mode in checkdoc status buffer
Nicholas Vollmer [Fri, 5 Jan 2024 17:22:10 +0000 (12:22 -0500)]
Use special-mode in checkdoc status buffer

* lisp/emacs-lisp/checkdoc.el (checkdoc-display-status-buffer): Use
`special-mode'.  (Bug#68268)

(cherry picked from commit 790b5982175b8dcd45fe444379e8039b6cc05e97)

15 months ago* lisp/isearch.el (isearch-search-and-update): Let-bind 'isearch-cmds'.
Juri Linkov [Fri, 5 Jan 2024 07:39:04 +0000 (09:39 +0200)]
* lisp/isearch.el (isearch-search-and-update): Let-bind 'isearch-cmds'.

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).

(cherry picked from commit dc9d02f8a01d86ac8ff3fb004bb2f22cf211dcef)

15 months ago* src/comp.c (Fcomp__compile_ctxt_to_file): Fix hash table Qunbound use.
Andrea Corallo [Thu, 4 Jan 2024 10:06:41 +0000 (11:06 +0100)]
* src/comp.c (Fcomp__compile_ctxt_to_file): Fix hash table Qunbound use.

(cherry picked from commit 9308d9a74ab586e9793b2561da23116f2b4fe205)

15 months agoProvide decent documentation for 'help-quick'
Eli Zaretskii [Thu, 4 Jan 2024 08:17:30 +0000 (10:17 +0200)]
Provide decent documentation for 'help-quick'

* lisp/help.el (help-quick, help-quick-toggle): Doc fix.

* doc/emacs/help.texi (Help Summary, Misc Help): Document
'help-quick-toggle'.

(cherry picked from commit a2a6619b2825c3c3d159610f0cd6fd89b791bd3f)

15 months ago; * src/window.c (Fset_window_margins): Doc fix.
Eli Zaretskii [Wed, 3 Jan 2024 13:14:41 +0000 (15:14 +0200)]
; * src/window.c (Fset_window_margins): Doc fix.

(cherry picked from commit ab66b749a276c9fdc70ad2ee114314f0cde862fc)

15 months agotreesit--pre-syntax-ppss: Fix args-out-of-range in internal--syntax-propertize
Dmitry Gutov [Tue, 2 Jan 2024 13:32:03 +0000 (15:32 +0200)]
treesit--pre-syntax-ppss: Fix args-out-of-range in internal--syntax-propertize

* lisp/treesit.el (treesit--pre-syntax-ppss): Make sure the lower
bound is still within the current restriction (bug#67977).

(cherry picked from commit 1a677d1429d1f9fea2d6b2bc9dd5644a5564cc27)

15 months ago; Elaborate minibuffer file name reading documentation
Eshel Yaron [Sat, 6 Jan 2024 13:28:14 +0000 (14:28 +0100)]
; Elaborate minibuffer file name reading documentation

* doc/emacs/mini.texi (Minibuffer File): Slightly elaborate.
(Completion Commands): Fix markup.

15 months agoSupport sorting file name completions list by last modified time
Eshel Yaron [Sat, 6 Jan 2024 12:31:23 +0000 (13:31 +0100)]
Support sorting file name completions list by last modified time

(minibuffer--sort-file-names-by-last-modified-time): New function.
(read-file-name-default): Add it to
'minibuffer-completions-sort-orders' buffer-locally.
* doc/emacs/mini.texi (Completion Commands): Elaborate about
'minibuffer-sort-completions'.

15 months agoAdd completion annotations for file name completion
Eshel Yaron [Fri, 5 Jan 2024 18:03:13 +0000 (19:03 +0100)]
Add completion annotations for file name completion

* lisp/minibuffer.el (completion-file-name-affixation): New function.
(completion-file-name-table): Use it as 'affixation-function'.
* doc/emacs/help.texi (Name Help): Move doc of 'completions-detailed'
from here to...
* doc/emacs/mini.texi (Completion Options): ...here.  Improve wording.
* etc/NEWS: Announce.

15 months ago; (dom-print): Use HTML entities for reserved characters.
Eshel Yaron [Fri, 5 Jan 2024 15:40:44 +0000 (16:40 +0100)]
; (dom-print): Use HTML entities for reserved characters.

15 months ago* lisp/mail/rmail.el (rmail-epa-decrypt): Fix typo (bug#68248).
Jeremy Bryant [Thu, 4 Jan 2024 23:58:19 +0000 (23:58 +0000)]
* lisp/mail/rmail.el (rmail-epa-decrypt): Fix typo (bug#68248).

(cherry picked from commit f9acf12f6f17b57265d19079e6973d167a328536)

15 months agoImprove documentation of derived modes and their parents
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.

* lisp/subr.el (derived-mode-all-parents)
(derived-mode-add-parents, provided-mode-derived-p)
(derived-mode-p): Doc fixes.

(cherry picked from commit d490874b3416d702686bb9dd25f75441d135264a)

15 months ago* lisp/startup.el (startup--load-user-init-file): Fix last change
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.

(cherry picked from commit ba300c96fa21af2fe7b7f25d16eec0a6c0738a95)

15 months agoImprove yaml-ts-mode fill-paragraph (bug#68226)
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.

* lisp/textmodes/yaml-ts-mode.el: Add yaml-ts-mode--fill-paragraph

(cherry picked from commit 1d40c601b3b77d3bf1ad1bdfbaf2f479ba9c4998)

15 months agoAvoid `defconst` for vars which we modify
Stefan Monnier [Thu, 4 Jan 2024 23:44:43 +0000 (18:44 -0500)]
Avoid `defconst` for vars which we modify

If we `setq` or let-bind a var, then presumably it's not a const.

* lisp/bookmark.el (bookmark-bmenu-buffer):
* lisp/char-fold.el (char-fold-table):
* lisp/pcmpl-linux.el (pcmpl-linux-fs-modules-path-format)
(pcmpl-linux-mtab-file):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log-buffer):
* lisp/emacs-lisp/check-declare.el (check-declare-warning-buffer):
* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory):
* lisp/erc/erc.el (erc-default-port):
* lisp/net/tramp.el (tramp-unknown-id-string)
(tramp-unknown-id-integer):
* lisp/url/url-util.el (url-unreserved-chars):

(cherry picked from commit 1870e2f48a7874b9a7cd627198a6079d6a3b70c0)

15 months agoImprove `handler-bind` doc
Stefan Monnier [Thu, 4 Jan 2024 21:28:39 +0000 (16:28 -0500)]
Improve `handler-bind` doc

* doc/lispref/control.texi (Handling Errors) <handler-bind>: Expand.
* doc/lispref/variables.texi (Variable Scoping): Mention static scoping.

(cherry picked from commit ae75333ca78f5c45e53e7e5d25f4e04a4d69ad8f)

15 months ago(backtrace-on-redisplay-error): Use `handler-bind`
Stefan Monnier [Tue, 26 Dec 2023 02:41:08 +0000 (21:41 -0500)]
(backtrace-on-redisplay-error): Use `handler-bind`

Reimplement `backtrace-on-redisplay-error` using `push_handler_bind`.
This moves the code from `signal_or_quit` to `xdisp.c` and
`debug-early.el`.

* lisp/emacs-lisp/debug-early.el (debug-early-backtrace):
Add `base` arg to strip "internal" frames.
(debug--early): New function, extracted from `debug-early`.
(debug-early, debug-early--handler): Use it.
(debug-early--muted): New function, extracted (translated) from
`signal_or_quit`; trim the buffer to a max of 10 backtraces.

* src/xdisp.c (funcall_with_backtraces): New function.
(dsafe_calln): Use it.
(syms_of_xdisp): Defsym `Qdebug_early__muted`.

* src/eval.c (redisplay_deep_handler): Delete var.
(init_eval, internal_condition_case_n): Don't set it any more.
(backtrace_yet): Delete var.
(signal_or_quit): Remove special case for `backtrace_on_redisplay_error`.
* src/keyboard.c (command_loop_1): Don't set `backtrace_yet` any more.
* src/lisp.h (backtrace_yet): Don't declare.

(cherry picked from commit 391c208aecc44fd82c599696d47a18782f2f36da)

15 months ago(signal_or_quit): Preserve error object identity
Stefan Monnier [Wed, 27 Dec 2023 20:06:32 +0000 (15:06 -0500)]
(signal_or_quit): Preserve error object identity

Make sure we build the (ERROR-SYMBOL . ERROR-DATA) object only once
when signaling an error, so that its `eq` identity can be used.
It also gets us a tiny bit closer to having real "error objects"
like in most other current programming languages.

* src/eval.c (maybe_call_debugger): Change arglist to receive the error
object instead of receiving the signal and the data separately.
(signal_or_quit): Build the error object right at the beginning so it
stays `eq` to itself.
Rename the `keyboard_quit` arg to `continuable` so say what it does
rather than what it's used for.
(signal_quit_p): Change arg to be the error object rather than just the
error-symbol.

* src/keyboard.c (cmd_error_internal, menu_item_eval_property_1):
Adjust calls to `signal_quit_p` accordingly.

* test/src/eval-tests.el (eval-tests--error-id): New test.

(cherry picked from commit 2ef6e40da88d5b4f070e339a2210f5751ab6a7cb)

15 months agoeval.c: Add new var `lisp-eval-depth-reserve`
Stefan Monnier [Wed, 27 Dec 2023 04:56:09 +0000 (23:56 -0500)]
eval.c: Add new var `lisp-eval-depth-reserve`

Rather than blindly increase `max-lisp-eval-depth` when entering the
debugger or running `signal-hook-function`, use this new "reserve"
to keep track of how much we have grown the stack for "debugger"
purposes so that for example recursive calls to `signal-hook-function`
can't eat up the whole C stack.

* src/eval.c (max_ensure_room): Rewrite.
(restore_stack_limits): Move before `max_ensure_room`.  Rewrite.
(call_debugger, signal_or_quit): Adjust calls accordingly.
Also grow `max-lisp-eval-depth` for `hander-bind` handlers.
(init_eval_once): Don't initialize `max_lisp_eval_depth` here.
(syms_of_eval): Initialize it here instead.
Add new var `lisp-eval-depth-reserve`.

* doc/lispref/eval.texi (Eval): Add `lisp-eval-depth-reserve`.

(cherry picked from commit 02edbc88a1210b8d5a3e62ca4f03ffd17b23cbf7)

15 months ago(macroexp--with-extended-form-stack): Use plain `let`
Stefan Monnier [Tue, 26 Dec 2023 04:55:53 +0000 (23:55 -0500)]
(macroexp--with-extended-form-stack): Use plain `let`

`macroexp--with-extended-form-stack` used manual push/pop so that upon
non-local exits the "deeper" value is kept, so the error handler gets
to know what was the deeper value, so as to be able to compute more
precise error locations.
Replace this with a `handler-bind` which catches that "deeper" value
more explicitly.

* lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings):
Use `handler-bind` to catch the value of `byte-compile-form-stack`
at the time of the error.  Also consolidate the duplicated code.

* lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack):
Use a plain dynbound let-rebinding.

(cherry picked from commit a5dcc1abea32abc906abfb66599c280b01d6ba27)

15 months agoMove batch backtrace code to `top_level_2`
Stefan Monnier [Thu, 21 Dec 2023 04:31:39 +0000 (23:31 -0500)]
Move batch backtrace code to `top_level_2`

Move ad-hoc code meant to ease debugging of bootstrap (and batch mode)
to `top_level_2` so it doesn't pollute `signal_or_quit`.

* src/lisp.h (pop_handler, push_handler_bind): Declare.
* src/keyboard.c (top_level_2): Setup an error handler to call
`debug-early` when noninteractive.
* src/eval.c (pop_handler): Not static any more.
(signal_or_quit): Remove special case for noninteractive use.
(push_handler_bind): New function, extracted from `Fhandler_bind_1`.
(Fhandler_bind_1): Use it.
(syms_of_eval): Declare `Qdebug_early__handler`.
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Weed out
frames below `debug-early`.
(debug-early--handler): New function.

(cherry picked from commit 604e34338f3b5a31439020c6704f9f9d07d17d69)

15 months agostartup.el: Use `handler-bind` to implement `--debug-init`
Stefan Monnier [Wed, 20 Dec 2023 00:46:47 +0000 (19:46 -0500)]
startup.el: Use `handler-bind` to implement `--debug-init`

This provides a more reliable fix for bug#65267 since we don't
touch `debug-on-error` nor `debug-ignore-errors` any more.

* lisp/startup.el (startup--debug): New function.
(startup--load-user-init-file): Use it and `handler-bind` instead of
let-binding `debug-on-error`.

(cherry picked from commit 80b081a0ac72a5a9e459af6c96f5b0226a79894f)

15 months agoemacs-module-tests.el (mod-test-non-local-exit-signal-test): Repair test
Stefan Monnier [Thu, 28 Dec 2023 05:49:39 +0000 (00:49 -0500)]
emacs-module-tests.el (mod-test-non-local-exit-signal-test): Repair test

That test relied on `debugger` and `debug-on-signal` in a way that
doesn't work with the new ERT code.

* test/src/emacs-module-tests.el (mod-test-non-local-exit-signal-test):
Use `handler-bind` rather than the debugger.

(cherry picked from commit 142c90a6f088a6eea66d6b08d05a5ff70c018aa6)

15 months agoUse handler-bind to repair bytecomp-tests
Mattias Engdegård [Wed, 27 Dec 2023 10:32:49 +0000 (11:32 +0100)]
Use handler-bind to repair bytecomp-tests

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--error-frame, bytecomp--byte-op-error-backtrace):
Make test pass again and simplify, using handler-bind instead
of the previous debugger hack.

(cherry picked from commit fa1063774ce32714365cf122b2a8cca2d23fc6cd)

15 months agoFix ert-tests.el for the new `handler-bind` code
Stefan Monnier [Thu, 28 Dec 2023 05:46:36 +0000 (00:46 -0500)]
Fix ert-tests.el for the new `handler-bind` code

Now that `ert.el` uses `handler-bind` instead of `debugger`, some
details of the behavior have changed.  More specifically,
three tests are now broken, but these basically tested the failure
of ERT's machinery to record errors when ERT was run within
a `condition-case`.
AFAICT, these tests do not check for a behavior that we want,
so rather than "fix" them, I deleted them (bug#67862).

* test/lisp/emacs-lisp/ert-tests.el (ert-test-error-debug)
(ert-test-fail-debug-with-condition-case): Delete.
(ert-test-should-failure-debugging): Don't use `ert-debug-on-error`.
(ert-test-with-demoted-errors): It now passes.  Bug#11218 is fixed!

(cherry picked from commit 25ea99c211ecf91735b44172da19fc53b304c5f4)

15 months agoert.el: Use `handler-bind` to record backtraces
Stefan Monnier [Tue, 19 Dec 2023 04:57:45 +0000 (23:57 -0500)]
ert.el: Use `handler-bind` to record backtraces

* lisp/emacs-lisp/ert.el (ert--should-signal-hook): Delete function.
(ert--expand-should-1): Don't bind `signal-hook-function`.
(ert--test-execution-info): Remove `next-debugger` slot.
(ert--run-test-debugger): Adjust to new calling convention.
Pass the `:backtrace-base` info to the debugger.
(ert--run-test-internal): Use `handler-bind` rather than let-binding
`debugger` and `debug-on-error`.

* lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory): Don't
use `defconst` if it's not meant to stay constant (e.g. we let-bind it
in tramp-tests.el).

(cherry picked from commit fe0f15dbc962b37d98507a494fd7720bad584a7a)

15 months ago(eval-expression): Fix bug#67196
Stefan Monnier [Tue, 19 Dec 2023 04:47:56 +0000 (23:47 -0500)]
(eval-expression): Fix bug#67196

* lisp/simple.el (eval-expression--debug): New function.
(eval-expression): Use it together with `handler-bind` instead of
let-binding `debug-on-error`.

(cherry picked from commit 7959a63ce258c90eb3c7947ab3318c5531eb37d9)

15 months agoNew special form `handler-bind`
Stefan Monnier [Tue, 26 Dec 2023 03:32:17 +0000 (22:32 -0500)]
New special form `handler-bind`

AFAIK, this provides the same semantics as Common Lisp's `handler-bind`,
modulo the differences about how error objects and conditions are
represented.

* lisp/subr.el (handler-bind): New macro.

* src/eval.c (pop_handler): New function.
(Fhandler_Bind_1): New function.
(signal_or_quit): Handle new handlertypes `HANDLER` and `SKIP_CONDITIONS`.
(find_handler_clause): Simplify.
(syms_of_eval): Defsubr `Fhandler_bind_1`.

* doc/lispref/control.texi (Handling Errors): Add `handler-bind`.

* test/src/eval-tests.el (eval-tests--handler-bind): New test.

* lisp/emacs-lisp/lisp-mode.el (lisp-font-lock-keywords):
Move 'handler-bind' from CL-only to generic Lisp.
(handler-bind): Remove indentation setting, it now lives in the macro
definition.

(cherry picked from commit 5ba75e183c60aff50949587c21066e876dabfbda)

15 months agoAdd file completion for "git blame" to pcomplete
Antero Mejr [Thu, 4 Jan 2024 19:49:23 +0000 (19:49 +0000)]
Add file completion for "git blame" to pcomplete

* lisp/pcmpl-git.el (pcomplete/git): Add "blame" to the tracked files
clause.  (Bug#68245)

(cherry picked from commit 225710ba79c10b53b6ba320327ca31192ca72387)

15 months ago; Fix documentation of last change
Eli Zaretskii [Thu, 4 Jan 2024 18:47:06 +0000 (20:47 +0200)]
; Fix documentation of last change

* lisp/minibuffer.el (completion-category-overrides): Doc fix.

* doc/emacs/mini.texi (Completion Options): Update documentation
of 'completions-sort'.
* doc/lispref/minibuf.texi (Completion Variables): Fox wording.
Add a cross-reference to where 'completions-sort' is documented.

(cherry picked from commit df505804ab6e7dc869cfc9db6308a8c568eddd6a)

15 months agoSupport display-sort-function in completion-category-overrides (bug#68214)
Juri Linkov [Thu, 4 Jan 2024 17:20:30 +0000 (19:20 +0200)]
Support display-sort-function in completion-category-overrides (bug#68214)

* doc/lispref/minibuf.texi (Completion Variables):
Add 'display-sort-function' to the table of
'completion-category-overrides'.

* lisp/calendar/calendar.el (calendar-read-date): Add metadata
category 'calendar-month' for completing-read reading a month name.

* lisp/minibuffer.el (completion-category-defaults):
Add 'display-sort-function' with identity for the category 'calendar-month'.
(completion-category-overrides): Add customization for completion sorting
with 'display-sort-function' and a choice like in 'completions-sort'.
(completion-metadata-override-get): New function.
(minibuffer-completion-help): Use 'completion-metadata-override-get'
instead of 'completion-metadata-get' to get sort-fun from
'display-sort-function'.

(cherry picked from commit dc99be8e633fa0d8594b72f41584a53590939fde)

15 months agoFix last change in tempo.el
Morgan Willcock [Sun, 31 Dec 2023 20:47:17 +0000 (20:47 +0000)]
Fix last change in tempo.el

* lisp/tempo.el: Set marker type for tempo-region-start to
move when text is inserted at its position.  This prevents
the template from inserting text into the region.  (Bug#68185)

(cherry picked from commit d69fb6dab28e55447516341cf28f1b6d06937ad6)

15 months agoEnsure indent-region argument order in tempo.el is correct
Morgan Willcock [Sun, 31 Dec 2023 20:47:17 +0000 (20:47 +0000)]
Ensure indent-region argument order in tempo.el is correct

* lisp/tempo.el (tempo-insert): Call 'indent-region' with the
stored region markers to ensure that the start and end arguments
are used in the correct order.  (Bug#68185)

(cherry picked from commit 5765cc3a5a32bdecfb6b28180afda97d4b74ee6a)

15 months agoDocument 'etags-regen-mode' in the Emacs user manual
Eli Zaretskii [Thu, 4 Jan 2024 09:34:21 +0000 (11:34 +0200)]
Document 'etags-regen-mode' in the Emacs user manual

* doc/emacs/maintaining.texi (Create Tags Table): Document
'etags-regen-mode'.

(cherry picked from commit ff00b85acf8371a358a055ef3e7325220bb6e362)

15 months agoRemove semantic patch for adjusting `XSAVE_*`
Stefan Kangas [Thu, 4 Jan 2024 01:41:22 +0000 (02:41 +0100)]
Remove semantic patch for adjusting `XSAVE_*`

* admin/coccinelle/xsave.cocci: Delete file.  The corresponding macros
were removed in 4139c98eb5f 2018-06-14 "Remove Lisp_Misc_Save_Value".

(cherry picked from commit 310ed338c195c755b11e0c62bde9629797b644c8)

15 months agoPrefer build_unibyte_string where applicable
Stefan Kangas [Thu, 4 Jan 2024 01:24:13 +0000 (02:24 +0100)]
Prefer build_unibyte_string where applicable

* src/fns.c (syms_of_fns):
* src/image.c (slurp_image): Prefer build_unibyte_string (str) to
make_unibyte_string (str, strlen (str)).
* admin/coccinelle/unibyte_string.cocci: Support string literals.

(cherry picked from commit d91a4133b0ad6bb5f53fdbd9ae0e4410c1422a64)

15 months agoPrefer NILP (x) to EQ (x, Qnil)
Stefan Kangas [Thu, 4 Jan 2024 00:49:34 +0000 (01:49 +0100)]
Prefer NILP (x) to EQ (x, Qnil)

* src/image.c (anim_prune_animation_cache):
Prefer NILP (x) to EQ (x, Qnil).
* admin/coccinelle/nilp.cocci: Semantic patch for above change.

(cherry picked from commit 88ed501abe9666fced46703613c000c26e450ad8)