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.
Juri Linkov [Wed, 14 Apr 2021 18:10:00 +0000 (21:10 +0300)]
* lisp/repeat.el: Add option to indicate repeat-mode in mode-line (bug#47566)
* lisp/repeat.el (repeat-echo-function): Rename from repeat-mode-echo.
Add choice repeat-echo-mode-line.
(repeat-in-progress): New variable.
(repeat-post-hook): Call repeat-echo-function with nil arg
at the end of repeating sequence.
(repeat-echo-message-string): New function with body from repeat-post-hook.
(repeat-echo-message): Rename from repeat-mode-message.
(repeat-echo-mode-line-string): New variable.
(repeat-echo-mode-line): New function.
Michael Albinus [Wed, 14 Apr 2021 11:25:36 +0000 (13:25 +0200)]
Rearrange argument handling in Tramp scp calls.
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
Use `start-process' instead of `start-process-shell-command'.
(tramp-make-copy-program-file-name): Do not quote `localname'.
* test/lisp/net/tramp-tests.el (tramp-method-out-of-band-p): Declare.
(tramp--test-windows-nt-and-batch-p)
(tramp--test-windows-nt-and-pscp-psftp-p): Remove, and also all callees.
(tramp--test-windows-nt-and-out-of-band-p)
(tramp--test-windows-nt-and-scp-p): New defuns.
(tramp-test17-dired-with-wildcards)
(tramp-test40-special-characters)
(tramp-test40-special-characters-with-stat)
(tramp-test40-special-characters-with-perl)
(tramp-test40-special-characters-with-ls, tramp-test41-utf8)
(tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
(tramp-test41-utf8-with-ls): Use them.
Eli Zaretskii [Wed, 14 Apr 2021 08:47:55 +0000 (11:47 +0300)]
Add two optional arguments to 'string-width'
* src/character.c (Fstring_width, lisp_string_width): Accept two
optional arguments FROM and TO, to indicate the substring to be
considered.
(Fstring_width): Add caveats in the doc string about display
features ignored by the function. (Bug#47712)
* src/character.h (lisp_string_width): Update prototype.
* src/editfns.c (styled_format): Adjust call of lisp_string_width
to its changed signature.
* test/src/character-tests.el (character-test-string-width): New
file with tests for 'string-width'.
* doc/lispref/display.texi (Size of Displayed Text): Document
caveats of using 'string-width'.
Stefan Monnier [Wed, 14 Apr 2021 03:55:47 +0000 (23:55 -0400)]
* src/xdisp.c (wset_update_mode_line): Move from `src/window.c`
Move that function next to its siblings. Also simplify it, since
after careful analysis it is now clear that the frame's title's update
is already handled elsewhere (in `prepare_menu_bars` and `redisplay_window`)
so we just need to make sure the `redisplay` bit is set.
* src/window.c (wset_update_mode_line): Move to `src/xdisp.c`.
* src/window.h (wset_update_mode_line): Declare.
Eric Abrahamsen [Sat, 13 Mar 2021 22:25:47 +0000 (14:25 -0800)]
Improvements to message-syntax-checks docs and options
* doc/misc/message.texi: Move the manual entry from the "News Headers"
section to the "Message Headers" section, as it is generally
applicable, not just to News.
* lisp/gnus/message.el (message-syntax-checks): Add an explicit alist
type specifying the valid options; point to the manual for more
information.
Eli Zaretskii [Tue, 13 Apr 2021 13:40:42 +0000 (16:40 +0300)]
Resurrect mouse-highlight of close buttons on tab-bar
* src/w32term.c (w32_draw_image_relief): Support tab-bar drawing
with relief as xterm.c does.
* src/xdisp.c (handle_tab_bar_click): Access the mouse-highlight
info. Call show_mouse_face to show the button in the pressed or
the released state, according to value of DOWN_P.
(note_tab_bar_highlight): Function added back.
(note_mouse_highlight): Call note_tab_bar_highlight when the mouse
pointer is in the tab-bar window.
(show_mouse_face): Return immediately if mouse_face_window is not
set up in HLINFO. This avoids rare assertion violations.
This file is needed for CEDET's bootstrap, tho, so we now keep a copy of it
under version control in `gram-wy-boot.el`, very much like we do with
the `ldefs-boot.el` copy of `loaddefs.el`.
* lisp/cedet/semantic/grm-wy-boot.el: Rename from
`lisp/cedet/semantic/grammar-wy.el`.
* lisp/cedet/semantic/grammar.el: Load `grm-wy-boot.el` if
`grammar-wy.el` hasn't been generated yet.
* admin/update_autogen: Also refresh `grm-wy-boot.el`.
* admin/grammars/Makefile.in (WISENT): Add `grammar-wy.el` to the
generated files.
Juri Linkov [Mon, 12 Apr 2021 16:14:45 +0000 (19:14 +0300)]
* lisp/repeat.el (repeat-mode-echo): New defcustom.
(repeat-post-hook): Use it.
(repeat-mode-message): New function (bug#47566).
(repeat-post-hook): Use real-this-command instead of this-command
to handle e.g. rectangle-exchange-point-and-mark remapped to
exchange-point-and-mark (bug#47688).
Stefan Monnier [Mon, 12 Apr 2021 15:08:19 +0000 (11:08 -0400)]
(define-minor-mode): Warn about use of pre-Emacs-21 style args
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode):
Use `advertised-calling-convention` to avoid promoting the old
style arguments. Emit a wanring when old-style arguments are used.
Massage the docstring accordingly.
* doc/lispref/modes.texi (Defining Minor Modes): Document the keyword
arguments rather than the old-style positional arguments.
Adjust verilog-mode to changes in the completion framework
* lisp/progmodes/verilog-mode.el (verilog-func-completion): Don't
bug out on `C-M-i' (which expects no point movement) (bug#47652).
(verilog-declaration-end): There may be no semicolons; don't bug out.
Ralph Schleicher [Mon, 12 Apr 2021 08:31:46 +0000 (10:31 +0200)]
Add command in eww to toggle images
* lisp/net/eww.el (eww-toggle-images): New function.
(eww-mode-map): Add key binding and menu entry.
* lisp/net/shr.el (shr-inhibit-images): Make it customizable.
* doc/misc/eww.texi (Basics): Document eww-toggle-images.
Fix index entries for shr-use-fonts and shr-use-colors.
(Advanced): Document shr-inhibit-images
(bug#47705).
Philipp Stephani [Mon, 12 Apr 2021 07:15:59 +0000 (09:15 +0200)]
Generate Seccomp filters only if we have the necessary constants.
If we're missing SECCOMP_SET_MODE_FILTER, the seccomp-filter build
fails. Reuse the existing HAVE_SECCOMP configuration variable, which
checks for these macros.
* configure.ac (HAVE_SECCOMP): Substitute in Makefile.in.
* lib-src/Makefile.in (HAVE_SECCOMP): New variable.
(SECCOMP_FILTER): Define only if HAVE_SECCOMP.
Stefan Monnier [Mon, 12 Apr 2021 03:47:14 +0000 (23:47 -0400)]
* lisp/**/*.el: Avoid positional args to `define-minor-mode`
Back in Emacs-21.1, `define-minor-mode` grew keywords arguments to
replace its old positional arguments. Let's make sure we don't use
the old-style any more.
Stefan Monnier [Mon, 12 Apr 2021 02:55:18 +0000 (22:55 -0400)]
* lisp/gnus/message.el: Give non-nil defaults for function vars
Also prefer #' to quote functions.
(message-send-rename-function, message-reply-to-function)
(message-wide-reply-to-function, message-followup-to-function):
Use a non-nil default value so it can be used with `add-function`.
(message-do-send-housekeeping): Tweak accordingly.
(message-get-reply-headers): Simplify by η-reduction.
Philipp Stephani [Sun, 11 Apr 2021 14:50:29 +0000 (16:50 +0200)]
Use pkg-config to check for libseccomp.
We need at list version 2.4.0 of libseccomp for seccomp-filter.c to
build cleanly.
* configure.ac: Use pkg-config to check for libseccomp.
* lib-src/Makefile.in (HAVE_LIBSECCOMP, LIBSECCOMP_LIBS)
(LIBSECCOMP_CFLAGS): New variables.
(SECCOMP_FILTER, seccomp-filter$(EXEEXT)): Use them.