Stefan Monnier [Sun, 30 Oct 2022 13:37:23 +0000 (09:37 -0400)]
dom-print: Fix missing entities quoting
Also use `?\s` for the space character.
* lisp/dom.el (dom-print): Properly quote special characters to avoid
generating invalid HTML/XML.
(dom-tag, dom-attributes, dom-children, dom-node)
(dom-add-child-before): Simplify.
(dom-set-attribute): Add at beginning rather than at end (slightly
more efficient and less destructive).
Stefan Kangas [Sun, 30 Oct 2022 13:30:56 +0000 (14:30 +0100)]
elide-head: Make trailing "/" in URL optional
* lisp/elide-head.el (elide-head-headers-to-hide): Make trailing
"/" in the gnu.org URL optional for the GPL.
* test/lisp/elide-head-tests.el
(elide-head--test-headers-to-hide/gpl3-5): New test.
Visuwesh [Mon, 10 Oct 2022 18:19:06 +0000 (23:49 +0530)]
Fix set-language-info-alist when multiple PARENTS are given
* lisp/international/mule-cmds.el (set-language-info-setup-keymap):
Function factored out from...
(set-language-info-alist): ...here. Do not mess up the keymaps when
multiple parents are given in PARENTS. (Bug#58376)
(tab-bar-select-tab): Set set-window-configuration
arg DONT-SET-MINIWINDOW to t. Reselect the previously active minibuffer
and unselect unnecessarily selected minibuffer.
(tab-bar-history-back, tab-bar-history-forward): Set set-window-configuration
arg DONT-SET-MINIWINDOW to t.
Eli Zaretskii [Sat, 29 Oct 2022 15:59:04 +0000 (18:59 +0300)]
Set 'native-comp-debug' to zero on MS-Windows
* lisp/emacs-lisp/comp.el (native-comp-debug): Don't emit debug
symbols on MS-Windows. The default was originally made 1 because
without that, C backtraces on Windows would not show
natively-compiled functions correctly, or would even stop short of
reaching the topmost call frame. But that turned out to be due to
a bug in GDB, which was meanwhile fixed in GDB 12. So we can now
reset the value back to zero, and gain smaller *.eln files on
MS-Windows.
Alan Mackenzie [Sat, 29 Oct 2022 13:21:39 +0000 (13:21 +0000)]
Fix the subr-arity returned by native compiled functions with lots of args
This fixes bug #58739. Make subr-arity return, e.g., (12 . 12) rather than
(12 . many) for a function with a fixed number of arguments more than 8.
* lisp/emacs-lisp/comp.el (comp-prepare-args-for-top-level): Only return a cdr
of 'many when there are &rest arguments.
* src/eval.c (eval_sub): Also check for a fixed number of args over 8 when
using the nargs + *args calling convention.
(funcall_subr): Also check numargs <= 8 before using the fixed args calling
convention. Include the case numargs > 8 in the aMany calling convention.
* src/lisp.h (DEFUN): Amend the comment about MANY.
Po Lu [Sat, 29 Oct 2022 10:21:09 +0000 (18:21 +0800)]
Fix crash destroying NS frame tool bar
* src/nsterm.m (ns_draw_glyphless_glyph_string_foreground): Work
around silly GCC bug causing splurious warnings.
([EmacsWindow dealloc]): Detach tool bar before dealloc'ing
window. (bug#58857)
Alan Mackenzie [Sat, 29 Oct 2022 10:04:37 +0000 (10:04 +0000)]
c-get-fontification-context: Refine the last non-default arm of the cond
This fixes bug #58772.
* lisp/progmodes/cc-fonts.el (c-get-fontification-context): Make the function
return (decl . nil) when MATCH-POS is in the second paren list of something
like DEFUN (..) (..). Tidy up untidy code with save-excursion's for greater
accuracy. Set a c-type text property value c-decl-arg-start to speed up
future calls. Reindent the entire function.
Stefan Kangas [Fri, 28 Oct 2022 00:17:58 +0000 (02:17 +0200)]
Prefer make-temp-name in make-mode.el
* lisp/progmodes/make-mode.el
(makefile-generate-temporary-filename): Make obsolete in favor of
'make-temp-name'. Simplify.
(makefile-save-temporary): Don't use above obsolete function.
Alan Mackenzie [Fri, 28 Oct 2022 17:50:33 +0000 (17:50 +0000)]
CC Mode: Fontify cast types without adding them to c-found-types
* lisp/progmodes/cc-engine.el (c-forward-type): Test for the special new
value `just-one' of c-promote-possible-types, and if found, fontify the type,
but don't add it to c-found-types.
(c-forward-decl-or-cast-1): Add the new &optional parameter inside-macro.
Whilst checking for a cast construct, analyze the text following the closing
paren more rigorously.
Check for, and allow, the closing paren of a macro arglist before the putative
cast construct.
* lisp/progmodes/cc-fonts.el (c-font-lock-declarations): In the lambda
function, pass the parameter inside-macro to c-forward-decl-or-cast-1.
* lisp/progmodes/cc-langs.el (c-primary-expr-regexp-details): New
c-lang-defvar which calculates `c-primary-expr-regexp' and three match
numbers for various sub-expressions in the regexp.
(c-primary-expr-regexp): Now extracted from `c-primary-expr-regexp-details'.
(c-per-++---match, c-per-&*+--match, c-per-\(-match): New
c-lang-defconsts/vars extracted from `c-primary-expr-regexp-details'.
Stefan Monnier [Fri, 28 Oct 2022 15:33:24 +0000 (11:33 -0400)]
cconv.el: Fix regression in cconv-tests-interactive-closure-bug51695
The new code to make interpreted closures safe-for-space introduced
a regression in `cconv-tests-interactive-closure-bug51695`, only seen
when using TEST_LOAD_EL.
A few other issues were found and fixed along the way.
* lisp/emacs-lisp/cconv.el (cconv-fv): Change calling convention and
focus on finding the free variables.
(cconv-make-interpreted-closure): New function.
* lisp/loadup.el: Use `compiled-function-p` rather than
`byte-code-function-p` so we also use safe-for-space interpreted
closures when we build with native compilation.
(internal-make-interpreted-closure-function):
Use `cconv-make-interpreted-closure`.
* src/eval.c (syms_of_eval): Rename `internal-filter-closure-env-function`
to `internal-make-interpreted-closure-function`.
(Ffunction): Let that new var build the actual closure.
* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-closure-bug51695): Test specifically the
interpreted case.
Stefan Monnier [Fri, 28 Oct 2022 13:36:40 +0000 (09:36 -0400)]
* lisp/emacs-lisp/re-builder.el: Cosmetic changes
(reb-valid-string): Declare it risky so the mode-line will obey its
text-properties.
(reb-lisp-syntax-p): No need to make it `defsubst`.
(reb-target-value): New function to replace the
`reb-target-binding` macro. Adjust all callers.
(reb-auto-update): Give a more informative error message than just
"invalid" and give it a warning face.
(reb-update-regexp): Always update `reb-regexp-src` (it's harmless),
rather than only when it's necessary (reduces the need for advice in pcre.el).
Jonas Bernoulli [Fri, 21 Oct 2022 20:55:53 +0000 (22:55 +0200)]
Include more information in error data for sqlite errors
Introduce a new 'sqlite-error' and use it for all errors signaled in
'src/sqlite.c', except those that already used 'sqlite-locked-error'.
Include the values of 'sqlite3_errcode', 'sqlite3_extended_errcode',
'sqlite3_errstr' and 'sqlite3_errmsg' in the error data.
* src/sqlite.c (load_dll_functions): Load 'sqlite3_extended_errcode'.
(sqlite-load-extension): Use 'xsignal1' as required by argument type.
(syms_of_sqlite): Introduce a new error type 'sqlite-error'.
(check_sqlite, sqlite-open, bind_values, sqlite-execute)
(sqlite-select, sqlite-load-extension, sqlite-next): Use it.
(sqlite_prepare_errdata): New function.
(sqlite_prepare_errmsg): Remove function.
(sqlite-execute, sqlite-select): Use new function.
(sqlite-locked-error): Derive from 'sqlite-error'.
Po Lu [Fri, 28 Oct 2022 12:06:06 +0000 (20:06 +0800)]
Simplify scroll valuator reset handling
* src/xterm.c (xi_populate_device_from_info)
(xi_reset_scroll_valuators_for_device_id, xi_handle_device_changed)
(handle_one_xevent):
* src/xterm.h (struct xi_scroll_valuator_t): Get rid of
`pending_enter_reset', which was extremely convoluted and kept
hitting server bugs. Now, valuators are reset upon all crossing
events.
Wamm K. D [Thu, 27 Oct 2022 19:07:03 +0000 (14:07 -0500)]
Fix failing test for package Hierarchy
This fixes a typo in one of the tests of Hierarchy which was causing
the test to fail.
* test/lisp/emacs-lisp/hierarchy-tests.el (hierarchy-delayed-add-trees):
Fix typo.
* doc/misc/modus-themes.org
(Option for red-green color deficiency or deuteranopia)
(Option for more bold constructs, Option for more italic constructs)
(Option for font mixing, Option for box buttons)
(Option for mode line presentation)
(Option for accented background in tab interfaces)
(Option for completion framework aesthetics, Option for mail citations)
(Option for line numbers, Option for mouseover effects)
(Option for diff buffer looks, Option for org-mode block styles)
(Option for Org agenda constructs)
(Option for the headings' overall style)
(Option for variable-pitch font in UI elements, Note on SHR fonts):
Revise markup of "non-nil" so that it is rendered properly in texinfo.
(Option for fringe visibility, Option for line highlighting): Reword
description of user option.
(Full support for packages or face groups): Update list of supported
packages or face groups.
(Note on ERC escaped color sequences)
(What is the best setup for legibility?)
(Port the Modus themes to other platforms?): Prefer American English.
(Note on pdf-tools link hints): Use double spacing between sentences
(Acknowledgements): Update list of names that have contributed to the
project, which was user feedback in this case.
* etc/themes/modus-themes.el (modus-themes, modus-themes-faces):
Reword doc string.
(modus-themes--version): Update to current version.
(modus-themes-version): Refine function definition.
(modus-themes-completion-standard-first-match)
(modus-themes-completion-standard-selected)
(modus-themes-completion-extra-selected)
(modus-themes-completion-key-binding, modus-themes-intense-markup)
(modus-themes--heading-weights, modus-themes--completion): Delete
obsolete forms, which were deprecated many months/version ago.
(modus-themes-fringes, modus-themes-completions)
(modus-themes-hl-line): Update default value and reword doc string
accordingly.
(modus-themes-faces): Update list of supported faces and their
attributes.
* etc/themes/modus-operandi-theme.el:
* etc/themes/modus-vivendi-theme.el: Update version header.
Wamm K. D [Thu, 4 Aug 2022 00:05:08 +0000 (19:05 -0500)]
Allow Hierarchy to delay computation of children
This adds an option to allow callers to specify that computing
the children of the hierarchy should be delayed to when the
user calls for them, by utilizing the tree-widget :expander
property.
* lisp/emacs-lisp/hierarchy.el (hierarchy-add-tree)
(hierarchy-add-trees): Add parameter 'delay-children-p'.
* lisp/emacs-lisp/hierarchy.el
(hierarchy--create-delayed-tree-widget): Add function.
* lisp/emacs-lisp/hierarchy.el (hierarchy-convert-to-tree-widget):
Utilize ':expander' if delaying children. (Bug#55900)
* test/lisp/emacs-lisp/hierarchy-tests.el: Add tests for
delayed-children functionality.
* lisp/mail/rmailsum.el (rmail-summary-currently-displayed-msgs):
New variable.
(rmail-summary-apply-filters-consecutively): New user option.
(rmail-summary-fill-displayed-messages, rmail-summary-negate): New
functions.
(rmail-summary-by-labels, rmail-summary-by-recipients)
(rmail-summary-by-regexp, rmail-summary-by-topic)
(rmail-summary-by-senders): Obey
'rmail-summary-apply-filters-consecutively'.
KEEP-FILTERING, to narrow the existing filtered summary.
Andrea Monaco [Thu, 27 Oct 2022 13:56:12 +0000 (16:56 +0300)]
Allow applying filters to summary consecutively
* lisp/mail/rmailsum.el (rmail-summary-currently-displayed-msgs):
New variable.
(rmail-summary-fill-displayed-messages, rmail-summary-negate): New
functions.
(rmail-summary-by-labels, rmail-summary-by-recipients)
(rmail-summary-by-regexp, rmail-summary-by-topic)
(rmail-summary-by-senders): Accept an additional argument
KEEP-FILTERING, to narrow the existing filtered summary.
Stefan Kangas [Wed, 26 Oct 2022 20:25:40 +0000 (22:25 +0200)]
Fix typo in textsec-restriction-level
* lisp/international/textsec.el (textsec-restriction-level):
* test/lisp/international/textsec-tests.el (test-restriction-level):
Fix typo in symbol name `moderately-restrictive'.
Eli Zaretskii [Wed, 26 Oct 2022 14:21:45 +0000 (17:21 +0300)]
Fix rare problems with current-column when text is invisible
* src/indent.c (scan_for_column, compute_motion): Don't miss
compositions when the position to check for composition happens to
be inside invisible text. (Bug#58791)
Po Lu [Wed, 26 Oct 2022 13:46:41 +0000 (21:46 +0800)]
Prevent gui_consider_frame_title from restoring dead top frames
* src/xdisp.c (unwind_format_mode_line): Check that
old_top_frame is live before selecting it. It could have been
deleted, which leads to signals when the post-command-hook
installed by xterm-set-window-title runs upon the last frame of
a terminal being deleted.
(gui_consider_frame_title): Rearrange code to be more
understandable.
Dynamic validation of styles in completion-category-overrides
The type of the defcustom completion-category-overrides must be able
to accommodate dynamic changes to completion-styles-alist, because
some packages (eglot) make their own additions.
This change fixes a failure in test-custom-opts. See discussion at:
https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01969.html
* lisp/minibuffer.el (completion--styles-type):
Add an "Other" case that accepts any symbol which is then validated
dynamically against completion-styles-alist.
Dmitry Gutov [Tue, 25 Oct 2022 21:09:01 +0000 (00:09 +0300)]
vc-hg-checkin-patch: Add implementation for Hg
* lisp/vc/vc-hg.el (vc-hg-checkin-patch): Add Hg-specific
implementation (bug#52349), like suggested in
https://lists.gnu.org/archive/html/emacs-devel/2022-10/msg01533.html.
(vc-hg--extract-headers): Extract from vc-hg-checkin.
where the foo/bar/... bindings are not only useless but can prevent
the GC from collecting that memory (i.e. it's a representation that is
not "safe for space") and it can also make that closure "unwritable"
(or more specifically, it can cause the closure's print
representation to be u`read`able).
Compiled closures don't suffer from this problem because `cconv.el`
actually looks at the code and only stores in the compiled closure
those variables which are actually used.
So, we fix this discrepancy by letting the existing code in `cconv.el` tell
`Ffunction` which variables are actually used by the body of the
function such that it can filter out the irrelevant elements and
return a closure of the form:
(closure ((y 7)) (x) (+ x y))
* lisp/loadup.el: Preload `cconv` and set
`internal-filter-closure-env-function` once we have a usable `cconv-fv`.
* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): Adjust to new
calling convention of `cconv-closure-convert`.
(byte-compile-not-lexical-var-p): Delete function, moved to `cconv.el`.
(byte-compile-bind): Use `cconv--not-lexical-var-p`.
* lisp/emacs-lisp/cconv.el (cconv--dynbound-variables): New var.
(cconv-closure-convert): New arg `dynbound-vars`
(cconv--warn-unused-msg): Remove special case for `ignored`,
so we don't get confused when a function uses an argument called
`ignored`, e.g. holding a list of things that it should ignore.
(cconv--not-lexical-var-p): New function, moved from `bytecomp.el`.
Don't special case keywords and `nil` and `t` since they are already
`special-variable-p`.
(cconv--analyze-function): Use `cconv--not-lexical-var-p`.
(cconv--dynbindings): New dynbound var.
(cconv-analyze-form): Use `cconv--not-lexical-var-p`.
Remember in `cconv--dynbindings` the vars for which we used
dynamic scoping.
(cconv-analyze-form): Use `cconv--dynbound-variables` rather than
`byte-compile-bound-variables`.
(cconv-fv): New function.
* src/eval.c (Fsetq, eval_sub): Remove optimization designed when
`lexical-binding == nil` was the common case.
(Ffunction): Use `internal-filter-closure-env-function` when available.
(eval_sub, Ffuncall): Improve error info for `excessive_lisp_nesting`.
(internal-filter-closure-env-function): New defvar.
Robert Pluim [Tue, 25 Oct 2022 13:18:51 +0000 (15:18 +0200)]
Fix eglot defcustom types
* lisp/progmodes/eglot.el (eglot-autoreconnect): Allow for 'nil'.
(eglot-connect-timeout): Allow for 'nil' and add descriptions.
(eglot-sync-connect): Split boolean into 'nil' and 't' and add descriptions.
(eglot-confirm-server-initiated-edits): Change 'symbol' type to 'const'.
Alan Mackenzie [Tue, 25 Oct 2022 13:28:57 +0000 (13:28 +0000)]
Test face name variables are bound before using them in cc-fonts.el
This fixes bug #58641.
Also, set c-reference-face-name to font-lock-constant face in preference to
c-label-face-name.
* lisp/progmodes/cc-fonts.el (c-preprocessor-face-name, c-label-face-name)
(c-constant-face-name, c-reference-face-name): Test variables with the same
name as font-lock faces are bound before accessing their values.
(c-reference-face-name): Use font-lock-constant face in preference to
c-label-face-name.