Commit graph

7649 commits

Author SHA1 Message Date
Andrea Corallo
bddd7a2d13 Do not emit assumptions referencing clobbered mvars (bug#46670)
* lisp/emacs-lisp/comp.el (comp-func): Add `vframe-size' slot.
	(comp-new-frame): Add `vsize' parameter.
	(comp-limplify-top-level, comp-limplify-function): Update for new
	`comp-new-frame'.
	(comp-maybe-add-vmvar): New function.
	(comp-add-cond-cstrs): Logic update to emit assumptions not
	referencing clobbered variables.
	(comp-place-phis, comp-ssa, comp-ssa-rename-insn)
	(comp-ssa-rename): Update rename logic to rename also negative
	slots.
	(comp-fwprop-insn): Update to handle `(assume mvar mvar)' form.
	* test/src/comp-tests.el (46670-1): Add testcase.
	* test/src/comp-test-funcs.el (comp-test-46670-1-f)
	(comp-test-46670-2-f): New functions.
2021-02-23 23:19:36 +01:00
Andrea Corallo
89e9b05180 * Move ssa rename from vector to comp-vec
* lisp/emacs-lisp/comp.el (comp-block): Updated `final-frame' slot
	type.
	(comp-limplify): Updated `frame' slot type.
	(comp-slot-n, comp-new-frame, comp-place-phis, comp-ssa)
	(comp-ssa-rename-insn, comp-ssa-rename, comp-finalize-phis): Use
	`comp-vec'.
2021-02-23 23:19:36 +01:00
Andrea Corallo
ec88bdba6f * Add a simple growable vector like type
* lisp/emacs-lisp/comp.el (comp-vec): Define struct.
	(comp-vec-copy, comp-vec-length, comp-vec--verify-idx)
	(comp-vec-aref, comp-vec-append, comp-vec-prepend): New functions.
2021-02-23 23:19:36 +01:00
Juri Linkov
6172454ff3 Small fixes
* lisp/emacs-lisp/seq.el (seq-contains): Move the ‘declare’ form
after the docstring.
* lisp/misc.el (copy-from-above-command): Fix whitespace regexp.
2021-02-23 21:05:30 +02:00
Stefan Kangas
9202106a99 Improve easymenu.el Commentary section
* lisp/emacs-lisp/easymenu.el: Improve Commentary section.
2021-02-23 03:24:39 +01:00
Andrea Corallo
28ce6f980f * Some clean-up in comp.el
* lisp/emacs-lisp/comp.el (comp-func): Remove 'array-h'.
	(comp-spill-lap-function, comp-intern-func-in-ctxt)
	(comp-spill-lap-function, comp-addr-to-bb-name): Update
	accordingly.
2021-02-22 20:49:11 +01:00
Stefan Monnier
8d5dfafab7 Prefer declare over a put of list-indent-function.
While at it, I enabled lexical-binding in the affected files.

* lisp/cedet/semantic/sb.el: Enable lexical-binding.
(semantic-sb-with-tag-buffer): Use `declare`.

* lisp/cedet/semantic/bovine/el.el: Enable lexical-binding.
(semantic-elisp-setup-form-parser): Use `declare`.

* lisp/emacs-lisp/ert.el:
* lisp/emacs-lisp/ert-x.el: Remove redundant `put`.

* lisp/emulation/cua-rect.el: Enable lexical-binding.
(cua--rectangle-operation, cua--rectangle-aux-replace): Use `declare`.

* lisp/mh-e/mh-acros.el: Enable lexical-binding.
(mh-do-in-gnu-emacs, mh-do-in-xemacs, mh-funcall-if-exists, defun-mh)
(defmacro-mh, with-mh-folder-updating, mh-in-show-buffer)
(mh-do-at-event-location, mh-iterate-on-messages-in-region)
(mh-iterate-on-range): Use `declare`.

* lisp/mh-e/mh-compat.el: Enable lexical-binding.
(mh-flet): Use `declare`.

* lisp/mh-e/mh-e.el: Enable lexical-binding.
(defgroup-mh, defcustom-mh, defface-mh): Use `declare`.

* lisp/net/sieve.el: Enable lexical-binding.  Remove redundant :group args.
(sieve-activate, sieve-remove, sieve-edit-script): Remove unused arg
from the interactive spec.
(sieve-deactivate-all): Remove unused var `name`.
(sieve-change-region): Use `declare`.

* lisp/obsolete/fast-lock.el: Enable lexical-binding.
Remove redundant :group args.  Remove XEmacs compat code.
(save-buffer-state): Remove macro.
(fast-lock-add-properties): Use `with-silent-modifications` instead.

* lisp/obsolete/lazy-lock.el: Enable lexical-binding.
Remove redundant :group args.
(do-while): Use `declare`.
(save-buffer-state): Remove macro.
(lazy-lock-fontify-rest-after-change, lazy-lock-defer-line-after-change)
(lazy-lock-defer-rest-after-change, lazy-lock-after-fontify-buffer)
(lazy-lock-after-unfontify-buffer, lazy-lock-fontify-region):
Use `with-silent-modifications` instead.

* lisp/obsolete/pgg.el: Enable lexical-binding.  Remove XEmacs compat code.
(pgg-save-coding-system, pgg-as-lbt, pgg-process-when-success):
Use `declare`.
(pgg-add-passphrase-to-cache): Remove unused var `new-timer`.
(pgg-decrypt-region): Remove unused var `buf`.

* lisp/org/org-agenda.el (org-let, org-let2): Move from org-macs and
use `declare`.

* lisp/org/org-macs.el (org-let, org-let2): Move these functions that
are inherently harmful to your karma to the only package that uses them.
(org-scroll): Use `pcase` to avoid `eval` and use more readable syntax
for those integers standing for events.

* lisp/progmodes/antlr-mode.el: Enable lexical-binding.
(save-buffer-state-x): Use `declare` and `with-silent-modifications`.

* lisp/international/mule-util.el (with-coding-priority):
* lisp/cedet/ede/proj-comp.el (proj-comp-insert-variable-once):
* lisp/org/org-element.el (org-element-map):
* test/lisp/emacs-lisp/bytecomp-tests.el (test-byte-comp-compile-and-load):
* test/lisp/emacs-lisp/generator-tests.el (cps-testcase): Use `declare`.
2021-02-22 11:54:17 -05:00
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
Andrea Corallo
81b1013555 * Don't use paths to indicate filenames
* lisp/emacs-lisp/comp.el (native--compile-async)
	(native-compile-async): Replace `paths' argname with `files'.
2021-02-22 14:31:23 +01:00
Andrea Corallo
d6227f6edc * Fix union constraint for mixed pos/neg constraints
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-union-1-no-mem): Fix neg
	type shadowing pos values.
	* test/lisp/emacs-lisp/comp-cstr-tests.el
	(comp-cstr-typespec-tests-alist): Add testcase.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Fix testcase.
2021-02-22 13:59:56 +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
Andrea Corallo
da4da88c76 * lisp/emacs-lisp/comp.el (comp-spill-lap): Fix doc string. 2021-02-21 22:20:59 +01:00
Andrea Corallo
cf1e8e792f Merge remote-tracking branch 'savannah/master' into HEAD 2021-02-21 22:08:01 +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
Andrea Corallo
f92bb788a0 Merge remote-tracking branch 'savannah/master' into native-comp 2021-02-17 22:26:28 +01:00
Andrea Corallo
1fe5994bcb Fix inverted logic in constraint comparison (bug#46540)
* lisp/emacs-lisp/comp-cstr.el (comp-cstr->, comp-cstr->=)
	(comp-cstr-<, comp-cstr-<=): Fix inverted logic.
	* test/src/comp-tests.el (comp-tests-type-spec-tests): Add
	three integer constrain tests.
2021-02-17 22:03:41 +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