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.
Do not search the global keymap in project--keymap-prompt
* lisp/progmodes/project.el: (project--keymap-prompt) Pass
project--keymap-prompt as a list to where-is-internal so that the
global keymap is not searched at all (bug#47501).
Stefan Kangas [Mon, 5 Apr 2021 12:17:02 +0000 (14:17 +0200)]
Obsolete local list functions in shadowfile.el
* lisp/shadowfile.el (shadow-union): Make obsolete in favour of
cl-union. Update callers.
(shadow-find): Make into obsolete function alias for seq-find.
Update callers.
(cl-lib): Remove unnecessary require.
Stefan Kangas [Sun, 4 Apr 2021 23:38:48 +0000 (01:38 +0200)]
Make ediff-copy-list alias obsolete
* lisp/vc/ediff-mult.el (ediff-intersect-directories)
(ediff-get-directory-files-under-revision): Don't use above
obsolete alias.
* lisp/vc/ediff-util.el (ediff-copy-list): Make alias obsolete.
Regenerate semantic grammars if the generating code changes
* admin/grammars/Makefile.in (emacs): Set load-prefer-newer.
(grammar_bovine, grammar_wisent): New variables.
(${bovinedir}/%-by.el, ${bovinedir}/scm-by.el)
(${cedetdir}/semantic/%-wy.el, ${wisentdir}/%-wy.el)
(${wisentdir}/javat-wy.el, ${cedetdir}/srecode/srt-wy.el):
Depend on the source file for the generating function.
* lisp/cedet/semantic/bovine/grammar.el (bovine--make-parser-1):
* lisp/cedet/semantic/wisent/grammar.el (wisent--make-parser-1):
Force generation of the output file. The previous "is the output
newer than the input" failed to account for changes in the
generation code itself. Force so we can let make figure it out.
Make maintainer-clean delete generated files, as per standards
These are generated files that were once kept in the repository.
When they were removed from the repository, as a half-way measure
they were only deleted by "extraclean", but this was never
necessary and was not a proper use of that rule.
* admin/charsets/Makefile.in (gen-clean): New phony target.
(maintainer-clean): Delete generated files.
* admin/grammars/Makefile.in (gen-clean): New phony target.
(maintainer-clean): Delete generated files.
* admin/unidata/Makefile.in (gen-clean): New phony target.
(maintainer-clean): Delete generated files.
* leim/Makefile.in (gen-clean): New phony target.
(maintainer-clean): Delete generated files.
* GNUmakefile: Doc fix.
Alan Third [Sun, 4 Apr 2021 13:08:48 +0000 (14:08 +0100)]
Work around librsvg bug (bug#47074)
Librsvg <= 2.40 has restrictions on how certain numbers can be run
together in path elements which do not match the SVG spec.
* etc/images/checkbox-mixed.svg:
* etc/images/checked.svg:
* etc/images/radio-checked.svg:
* etc/images/unchecked.svg: Separate problem numbers.
* etc/images/radio-mixed.svg: Separate problem numbers and color and
font-weight data.
Eli Zaretskii [Sun, 4 Apr 2021 11:53:20 +0000 (14:53 +0300)]
Fix MS-Windows build
* src/image.c: (init_svg_functions) [WINDOWSNT]: Define and load
rsvg_handle_set_stylesheet from the DLL for librsvg > 2.48.
(lookup_image): Use xmalloc.
Stefan Kangas [Sun, 4 Apr 2021 11:23:40 +0000 (13:23 +0200)]
Use lexical-binding in hilit-chg.el
* lisp/hilit-chg.el: Use lexical-binding. Remove redundant :group
args. Doc and formatting fixes.
(highlight-changes-mode, highlight-changes-visible-mode):
Use keyword arguments.
(hilit-chg-display-changes, highlight-changes-rotate-faces):
Quote function symbols as such.
(hilit-x, hilit-y, hilit-e): Define variables on top-level to
silence the byte-compiler.
(highlight-markup-buffers): Improve message format.
Eli Zaretskii [Sun, 4 Apr 2021 07:10:00 +0000 (10:10 +0300)]
Fix unexec compilation
* src/pdumper.c (thaw_hash_tables): Now conditioned by
HAVE_PDUMPER.
(init_pdumper_once): No-op unless HAVE_PDUMPER. Reported by
Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>.
Alan Third [Sat, 3 Apr 2021 22:23:54 +0000 (23:23 +0100)]
Make new SVG widgets match character height (bug#47074)
* etc/images/checkbox-mixed.svg:
* etc/images/checked.svg:
* etc/images/radio-checked.svg:
* etc/images/radio-mixed.svg:
* etc/images/radio.svg:
* etc/images/unchecked.svg: Use viewBox and set height to 1em.
Alan Third [Sun, 28 Mar 2021 16:52:57 +0000 (17:52 +0100)]
Set CSS for SVG files
* src/dispextern.h (struct image): Add font details required for the CSS.
* src/image.c (free_image): Free the font family string.
(search_image_cache):
(uncache_image): Make image caching understand the font details.
(lookup_image): Handle the font details when generating the image and
looking up the cache.
(svg_css_length_to_pixels): Handle 'em' when we know the font size.
(svg_load_image): Generate the CSS and apply it to the SVG.
(enum svg_keyword_index):
(svg_format):
(syms_of_image): Add ':css' attribute.
* doc/lispref/display.texi (SVG Images): Add details of new svg image
attributes.
Stefan Kangas [Sat, 3 Apr 2021 19:53:06 +0000 (21:53 +0200)]
Add SVG icons for customize buffers
* etc/images/checkbox-mixed.svg:
* etc/images/checked.svg:
* etc/images/down.svg:
* etc/images/left.svg:
* etc/images/radio-checked.svg:
* etc/images/radio-mixed.svg:
* etc/images/radio.svg:
* etc/images/right.svg:
* etc/images/unchecked.svg:
* etc/images/up.svg: New files from the Adwaita Icon Theme (made by
the GNOME project). The background color was changed from gray to
none to use the same colors as the current face instead. (Bug#47074)
* etc/images/README: Add license information for the above new files.
* lisp/wid-edit.el (widget-image-conversion): Prefer SVG if it exists.
(radio-button): Rename radio buttons to "radio-checked" and
"radio". These files did not exist before.
Stefan Kangas [Fri, 2 Apr 2021 23:21:32 +0000 (01:21 +0200)]
Replace two functions with seq-subseq
* lisp/emacs-lisp/seq.el (seq-subseq): Add autoload cookie.
* lisp/eshell/esh-util.el (eshell-sublist): Redefine using seq-subseq
and make obsolete. Update callers.
* lisp/wid-edit.el (widget-sublist): Redefine as obsolete function
alias for seq-subseq. Update callers.
Stefan Monnier [Fri, 2 Apr 2021 23:51:41 +0000 (19:51 -0400)]
* lisp/progmodes/simula.el: Use lexical-binding
(simula-tab-always-indent): Mark as obsolete.
(simula-mode-map): Don't bind TAB.
(simula-indent-command): Mark as obsolete.
(hilit-set-mode-patterns): Remove obsolete support for hilit19.
(simula-mode-syntax-table): Move initialization code into the declaration.
Stefan Kangas [Fri, 2 Apr 2021 22:50:55 +0000 (00:50 +0200)]
Use lexical-binding in recentf.el
* lisp/recentf.el: Use lexical-binding. Doc fix.
(recentf-save-file): Strength reduce 'eval' to 'symbol-value'.
(recentf-trunc-list): Make into obsolete function alias for
'seq-take'. Update callers.
(recentf-show-file-shortcuts-flag): Doc fix.
(recentf-menu-elements, recentf-make-menu-items)
(recentf-make-menu-item, recentf-dialog-mode-map)
(recentf-dialog, recentf-open-files-item)
(recentf-open-files-items, recentf-open-files)
(recentf-load-list): Quote function symbols as such.
(recentf-relative-filter, recentf-file-name-nondir): Remove
redundant #' before lambda.