summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* lisp-mnt, checkdoc: Reduce run-time dependenciesStefan Monnier2022-02-072-29/+37
| | | | | | | | * lisp/emacs-lisp/lisp-mnt.el: Don't require `mail-parse` at top-level. (lm-crack-address): Require it here instead. * lisp/emacs-lisp/checkdoc.el (dired): Don't load at run-time. (checkdoc-dired): Add corresponding `declare-function`.
* Fix eval-tests/backtrace-in-batch-mode testStefan Monnier2022-02-061-4/+5
| | | | | * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Fix the zero-arg case.
* (debug-early-backtrace): Tweak the non-evald outputStefan Monnier2022-02-061-0/+2
| | | | | * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Make the non-evald output more like what is used in `debug.el`.
* (debug-early-backtrace): Tweak the non-evald outputStefan Monnier2022-02-061-12/+9
| | | | | * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Make the non-evald output more like what is used in `debug.el`.
* Improve the elp-instrument-package doc stringLars Ingebrigtsen2022-02-061-1/+6
| | | | | * lisp/emacs-lisp/elp.el (elp-instrument-package): Note the effect of loading further files (bug#13252).
* Add new user option 'find-library-include-other-files'Lars Ingebrigtsen2022-02-061-7/+36
| | | | | | | * lisp/emacs-lisp/find-func.el (read-library-name--find-files): New function (bug#15735). (read-library-name): Use it. (find-library-include-other-files): New user option.
* * lisp/emacs-lisp/debug-early.el: Improve the documentationAlan Mackenzie2022-02-051-9/+19
|
* (with-demoted-errors): Warn on missing `format` argStefan Monnier2022-02-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `format` arg has been mandatory for a while, but the backward compatibility code that handled the case of a missing `format` arg made it hard to notice when using the old calling convention. * lisp/subr.el (with-demoted-errors): Warn on missing `format` arg. * lisp/emacs-lisp/smie.el (smie-indent--separator-outdent): Don't abuse `with-demoted-errors`. (smie-indent-line, smie-auto-fill): * test/lisp/emacs-lisp/ert-tests.el (ert-test-with-demoted-errors): * lisp/vc/vc-hooks.el (vc-refresh-state): * lisp/vc/vc-annotate.el (vc-annotate-background-mode): * lisp/vc/diff-mode.el (diff-syntax-fontify-hunk): * lisp/textmodes/reftex-toc.el (reftex-re-enlarge): * lisp/progmodes/sh-script.el (sh-smie-sh-rules): * lisp/progmodes/octave.el (inferior-octave-startup): * lisp/pcmpl-gnu.el (pcmpl-gnu-make-all-targets): * lisp/org/org-refile.el (org-refile): * lisp/org/org-capture.el (org-capture-store-last-position): * lisp/nxml/nxml-mode.el (nxml-mode): * lisp/notifications.el (notifications-notify): * lisp/gnus/mm-view.el (mm-display-inline-fontify): * lisp/finder.el (finder-unload-function): * lisp/files.el (safe-local-variable-p, backup-buffer-copy * lisp/autorevert.el (auto-revert-notify-handler): Pass `format` arg to `with-demoted-errors`.
* * Have `null' and `not' explicit in LIMPLE so we inline themAndrea Corallo2022-02-041-1/+3
| | | | | * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Generate explicit `eq' call in LIMPLE for LAP opcode 'not'.
* New file lisp/emacs-lisp/debug-early.el for backtraces in early bootstrapAlan Mackenzie2022-02-021-0/+77
| | | | | | | | | | | | | | | This is also used in batch mode in general. * lisp/debug-early.el (debug-early-backtrace, debug-early): New functions. * lisp/loadup.el (top level): Load debug-early.el as first file. * src/eval.c (signal_or_quit): Remove the condition in the batch mode section of not being in dumping or bootstrap, since it is no longer needed. Test that 'debug-early's symbol-function is bound. Ensure there is enough working space in specpdl and eval_depth. (syms_of_eval): New DEFSYM for Qdebug_early. Initialise Vdebugger to Qdebug_early rather than Qnil.
* Fix bug with M-x compile-defun in a defconst/defvarAlan Mackenzie2022-02-021-9/+9
| | | | | * lisp/emacs-lisp/bytecomp.el (compile-defun): Have symbols-with-pos-enabled bound to non-nil when the eval takes place.
* Remove extra \= from obsoletion messageAndreas Schwab2022-02-012-5/+5
| | | | | | | * lisp/emacs-lisp/eieio.el (defclass): Remove \= from obsoletion message. * lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload) (eieio-defclass-internal): Likewise.
* (byte-compile-eval): Adjust to changes in `load-history`Stefan Monnier2022-01-312-18/+12
| | | | | | | | | | | | | | | | | The `function-history` patch introduced a regression which caused spurious compiler warnings. Fix it. The new code also fixes a bug in the old code, thus causing some new non-spurious warnings. Fix them as well. * lisp/emacs-lisp/bytecomp.el (byte-compile-eval): Adjust to changes in `load-history`. * lisp/gnus/gnus-group.el (nnrss-discover-feed) (nnrss-save-server-data): Use `declare-function`. * lisp/cedet/semantic/wisent/comp.el (wisent-defcontext) (wisent-with-context): * lisp/emacs-lisp/comp.el (comp-op-case): Silence compiler warning.
* Factor out function to check for clang in testsStefan Kangas2022-01-311-0/+8
| | | | | | | | | | | | | | | This also stops a flymake test from failing on my machine. * lisp/emacs-lisp/ert-x.el (ert-gcc-is-clang-p): New function factored out from ... * test/lisp/progmodes/flymake-tests.el (flymake-tests--gcc-is-clang): * test/lisp/cedet/semantic/bovine/gcc-tests.el (semantic-gcc-test-output-parser-this-machine): ... here. * test/lisp/progmodes/flymake-tests.el (different-diagnostic-types) (included-c-header-files): * test/lisp/cedet/semantic/bovine/gcc-tests.el (semantic-gcc-test-output-parser-this-machine): Use above new function.
* Fix with-suppressed-warnings edebug specLars Ingebrigtsen2022-01-311-1/+1
| | | | | * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Fix edebug spec.
* package.el: Fix bug#53529Stefan Monnier2022-01-291-1/+2
| | | | | * lisp/emacs-lisp/package.el (package-autoload-ensure-default-file): Enforce Unix EOLs.
* Reduce code duplication in parts of (auto)load&defaliasStefan Monnier2022-01-281-1/+1
| | | | | | | | | | | | | | | | | | * src/data.c (defalias): New function, extracted from `Fdefalias`. (Fdefalias): Use it. (Ffset): Don't handle `Vautoload_queue` here, handle it in `defalias` instead. * src/comp.c (comp--register-subr): Use `defalias` instead of duplicating its code. * src/eval.c (load_with_autoload_queue): New function, extracted from `Fautoload_do_load`. (Fautoload_do_load): Use it. (un_autoload): Mark it as static. * src/fns.c (Frequire): Use it as well. * src/lisp.h (defalias, load_with_autoload_queue): New declarations. (un_autoload): Remove declaration.
* Fix copyright-fix-years, use a dash to separate years in a rangeLele Gaifax2022-01-281-1/+1
| | | | | | | | | | | | | | | | | Commit 7a46fa9c751f7c3147cd9b27fe84c1ce25419d3b, allowing en-dash as years separator, changed the way the years range is composed taking the separator from the `sep' variable instead of always using an hardwired hyphen. Since the code explicitly avoid to touch (that is, extend) existing ranges, that `sep' variable is almost always a space, or whatever character precedes the last parsed year, thus generating a range like "2020 2022" instead of "2020-2022". * lisp/emacs-lisp/copyright.el (copyright-fix-years): Always use an dash to separate years in a range. * test/lisp/emacs-lisp/copyright-tests.el (with-copyright-fix-years-test): (copyright-fix-years-tests--data): (text-copyright-fix-years): New test cases (bug#53597).
* * Have `benchmark-run-compiled' use the native compiler when availableAndrea Corallo2022-01-271-1/+5
| | | | | * lisp/emacs-lisp/benchmark.el (benchmark-run-compiled): Use native compiler when available.
* Fix copyright-find-copyright when searching from the endLars Ingebrigtsen2022-01-261-1/+3
| | | | | * lisp/emacs-lisp/copyright.el (copyright-find-copyright): Make the double check also work when searching from the end (bug#7179).
* Fix copyright.el comment and add a testLars Ingebrigtsen2022-01-261-1/+1
| | | | | * lisp/emacs-lisp/copyright.el (copyright-find-copyright): Fix comment (bug#7179).
* * `batch-byte+native-compile' produce .eln younger than .elc (bug#52912)Andrea Corallo2022-01-251-6/+11
| | | | | | | * lisp/emacs-lisp/comp.el (batch-native-compile): Add return value. (batch-byte+native-compile): Touch the produced .eln after the corresponding .elc is produced.
* * lisp/emacs-lisp/comp.el (batch-byte+native-compile): Fix unwind formAndrea Corallo2022-01-251-2/+2
|
* Don't mutate literals in tabulated-list-widen-current-columnLars Ingebrigtsen2022-01-251-0/+3
| | | | | | * lisp/emacs-lisp/tabulated-list.el (tabulated-list-widen-current-column): Avoid mutating constants (bug#53501).
* Fix widening some columns in tabulated-list-widen-current-columnLars Ingebrigtsen2022-01-251-1/+4
| | | | | | * lisp/emacs-lisp/tabulated-list.el (tabulated-list-widen-current-column): Don't bug out on list-based columns (bug#53498).
* Remove some dubious uses of `interactive-form`Stefan Monnier2022-01-241-3/+3
| | | | | | | * lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): `commandp` and `interactive-form` are for function values, not for source code. * lisp/cedet/semantic/db-el.el (semanticdb-elisp-sym->tag): Prefer `commandp` over `interactive-form`.
* Allow jumping to ert failure definitionsLars Ingebrigtsen2022-01-242-5/+36
| | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-test): (ert-deftest): Store the file name. (ert-test-location): New function. (ert-run-tests-batch): Use it. * lisp/emacs-lisp/find-func.el (find-ert-deftest-regexp): New variable. (find-function-regexp-alist): Add ert-deftest (bug#22471). Based on code by Phillip Lord <phillip.lord@russet.org.uk>.
* ; * lisp/emacs-lisp/byte-opt.el: Remove outdated commentsMattias EngdegÄrd2022-01-241-116/+2
| | | | | These were optimisation ideas that have been implemented, have become irrelevant, or were impractical to begin with.
* Remove the unused unbind-all bytecodeMattias EngdegÄrd2022-01-242-6/+1
| | | | | | | | | | | | | It was implemented but never generated, originally intended for TCO in the pre-lexbind era (which was semantically dubious anyway). Removing it speeds up the interpreter because there is no longer any need for the outermost `count` variable unless checking is enabled. * lisp/emacs-lisp/bytecomp.el: * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): * src/bytecode.c (BYTE_CODES, exec_byte_code): Remove definition and implementation of unbind-all, freeing up the opcode for other purposes.
* Expunge read-with-symbol-position and read-symbol-positions-listAlan Mackenzie2022-01-241-6/+1
| | | | | | | | | | | | These are remnants of the old way of determining byte compiler warning positions. * src/lread.c (read_internal_start, read1): Remove initializations amd manipulations of these variables. (syms_of_lread): Remove the declarations of the variables. * lisp/emacs-list/bytecomp.el (compile-defun, byte-compile-from-buffer): Remove bindings of the variables.
* Bind print-symbols-bare to t in byte-compile-from-bufferAlan Mackenzie2022-01-231-6/+7
| | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Bind print-symbols-bare to t here for the benefit of non-defining forms in buffers.
* Fix tabulated-list-widen-current-column widening wrong columnThuna2022-01-231-11/+11
| | | | | | | | * tabulated-list.el (tabulated-list-widen-current-column): Use correct comparison operation when checking if point is within the column bounds (bug#53375). Copyright-paperwork-exempt: yes
* Fix position argument to macroexp--warn-wrap in cconv--convert-funcbodyAlan Mackenzie2022-01-231-1/+1
| | | | | | * lisp/emacs-lisp/cconv.el (cconv--convert-funcbody): Change the position argument to macroexp--warn-wrap from BODY to ARG, to give correct positions in warning messages.
* Add new function to prompt a user for a process namePhil Sainty2022-01-231-0/+42
| | | | | * lisp/emacs-lisp/subr-x.el (read-process-name): New function (bug#32640).
* Don't use 'load-read-function' in byte-compile-from-bufferAlan Mackenzie2022-01-221-2/+5
| | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Call read-positioning-symbols directly, rather than binding load-read-function to it. This is so that a lower level use of load-read-function will not return a form containing symbols with position.
* Merge branch 'scratch/correct-warning-pos'Alan Mackenzie2022-01-2214-498/+675
|\
| * Merge branch 'master' into scratch/correct-warning-posAlan Mackenzie2022-01-229-189/+687
| |\
| * | Miscellaneous amendments to the scratch/correct-warning-pos branchAlan Mackenzie2022-01-221-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cedet/semantic/fw.el (semantic-alias-obsolete) (semantic-varalias-obsolete): Replace calls to byte-compile-warn with calls to byte-compile-warn-x (when it exists). * lisp/emacs-lisp/bytecomp.el (byte-compile-log-warning-function) (byte-compile--log-warning-for-byte-compile): Make the POSITION parameter no longer &optional (for the benefit of flymake on *.el). (byte-compile-log-warning): Replace a nil POSITION argument with an actual position. (byte-compile-file-form-require): Push the required symbol onto byte-compile-form-stack, for the benefit of `do-after-load-evaluation'. * lisp/keymap.el (define-keymap--compile): Replace four calls to byte-compile-warn with byte-compile-warn-x. * doc/lispref/elisp.texi (master menu): Add entries for Shorthands and Symbols with position. * doc/lispref/streams.texi (Input Functions): Document read-positioning-symbols. * doc/lispref/symbols.texi (Symbols): Add new menu entry. (Symbols with Position): New @section.
| * | Remove the remnants of old position mechanism from scratch/correct-warning-posAlan Mackenzie2022-01-153-123/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also correct one or two positions in macroexp-warn-and-return invocations. * lisp/emacs-lisp/bytecomp.el (byte-compile-read-position) (byte-compile-last-position, byte-compile-set-symbol-position): Remove. (byte-compile-warning-prefix, byte-compile-function-warn) (byte-compile-emit-callargs-warn, byte-compile-arglist-warn) (byte-compile-warn-about-unresolved-functions, compile-defun) (byte-compile-from-buffer, byte-compile-from-buffer) (byte-compile-file-form-defmumble, byte-compile-check-lambda-list) (byte-compile-lambda, byte-compile-form, byte-compile-normal-call) (byte-compile-check-variable, byte-compile-push-constant) (byte-compile-subr-wrong-args, byte-compile-negation-optimizer) (byte-compile-condition-case, byte-compile-defvar, byte-compile-autoload) (byte-compile-lambda-form): Remove the remnants of the old warning position mechanism. (byte-compile-function-warn): Replace byte-compile-last-position by a symbol-with-pos-pos call. (compile-defun): Use local variable start-read-position to fulfil purpose of old byte-compile-read-position. Push the just read FORM onto byte-compile-form-stack. * lisp/emacs-lisp/eieio.el (defclass): New mechanism to get the correct source warning position to macroexp-warn-and-return. * lisp/emacs-lisp/macroexp (macroexp--unfold-lambda): Correct the position argument given to macroexp-warn-and-return.
| * | Merge branch 'master' into scratch/correct-warning-posAlan Mackenzie2022-01-145-11/+25
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge branch: commit d29291d665e808307126bf52c3e748fef78f0f9c (HEAD -> master, origin/master, origin/HEAD) Author: Stefan Monnier <monnier@iro.umontreal.ca> Date: Fri Jan 14 12:26:30 2022 -0500 (macroexp--expand-all): Fix bug#53227 and bug#46636
| * | | Commit fixes and enhancements to the scratch/correct-warning-pos branchAlan Mackenzie2022-01-145-290/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No longer strip positions from symbols before each use of a form, instead relying on the low level C routines to do the right thing. Instead strip them from miscellaneous places where this is needed. Stip them alson in `function-put'. Push forms onto byte-compile-form-stack and pop them "by hand" rather than by binding the variable at each pushing, so that it will still have its data after an error has been thrown and caught by a condition case. This gives an source position to the ensuing error message. * lisp/emacs-lisp/byte-run.el (byte-run--ssp-seen, byte-run--circular-list-p) (byte-run--strip-s-p-1, byte-run-strip-symbol-positions): New functions and variables, which together implement stripping of symbol positions. The latest (?final) version modifies the argument in place rather than making a copy. (function-put): Strip symbol positions from all of the arguments before doing the `put'. * lisp/emacs-lisp/bytecomp.el (byte-compile--form-stack): has been renamed to byte-compile-form-stack and moved to macroexp.el. (byte-compile-initial-macro-environment (eval-and-compile)): Replace macroexpand-all-toplevel with macroexpand--all-toplevel. (displaying-byte-compile-warnings): bind byte-compile-form-stack here. (byte-compile-toplevel-file-form, byte-compile-form): Push the top level form onto byte-compile-form-stack (whereas formally the variable was bound at each pushing). Manually pop this from of the variable at the end of the function. * lisp/emacs-lisp/cl-macs.el (cl-define-compiler-macro): Remove the symbol stripping. * lisp/emacs-lisp/comp.el (comp--native-compile): Set max-specpdl-size to at least 5000 (previously it was 2500). Bind print-symbols-bare to t. * lisp/emacs-lisp/macroexp.el (byte-compile-form-stack): Definition move here from bytecomp.el for easier compilation. (byte-compile-strip-symbol-positions and associated functions): Removed. (macro--expand-all): push argument FORM onto byte-compile-form-stack at the start of this function, and pop it off at the end. (internal-macroexpand-for-load): No longer strip symbol positions. Bind symbols-with-pos-enabled and print-symbols-bare to t. * lisp/help.el (help--make-usage): Strip any position from argument ARG. * src/fns.c (Fput): No longer strip symbol positions from any of the arguments.
| * | | Merge branch 'master' into scratch/correct-warning-posAlan Mackenzie2022-01-1194-814/+1197
| |\ \ \
| * | | | Miscellaneous enhancements to scratch/correct-warning-pos.Alan Mackenzie2021-12-312-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Check the type (symbol with position) of the argument given to the native compiled version of SYMBOL_WITH_POS_SYM. 2. Handle infinite recursion caused by circular lists, etc., in macroexp-strip-symbol-positions by using hash tables. 3. Read byte compiled functions without giving symbols positions. * lisp/emacs-lisp/comp.el (comp-finalize-relocs): Add symbol-with-pos-p into the list of relocated symbols. * lisp/emacs-lisp/macroexp.el (macroexp--ssp-conses-seen) (macroexp--ssp-vectors-seen, macroexp--ssp-records-seen): Renamed, and animated as hash tables. (macroexp--strip-s-p-2): Optionally tests for the presence of an argument in one of the above hash tables, so as to handle otherwise infinite recursion. (byte-compile-strip-s-p-1): Add a condition-case to handle infinite recursion caused by circular lists etc., using the above hash tables as required. * src/comp.c (comp_t): New element symbol_with_pos_sym. (emit_SYMBOL_WITH_POS_SYM): Amend just to call the new SYMBOL_WITH_POS_SYM. (emit_CHECK_SYMBOL_WITH_POS, define_SYMBOL_WITH_POS_SYM): New functions. (Fcomp__init_ctxt): Register an emitter for Qsymbol_with_pos_p. (Fcomp__compile_ctxt_to_file): Call define_SYMBOL_WITH_POS_SYM. (syms_of_comp): Define Qsymbol_with_pos_p. * src/data.c (syms_of_data): Define a new error symbol Qrecursion_error, an error category for the new error symbols Qexcessive_variable_binding and Qexcessive_lisp_nesting. * src/eval.c (grow_specpdl): Change the signal_error call to an xsignal0 call using the new error symbol Qexcessive_variable_binding. (eval_sub, Ffuncall): Change the `error' calls to xsignal using the new error symbol Qexcessive_lisp_nesting. * src/lread.c (read1): When reading a compiled function, read the components of the vector without giving its symbols a position.
| * | | | Make symbols with positions work with native compilationAlan Mackenzie2021-12-304-302/+319
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This version of the software should bootstrap Emacs successfully with native compilation enabled. * lisp/emacs-lisp/bytecomp.el (byte-compile-strip-s-p-1) (byte-compile-strip-symbol-positions): Rename and move to macroexp.el. Rename calls to these functions throughout the file. (byte-compile-initial-macro-environment): In the code sections for eval-when-compile and eval-and-compile, call macroexp-strip-symbol-positions before evaluating code. (byte-compile-file, byte-compile-output-file-form) (byte-compile-file-form-defmumble, byte-compile, batch-byte-compile): Call macroexp-strip-symbol-positions from code being passed to the native compiler. * lisp/emacs-lisp/cl-macs.el (cl-macs--strip-s-p-1) (cl-macs--strip-symbol-positions): Remove, replacing them with the renamed functions in macroexp.el. (cl-define-compiler-macro): Apply macroexp-strip-symbol-positions to ARGS and BODY. * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Use `null' to compile byte-not rather than a compilation of `eq'. (comp--native-compile): bind symbols-with-pos-enabled to t. * lisp/emacs-lisp/macroexp.el (byte-compile--ssp-conses-seen) (byte-compile--ssp-vectors-seen, byte-compile--ssp-records-seen): Provisional auxiliary variables to support the following functions. (macroexp--strip-s-p-2, byte-compile-strip-s-p-1) (macroexp-strip-symbol-positions): Functions moved from bytecomp.el, renamed, and further developed. (macroexp--compiler-macro): Bind symbol-with-pos-enabled to t around the call to `handler'. (internal-macroexpand-for-load): Strip symbol positions from the form being eagerly expanded for macros. * src/comp.c (F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM): New macro for a relocation symbol. (comp_t): New elements bool_ptr_type, f_symbols_with_pos_enabled_ref, lisp_symbol_with_position, lisp_symbol_with_position_header, lisp_symbol_with_position_sym, lisp_symbol_with_position_pos, lisp_symbol_with_position_type, lisp_symbol_with_position_ptr_type, get_symbol_with_position. (helper_GET_SYMBOL_WITH_POSITION): New function. (emit_BASE_EQ): Function rename from emit_EQ. (emit_AND, emit_OR, emit_BARE_SYMBOL_P, emit_SYMBOL_WITH_POS_P) (emit_SYMBOL_WITH_POS_SYM): New functions. (emit_EQ): New function which handles symbols with position correctly. (emit_NILP): Use emit_BASE_EQ rather than emit_EQ. (emit_limple_insn): When emitting a conditional branch, check each operand for being a literal Qnil, and if one of them is, use emit_BASE_EQ rather than emit_EQ. (declare_runtime_imported_funcs): Declare helper_GET_SYMBOL_WITH_POSITION. (emit_ctxt_code): Export the global F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM. (define_lisp_symbol_with_position, define_GET_SYMBOL_WITH_POSITION): New functions. (Fcomp__init_ctxt): Initialise comp.bool_ptr_type, call the two new define_.... functions. (load_comp_unit): Initialise **f_symbols_with_pos_enabled_reloc. * src/fns.c (Fput): Strip positions from symbols in PROPNAME and VALUE.
| * | | | Several amendments to scratch/correct-warning-pos.Alan Mackenzie2021-12-0112-33/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The position return by read-positioning-symbols is now the position in the buffer, rather than the offset from the start of a form, enabling warning positions in other parts of the buffer to be output. * src/lisp.h (lisp_h_EQ): Add XLI casts so that it compiles cleanly. * src/data.c (Fremove_pos_from_symbol): New DEFUN. * src/lread.c (readchar_count): renamed to readchar_offset. (read_internal_start) Initialize readchar_offset to the buffer's point when STREAM is a buffer. * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-prefix): Amend to use OFFSET as a buffer position, not an offset from the start of a form. (byte-compile-warn): Remove symbol positions from any shape of ARGS, not just a symbol with position. * lisp/emacs-lisp/cconv.c (cconv-convert): In the :unused case, position the new IGNORE symbol with the VAR it has replaced. * lisp/emacs-lisp/macroexp.el (macroexp--warn-wrap, macroexp-warn-and-return): Add an extra position parameter to each. * lisp/emacs-lisp/bindat.el (bindat-type), lisp/emacs-lisp/byte-run.el (defmacro, defun), lisp/emacs-lisp/cconv.el (cconv--convert-func-body) (cconv-convert), lisp/emacs-lisp/cl-generic.el (cl-defmethod), lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet, cl-defstruct), lisp/emacs-lisp/easy-mmode.el (define-minor-mode), lisp/emacs-lisp/eieio-core.el (eieio-oref, eieio-oref-default) (eieio-oset-default), lisp/emacs-lisp/eieio.el (defclass), lisp/emacs-lisp/gv.el (gv-ref), lisp/emacs-lisp/macroexp.el (macroexp-macroexpand, macroexp--unfold-lambda, macroexp--expand-all), lisp/emacs-lisp/pcase.el (pcase-compile-patterns, pcase--u1): Add an extra position argument to each call of macroexp-warn-and-return.
| * | | | First commit of scratch/correct-warning-pos.Alan Mackenzie2021-11-2910-187/+411
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This branch is intended to generate correct position information in warning and error messages from the byte compiler, and is intended thereby to fix bugs It introduces a new mechanism, the symbol with position. This is taken over from the previous git branch scratch/accurate-warning-pos which was abandoned for being too slow. The main difference in the current branch is that the symbol `nil' is never given a position, thus speeding up NILP markedly. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand) (byte-optimize-form-code-walker, byte-optimize-let-form, byte-optimize-while) (byte-optimize-apply): Use byte-compile-warn-x in place of byte-compile-warn. * lisp/emacs-lisp/bytecomp.el (byte-compile--form-stack): New variable. (byte-compile-strip-s-p-1, byte-compile-strip-symbol-positions): New functions. (byte-compile-recurse-toplevel, byte-compile-initial-macro-environment) (byte-compile-preprocess, byte-compile-macroexpand-declare-function): Bind print-symbols-bare to non-nil. (byte-compile--first-symbol, byte-compile--warning-source-offset): New functions. (byte-compile-warning-prefix): Modify to output two sets of position information, the old (incorrect) set and the new set. (byte-compile-warn): Strip positions from symbols before outputting. (byte-compile-warn-x): New function which outputs a correct position supplied in an argument. (byte-compile-warn-obsolete, byte-compile-emit-callargs-warn) (byte-compile-format-warn, byte-compile-nogroup-warn) (byte-compile-arglist-warn, byte-compile-docstring-length-warn) (byte-compile-warn-about-unresolved-functions, byte-compile-file) (byte-compile--check-prefixed-var, byte-compile--declare-var) (byte-compile-file-form-defvar-function, byte-compile-file-form-defmumble) (byte-compile-check-lambda-list, byte-compile--warn-lexical-dynamic) (byte-compile-lambda, byte-compile-form, byte-compile-normal-call) (byte-compile-check-variable, byte-compile-free-vars-warn) (byte-compile-subr-wrong-args, byte-compile-fset, byte-compile-set-default) (byte-compile-condition-case, byte-compile-save-excursion) (byte-compile-defvar, byte-compile-autoload) (byte-compile-make-variable-buffer-local, byte-compile-define-symbol-prop) (byte-compile-define-keymap): Replace byte-compile-warn with byte-compile-warn-x. (byte-compile-file, compile-defun): Bind symbols-with-pos-enabled to non-nil. (compile-defun, byte-compile-from-buffer): Use `read-positioning-symbols' rather than plain `read'. (byte-compile-toplevel-file-form, byte-compile-form): Dynamically bind byte-compile--form-stack. (byte-compile-file-form-autoload, byte-compile-file-form-defvar) (byte-compile-file-form-make-obsolete, byte-compile-lambda) (byte-compile-push-constant, byte-compile-cond-jump-table) (byte-compile-define-keymap, byte-compile-annotate-call-tree): Strip positions from symbols where they are unwanted. (byte-compile-file-form-defvar): Strip positions from symbols using `bare-symbol'. (byte-compile-file-form-defmumble): New variable bare-name, a version of name without its position. (byte-compile-lambda): Similarly, new variable bare-arglist. (byte-compile-free-vars-warn): New argument arg supplying position information to byte-compile-warn-x. (byte-compile-push-constant): Manipulation of symbol positions. (display-call-tree): Strip positions from symbols. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use) (cconv--analyze-function, cconv-analyze-form): Replace use of byte-compile-warn with byte-compile-warn-x. * lisp/emacs-lisp/cl-generic.el (cl-defmethod): New variable org-name which will supply position information to a new macroexp-warn-and-return. * lisp/emacs-lisp/cl-macs.el (cl-macs--strip-s-p-1) (cl-macs--strip-symbol-positions): New functions to strip positions from symbols in an expression. These duplicaate similarly named functions in bytecomp.el. * lisp/emacs-lisp/macroexpand.el (macroexp--warn-wrap): Calls byte-compile-warn-x in place of byte-compile-warn. (macroexp-warn-and-return): Commented out new position parameter _arg. * src/.gdbinit: Add in code to handle symbols with position. * src/alloc.c (XPNTR, set_symbol_name, valid_lisp_object_p, purecopy) (mark_char_table, mark_object, survives_gc_p, symbol_uses_obj): Use BARE_SYMBOL_P and XBARE_SYMBOL in place of the former SYMBOLP and XSYMBOL. (build_symbol_with_pos): New function. (Fgarbage_collect): Bind Qsymbols_with_pos_enabled to nil around the call to garbage_collect. * src/data.c (Ftype_of): Add case for PVEC_SYMBOL_WITH_POS. (Fbare_symbol_p, Fsymbol_with_pos_p, Fbare_symbol, Fsymbol_with_pos_pos) (Fposition_symbol): New functions. (symbols_with_pos_enabled): New boolean variable. * src/fns.c (internal_equal, hash_lookup): Handle symbols with position. * src/keyboard.c (recursive_edit_1): Bind Qsymbols_with_pos_enabled and Qprint_symbols_bare to nil. * src/lisp.h (lisp_h_PSEUDOVECTORP): New macro. (lisp_h_BASE_EQ): New name for the former lisp_h_EQ. (lisp_h_EQ): Extended to handle symbols with position. (lisp_h_NILP): Now uses BASE_EQ rather than EQ. (lisp_h_SYMBOL_WITH_POS_P, lisp_h_BARE_SYMBOL_P): New macros. (lisp_h_SYMBOLP): Redefined to handle symbols with position. (BARE_SYMBOL_P, BASE_EQ): New macros. (SYMBOLP (macro)): Removed. (SYMBOLP (function), XSYMBOL, make_lisp_symbol, builtin_lisp_symbol) (c_symbol_p): Moved to later in file. (struct Lisp_Symbol_With_Pos): New data type. (pvec_type): PVEC_SYMBOL_WITH_POS: New type code. (PSEUDOVECTORP): Redefined to use the lisp_h_PSEUDOVECTORP. (BARE_SYMBOL_P, SYMBOL_WITH_POS_P, SYMBOLP, XSYMBOL_WITH_POS, XBARE_SYMBOL) (XSYMBOL, make_lisp_symbol, builtin_lisp_symbol, c_symbol_p, CHECK_SYMBOL) (BASE_EQ): New functions, or functions moved from earlier in the file. (SYMBOL_WITH_POS_SYM, SYMBOL_WITH_POS_POS): New INLINE functions. * src/lread.c (read0, read1, read_list, read_vector, read_internal_start) (list2): Add a new bool parameter locate_syms. (Fread_positioning_symbols): New function. (Fread_from_string, read_internal_start, read0, read1, read_list): Pass around suitable values for locate_syms. (read1): Build symbols with position when locate_syms is true. * src/print.c (print_vectorlike): Add handling for PVEC_SYMBOL_WITH_POS. (print_object): Replace EQ with BASE_EQ. (print_symbols_bare): New boolean variable.
* | | | | Use load-read-function in byte-compile-from-bufferLars Ingebrigtsen2022-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Use load-read-function. * src/lread.c (syms_of_lread): Adjust doc string (bug#33723).
* | | | | Speed up multisession--set-value-sqlite slightlyLars Ingebrigtsen2022-01-221-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/multisession.el (multisession--set-value-sqlite): Use `readablep'.
* | | | | Make the test for existing multisession variables more sensibleLars Ingebrigtsen2022-01-221-2/+2
| |_|_|/ |/| | | | | | | | | | | | | | | * lisp/emacs-lisp/multisession.el (multisession-edit-value): Unconfuse the code.
* | | | Interpret a "" value of EMACS_TEST_VERBOSE as "off"Lars Ingebrigtsen2022-01-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | * doc/misc/ert.texi (Running Tests in Batch Mode): Adjust doc. * lisp/emacs-lisp/ert.el (ert-run-tests-batch): Allow overriding the EMACS_TEST_VERBOSE variable by setting it to "" (bug#53313).