summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
...
| * * lisp/emacs-lisp/edebug.el: Tweak last changeStefan Monnier2021-02-101-37/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use generic functions i.s.o `edebug--spec-op-function`. <toplevel>: No need to register the &foo and :foo handler any more. (edebug--handle-&-spec-op, edebug--handle-:-spec-op): New generic functions. (edebug-match-specs): Use them. (edebug--get-spec-op): Remove function. (edebug-match-&optional, edebug-match-&rest, edebug-match-&or) (edebug-match-&not, edebug-match-&key, edebug-match-&error) (edebug-match-&define): Turn functions into methods of `edebug--handle-&-spec-op`. (edebug-match-:name, edebug-match-:unique): Turn functions into methods of `edebug--handle-:-spec-op`.
| * * list/emacs-lisp/edebug.el: Don't overload `edebug-form-spec`Stefan Monnier2021-02-101-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `edebug-form-spec` symbol property was used to store two different things: the handlers for spec elements like `body` and the handlers for spec operators like `&or`. But these two sets use different calling conventions, so they're fundamentally incompatible. So, move the handlers to spec operators to the new property `edebug--spec-op-function`. This unbreaks Edebugging of: (cl-flet ((f (&rest x) x)) 3) * lisp/emacs-lisp/edebug.el <toplevel>: Split the alist of built in spec elements into normal spec element and spec ops. (edebug--get-spec-op): New function. (edebug-match-specs): Use it. (edebug-match-:name): Rename from `edebug-match-colon-name`.
| * Fix local defvar scoping error (bug#46387)Mattias Engdegård2021-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This bug was introduced by the lexical variable constant propagation mechanism. It was discovered by Michael Heerdegen. * lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form) (byte-optimize-body): Let the effects of a local defvar declaration be scoped by let and let*, not any arbitrary Lisp expression body (such as progn). * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--get-vars) (bytecomp-local-defvar): New test.
| * * lisp/emacs-lisp/byte-opt.el (byte-optimize--pcase): New macroStefan Monnier2021-02-091-20/+50
| | | | | | | | (byte-optimize-form-code-walker): Use it.
| * * lisp/emacs-lisp/macroexp.el: Break cycle with bytecomp/byte-optStefan Monnier2021-02-093-78/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent change in macroexp triggered a cyclic dependency error during eager macroexpansion when neither `bytecomp` nor `byte-opt` had been byte-compiled yet. This fixes it by moving the offending function to macroexp.el. * lisp/emacs-lisp/macroexp.el (macroexp--unfold-lambda): Move from byte-opt.el and rename. (macroexp--expand-all): Use it. * lisp/emacs-lisp/byte-opt.el (byte-compile-unfold-lambda): Move to macroexp.el. (byte-compile-inline-expand, byte-optimize-form-code-walker): * lisp/emacs-lisp/bytecomp.el (byte-compile-form): Use `macroexp--unfold-lambda` instead.
| * Remove some dead, commented out code from lisp-mode.elStefan Kangas2021-02-091-3/+0
| | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-data-mode-syntax-table): Remove code commented out since 2005.
| * Preserve leading whitespace in `lm-commentary'.Matt Armstrong2021-02-091-1/+1
| | | | | | | | | | * lisp/emacs-lisp/lisp-mnt.el (lm-commentary): Preserve leading whitespace (bug#46364).
| * Move all usages of `values' to `values--store-value'Lars Ingebrigtsen2021-02-092-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/simple.el (eval-expression): * lisp/progmodes/elisp-mode.el (eval-last-sexp): * lisp/emacs-lisp/pp.el (pp-eval-expression): * lisp/emacs-lisp/edebug.el (edebug-eval-expression): * lisp/emacs-lisp/pp.el (pp-eval-expression): * lisp/emacs-lisp/edebug.el (edebug-eval-expression): * lisp/cedet/data-debug.el (data-debug-eval-expression): Use it instead of pushing to `values' directly (bug#22066). * lisp/subr.el (values--store-value): New function.
| * ; Minor license statement fixesStefan Kangas2021-02-081-0/+2
| |
| * ; * lisp/emacs-lisp/byte-opt.el: improved commentMattias Engdegård2021-02-071-1/+1
| |
| * ; Improved commentary in the variable constprop mechanismMattias Engdegård2021-02-071-8/+13
| | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-opt.el (byte-optimize--lexvars) (byte-optimize--vars-outside-condition) (byte-optimize-form-code-walker, byte-optimize-let-form): Clarify various aspects in the variable constant-propagation code, as kindly pointed out by Stefan Monnier.
| * Constprop of lexical variablesMattias Engdegård2021-02-061-70/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lexical variables bound to a constant value (symbol, number or string) are substituted at their point of use and the variable then eliminated if possible. Example: (let ((x (+ 2 3))) (f x)) => (f 5) This reduces code size, eliminates stack operations, and enables further optimisations. The implementation is conservative, and is strongly curtailed by the presence of variable mutation, conditions and loops. * lisp/emacs-lisp/byte-opt.el (byte-optimize-enable-variable-constprop) (byte-optimize-warn-eliminated-variable): New constants. (byte-optimize--lexvars, byte-optimize--vars-outside-condition) (byte-optimize--vars-outside-loop, byte-optimize--dynamic-vars): New dynamic variables. (byte-optimize--substitutable-p, byte-optimize-let-form): New functions. (byte-optimize-form-code-walker): Adapt clauses for variable constprop, and add clauses for 'setq' and 'defvar'. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-var) (bytecomp-test-get-var, bytecomp-test-identity) (byte-opt-testsuite-arith-data): Add test cases.
| * Fix previous change in testcover.elLars Ingebrigtsen2021-02-061-4/+4
| | | | | | | | | | | | * lisp/emacs-lisp/testcover.el (testcover-analyze-coverage-edebug-after): The wrapper macro is called `1value', not `testcover-1value'.
| * Rename the `1value' symbol in testcover.elLars Ingebrigtsen2021-02-061-30/+30
| | | | | | | | | | | | * lisp/emacs-lisp/testcover.el: Rename the symbol `1value' throughout the file to `testcover-1value' to allow using the variable in code that's to be tested (bug#25471).
| * Avoid a compilation warning in iter-doLars Ingebrigtsen2021-02-061-9/+12
| | | | | | | | | | | | * lisp/emacs-lisp/generator.el (iter-do): Avoid a compilation warning on using variables marked for not using (bug#31641). Eg. (iter-do (_ i))
| * * lisp/emacs-lisp/pcase.el (let): Reimplement as a pcase macroStefan Monnier2021-02-051-13/+6
| | | | | | | | | | (pcase--macroexpand, pcase--u1): Remove handling of `let` from `pcase`s core.
| * * lisp/emacs-lisp/checkdoc.el: Doc fix; don't mention built-ins.Stefan Kangas2021-02-051-7/+0
| |
| * Improve filling of Emacs Lisp doc stringsLars Ingebrigtsen2021-02-041-1/+18
| | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): When filling a Lisp string, try to avoid filling bits that follow it (bug#28937).
| * Allow a :variable keyword in define-globalized-minor-modeLars Ingebrigtsen2021-02-041-1/+3
| | | | | | | | | | | | | | * doc/lispref/modes.texi (Defining Minor Modes): Document it. * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Allow specifying a :variable to be used if the underlying mode has a divergent variable to store the state (bug#29081).
| * Remove some unnecessary references to Emacs 19Stefan Kangas2021-02-041-2/+1
| | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/elp.el: * lisp/mouse-copy.el: * lisp/mouse-drag.el: * lisp/progmodes/simula.el (simula-mode-map): * lisp/term.el (term-matching-input-from-input-string): * lisp/vcursor.el: Doc fix; don't mention Emacs 19.
| * Remove XEmacs compat code from edebug.elStefan Kangas2021-02-041-11/+14
| | | | | | | | | | * lisp/emacs-lisp/edebug.el (edebug-window-live-p, edebug-mark): Make obsolete. Update callers.
| * * lisp/gnus/gnus-art.el: Fix misuse of `standard-value`.Stefan Monnier2021-02-021-2/+1
| | | | | | | | | | | | | | | | | | | | * lisp/custom.el (custom--standard-value): New function. * lisp/gnus/gnus-art.el: (gnus-article-browse-html-parts) (gnus-article-browse-html-article): * lisp/dired-aux.el (dired-do-find-regexp-and-replace): * lisp/emacs-lisp/package-x.el (package-upload-buffer-internal): * lisp/startup.el (command-line): Use it.
| * * lisp/emacs-lisp/lisp-mode.el (lisp-mode): Also set `comment-end-skip`Stefan Monnier2021-02-021-0/+1
| |
| * Fix |# fontification in lisp-modechuntaro2021-02-021-0/+1
| | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-mode): Give the |# the correct (font-lock-comment-delimited-face) face (bug#39820). Copyright-paperwork-exempt: yes
| * Prefer defvar-local in emacs-lisp/*.elStefan Kangas2021-01-316-20/+10
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/chart.el (chart-local-object): * lisp/emacs-lisp/easy-mmode.el (define-minor-mode) (define-globalized-minor-mode): * lisp/emacs-lisp/edebug.el: * lisp/emacs-lisp/generic.el (generic-font-lock-keywords): * lisp/emacs-lisp/re-builder.el (reb-regexp, reb-regexp-src) (reb-overlays): * lisp/emacs-lisp/syntax.el (syntax-propertize-extend-region-functions): Prefer defvar-local.
| * Revert "Improve fontifying of #| ... |# in `lisp-mode'"Lars Ingebrigtsen2021-01-311-1/+0
| | | | | | | | | | | | This reverts commit 1275dc4711af77c9c223063dcd149d782d497463. Setting comment-end isn't the correct thing to do -- it makes M-; insert that string.
* | Merge remote-tracking branch 'savannah/master' into native-compAndrea Corallo2021-01-3015-194/+246
|\|
| * Improve fontifying of #| ... |# in `lisp-mode'Lars Ingebrigtsen2021-01-291-0/+1
| | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp-mode): Fontify the end delimiter in #| ... |# correctly (bug#39820).
| * Fix position in empty buffers in checkdoc-file-comments-engineLars Ingebrigtsen2021-01-291-1/+3
| | | | | | | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc-file-comments-engine): Don't give invalid positions on empty buffers (bug#39987).
| * Use lexical-binding in all of `lisp/emacs-lisp`Stefan Monnier2021-01-2811-130/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bindat.el: Use lexical-binding. (bindat--unpack-group, bindat--length-group, bindat--pack-group): Declare `last` and `tag` as dyn-scoped. (bindat-unpack, bindat-pack): Bind `bindat-raw` and `bindat-idx` via `let` rather than via the formal arglist. * lisp/emacs-lisp/package-x.el: * lisp/emacs-lisp/generic.el: * lisp/emacs-lisp/eieio-opt.el: * lisp/emacs-lisp/derived.el: * lisp/emacs-lisp/crm.el: Use lexical-binding. * lisp/emacs-lisp/helper.el: Use lexical-binding. (Helper-help-map): Move initialization into declaration. * lisp/emacs-lisp/regi.el: Use lexical-binding. (regi-interpret): Remove unused var `tstart`. Declare `curframe`, `curentry` and `curline` as dyn-scoped. * lisp/emacs-lisp/shadow.el: Use lexical-binding. (load-path-shadows-find): Remove unused var `file`. Tighten a regexp, use `push`. * lisp/emacs-lisp/tcover-ses.el: Use lexical-binding. Require `ses`. Remove correspondingly redundant declarations. (ses--curcell-overlay): Declare. (ses-exercise): Use `dlet` and use a properly-prefixed var name. Fix name of `curcell-overlay` variable. * lisp/emacs-lisp/unsafep.el: Use lexical-binding. (unsafep): Bind `unsafep-vars` via `let` rather than via the formal arglist.
| * * lisp/emacs-lisp/macroexp.el (macroexp-if): Fix typoStefan Monnier2021-01-271-1/+1
| |
| * * lisp/emacs-lisp/pcase.el (pcase--split-pred): Handle `memq` pred.Stefan Monnier2021-01-271-17/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve handling of the `member` tests generated from (or 'a 'b 'c). This will expand (pcase EXP ((and (or 1 2 3) (guard (FOO))) EXP1) (1 EXP2) (6 EXP3)) to (cond ((memql '(3 2 1) EXP) (cond ((FOO) EXP1) ((eql EXP 1) EXP2))) ((eql EXP 6) EXP3)) rather than to (cond ((memql '(3 2 1) EXP) (cond ((FOO) EXP1) ((eql EXP 1) EXP2) ((eql EXP 6) EXP3))) ((eql EXP 1) EXP2) ((eql EXP 6) EXP3))
| * * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Perform β-reductionStefan Monnier2021-01-271-11/+28
| | | | | | | | | | | | | | Also, in `funcall` macroexpand the function before checking to see if we can remove the `funcall`. (macroexp-if): Trim trailing `nil` in the generated code while we're at it.
| * Fontify special forms and macros the sameLars Ingebrigtsen2021-01-251-4/+3
| | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp--el-match-keyword): Handle special forms and macros the same way (bug#43265). This makes things like (setq a '(if a b)) be fontified correctly (i.e., not fontified as a keyword).
| * Rewrite lisp--el-funcall-position-p to be inverse of the -not functionLars Ingebrigtsen2021-01-241-38/+43
| | | | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp--el-funcall-position-p): Rename and rewrite to return the inverse value. Non-inverted predicate functions are easier to reason about. (lisp--el-non-funcall-position-p): Make obsolete.
| * Fix macro fontification in `condition-case' handler bodiesLars Ingebrigtsen2021-01-241-6/+9
| | | | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p): Fontify macros in the BODY of HANDLERS in `condition-case' correctly (bug#43265).
| * Tweak `condition-case' keyword highlightsLars Ingebrigtsen2021-01-241-2/+5
| | | | | | | | | | * lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p): Tweak `condition-case' position check to skip the VAR form.
* | Merge remote-tracking branch 'savannah/master' into native-compAndrea Corallo2021-01-2410-712/+810
|\|
| * Fix missing file&line info in "Unknown defun property" warningsStefan Monnier2021-01-232-11/+19
| | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/byte-run.el (defmacro, defun): Use `macroexp--warn-and-return` rather than `message`. * lisp/emacs-lisp/macroexp.el: Fix `macroexp--compiling-p`. (macroexp--warn-and-return): Don't try and detect repetition on forms like `nil`. (macroexp-macroexpand): Don't forget to bind `macroexpand-all-environment`.
| * Fix spurious "Lexical argument shadows the dynamic variable" due to inliningStefan Monnier2021-01-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch doing: rm lisp/calendar/calendar.elc make lisp/calendar/cal-hebrew.elc would spew out lots of spurious such warnings about a `date` argument, pointing to code which has no `date` argument in sight. This was because that code had calls to inlinable functions (taking a `date` argument) defined in `calendar.el`, and while `date` is a normal lexical var at the site of those functions' definitions, it was declared as dynbound at the call site. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Don't impose our local context onto the inlined function. * test/lisp/emacs-lisp/bytecomp-tests.el: Add matching test.
| * * lisp/emacs-lisp/bytecomp.el (byte-compile--declare-var): Fix warningStefan Monnier2021-01-201-1/+2
| | | | | | | | | | Make sure the "declared after first use" is under the control of the `lexical` option.
| * checkdoc-spellcheck-documentation-flag doc string improvementLars Ingebrigtsen2021-01-201-1/+6
| | | | | | | | | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc-spellcheck-documentation-flag): Mention `ispell-kill-ispell' (bug#6221).
| * Revert "Always send Lisp words to checkdoc-ispell-init"Lars Ingebrigtsen2021-01-201-8/+6
| | | | | | | | | | | | | | This reverts commit 93141d581330d94e7eec9f114def2bec15f87866. This would make checkdoc words be used in other flyspell buffers.
| * Always send Lisp words to checkdoc-ispell-initLars Ingebrigtsen2021-01-201-6/+8
| | | | | | | | | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc-ispell-init): Always send the Lisp words to the process (bug#6221). This allows an existing ispell process to be correctly initialised.
| * Move the ‘declare’ form before the interactive spec in 10 functions.Juri Linkov2021-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/package.el (package-menu-hide-package): * lisp/font-lock.el (font-lock-debug-fontify): * lisp/image.el (image-jpeg-p): * lisp/mail/flow-fill.el (fill-flowed-test): * lisp/mh-e/mh-speed.el (mh-speed-toggle, mh-speed-view): * lisp/progmodes/project.el (project-async-shell-command) (project-shell-command, project-compile): * lisp/progmodes/sh-script.el (sh-assignment): Fix special forms to follow in this order: docstring, declare, interactive.
| * * lisp/emacs-lisp/subr-x.el (named-let): New macroStefan Monnier2021-01-201-0/+22
| |
| * * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Add 2 new optsStefan Monnier2021-01-201-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces two new optimizations. They're designed for code like (while (let (...) (if ... (progn blabla t) (progn blabla nil))) ...) and they allow the elimination of the test internal to `while` since we can immediately know when we return `t` or `nil` what the result of the test will be. `cl-labels` tends to generate this kind of code when it applies the tail-call optimization.
| * * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Move some opts.Stefan Monnier2021-01-201-49/+50
| | | | | | | | | | | | | | This moves two optimizations from the final pass to the main loop. Both may enable further optimizations (and the second can be applied repeatedly but "from the end", so the loop in the final pass only gets to apply it once).
| * * lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Re-indentStefan Monnier2021-01-201-457/+457
| |
| * * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Use pcaseStefan Monnier2021-01-161-176/+175
| |