Commit graph

6670 commits

Author SHA1 Message Date
Julian Scheid
f8d8759059 cl-extra: Fix docstring retrieval
* lisp/emacs-lisp/cl-extra.el (cl--describe-class-slots): Fix
docstring retrieval (bug#46662).
2021-02-22 16:06:58 +01:00
Mattias Engdegård
88a02e4c89 Fix compilation of closures with nontrivial doc strings
* lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure):
Use the supplied doc string if it's a literal; fall back to the old
slow way of building a closure otherwise.
2021-02-22 11:46:04 +01:00
Mattias Engdegård
d0c47652e5 Faster, more compact, and readable closure creation
Simplify closure creation by calling a single function at run time
instead of putting it together from small pieces.  This is faster
(by about a factor 2), takes less space on disk and in memory, and
makes internal functions somewhat readable in disassembly listings again.

This is done by creating a prototype function at compile-time whose
closure variables are placeholder values V0, V1... which can be seen
in the disassembly.  The prototype is then cloned at run time using
the new make-closure function that replaces the placeholders with
the actual closure variables.

* lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure):
Generate call to make-closure from a prototype function.
* src/alloc.c (Fmake_closure): New function.
(syms_of_alloc): Defsubr it.
* src/data.c (syms_of_data): Defsym byte-code-function-p.
2021-02-21 21:58:25 +01:00
Stefan Kangas
669b911c66 ; Fix previous easy-menu-define conversion
* lisp/emacs-lisp/re-builder.el (reb-mode-menu):
* lisp/progmodes/make-mode.el (makefile-mode-menu): Replace :button
attribute with :style and :selected.
2021-02-21 10:49:07 +01:00
Lars Ingebrigtsen
12578d6aca Change how (declare (modes store the data
* lisp/emacs-lisp/byte-run.el (byte-run--set-modes): Change from
being a predicate to storing the modes.  This allows using the
modes for positive command discovery, too.
* src/data.c (Fcommand_modes): Look at the `command-modes' symbol
property, too.
2021-02-20 14:29:41 +01:00
Lars Ingebrigtsen
825aed11d2 Add the `always' function
* doc/lispref/functions.texi (Calling Functions): Document it.
* lisp/subr.el (always): New function.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Mark it as
side effect free.
2021-02-20 13:44:19 +01:00
Stefan Kangas
d184895a42 Convert re-builder menu to easy-menu-define
* lisp/emacs-lisp/re-builder.el (reb-mode-map): Move menu
definition from here...
(reb-mode-menu): ...to here, and rewrite using easy-menu-define.
2021-02-20 07:55:04 +01:00
Stefan Monnier
b6eccad06c * lisp/emacs-lisp/bytecomp.el: Don't warn for repeated _ args
(byte-compile-check-lambda-list): Skip warnings of repeated arg for
those that are declared as unused anyway.
2021-02-19 12:51:36 -05:00
Stefan Kangas
7467dc4f18 Do interactive mode tagging for package.el 2021-02-19 06:15:34 +01:00
Stefan Monnier
5977de581c * lisp/emacs-lisp/bindat.el: Tweak example in comment
Suggested by Kim Storm <storm@cua.dk>.
2021-02-18 11:15:13 -05:00
Mattias Engdegård
de15ca7d00 Fix typos
* doc/lispref/display.texi (Size of Displayed Text):
* doc/lispref/windows.texi (Buffer Display Action Functions):
* etc/NEWS:
* etc/ORG-NEWS (Org-Attach has been refactored and extended):
* lisp/battery.el (display-battery-mode, battery--upower-subsribe):
* lisp/calendar/parse-time.el:
* lisp/dired-x.el:
* lisp/emacs-lisp/chart.el (chart-sequece, chart-bar-quickie):
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p)
(eldoc-documentation-strategy):
* lisp/emacs-lisp/pcase.el (pcase--split-pred, pcase--u1):
* lisp/gnus/gnus-search.el (gnus-search-expandable-keys)
(gnus-search-parse-query, gnus-search-query-return-string)
(gnus-search-imap, gnus-search-imap-search-command)
(gnus-search-transform-expression):
* lisp/gnus/nnselect.el:
* lisp/isearch.el (isearch-lazy-count-format):
* lisp/mh-e/mh-show.el (mh-show-msg):
* lisp/net/dictionary-connection.el (dictionary-connection-open):
* lisp/net/dictionary.el (dictionary-default-popup-strategy)
(dictionary, dictionary-split-string, dictionary-do-select-dictionary)
(dictionary-display-dictionarys, dictionary-search)
(dictionary-tooltip-mode):
* lisp/net/eudcb-macos-contacts.el (eudc-macos-contacts-set-server):
* lisp/net/mailcap.el (mailcap-mime-data):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/nxml/nxml-mode.el (nxml-mode):
* lisp/progmodes/cc-engine.el:
* lisp/progmodes/cperl-mode.el (cperl-mode)
(cperl-fontify-syntaxically):
* lisp/progmodes/flymake.el (flymake-diagnostic-functions):
* lisp/progmodes/verilog-mode.el (verilog--supressed-warnings)
(verilog-preprocess):
* lisp/simple.el (self-insert-uses-region-functions):
* lisp/textmodes/bibtex.el (bibtex-copy-summary-as-kill):
* lisp/textmodes/texnfo-upd.el (texinfo-insert-master-menu-list):
* src/dispnew.c:
* src/font.c (Ffont_get):
* src/indent.c (compute_motion):
* src/process.c (init_process_emacs):
* src/w32fns.c (deliver_wm_chars):
* test/lisp/jsonrpc-tests.el (deferred-action-complex-tests):
Fix typos in documentation, comments, and internal identifiers.
2021-02-18 16:50:55 +01:00
Stefan Monnier
bae2cfe63c * lisp/emacs-lisp/edebug.el (eval-defun): Simplify
(edebug-all-defs, edebug-all-forms): Don't autoload since the problem
it was working around has been fixed a while back.
(edebug--eval-defun): Rename from `edebug-eval-defun` and simplify by
making it an `:around` advice.
(edebug-install-read-eval-functions)
(edebug-uninstall-read-eval-functions): Adjust accordingly.
(edebug-eval-defun): Redefine as an obsolete wrapper.

* lisp/progmodes/elisp-mode.el (elisp--eval-defun):
Use `load-read-function` so it obeys `edebug-all-(defs|forms)`.
(elisp--eval-defun): Fix recent regression introduced with
`elisp--eval-defun-result`.
2021-02-18 10:27:36 -05:00
Mattias Engdegård
892db042a0 Fix rx regexp form with deprecated syntax
The argument of the rx `regexp` form is assumed to evaluate to a valid
regexp, but certain kinds of deprecated but still accepted usage were
not handled correctly, such as unescaped literal (special) characters:
 (rx "a" (regexp "*")) => "a*" which is wrong.
Handle these cases; there is no extra trouble.

* lisp/emacs-lisp/rx.el (rx--translate-regexp): Force bracketing
of single special characters.
* test/lisp/emacs-lisp/rx-tests.el (rx-regexp): Add test case.
2021-02-18 11:32:50 +01:00
Lars Ingebrigtsen
6735bb3d22 Adjust the edebug spec for `interactive'
* lisp/emacs-lisp/edebug.el: Adjust the edebug spec for
`interactive' for the new syntax.
2021-02-17 20:59:44 +01:00
Lars Ingebrigtsen
0324ec1737 Fix recently introduced bug in `byte-compile-lambda'
* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Fix recently
introduced error when compiling non-lexical commands (bug#46589).
2021-02-17 17:12:31 +01:00
Lars Ingebrigtsen
b3e34643c4 Change name for the completion-* predicates
* lisp/simple.el (command-completion-default-include-p)
(command-completion-with-modes-p, command-completion-button-p):
Rename from completion-*.
(read-extended-command-predicate): Adjust default predicate.

* lisp/emacs-lisp/byte-run.el (byte-run--set-modes): Adjust
predicate name.
2021-02-17 12:01:27 +01:00
Stefan Monnier
62cda6acd6 * lisp/emacs-lisp/bindat.el: Add 64bit int support
(bindat--unpack-u64, bindat--unpack-u64r, bindat--pack-u64)
(bindat--pack-u64r): New functions.
(bindat--unpack-item, bindat--pack-item): Use them.
(bindat--fixed-length-alist): Add new types.
2021-02-15 23:54:45 -05:00
Stefan Monnier
a0b35e2f80 * lisp/emacs-lisp/bindat.el: Clarify when field labels are optional
The fixes the doc and the Edebug spec, as well as a subtle issue in
the code where a field whose name is (eval 'fill) was mistakenly
considered as an anonymous field of type `fill`.

(bindat--unpack-item, bindat--unpack-group, bindat--length-group)
(bindat--pack-item, bindat--pack-group): Use dotimes, dolist, and pcase.
(bindat--item-aux): New edebug elem.
(bindat-item): Use it to fix the handling of optional fields.
(bindat-format-vector): Use `mapconcat`.
2021-02-15 23:22:09 -05:00
Stefan Monnier
83d9fbe3bb * lisp/emacs-lisp/bindat.el (bindat-spec): New macro.
It's basically an alias for `quote`, but it offers the advantage of
providing Edebug support and opens the possibility of compiling
the bindat spec to ELisp code.

* doc/lispref/processes.texi (Bindat Spec): Document `bindat-spec`.
(Bindat Functions): Tweak a few things to adjust to the state of the code.

* test/lisp/emacs-lisp/bindat-tests.el: Use it.

* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests--read): New function.
(edebug-tests--&rest-behavior): New test.
2021-02-15 21:25:15 -05:00
Stefan Monnier
d41a4ad4ae * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Warn on empty let bodies 2021-02-15 12:07:52 -05:00
Stefan Monnier
fc4927fc3a * lisp/emacs-lisp/bindat.el: Expose the struct variable (bug#46534)
(bindat--unpack-group, bindat--length-group, bindat--pack-group):
Mark it as dynamically scoped.
2021-02-15 10:50:07 -05:00
Lars Ingebrigtsen
b535c8ba87 Add a new variable `global-minor-modes'
* doc/lispref/modes.texi (Minor Modes): Document it.
* lisp/simple.el (global-minor-modes): New variable.
(completion-in-mode-p): Use it.
(completion-with-modes-p): Use it.

* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Support it.
2021-02-15 13:08:21 +01:00
Lars Ingebrigtsen
0bd846c174 Rename minor-modes to local-minor-modes
* doc/lispref/modes.texi (Minor Modes): Update documentation.
* lisp/simple.el (completion-with-modes-p): Change usage.

* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Change usage.

* src/buffer.c: Rename from minor_modes to local_minor_modes
throughout.
(syms_of_buffer): Rename minor-modes to local-minor-modes.

* src/buffer.h (struct buffer): Rename minor_modes_.

* src/pdumper.c (dump_buffer): Update hash and usage.
2021-02-15 13:08:21 +01:00
Stefan Monnier
54e577fbc1 * lisp/emacs-lisp/edebug.el (edebug-&optional, edebug-&rest): Remove vars
According to my tests, `edebug-&optional` never has any effect.
And `edebug-&rest` can be replaced with a closure.

(edebug-&rest-wrapper): Remove function.
(edebug--match-&-spec-op): Use a closure to remember the `specs`.
2021-02-14 23:56:42 -05:00
Stefan Monnier
623e534e49 * lisp/emacs-lisp/byte-run.el (compiler-macro): Make it Edebuggable
* lisp/emacs-lisp/gv.el (gc-expander, gv-setter): Reuse the spec of
`compiler-macro`.
2021-02-14 23:03:04 -05:00
Stefan Monnier
b939f7ad35 * Edebug: Generalize &lookup, use it for cl-macrolet and cl-generic
This allows the use of (declare (debug ...)) in the lexical macros
defined with `cl-macrolet`.  It also fixes the names used by Edebug
for the methods of `cl-generic` so it doesn't need to use gensym
and so they don't include the formal arg names any more.

* lisp/emacs-lisp/edebug.el (edebug--match-&-spec-op):
Rename from `edebug--handle-&-spec-op`.
(edebug--match-&-spec-op <&interpose>): Rename from `&lookup` and
generalize so it can let-bind dynamic variables around the rest of the parse.
(edebug-lexical-macro-ctx): Rename from `edebug--cl-macrolet-defs` and
make it into an alist.
(edebug-list-form-args): Use the specs from `edebug-lexical-macro-ctx`
when available.
(edebug--current-cl-macrolet-defs): Delete var.
(edebug-match-cl-macrolet-expr, edebug-match-cl-macrolet-name)
(edebug-match-cl-macrolet-body): Delete functions.
(def-declarations): Use new `&interpose`.
(edebug--match-declare-arg): Rename from `edebug--get-declare-spec` and
adjust to new calling convention.

* lisp/subr.el (def-edebug-elem-spec): Fix docstring.
(eval-after-load): Use `declare`.

* lisp/emacs-lisp/cl-generic.el: Fix Edebug names so we don't need
gensym any more and we only include the specializers but not the formal
arg names.
(cl--generic-edebug-name): New var.
(cl--generic-edebug-remember-name, cl--generic-edebug-make-name): New funs.
(cl-defgeneric, cl-defmethod): Use them.

* lisp/emacs-lisp/cl-macs.el: Add support for `debug` declarations in
`cl-macrolet`.
(cl-declarations-or-string):
Fix use of `lambda-doc` and allow use of `declare`.
(edebug-lexical-macro-ctx): Declare var.
(cl--edebug-macrolet-interposer): New function.
(cl-macrolet): Use it to pass the right `lexical-macro-ctx` to the body.

* lisp/emacs-lisp/pcase.el (pcase-PAT): Use new `&interpose`.
(pcase--edebug-match-pat-args): Rename from `pcase--get-edebug-spec` and
adjust to new calling convention.

* test/lisp/emacs-lisp/cl-generic-tests.el (cl-defgeneric/edebug/method):
Adjust to the new names.

* test/lisp/emacs-lisp/edebug-tests.el (edebug-cl-defmethod-qualifier)
(edebug-tests-cl-flet): Adjust to the new names.

* doc/lispref/edebug.texi (Specification List): Document &interpose.
2021-02-14 21:34:09 -05:00
Lars Ingebrigtsen
c339691772 Fix byte-run--set-modes call signature
* lisp/emacs-lisp/byte-run.el (byte-run--set-modes): We take a
list of modes, not a single one (and fix the quoting).
2021-02-14 18:01:06 +01:00
Lars Ingebrigtsen
2f00a3435a Don't update `minor-modes' in global modes
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): There's no
point in setting the buffer-local `minor-modes' in global modes.
2021-02-14 16:51:14 +01:00
Lars Ingebrigtsen
869cdcf4e7 Really fix the syntax problem in define-minor-mode
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix
interactive extension in previous change.
2021-02-14 14:13:38 +01:00
Lars Ingebrigtsen
07e6b29b12 Fix previous define-minor-mode change
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Fix
interactive extension in previous change.
2021-02-14 14:12:08 +01:00
Lars Ingebrigtsen
40f7804ecb Allow define-minor-mode to take an :interactive keyword
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Allow
specifying the :interactive state and the modes.
2021-02-14 14:06:16 +01:00
Lars Ingebrigtsen
c1ef7adeb6 Add 'read-extended-command-predicate'
* doc/emacs/m-x.texi (M-x): Document it.
* doc/lispref/commands.texi (Interactive Call): Document it further.

* lisp/simple.el (read-extended-command-predicate): New user option.
(read-extended-command-predicate): Use it.
(completion-in-mode-p): New function (the default predicate).
2021-02-14 13:56:53 +01:00
Lars Ingebrigtsen
2bfcd93e83 Mark easy-menu-do-define menus as "not interesting"
* lisp/emacs-lisp/easymenu.el (easy-menu-do-define): Mark menu
keymaps as "not interesting" when doing completion.
2021-02-14 13:31:10 +01:00
Lars Ingebrigtsen
9291e7316f Add new 'declare' forms for command completion predicates
* doc/lispref/functions.texi (Declare Form): Document the new
`completion' and `modes' declarations.
* lisp/simple.el (completion-with-modes-p): New helper functions.

