Fix apparently wrong `delete` and `delq` value discards (bug#61730)
* lisp/startup.el (normal-top-level):
Update process-environment in case the DISPLAY variable comes first.
Also stop iterating over initial-environment once the first DISPLAY
is found.
* lisp/allout.el (allout-get-configvar-values):
* lisp/org/org.el (org-display-inline-remove-overlay):
* lisp/progmodes/gdb-mi.el (gdb-get-location):
* lisp/progmodes/idlwave.el
(idlwave-convert-xml-clean-routine-aliases)
(idlwave-convert-xml-clean-sysvar-aliases):
* lisp/textmodes/reftex.el (reftex-ref-style-toggle):
Update the base variable after performing a destructive deletion,
where it was obvious that this was intended.
Andrea Corallo [Wed, 24 May 2023 15:05:26 +0000 (17:05 +0200)]
Fix nativecomp ICE compiling structure related code (bug#63674)
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Define the predicate to
be effective at compile time as native comp relies on `cl-typep' that
relies o predicates to work.
Use return values of assq-delete-all and assoc-delete-all
* lisp/allout-widgets.el (allout-widgets-mode):
* lisp/progmodes/eglot.el (eglot-handle-notification):
Update variables with the new value, which was probably the intention
here.
Spencer Baugh [Fri, 12 May 2023 19:28:06 +0000 (15:28 -0400)]
Use faster option for running vc-hg status (Bug#63470)
In modern Mercurial, removing the "re:" "-I" "." options provides a
10x-20x speedup because it allows the Rust implementation of "hg
status" to be used.
* lisp/vc/vc-hg.el (vc-hg--program-version): Add.
(vc-hg-dir-status-files): Use --config commands.status.relative=1 to
make paths relative when available.
Alan Mackenzie [Mon, 22 May 2023 16:09:07 +0000 (16:09 +0000)]
Fix syntax bugs involving escaped newlines in comments
This fixes bug#63535
* src/syntax.c (forw_comment): take the initial syntax from the
argument PREV_SYNTAX rather than checking the buffer position
for a backslash. Update the state at each character scanned.
(scan_sexps_forward): When the end position is escaped after a
call to forw_comment, return this status to the caller.
* test/lisp/filenotify-tests.el (file-notify-test04-autorevert):
Run with a lower `auto-revert-interval` (1 s) and adjust the
a timeout value. This should lower the time for this particular
test from 25 to below 10 s.
Po Lu [Mon, 22 May 2023 03:52:33 +0000 (11:52 +0800)]
Plug various leaks and fix input method initialization
* src/image.c (free_bitmap_record): Free bm->name correctly even
if the display connection has been closed.
* src/xfns.c (x_window): Use dpyinfo-specific `use_xim' flag.
* src/xterm.c (use_xim): Remove global variable.
(xim_destroy_callback): Free `xim_styles' if present, and set it
to NULL to be on the safe side.
(xim_open_dpy): Consult dpyinfo->use_xim instead. Don't leak
`xim_styles' if an IM was previously opened.
(xim_initialize): Use dpyinfo-specific `use_xim' flag.
(xim_close_dpy): Check if `dpyinfo->xim_callback_data' is set
before unregistering the instantiation callback.
(x_term_init): Determine whether or not to use XIM for each
display opened, instead of using the resources of the last
display opened to toggle a global flag.
(x_delete_terminal): Always call `image_destroy_all_bitmaps' and
`xim_close_dpy'. Free storage used to hold bitmap records.
* src/xterm.h (struct x_display_info): New field `use_xim'.
F. Jason Park [Fri, 19 May 2023 06:47:27 +0000 (23:47 -0700)]
Fix custom type of erc-autojoin-channels-alist
* lisp/erc/erc-join.el (erc-autojoin-channels-alist): In ERC 5.4, the
type of this option changed to accept symbols signifying IRC network
names. However, the option's definition was not updated to reflect
that. See commit 9bb8d90cddf "Allow irc network symbols in
erc-autojoin-channels-alist".
F. Jason Park [Fri, 19 May 2023 06:47:27 +0000 (23:47 -0700)]
; Silence byte compiler in erc-netsplit-JOIN
* etc/ERC-NEWS: Partially revert edit from c9f1ad2a870 "Revive option
erc-query-on-unjoined-chan-privmsg".
* lisp/erc/erc-netsplit.el (erc-netsplit-JOIN): Silence byte compiler
warning re ignored return value from `delete' when removing nicks.
Could probably suppress rather than reconstitute since the CAR of an
`erc-netsplit-list' entry originates from the trailing "reason" param
of the instigating "QUIT" command and should look something like
"irc.example.org chat.example.org", which cannot be confused for a
nickname.
* test/lisp/erc/resources/erc-scenarios-common.el: Fix wording in
Commentary.
Eli Zaretskii [Sun, 21 May 2023 10:57:14 +0000 (13:57 +0300)]
New Rmail commands for reading mailing-lists
* lisp/mail/rmail.el (rmail--mailing-list-message): New internal
function.
(rmail-mailing-list-help, rmail-mailing-list-post)
(rmail-mailing-list-unsubscribe, rmail-mailing-list-archive): New
commands.
(rmail-mode-map): Add menu items for the new commands.
* lisp/emacs-lisp/bytecomp.el (mutating-fns):
Add assoc-delete-all, assq-delete-all and rassq-delete-all.
* lisp/emacs-lisp/shortdoc.el (alist, list):
Don't mutate constants in examples illustrating use of
assoc-delete-all, assq-delete-all and rassq-delete-all.
Eli Zaretskii [Sat, 20 May 2023 14:26:52 +0000 (17:26 +0300)]
Fix async invocations in Dired with 'fish' shell
* lisp/dired-aux.el (dired-shell-stuff-it): Separate '&' and ';'
by blanks, for the sake of shells such as 'fish'. Suggested by
Lycomedes 1814 <lycomedes1814@yandex.com>.
* lisp/calc/calc-graph.el (calc-graph-compute-2d):
* lisp/calendar/appt.el (appt-activate):
* lisp/progmodes/cc-styles.el (c-make-styles-buffer-local):
Make use of what `delq` returns, to stave off possible mistakes or at
least make clear that there isn't any.
Improved copy-tree documentation and test (bug#63509)
* etc/NEWS: Move entry since it's an incompatible change.
* lisp/emacs-lisp/shortdoc.el (vector): Make the example relevant.
* lisp/subr.el (copy-tree): Rename second argument,
since 'vector-like' is a term with a specific meaning in Emacs
but not the one intended here.
* doc/lispref/lists.texi (Building Lists): Rename second argument,
and make it clear that the input must be acyclic.
* doc/lispref/records.texi (Record Functions):
Be more precise: `copy-sequence` is used to copy records,
`copy-tree` copies trees made of records etc.
* test/lisp/subr-tests.el (subr--copy-tree): Extend and strengthen the
test considerably, using the print-circle trick to detect structure
sharing precisely.
Joseph Turner [Mon, 15 May 2023 04:02:15 +0000 (21:02 -0700)]
Make 'copy-tree' work with records
* doc/lispref/lists.texi (Building Cons Cells and Lists): Document
new behavior of 'copy-tree'.
* doc/lispref/records.texi (Record Functions): Cross-reference to
lists.texi.
* etc/NEWS: Mention change. (Bug#63509)
* lisp/emacs-lisp/shortdoc.el: Add 'copy-tree' example to vector
group.
* lisp/subr.el (copy-tree): Recurse into records as well as
vectors when optional second argument is non-nil. Rename second
argument from VECP to VECTOR-LIKE-P.
* test/lisp/subr-tests.el: Test new behavior.
* lisp/progmodes/python.el:
(python-skeleton-define): Use command-modes as a shorthand for
completion-predicate (bug#63552).
(python--completion-predicate, python-shell--completion-predicate):
Remove accordingly; no longer used.
(python-define-auxiliary-skeleton): Prefer function-put over put.
Eli Zaretskii [Thu, 18 May 2023 11:49:49 +0000 (07:49 -0400)]
; Merge from origin/emacs-29
The following commits were skipped:
88ca37b8589 ; Regenerate files for emacs-29.0.91 4627ede36b1 ; * lisp/ldefs-boot.el: Regenerate for emacs-29.0.91. c90d47619e6 Bump Emacs version for next pretest
Eli Zaretskii [Thu, 18 May 2023 11:49:49 +0000 (07:49 -0400)]
Merge from origin/emacs-29
229af8e4b31 ; * lisp/progmodes/csharp-mode.el (csharp-ts-mode--defun-... ce7d18cbc07 ; Minor fixes in ELisp manual 5c8864fab4f ; * lisp/simple.el (async-shell-command): Doc fix. (Bug#... b96dc472bcb Ignore current-prefix-arg in async-shell-command 1e6a7594361 Fix building of VC package manuals with relative includes 61659f36c88 Another fix for VHDL mode highlighting
Jens Schmidt [Tue, 16 May 2023 21:31:19 +0000 (23:31 +0200)]
Clarify misleading comment in isearch.el
Clarify a misleading comment in isearch.el as to whether frame events
should exit an isearch or not (Bug#62032, Bug#41338 for background
information).
* lisp/isearch.el (isearch-mode-map): Replace the misleading comment.
(Bug#62032)
Paul Eggert [Wed, 17 May 2023 17:53:26 +0000 (10:53 -0700)]
Port modiff changes to GCC 4.8.5
Problem reported by Spencer Baugh.
* src/lisp.h (elogb): Now simply a function on unsigned long long int.
This avoids problems porting to GCC 4.8.5 20150623 (Red Hat 4.8.5-44).
There may be a minor runtime cost on 32-bit platforms but it’s
not worth worrying about.
* lisp/progmodes/python.el (python--completion-predicate)
(python-shell--completion-predicate): Filter M-x completion based on
python-base-mode instead of python-mode. This allows for
python-ts-mode as well (bug#63552).
Tony Zorman [Thu, 29 Dec 2022 10:05:04 +0000 (11:05 +0100)]
Add :vc keyword to use-package for VC package support
* lisp/use-package/use-package-core.el (use-package-keywords): Add :vc.
(use-package-handler/:load-path): Insert 'load-path' into 'state'.
(use-package-vc-install): Install the package with package-vc.el.
(use-package-handler/:vc): Handler for the :vc keyword.
(use-package-normalize--vc-arg): Normalization for more complex
arguments to 'use-package-normalize/:vc', in order to make them
compatible with the specification of 'package-vc-selected-packages'.
(use-package-normalize/:vc): Normalizer for the :vc keyword.
(use-package): Document :vc.
* lisp/use-package/use-package-ensure.el (use-package-handler/:ensure):
Do not ensure a package when :vc is used in the declaration.
* test/lisp/use-package/use-package-tests.el (use-package-test/:vc-1):
(use-package-test/:vc-2):
(use-package-test/:vc-3):
(use-package-test/:vc-4):
(use-package-test/:vc-5):
(use-package-test-normalize/:vc):
Add tests for :vc.
* etc/NEWS: Mention change. (Bug#60418)
João Távora [Tue, 16 May 2023 18:23:33 +0000 (19:23 +0100)]
Eglot: rework eglot-handle-request (bug#62116)
Address comments in the bug tracker regarding widening, and
prematurely reporting success to the server before knowing if the file
can indeed be shown.
Guard against swapping the minibuffer when the minibuffer is in the selected
window (bug#62427). The function was already protected when the minibuffer
is in other-window.
* lisp/net/eudc-vars.el (eudc-ldap-no-wildcard-attributes): Cover
`eudc-query-form' and `eudc-expand-inline' behavior in the
customization docstring. (Bug#62721)
Paul Eggert [Mon, 15 May 2023 01:51:24 +0000 (18:51 -0700)]
Prefer _WIDTH macros to sizeof in pdumper.c
This is a bit clearer, and should work better on hypothetical
platforms where integers have holes in their representation.
* src/pdumper.c: Since the code no longer uses CHAR_BIT,
don’t worry about whether it equals 8.
(DUMP_OFF_WIDTH): New macro.
(EMACS_RELOC_LENGTH_BITS, DUMP_RELOC_OFFSET_BITS): Use it.
(DUMP_BITSET_WORD_WIDTH): New macro.
(dump_bitsets_init, dump_bitset__bit_slot)
(dump_bitset_bit_set_p, dump_bitset__set_bit_value): Use it.
Paul Eggert [Mon, 15 May 2023 01:51:24 +0000 (18:51 -0700)]
Help GCC compute modiff_incr
* src/floatfns.c: Don’t include count-leading-zeros.h,
since we no longer use it directly.
(ecount_leading_zeros): Remove.
(Flogb): Use elogb instead of doing it by hand.
* src/lisp.h: Include count-leading-zeros.h.
(elogb): New macro.
(modiff_incr): Use it so that on typical platforms we
use a hardware instruction instead of a loop.
Paul Eggert [Mon, 15 May 2023 01:51:23 +0000 (18:51 -0700)]
Work after 2038 on 32-bit GNU/Linux
This adds support for 64-bit time_t on 32-bit GNU/Linux ARM and
x86, where time_t was historically 32-bit. The resulting Emacs
should continue to work for timestamps after mid-January 2038.
* admin/merge-gnulib (GNULIB_MODULES): Add year2038.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
Paul Eggert [Mon, 15 May 2023 01:51:23 +0000 (18:51 -0700)]
Pacify GCC 13 -Wnull-dereference in itree.c
* src/itree.c (itree_remove_fix): Simplify code and remove a
couple of eassume calls. This works around GCC bug 109586.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109856
Paul Eggert [Mon, 15 May 2023 01:51:23 +0000 (18:51 -0700)]
Pacify GCC 13 -Wanalyzer-out-of-bounds
* src/alloc.c (NEAR_STACK_TOP): Hoist from here ...
* src/thread.h: ... to here.
* src/print.c (print_object): Use NEAR_STACK_TOP instead of raw
buffer address. This is more natural, and pacifies GCC 13.
Paul Eggert [Mon, 15 May 2023 01:51:22 +0000 (18:51 -0700)]
Avoid duplicate configure-time codeset tests
* admin/merge-gnulib: Copy m4/codeset.m4 too. This is mostly for
documentation, as it’s now automatically copied by other modules.
* configure.ac (EMACS_PAPER_WIDTH): New macro. This relies on
Gnulib, to avoid duplicate tests for HAVE_LANGINFO_CODESET.
Joseph Turner [Sat, 6 May 2023 21:49:43 +0000 (14:49 -0700)]
Fix building of VC package manuals with relative includes
* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Invoke makeinfo with -I to ensure the package directory is always
consulted for @include statements. (Bug#63337)
F. Jason Park [Mon, 8 May 2023 02:43:57 +0000 (19:43 -0700)]
Make some module toggles more resilient in ERC
* lisp/erc/erc-goodies.el (erc-scrolltobottom-mode,
erc-scrolltobottom-enable, erc-move-to-prompt-mode,
erc-move-to-prompt-enable): Guard setup procedure behind
`erc--updating-modules-p'.
* lisp/erc/erc-imenu.el (erc-imenu-mode, erc-imenu-enable,
erc-imenu-disable): Don't run setup when `erc--updating-modules-p' is
non-nil. Also, don't restrict teardown to buffers of the same
process.
* lisp/erc/erc-match.el (erc-match-mode, erc-match-enable): Run
major-mode hook member immediately outside of `erc-update-modules' in
`erc-open'.
* lisp/erc/erc-spelling.el (erc-spelling-mode, erc-spelling-enable):
Only conditionally run setup immediately.
* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable,
erc-stamp-disable): Run setup hook immediately. Don't forget to
kill local vars in all ERC buffers during teardown.
* lisp/erc/erc.el (erc--updating-modules-p): New variable that global
modules can use to provide their `erc-mode-hook'-deferred code on
demand while shielding it from running during early ERC buffer
initialization.
(erc-open): Make `erc--updating-modules-p' non-nil while activating
global modules. (Bug#60936)
F. Jason Park [Sun, 7 May 2023 14:28:56 +0000 (07:28 -0700)]
Optionally add spacing between ERC messages
* etc/ERC-NEWS: Mention option `erc-fill-line-spacing'.
* lisp/erc/erc-fill.el (erc-fill-line-spacing,
erc-fill-spaced-commands): Add options to allow for extra spacing
between messages.
(erc-fill--function): Internal var allowing modules to override user
option `erc-fill-function'.
(erc-fill): Add extra line-spacing on certain types of messages.
Prefer `erc-fill--function', when set, over `erc-fill-function'.
(erc-fill--make-module-dependency-msg,
erc-fill--wrap-ensure-dependencies): Rename former to latter and make
more useful.
(erc-fill-wrap-mode, erc-fill-wrap-enable, erc-fill-wrap-disable):
Refactor.
(erc-fill--wrap-fix): Remove unused function.
(erc-fill-wrap-nudge): Remove reference to nonexistent function in doc
string.
* test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--graphic-dir): New
variable.
(erc-fill-tests--compare): Look in `erc-fill-tests--graphic-dir' for
graphical snapshots ignored by Git.
(erc-fill-line-spacing): New test.
* test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: New
file. (Bug#60936)
F. Jason Park [Mon, 8 May 2023 02:43:57 +0000 (19:43 -0700)]
Add helper for restoring local session vars in ERC
* lisp/erc/erc-common.el (erc--input-split): Suppress warning for
obsolete variable `erc-send-this' in init form.
* lisp/erc/erc-goodies.el (erc--keep-place-indicator-setup): Use macro
`erc--restore-initialize-priors' to preserve last session's indicator
position, if any.
(erc-keep-place-indicator-mode, erc-keep-place-indicator-enable): Use
convenience function to show missing-dependency notice.
* lisp/erc/erc-sasl.el (erc-sasl-auth-source-password-as-host): Merge
redundant `when' forms for clarity.
(erc-sasl--init): Remove unused function.
(erc-sasl-mode, erc-sasl-enable): Use helper to restore
`erc-sasl--options', essentially inlining the body of the now defunct
`erc-sasl--init'.
* lisp/erc/erc.el (erc--restore-initialize-priors): New macro to help
local modules and mode hooks prefer existing state over initializing
anew.
(erc--warn-once-before-connect): Add helper function to display
an "error notice" just after module setup.
(erc-accidental-paste-threshold-seconds) Improve doc string.
* test/lisp/erc/erc-goodies-tests.el
(erc-controls-highlight--examples, erc-controls-highlight--inverse,
erc-controls-highlight--motd, erc-keep-place-indicator-mode): Remove
feature check. For the latter, also start fake process and shadow
`erc-connect-pre-hook'.
* test/lisp/erc/erc-tests.el (erc--restore-initialize-priors): New
test. Also see test/lisp/erc/erc-scenarios-base-local-modules.el for
a more realistic exercising of this functionality. (Bug#60936)