Philipp Stephani [Fri, 23 Apr 2021 10:52:51 +0000 (12:52 +0200)]
Fix small bug in 'completion-table-subvert'.
Even for a trivial underlying completion table (where the 'boundaries'
action returns nil), we need to provide nontrivial boundaries so that
they match the behavior of 'all-completions'.
* lisp/minibuffer.el (completion-table-subvert): Return boundaries
even for trivial underlying completion table.
* test/lisp/minibuffer-tests.el (completion-table-subvert-test):
Amend unit test to also test boundaries. While there, also test
the other completion functions.
Add support for using a TLS client certificate with 'erc-tls' (bug#47788)
* lisp/erc/erc-backend.el (erc-session-client-certificate): New
buffer-local variable storing the TLS client certificate used for the
current connection.
(erc-open-network-stream): Use open-network-stream instead of
make-network-process, and pass any additional arguments to it.
(erc-server-connect): Add an optional client-certificate argument
that if present is passed with the :client-certificate keyword as part
of the arguments to erc-server-connect-function.
* lisp/erc/erc.el (erc-open): Add new optional client-certificate
argument, set it as erc-session-client-certificate, and pass it along
to erc-server-connect.
(erc): Clarify documentation string with respect to the full-name
argument.
(erc-tls): Add new client-certificate keyword argument and pass it in
the direct call to erc-open (instead of going through erc).
(erc-open-tls-stream): Pass any additional arguments (such as
:client-certificate) to open-network-stream. Also allow overriding
:nowait if desired.
* doc/misc/erc.texi: Add documentation for erc-tls, including the new
:client-certificate argument.
* lisp/progmodes/project.el (project-compilation-buffer-name-function):
New option.
(project-compile): Use it.
(project-prefixed-buffer-name): New function.
Eli Zaretskii [Thu, 22 Apr 2021 17:23:23 +0000 (20:23 +0300)]
Fix MS-Windows link switches for unexec
* configure.ac (LD_SWITCH_SYSTEM_TEMACS) [mingw32]: Disable ASLR
when linking for unexec. Reported by Nikolay Kudryavtsev
<nikolay.kudryavtsev@gmail.com>.
Stefan Monnier [Thu, 22 Apr 2021 13:32:04 +0000 (09:32 -0400)]
Fix unload+reload of files using `custom-initialize-delay` (bug#47072)
* lisp/custom.el (custom-initialize-delay): Don't delay if
`custom-delayed-init-variables` has already been processed.
* lisp/startup.el (command-line): Mark `custom-delayed-init-variables`
as processed.
Alan Mackenzie [Thu, 22 Apr 2021 12:07:21 +0000 (12:07 +0000)]
Fix unclean "can't happen" error handling in read_minibuf_unwind
Also fix a bug where, with minibuffer-follows-selected-frame neither nil nor
t, a minibuffer could appear in two frames at the same time.
* src/window.c (Fset_window_configuration): Add a new &optional parameter
DONT-SET-MINIWINDOW, which inhibits the minibuffer from being restored from
the supplied window configuration.
(restore_window_configuration): Enhance to match the above.
* src/minibuf.c (read_minibuf): Enhance the argument list to the
restore_window_configuration calls to match the above. In the main case,
restoring the minibuffer is inhibited.
(read_minibuf_unwind): Should the frame with the expired minibuffer not be
found ("can't happen"), unwind the stacked data nevertheless, rather than just
exiting.
* src/keyboard.c (read_char_help_form_unwind): Amend a call of
Fset_window_configuration.
* doc/lispref/windows.texi (Window Configurations): Document the new form of
set-window-configuration.
* etc/NEWS (Lisp Changes in Emacs 28.1): Amend the entry for
set-window-configuration.
Eli Zaretskii [Thu, 22 Apr 2021 11:01:42 +0000 (14:01 +0300)]
Fix Isearch hscrolling in a corner case
* lisp/isearch.el (isearch-update): When we start hscrolled,
consider also the case that point ends up being to the left of the
hscrolled window's edge. (Bug#46316)
In order to correctly detect the case of the "new style" with an empty body,
remove the old optional arguments `init-value`, `lighter`, and `keymap`,
so we can distinguish the "nil arg" from the "absent arg" cases.
Harald Jörg [Mon, 19 Apr 2021 22:25:39 +0000 (00:25 +0200)]
cperl-mode: Avoid abbrev expansion in variable names
* lisp/progmodes/cperl-mode.el (cperl-electric-else): Don't expand
scalar variables like '$continue' as keywords. (Bug#47902)
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test-hyperactive-electric-else): Verify that keywords are
expanded but variable names aren't.
Eli Zaretskii [Tue, 20 Apr 2021 14:58:18 +0000 (17:58 +0300)]
Fix Rmail-MIME size estimations
The quoted-printable estimation was obviously wrong: the size becomes
smaller when decoded, not larger...
* lisp/mail/rmailmm.el (rmail-mime-set-bulk-data): Fix estimations
of decoded MIME attachment.
Alan Mackenzie [Tue, 20 Apr 2021 10:14:40 +0000 (10:14 +0000)]
Introduce and use minibuffer-mode. This fixes bug #47150
* lisp/minibuffer.el (minibuffer-mode): New derived mode.
* src/minibuf.c (syms_of_minibuf): New DEFSYMs Qminibuffer_mode,
Qminibuffer_inactive_mode, Qminibuffer_completing_file_name,
Qselect_frame_set_input_focus, Qadd_to_history.
(read_minibuf, set_minibuffer_mode, read_minibuf_unwind): Use the new DEFSYMs
in place of continual interning.
(set_minibuffer_mode): Put an active minibuffer into minibuffer-mode rather
than fundamental-mode.
Even in the cases where it does not make much visible difference,
it brings the benefit of making the result deterministic.
* minibuffer.el (minibuffer--sort-by-length-alpha): New function.
(minibuffer--sort-by-position): New function extracted from
`completion-all-sorted-completions`.
(completion-all-sorted-completions): Use use them.
Philipp Stephani [Mon, 19 Apr 2021 19:10:20 +0000 (21:10 +0200)]
Seccomp filter: deal with arch_prctl(ARCH_CET_STATUS, ...).
The dynamic loader of GNU libc 2.28 uses this system call to
initialize CPU information, see
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/cpu-features.c;hb=glibc-2.28#l28.
Simulating an older kernel by returning EINVAL should be the most
harmless rule here.
The ARCH_CET_STATUS symbol isn't yet exposed by the kernel headers;
see the FIXME at the top of
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/include/asm/prctl.h;hb=glibc-2.28.
* lib-src/seccomp-filter.c (ARCH_CET_STATUS): Define if not
already present. Inline the value because there doesn't seem to
be a header file exporting this constant yet.
(main): Make ARCH_CET_STATUS subfunction of arch_prctl return EINVAL.
* lisp/minibuffer.el (completion-all-sorted-completions): Use hash
table for sorting by history position, O(m+n*log(n)) instead of
O(m*n*log(n)) with history length `m` and candidate length `n`.
Philipp Stephani [Sun, 18 Apr 2021 19:47:53 +0000 (21:47 +0200)]
Add quoted filename support to 'project-find-regexp' (Bug#47799).
This is only a band-aid; it would be better to fix xref.el to work
with quoted filenames as well.
* lisp/progmodes/project.el (project--find-regexp-in-files): Unquote
filenames before passing them to 'xref-matches-in-files'.
* test/lisp/progmodes/project-tests.el (project/quoted-directory):
Also test 'project-find-regexp'.
Philipp Stephani [Sun, 18 Apr 2021 19:43:17 +0000 (21:43 +0200)]
Skip a unit test that requires an external program if necessary.
* test/lisp/progmodes/project-tests.el (project/quoted-directory):
Skip if the 'find' program isn't available. The 'project-files'
function uses 'find' to obtain the list of project files.
* doc/misc/modus-themes.org (COPYING): Reword to match the phrasing of
other manuals that are distributed with Emacs.
(Install from the archives)
(Sample configuration for use-package)
(Option for more bold constructs)
(Option for more slanted constructs)
(Option for syntax highlighting)
(Option for no font mixing)
(Option for links)
(Option for command prompt styles)
(Option for completion framework aesthetics)
(Option for fringe visibility)
(Option for language checkers)
(Option for org-habit graph styles)
(Option for line numbers (display-line-numbers-mode))
(Option for parenthesis matching (show-paren-mode))
(Option for diff buffer looks)
(Option for scaled headings)
(Option for variable-pitch font in UI elements)
(Option for variable-pitch font in headings)
(Case-by-case face specs using the themes' palette (DIY))
(Face specs at scale using the themes' palette (DIY))
(Font configurations for Org and others (DIY))
(Load theme depending on time of day): Minor markup changes for better
texi output.
(Option for mode line presentation): Document new possible values for
'modus-themes-mode-line'.
(Option for line highlighting (hl-line-mode)): Document new
'modus-themes-hl-line' variable, which supersedes
'modus-themes-intense-hl-line'.
(Option for active region): Document new possible values for
'modus-themes-region'.
(Option for org-mode block styles): Cite variables that affect
fontification.
(Option for the headings' overall style): Include the option of a
per-level nil value.
(Remap face with local value (DIY))
(Override colors (DIY)): Add sections.
(Full support for packages or face groups): Document newly supported packages
(Note for dimmer.el)
(Note for EWW and Elfeed fonts (SHR fonts)): Add notes.
(Acknowledgements): Add names of new contributors.
(GNU Free Documentation License): Add tags for html export.
* etc/themes/modus-operandi-theme.el (File)
* etc/themes/modus-vivendi-theme.el (File): Update to version 1.3.1
Martin Rudalics [Sun, 18 Apr 2021 07:51:32 +0000 (09:51 +0200)]
Avoid selecting tooltip windows and frames (Bug#47207)
* src/frame.c (do_switch_frame): Don't switch to a tooltip frame.
(Fselect_frame): Do not select a tooltip frame.
* src/w32fns.c (Fx_show_tip):
* src/xfns.c (Fx_show_tip): Set the tooltip window's
`no-other-window' parameter so `other-window' will skip it.
* src/window.c (select_window): Do not select a tooltip window.
(candidate_window_p): Make sure MINIBUF is live.
(decode_next_window_args): Make sure that W's frame's minibuffer
window is live before including it.
(Qno_other_window): New symbol.
Don't bind `load-read-function` to nil but to its actual default value.
Actually, I'm not sure it's worth the trouble rebinding this var, but
if we do, then we should bind it to a valid value rather than to nil.
* lisp/emacs-lisp/edebug.el (edebug--eval-defun): Re-install our advice
if needed.
Philipp Stephani [Sat, 17 Apr 2021 19:06:11 +0000 (21:06 +0200)]
Attempt to print some debugging information on Seccomp failures.
Try to search the audit log as well as recent core dumps.
* test/src/emacs-tests.el (emacs-tests--seccomp-debug): New helper
function.
(emacs-tests/seccomp/allows-stdout)
(emacs-tests/seccomp/forbids-subprocess)
(emacs-tests/bwrap/allows-stdout): Use it.
Alan Mackenzie [Fri, 16 Apr 2021 19:34:00 +0000 (19:34 +0000)]
Check minibuffer windows are live windows, rather than assuming it
This partly fixes bug #47207.
* src/minibuf.c (choose_minibuf_frame, move_minibuffers_onto_frame)
(read_minibuf (twice), read_minibuf_unwind): Before using a frame's
->minibuffer_window field, check it is valid with WINDOW_LIVE_P.
(choose_minibuf_frame): Remove the emacs_abort for a null minibuffer.
Alan Third [Mon, 12 Apr 2021 19:30:12 +0000 (20:30 +0100)]
Allow use of em in image spec sizes
* src/image.c (image_get_dimension): New function.
(compute_image_size): Use image_get_dimension to set the sizes, and
pass in the image struct instead of just the spec.
(image_set_transform):
(imagemagick_load_image):
(svg_load_image): Use the image instead of the spec in compute_image_size.
(syms_of_image): Add 'em' as a symbol.
Philipp Stephani [Thu, 15 Apr 2021 16:41:04 +0000 (18:41 +0200)]
Improve project support for quoted directory names (Bug#47799)
* lisp/progmodes/project.el (project--files-in-directory): Unquote
directory name before passing it to 'find'.
(project--remote-file-names): Requote local filenames if the original
directory is quoted.
* test/lisp/progmodes/project-tests.el (project/quoted-directory): New
unit test.
Stefan Monnier [Thu, 15 Apr 2021 15:27:52 +0000 (11:27 -0400)]
* lisp/emacs-lisp/bindat.el: Allow non-fixed size of `strz`
(bindat--unpack-strz): Allow `len` to be nil.
(bindat--pack-strz): New function.
(bindat--type) <strz>: Make `len` arg optional.
(bindat-type): Adjust debug spec and docstring accordingly.
Allow a condition-case handler on the form (:success BODY) to be
specified as the success continuation of the protected form, with
the specified variable bound to its result.
* src/eval.c (Fcondition_case): Update the doc string.
(internal_lisp_condition_case): Implement in interpreter.
(syms_of_eval): Defsym :success.
* lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case):
Implement in byte-compiler.
* lisp/emacs-lisp/cl-macs.el (cl--self-tco): Allow self-TCO
from success handler.
* doc/lispref/control.texi (Handling Errors): Update manual.
* etc/NEWS: Announce.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases)
(bytecomp-condition-case-success):
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels):
Add test cases.
Alan Mackenzie [Thu, 15 Apr 2021 10:11:20 +0000 (10:11 +0000)]
CC Mode: Put debug specs inside declare forms. Add missing debug specs.
* lisp/progmodes/cc-bytecomp.el, lisp/progmodes/cc-cmds.el,
lisp/progmodes/cc-defs.el, lisp/progmodes/cc-engine.el,
lisp/progmodes/cc-fonts.el, lisp/progmodes/cc-langs.el,
lisp/progmodes/cc-mode.el: Change the explicit def-edebug-spec for many macros
into a (declare (debug ...) ..) form. Add such forms to macros which were
previously lacking def-edebug-spec forms.