* lisp/emacs-lisp/byte-run.el (byte-run--set-completion)
(byte-run--set-modes):
(defun-declarations-alist): New declarations for `completion' and
`modes'.
2021-02-14 13:29:35 +01:00
Lars Ingebrigtsen
58e0c8ee86 Extend the syntax of `interactive' to list applicable modes
* doc/lispref/commands.texi (Using Interactive): Document the
extended `interactive' form.
* doc/lispref/loading.texi (Autoload): Document list-of-modes
form.

* lisp/emacs-lisp/autoload.el (make-autoload): Pick the list of
modes from `interactive' out of the functions.

* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Allow for the
extended `interactive' form.

* src/callint.c (Finteractive): Document the extended form.

* src/data.c (Finteractive_form): Return the interactive form in
the old format (even when there's an extended `interactive') to
avoid having other parts of Emacs be aware of this.
(Fcommand_modes): New defun.

* src/emacs-module.c (GCALIGNED_STRUCT): Allow for modules to
return command modes.

* src/lisp.h: New function module_function_command_modes.
2021-02-14 13:21:24 +01:00
Lars Ingebrigtsen
43ecde8578 Introduce an :interactive keyword for `defined-derived-mode'
* doc/lispref/modes.texi (Derived Modes): Document it.
* lisp/emacs-lisp/derived.el (define-derived-mode): Introduce a
new :interactive keyword.
2021-02-14 12:58:20 +01:00
Lars Ingebrigtsen
760910f491 Add a new buffer-local variable `minor-modes'
* lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Keep
`minor-modes' updated.
* src/buffer.c (bset_minor_modes, Fmake_indirect_buffer)
(reset_buffer, init_buffer_once): Initialise `minor-modes'.
(syms_of_buffer): Add `minor-modes' as a new permanently-local
variable.

* src/buffer.h (struct buffer): Add minor_modes_.
2021-02-14 12:37:44 +01:00
Stefan Monnier
103039b06c * lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Reinstate.
Removed by accident.
2021-02-13 19:24:33 -05:00
Stefan Monnier
2d9ff601ab * lisp/emacs-lisp/edebug.el: Fix called-interactively-p
And get rid of the old special-case handling of `interactive-p`, which
is now redundant.

(edebug--called-interactively-skip): Fix lexical-binding case,
and adjust to some formerly missed call patterns.
(edebug-def-interactive, edebug-interactive-p): Remove vars.
(edebug-interactive-p-name, edebug-wrap-def-body)
(edebug-make-enter-wrapper): Remove functions.
(edebug-list-form): Don't special-case `interactive-p`.
2021-02-13 19:22:17 -05:00
Stefan Monnier
39a401ddae * lisp/emacs-lisp/edebug.el (edebug-match-lambda-expr): Delete function
(lambda-expr): Define with `def-edebug-elem-spec` instead.
(edebug--handle-&-spec-op): Remove left over code.
(interactive): Re-add mistakenly removed spec elem.

* doc/lispref/edebug.texi (Specification List): Remove `function-form`.
2021-02-13 17:50:31 -05:00
Stefan Monnier
2007afd21b * lisp/emacs-lisp/edebug.el (edebug--handle-&-spec-op <&name>): New method
(edebug--concat-name): New function.
(edebug-match-name, edebug-match-cl-generic-method-qualifier)
(edebug-match-cl-generic-method-args): Delete functions.

* doc/lispref/edebug.texi (Specification List): Document it.

* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Use `&name`.
(cl-generic--method-qualifier-p): New predicate.
(cl-defmethod): Use it and `&name`.
* lisp/emacs-lisp/cl-macs.el (cl-defun, cl-iter-defun, cl-flet):
* lisp/emacs-lisp/eieio-compat.el (defmethod):
* lisp/emacs-lisp/gv.el (gv-define-setter):
* lisp/emacs-lisp/ert.el (ert-deftest): Use `&name`.
* lisp/erc/erc-backend.el (define-erc-response-handler): Use `declare`
and `&name`.
2021-02-13 16:21:53 -05:00
Stefan Monnier
f65402f851 (backtrace-goto-source-functions): Make it a normal abnormal hook
* lisp/emacs-lisp/backtrace.el (backtrace-goto-source-functions):
Don't mark it as buffer-local any more.
(backtrace-goto-source): Use `run-hook-with-args-until-success`.

* lisp/emacs-lisp/edebug.el (edebug-pop-to-backtrace): Clarify that the
hook is only intended to be modified buffer-locally.
2021-02-13 10:41:45 -05:00
Stefan Monnier
ca0842347e Edebug: Make it possible to debug gv-expanders in declare
Arrange for declarations to be able to specify their own specs via
the `edebug-declaration-spec` property.

* lisp/emacs-lisp/edebug.el: (edebug--get-declare-spec): New function.
(def-declarations): New spec element.
(defun, defmacro): Use it in their spec.

* lisp/emacs-lisp/gv.el (gv-expander, gv-setter):
Set `edebug-declaration-spec`.

* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-gv-expander): New test.

* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
(edebug-test-code-use-gv-expander): New test case.
2021-02-12 22:53:38 -05:00
Stefan Monnier
d1be48fded Edebug: Overload edebug-form-spec even less
The `edebug-form-spec` symbol property was used both to map forms's
head symbol to the corresponding spec, and to map spec element names
to their expansion.

This lead to name conflicts which break instrumentation of examples such as

    (cl-flet ((gate (x) x)) (gate 4))

because of the Edebug spec element `gate`.
So introduce a new symbol property `edebug-elem-spec`.

* lisp/subr.el (def-edebug-elem-spec): New function.

* lisp/emacs-lisp/edebug.el (edebug--get-elem-spec): New function.
(edebug-match-symbol): Use it.
(Core Edebug elems): Put them on `edebug-elem-spec` instead of
`edebug-form-spec`.
(ELisp special forms): Set their `edebug-form-spec` via dolist.
(Other non-core Edebug elems): Use `def-edebug-elem-spec`.
(edebug-\`): Use `declare`.

* lisp/emacs-lisp/pcase.el (pcase-PAT, pcase-FUN, pcase-QPAT):
* lisp/skeleton.el (skeleton-edebug-spec):
* lisp/emacs-lisp/cl-macs.el: Use `def-edebug-elem-spec`.

* test/lisp/emacs-lisp/edebug-tests.el
(edebug-tests--conflicting-internal-names): New test.
* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
(edebug-test-code-cl-flet1): New test case.

* doc/lispref/edebug.texi (Specification List): Add `def-edebug-elem-spec`.
(Specification Examples): Use it.

* doc/lispref/loading.texi (Hooks for Loading): Avoid the use of
`def-edebug-spec` in example (better use `debug` declaration).
2021-02-12 19:28:25 -05:00
Basil L. Contovounesios
c3163069a1 Fix ElDoc setup for eval-expression
* lisp/emacs-lisp/eldoc.el (eldoc--eval-expression-setup): Don't set
global value of eldoc-documentation-strategy (bug#44886).
2021-02-12 21:28:47 +00:00
Stefan Monnier
f8dbefbaa5 Use declare instead of def-edebug-spec in most places
* lisp/speedbar.el: Use lexical-binding.
(speedbar-with-writable): Use `declare`.

* lisp/subr.el (def-edebug-spec): Use `declare`.

* lisp/cedet/ede/base.el: Use lexical-binding.
(ede-with-projectfile): Use `declare`.
(recentf-exclude): Declare var.

* lisp/cedet/ede/pmake.el: Use lexical-binding.
(ede-pmake-insert-variable-shared, ede-pmake-insert-variable-once):
Use `declare`.

* lisp/cedet/ede/proj-comp.el: Use lexical-binding.
(ede-compiler-begin-unique, ede-compiler-only-once)
(ede-linker-begin-unique, ede-linker-only-once): Use `declare`.

* lisp/cedet/semantic/ctxt.el: Use lexical-binding.
(semantic-with-buffer-narrowed-to-context)
(semantic-with-buffer-narrowed-to-command): Use `declare`.
(semantic--progress-reporter): Declare var.
(semantic-ctxt-end-of-symbol-default): Remove unused var `fieldsep`.

* lisp/cedet/semantic/lex-spp.el: Use lexical-binding.
(define-lex-spp-macro-declaration-analyzer)
(define-lex-spp-include-analyzer, semantic-lex-with-macro-used)
(define-lex-spp-macro-undeclaration-analyzer): Use `declare`.
(semantic-lex-spp-symbol-remove): Rename arg to avoid colliding with
dynamic variable `obarray`.
(semantic-lex-spp-symbol-pop): Remove unused var `oldvalue`.
(semantic-lex-spp-lex-text-string): Remove unused var `analyzer`.

* lisp/cedet/semantic/lex.el (define-lex)
(semantic-lex-unterminated-syntax-protection, define-lex-analyzer)
(define-lex-regex-analyzer, define-lex-block-analyzer)
(semantic-lex-catch-errors): Use `declare`.

* lisp/cedet/semantic/tag.el: Use lexical-binding.
(semantic-with-buffer-narrowed-to-current-tag)
(semantic-with-buffer-narrowed-to-tag): Use `declare`.

* lisp/cedet/semantic/wisent.el: Use lexical-binding.
(define-wisent-lexer): Use `declare`.

* lisp/emacs-lisp/cl-lib.el (cl-pushnew): The arg to :test can be any
form not just function form.

* lisp/org/ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Use `declare`.

* lisp/org/ob-core.el (org-babel-map-src-blocks): Use `declare`.
(org-babel-result-cond): Simplify edebug spec.

* lisp/org/org-clock.el (org-with-clock-position, org-with-clock):
* lisp/org/org-agenda.el (org-agenda-with-point-at-orig-entry):
* lisp/org/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`.

