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`.
Terminate isearch when point has moved to another buffer
* lisp/isearch.el (isearch-post-command-hook): Terminate isearch
when the command just executed has moved point to another buffer.
https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg00309.html
User option to move to another match when changing direction in isearch.
* lisp/isearch.el (isearch-direction-change-changes-match):
New user option (bug#47599).
(isearch-repeat): Use the new option.
(isearch-repeat-forward, isearch-repeat-backward): Adapt to the
new option.
* etc/NEWS: Mention the new user option.
* doc/emacs/search.texi: Document the new user option.
Stefan Monnier [Thu, 8 Apr 2021 18:44:37 +0000 (14:44 -0400)]
* lisp/progmodes/vhdl-mode.el: Use progress-reporter
This was actually prompted by a backward compatibility problem
(because of the use of Emacs-27's `time-convert`). The new code
seems to work fine in Emacs-25.
It also fixes a minor bug that made the echo area messages of
`vhdl-indent-region` compete with those of `indent-region`.
(vhdl-progress-info): Delete variable.
(vhdl--progress-reporter): New var to replace it.
(vhdl-update-progress-info): Delete function.
(vhdl-indent-line): Call progress-reporter-update instead.
(vhdl-indent-region): Make it an obsolete alias of `indent-region`.
Change all users.
(vhdl-align-region-groups, vhdl-align-region, vhdl-fix-case-region-1):
Use `make-progress-reporter` and `progress-reporter-update`.
Juri Linkov [Wed, 7 Apr 2021 16:47:09 +0000 (19:47 +0300)]
Don't set isearch-success in isearch-wrap functions
* lisp/comint.el (comint-history-isearch-wrap):
* lisp/simple.el (minibuffer-history-isearch-wrap):
Don't set isearch-success to t, so isearch-repeat won't skip the
beginning of the wrapped match with (forward-char (if isearch-forward 1 -1)).
Allow complex key bindings in project-switch-project
* lisp/progmodes/project.el (project-switch-project): Replace
read-event with an overriding local map and read-key-sequence to allow
for complex key bindings to be read (bug#47620).
Stefan Monnier [Tue, 6 Apr 2021 21:06:07 +0000 (17:06 -0400)]
* lisp/find-file.el: Make the commands oblivious to mouse/non-mouse
(ff-find-other-file): Add `event` argument.
(ff-find-other-file-other-window): Rename from
`ff-mouse-find-other-file-other-window` and use this new argument.
(ff-mouse-find-other-file, ff-mouse-find-other-file-other-window):
Make them obsolete aliases.
(ff-upcase-p): Remove unused `start` and `end` arguments and
simplify accordingly.
Stefan Monnier [Tue, 6 Apr 2021 20:28:50 +0000 (16:28 -0400)]
* lisp/find-file.el: Use lexical-binding
Remove unused `:group` args. Prefer #' to quote function.
(ff-special-constructs, ff-find-the-other-file, ff-get-file-name)
(ff-list-replace-env-vars, ff-cc-hh-converter): Use `match-string`.
(modula2-other-file-alist): Tighten regexps.
(ff-get-other-file, ff-find-other-file): Use dynamic scoping.
(ff-find-the-other-file): Minor simplification.
(ff-other-file-name): Delete unused function.
(ff-string-match): Don't let-bind `case-fold-search` if not needed.
(ff-basename): Make it an obsolete alias for `file-name-nondirectory`.
(ff-switch-file): Minor simplification.
(ff-list-replace-env-vars): Use [:alnum:].
(ff-upcase-p): Use [:upper:]
(ff-cc-hh-converter): Use [:upper:] and [:lower:].
Stefan Monnier [Tue, 6 Apr 2021 04:26:38 +0000 (00:26 -0400)]
* lisp/msb.el: Use lexical-binding
Remove redundant `:group` args.
(msb--add-to-menu): Strength-reduce `eval` to `symbol-value` and use `push`.
(msb--create-sort-item): Strength-reduce `eval` to `symbol-value`.
(msb-menu-bar-update-buffers): Replace `(lambda...) with a proper closure.
Stefan Monnier [Tue, 6 Apr 2021 04:13:44 +0000 (00:13 -0400)]
* lisp/hippie-exp.el: Use lexical-binding
Remove redundant `:group` args.
(make-hippie-expand-function): Turn it into a function returning
a closure.
(try-expand-all-abbrevs): Strength-reduce `eval` to `symbol-value`
and use `abbrev-table-p` rather than `vectorp`.
Stefan Monnier [Mon, 5 Apr 2021 21:30:11 +0000 (17:30 -0400)]
* lisp/comint.el: Fix understickiness of non-comint properties
When a third party package adds properties to the prompt they don't
necessarily want to be `read-nonsticky` (e.g. for the `cursor-intangible`
property), so replace the catchall `rear-nonsticky t` with an
actual list of the properties that we want to be `rear-nonsticky`.
(comint-send-input, comint-output-filter): Don't mark
all properties as non-sticky.
Juri Linkov [Mon, 5 Apr 2021 21:18:59 +0000 (00:18 +0300)]
* lisp/tab-bar.el: Add repeat-map keymaps.
* lisp/tab-bar.el (tab-bar-switch-repeat-map): New keymap used for
'tab-next' and 'tab-previous'.
(tab-bar-move-repeat-map): New keymap used for 'tab-move'.
https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg01103.html
Juri Linkov [Mon, 5 Apr 2021 21:02:43 +0000 (00:02 +0300)]
* lisp/repeat.el (repeat-keep-prefix): New defcustom.
* lisp/repeat.el (repeat-map): New autoloaded global variable.
(repeat-post-hook): Use 'repeat-map' when non-nil
and reset it to nil afterwards.
(repeat-post-hook): Keep the current prefix when
'repeat-keep-prefix' is non-nil.
* lisp/window.el (other-window-repeat-map): Add "O" that sets
'repeat-map' to 'other-window-repeat-map' before calling
'(other-window -1)'.
* lisp/repeat.el (repeat-post-hook): Rename let-bound repeat-map to rep-map.
Define let-bound prefix-command-p. Use lookup-key with
this-single-command-keys instead of last-command-event.
Don't show message when typing prefix keys.
https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg00083.html
Michael Albinus [Mon, 5 Apr 2021 17:37:30 +0000 (19:37 +0200)]
Use powershell for Tramp on MS Windows
* lisp/net/tramp-sh.el (tramp-use-ssh-controlmaster-options):
Nil on MS Windows.
(tramp-connection-properties): Add "encoding-shell".
(tramp-maybe-open-connection): Use it. Change exit handling.
(tramp-actions-before-shell): Add `tramp-no-job-control-regexp'.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-no-job-control-regexp): New defcustom.
(tramp-get-debug-buffer): Set coding system.