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.
Eli Barzilay [Sat, 10 Apr 2021 19:10:35 +0000 (15:10 -0400)]
Fix calculator-string-to-number yet again (bug#47694)
* lisp/calculator.el (calculator-string-to-number):
The last bugfix changed the code to just blindly replace ".e". This
has some minor problems like making "-." parse as 0.0 instead of -0.0,
and ".1.e1" is parsed as 1 instead of 0.1. Instead, replace the first
"." that is followed by a non-digit with ".0". Since this has had
several problems over the years, add some tests too. (Also, restore
the original if-indentation style.)
Eli Zaretskii [Sun, 11 Apr 2021 09:12:45 +0000 (12:12 +0300)]
Fix handling of mouse clicks on tab-bar buttons
* src/xdisp.c (note_mouse_highlight): Don't attempt to highlight
tab-bar buttons.
(note_tab_bar_highlight): Function deleted: it had no effect on
display of tab-bar buttons.
(tab_bar_item_info): Mention all arguments in the commentary.
(get_tab_bar_item): Don't pay attention to mouse-highlight
information; instead, compare the button's index with the one
recorded in f->last_tab_bar_item.
(handle_tab_bar_click): Don't attempt to show tab-bar buttons in
pressed or released state: that isn't supported. Determine
whether to generate a tab-bar button click based on DOWN_P
argument, not on mouse-highlight, which has no effect on tab-bar
display. (Bug#47581)
Co-authored-by: João Távora <joaotavora@gmail.com>
* lisp/icomplete.el (icomplete-completions): Consider icomplete-vertical-mode.
(icomplete-vertical-mode-minibuffer-map): New map.
(icomplete--vertical-minibuffer-setup): New helper.
(icomplete-vertical-mode): New minor mode.
Alan Mackenzie [Sat, 10 Apr 2021 19:18:28 +0000 (19:18 +0000)]
Convert CC Mode to lexical binding in Emacs
lisp/progmodes/cc-align.el, lisp/progmodes/cc-awk.el,
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-guess.el,
lisp/progmodes/cc-langs.el, lisp/progmodes/cc-menus.el,
lisp/progmodes/cc-mode.el, lisp/progmodes/cc-styles.el,
lisp/progmodes/cc-subword.el, lisp/progmodes/cc-vars.el: Mark these files with
a `lexical-binding' setting in line 1.
lisp/progmodes/cc-align.el, lisp/progmodes/cc-engine.el,
lisp/progmodes/cc-vars.el (c-syntactic-context, c-syntactic-element): Declare
these as special variables.
lisp/progmodes/cc-bytecomp.el (cc-bytecomp-debug-msg): prefix the parameter
ARGS with a _, and remove an `ignore' call.
lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Remove `kluge-start',
an unused variable.
(c-while-widening-to-decl-block): Add an extra parameter, which suppresses
the generation of a setting of variable `where'.
(c-defun-name-and-limits): Remove variable `where' from the function and use
the new argument to the previous macro.
lisp/progmodes/cc-engine.el (c-cache-to-parse-ps-state): Remove two unneeded
variables, `last' and `intermediate'.
Philipp Stephani [Mon, 14 Dec 2020 20:25:11 +0000 (21:25 +0100)]
Add support for --seccomp command-line option.
When passing this option on GNU/Linux, Emacs installs a Secure
Computing kernel system call filter. See Bug#45198.
* configure.ac: Check for seccomp header.
* src/emacs.c (usage_message): Document --seccomp option.
(emacs_seccomp): New wrapper for 'seccomp' syscall.
(load_seccomp, maybe_load_seccomp): New helper functions.
(main): Potentially load seccomp filters during startup.
(standard_args): Add --seccomp option.
* lisp/startup.el (command-line): Detect and ignore --seccomp option.
* test/src/emacs-tests.el (emacs-tests/seccomp/absent-file)
(emacs-tests/seccomp/empty-file)
(emacs-tests/seccomp/file-too-large)
(emacs-tests/seccomp/invalid-file-size): New unit tests.
(emacs-tests--with-temp-file): New helper macro.
Philipp Stephani [Thu, 18 Mar 2021 11:40:08 +0000 (12:40 +0100)]
Edebug: Disable backtracking when hitting a &define keyword.
Edebug doesn't deal well with backtracking out of definitions, see
Bug#41988. Rather than trying to support this rare situation (e.g. by
implementing a multipass parser), prevent it by adding an implicit
gate.
* lisp/emacs-lisp/edebug.el (edebug--match-&-spec-op): Disable
backtracking when hitting a &define keyword.
* test/lisp/emacs-lisp/edebug-tests.el
(edebug-tests-duplicate-&define): New unit test.
(edebug-tests--duplicate-&define): New helper macro.
* doc/lispref/edebug.texi (Backtracking): Mention &define in the list
of constructs that disable backtracking.
Michael Albinus [Sat, 10 Apr 2021 12:46:58 +0000 (14:46 +0200)]
Tramp: fix location of files on W32
* lisp/net/tramp.el:
* lisp/net/tramp-sh.el: Use (eq system-type 'windows-nt) where appropriate.
(tramp-completion-function-alist-ssh): Fix location of files on W32.
Jim Porter [Sat, 10 Apr 2021 11:16:13 +0000 (13:16 +0200)]
Further fix of hostname completion on MS Windows
* lisp/net/tramp.el (tramp-completion-file-name-regexp-simplified)
(tramp-completion-file-name-regexp-separate): Fix W32 hostname/method
completion for simplified and separate syntaxes (same as the previous change
to default syntax).
João Távora [Sat, 10 Apr 2021 10:19:26 +0000 (11:19 +0100)]
Fail earlier if stale Flymake report functions called
If a Flymake backend calls a "stale" report function,
flymake--handle-report might be called for a backend function that is
no longer in the flymake--backend-state hash table. This patch makes
that erroneous situation slightly more explicit.
Alan Mackenzie [Fri, 9 Apr 2021 20:52:49 +0000 (20:52 +0000)]
CC Mode: fix c-where-wrt-brace-construct to cope with class declarations
Make the function correctly recognize a brace block preceded by an
introductory line without a parameter list.
* lisp/progmodes/cc-cmds.el (c-where-wrt-brace-contruct): Reintroduce the use
of c-beginning-of-decl-1, which was removed some weeks ago, in place of a
c-syntactic-skip-backward. Reformulate the code generally.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't
perform incorrect optimisations when a condition-case variable shadows
another lexical variable.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
New test case.
These changes allow all bytecomp-tests to be run interactively.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--with-warning-test)
(bytecomp--define-warning-file-test): Interpret any space in the
pattern as arbitrary whitespace to tolerate line breaks.
Don't abuse the expected-failure mechanism when checking
for the expected absense of a warning.
(bytecomp/*.el): Rewrite patterns to work with line breaks
in the middle.
Now all test cases are run with both lexical and dynamic binding
where applicable, comparing interpreted against compiled results.
Previously, almost all tests were only run with dynamic binding
which was definitely not intended.
* lisp/emacs-lisp/cl-macs.el (cl--self-tco): Recognise
`condition-case` handlers as being in the tail position.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels):
Extend test.
Jim Porter [Fri, 9 Apr 2021 07:57:06 +0000 (09:57 +0200)]
Fix hostname completion on MS Windows
* lisp/net/tramp.el (tramp-completion-file-name-regexp-default):
Handle volume letter being added to paths for file name completion on W32
systems. This fixes hostname (and method) autocomplete on W32.
Stefan Monnier [Thu, 25 Mar 2021 02:59:52 +0000 (22:59 -0400)]
* lisp/progmodes/vhdl-mode.el: Use lexical-binding
Use #' to quote function names to get better compiler diagnostics.
Wrap some lines to avoid arguments "hidden" in positions that are easy
to misread.
Prefix unused arguments with a semi-colon to silence compiler warnings.
Fix a few comments that used ;;; even though they were not headings.
(vhdl-emacs-21): Delete variable.
Replace all uses with (not (featurep 'xemacs)) instead since `vhdl-mode`
has been incompatible with Emacs<21 for more than 10 years already.
(vhdl-prepare-search-1): Add Edebug declaration.
(vhdl-prepare-search-2): Add Edebug declaration and use
`with-syntax-table`.
(vhdl-visit-file): Add Edebug and indentation declaration.
Move the bulk of the code to a function for easier debugging.
(vhdl--visit-file): New function extracted from `vhdl-visit-file`.
Be careful not to modify syntax tables in unrelated buffers.
(vhdl-speedbar-refresh): Remove unused var `pos`.
(vhdl-backward-sexp): Remove unused var `last-forward`.
(vhdl-electric-tab, vhdl-minibuffer-tab, vhdl-line-expand):
Rename arg to avoid conflict with the `prefix-arg`
global variable.
(vhdl-align-region-1): Remove unused var `indent`.
(vhdl-character-to-event): Actually give a body to that poor function.
(vhdl-template-context): Remove unused vars `entity-exists` and `string`.
(vhdl-template-group): Remove unused var `start`.
(vhdl-template-argument-list): Remove unused var `start`.
(vhdl-port-paste-context-clause): Remove unused var `margin`.
(vhdl-port-paste-testbench): Remove unused var `source-buffer`.
(vhdl-hs-minor-mode): Declare function `hs-hide-all`.
(vhdl-get-hierarchy): Rename arguments `ent-alist`, `conf-alist`, and
`conf-key` and bind those dynamically scoped var via `let` instead
since arguments can't be dynamically scoped.
(vhdl-speedbar-insert-hierarchy, vhdl-compose-configuration-architecture):
Same thing with arguments `ent-alist` and `conf-alist`.
(vhdl-cache-version): Declare variable.
(speedbar-expand-line, speedbar-edit-line): Declare functions.
(vhdl-speedbar-update-current-unit): Declare before first use.
(vhdl-compose-new-component): Remove unused var `project`.
(lazy-lock-minimum-size): Declare variable.
(vhdl-submit-bug-report): Declare variable `reporter-prompt-for-summary-p`.
Stefan Monnier [Thu, 8 Apr 2021 23:34:57 +0000 (19:34 -0400)]
* lisp/shadowfile.el: Use lexical-binding
Delete redundant `:group` args.
(shadow-hashtable): Make it an actual hash-table.
(shadow-shadows-of, shadow-invalidate-hashtable): Adjust accordingly.
(shadow-insert-var): Strength-reduce `eval` to `symbol-value`.
(shadow--save-buffers-kill-emacs): New function extracted from
`shadow-save-buffers-kill-emacs`.
(shadow-save-buffers-kill-emacs): Use it and use `save-buffers-kill-emacs`.
(shadow-initialize, shadowfile-unload-function):
Use `advice-add/remove` rather than override `save-buffers-kill-emacs`
with `defalias`.