* lisp/textmodes/rst.el (push): Remove redundant edebug spec.

* lisp/vc/pcvs-parse.el: Use lexical-binding.
(cvs-parse-buffer): Rename arg to avoid dynbound conflict.
(cvs-or): Use `declare`.
2021-02-12 16:08:01 -05:00
Mattias Engdegård
9518926220 Simplify expression in byte-code decompiler
* lisp/emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
Replace roundabout expression with what it essentially does.
2021-02-12 20:52:05 +01:00
Mattias Engdegård
5a11e9185c byte-opt.el: More concise expression
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Refactor `setq` clause.
2021-02-12 20:52:05 +01:00
Mattias Engdegård
ea29908c18 Avoid traversing dead if branches in bytecode optimiser
There is no point in traversing conditional branches that are
statically known never to be executed.  This saves some optimisation
effort, but more importantly prevents variable assignments and
references in those branches from blocking effective constant
propagation.

Also attempt to traverse as much as possible in an unconditional
context, which enables constant-propagation through (linear)
assignments.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form):
Rewrite the (tail) recursion into an explicit loop.  Normalise a
return value of (quote nil) to nil, for easier subsequent
optimisations.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't
traverse dead `if` branches.  Use unconditional traversion context
when possible.
2021-02-12 20:52:05 +01:00
Stefan Monnier
c7b35ea306 * lisp/emacs-lisp/edebug.el (edebug--handle-&-spec-op) <&lookup>: New method
* doc/lispref/edebug.texi (Specification List): Document it.

* lisp/emacs-lisp/pcase.el (pcase-PAT): Use it.
(pcase-MACRO): Remove Edebug element.
(pcase--get-edebug-spec): New function.
(pcase--edebug-match-macro): Remove function.
2021-02-12 12:17:40 -05:00