aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/master' into scratch/pkgGerd Möllmann2023-12-191-4/+16
|\
| * debug.el: Straighten the code that find the "base" of the backtraceStefan Monnier2023-12-181-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the caller tell us clearly where is the base of the backtrace, if it's not `debug`. This is done by passing a new `:backtrace-base` keyword argument to `debug`. Then use this info systematically in all the places where we access the real C-level backtrace, to try and avoid inconsistencies and brittle code that tries to enumerate the expected frames we're in. * src/eval.c (get_backtrace_starting_at): Add support for offsets in the `base` argument. (Fbacktrace_debug): Add optional `base` argument. * lisp/emacs-lisp/debug.el (debug, debugger-frame, debugger-frame-clear): Use `debugger--backtrace-base` when calling `backtrace-debug`. (debugger-setup-buffer): Use `debugger--backtrace-base` when calling `backtrace-get-frames`. (debugger-frame-number): Drop `skip-base` arg, assume it's never nil. Add sanity check. (debugger--backtrace-base): Use the `:backtrace-base` info in `debugger-args`. (debugger-eval-expression): Adjust call to `debugger-frame-number`. (debug--implement-debug-on-entry): Pass appropriate `:backtrace-base`.
* | Make sure *package* is buffer-localGerd Möllmann2023-12-051-1/+1
| | | | | | | | | | | | | | | | * src/pkg.c (pkg_in_emacs_package): New function. * src/lisp.h: Declare it. * src/eval.c (run_hook_with_args): Use it. * src/lread.c (Fload): Use it. * src/xdisp.c (handle_fontified_prop): Use it.
* | Setting buffer-local *package*Gerd Möllmann2023-12-041-13/+25
| | | | | | | | | | | | | | * lisp/emacs-lisp/pkg.el (buffer-package): Get buffer's *package*. (set-buffer-package): Set it. * src/eval.c (Fdefault_buffer_local_value): Rewrite. (Fset_default_buffer_local_value): New function.
* | Merge remote-tracking branch 'origin/master' into scratch/pkgGerd Möllmann2023-11-251-2/+6
|\ \ | |/
| * Merge from origin/emacs-29Eli Zaretskii2023-11-111-0/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ce0ebb91f25 Improve documentation of read syntax and printed represen... 81f84b00a5d ; * doc/lispref/modes.texi (Other Font Lock Variables): A... 434592b0746 ; * lisp/dired.el (dired-use-ls-dired): Doc fix (bug#67053). fe000236cf2 Improve documentation of signaling errors in batch mode 103ca678ac1 Fix treesit-simple-indent-presets docstring (bug#67007) b7871cefe7b Prevent an infinite loop in todo-mode (bug#66994) fa8cc4c9ee2 Fix cmake-ts-mode indentation (Bug#66845) 5bdc61bc0ef Update to Org 9.6.11 18e2de1bec9 ; * lisp/bindings.el (right-word, left-word): Doc fix. 4f0fc3bfda3 ; Document core input events problems with XInput2
| | * Improve documentation of signaling errors in batch modeEli Zaretskii2023-11-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/control.texi (Signaling Errors) (Processing of Errors): * doc/lispref/os.texi (Batch Mode): * doc/lispref/debugging.texi (Invoking the Debugger): * lisp/emacs-lisp/debug.el (debug): * src/eval.c (Fsignal): * lisp/subr.el (error): Document more prominently that signaling an unhandled error in batch mode kills Emacs. Better documentation of backtrace in batch mode.
| * | Use BASE_EQ instead of EQ for some uninterned symbolsMattias Engdegård2023-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/editfns.c (labeled_restrictions_pop, Fwiden): * src/eval.c (lexbound_p, Fbacktrace__locals): * src/fileio.c (Finsert_file_contents): * src/fns.c (Fyes_or_no_p): * src/keyboard.c (command_loop_1): Use BASE_EQ for comparing with Qoutermost_restriction, Qinternal_interpreter_environment and Qunbound as uninterned symbols won't be EQ to a symbol-with-pos.
* | | Merge remote-tracking branch 'origin/master' into scratch/pkgGerd Möllmann2023-10-311-3/+7
|\ \ \ | |/ /
| * | Improved `eval` documentationMattias Engdegård2023-10-231-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Prompted by Michael Heerdegen. * src/eval.c (Feval): * doc/lispref/eval.texi (Eval): Be more precise about the LEXICAL argument.
* | | Bind *package* in hooksGerd Möllmann2023-10-021-2/+9
| | | | | | | | | | | | | | | * src/eval.c (run_hook_with_args): Bind *package* to the emacs package.
* | | Rework buffer-packageGerd Moellmann2023-09-051-19/+16
| | |
* | | Add default-buffer-local-valueGerd Moellmann2023-09-041-0/+35
|/ / | | | | | | | | | | * src/eval.c (default_buffer_local_binding): New function. (Fdefault_buffer_local_value): New function. (syms_of_eval): Add defsubr.
* | Fix invocation with --debug-init and changes to debug-ignored-errorsEli Zaretskii2023-08-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | * src/eval.c (syms_of_eval) <debug-ignored-errors>: Mention in the doc string the caveat with removing errors from the standard value while invoking Emacs with --debug-init. * lisp/startup.el (startup--load-user-init-file): If the user's init files add to the value of 'debug-ignored-errors', make sure the additions are preserved after restoring the value we reset during loading the init file, if Emacs was invoked with "--debug-init". (Bug#65267)
* | * src/eval.c (get_backtrace): Don't skip the top frameStefan Monnier2023-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | `profiler.el` was reporting incomplete backtraces. I had a suspicion there was something off, but it became obvious when I saw that `set-buffer-multibyte` did not appear in the `profiler-report` output when opening a large compressed tarball, even though I knew it to be a large contributor (which `elp-results` confirmed). I have no idea why this `backtrace_next` was there, sadly, but now `profiler-report` gives me results that make a lot more sense.
* | Prefer C23 ckd_* to Gnulib *_WRAPV macrosPaul Eggert2023-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C23 has added ckd_add etc. macros with functionality equivalent to the older Gnulib INT_ADD_WRAPV macros, so switch to the more-standard names. * admin/merge-gnulib (GNULIB_MODULES): Add stdckdint. This merely makes the dependency explicit, as we were already using this Gnulib module indirectly. * lib-src/etags.c, src/lisp.h: Include stdckdint.h. * lib-src/etags.c (xnmalloc, xnrealloc): * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string) (mark_memory): * src/bignum.c (emacs_mpz_pow_ui): * src/buffer.c (record_overlay_string, overlay_strings): * src/bytecode.c (exec_byte_code): * src/casefiddle.c (do_casify_multibyte_string): * src/ccl.c (ccl_driver, Fccl_execute_on_string): * src/character.c (char_width, c_string_width) (lisp_string_width, count_size_as_multibyte) (string_escape_byte8): * src/cmds.c (internal_self_insert): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display_interactive): * src/doprnt.c (parse_format_integer): * src/editfns.c (Freplace_buffer_contents, str2num) (styled_format): * src/emacs-module.c (module_global_reference_p) (module_make_global_ref, module_funcall): * src/eval.c (max_ensure_room): * src/fileio.c (blocks_to_bytes): * src/fns.c (Ffillarray): * src/font.c (font_intern_prop): * src/frame.c (check_frame_pixels): * src/gnutls.c (gnutls_hex_string, gnutls_symmetric_aead): * src/gtkutil.c (get_utf8_string): * src/haikuterm.c (haiku_term_init): * src/image.c (xbm_scan, image_to_emacs_colors) (image_detect_edges, png_load_body): * src/keyboard.c (Frecursion_depth): * src/keymap.c (Flookup_key, Fkey_description): * src/lisp.h (modiff_incr, SAFE_ALLOCA_LISP_EXTRA): * src/lread.c (read_bool_vector): * src/pgtkterm.c (pgtk_term_init): * src/regex-emacs.c (regex_compile): * src/term.c (encode_terminal_code): * src/termcap.c (tputs): * src/textconv.c (textconv_query): * src/timefns.c (timespec_ticks, lisp_time_hz_ticks) (Fdecode_time, check_tm_member): * src/tparam.c (tparam1): * src/w32term.c (w32_initialize_display_info): * src/xdisp.c (fill_column_indicator_column, decode_mode_spec): * src/xselect.c (selection_data_size, x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (xm_setup_dnd_targets, x_sync_get_monotonic_time) (x_sync_current_monotonic_time, x_sync_note_frame_times) (x_display_set_last_user_time, x_term_init): Prefer the C23 stdckdint macros to their Gnulib intprops.h counterparts, since C23 is standard.
* | Disallow creation of circular variable alias chainsMattias Engdegård2023-04-141-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `defvaralias` signal an error upon attempts to create variable alias cycles. This detects errors earlier and makes the alias traversal during execution simpler and faster since no cycle detection is needed elsewhere. Now variable and function aliases are handled identically in these respects. * src/lisp.h (indirect_variable): Remove declaration. * src/data.c (indirect_variable): Remove. (Findirect_variable): Update doc string. Simplify alias resolution. (Fboundp, find_symbol_value, set_internal, default_value) (set_default_internal, Fmake_variable_buffer_local) (Fmake_local_variable, Fkill_local_variable, Flocal_variable_p) (Flocal_variable_if_set_p, Fvariable_binding_locus): * src/buffer.c (buffer_local_value): * src/eval.c (specbind): Simplify variable alias resolution. (Fdefvaralias): Update doc string. Check for cycles. * doc/lispref/variables.texi (Variable Aliases): Mention that `defvaralias` can signal `cyclic-variable-indirection` but `indirect-variable` cannot. * etc/NEWS: Announce the change. * test/src/eval-tests.el (eval-tests-defvaralias): New test.
* | Stop pretending that specpdl overflow can ever occurMattias Engdegård2023-04-131-2/+1
| | | | | | | | | | | | * src/eval.c (grow_specpdl_allocation): Remove impossible error. * src/data.c (syms_of_data): Note obsolence of `excessive-variable-binding`.
* | src/eval.c: Fix bug#62419Stefan Monnier2023-04-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Yup, almost 40 years after ELisp first combined them, buffer-local and let bindings still don't work quite right :-( The "automatically buffer-local if set" semantics should follow the principle that it becomes buffer-local iff the var's current binding refers to the top-level/global/non-let binding. * src/eval.c (let_shadows_buffer_binding_p): Disregard non-global let-bindings. * test/src/eval-tests.el (eval-test--bug62419): New test.
* | Detect and prevent function alias loops in `fset` and `defalias`Mattias Engdegård2023-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `fset` and `defalias` signal an error on attempts to create circular alias chains. This is more effective, efficient and convenient than permitting alias loops to be created and trying to detect them at run time each time a function is called, which is what we have been doing until now, badly. * lisp/help-fns.el (help-fns--analyze-function): Don't pass obsolete argument. * lisp/subr.el (function-alias-p): * src/data.c (indirect_function, Findirect_function): Simplify. Now error-free, second argument obsolete. (Ffset): Detect loops. * test/lisp/help-fns-tests.el (help-fns--analyze-function-recursive): * test/lisp/subr-tests.el (test-alias-p): Adapt tests. * test/src/data-tests.el (data-tests-fset, data-tests-defalias): New. * doc/lispref/eval.texi (Function Indirection): * doc/lispref/functions.texi (Defining Functions, Function Cells): Update manual. * etc/NEWS: Announce.
* | Remove unnecessary cons in lexical evalMattias Engdegård2023-02-071-1/+6
| | | | | | | | | | | | * src/eval.c (list_of_t): New. (Feval): Use list_of_t instead of consing every time. (syms_of_eval): Set list_of_t to (t) and staticpro it.
* | Merge from origin/emacs-29Eli Zaretskii2023-01-011-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | cae528457c ; Add 2023 to copyright years. b394359261 Improve documentation of 'isearch-open-overlay-temporary' ab3210e709 Document 'use-package' in the 2 main manuals # Conflicts: # etc/refcards/ru-refcard.tex # lib/explicit_bzero.c # m4/explicit_bzero.m4
| * ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
| |
* | Fix condition-case empty success handler misinterpretationMattias Engdegård2022-12-241-3/+3
|/ | | | | | | | | | | (condition-case X E (:success)) should return nil; the compiler behaves correctly in this case. * src/eval.c (internal_lisp_condition_case): Evaluate an empty :success handler as nil instead of pretending it isn't there. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case.
* Merge remote-tracking branch 'savannah/master' into feature/tree-sitterYuan Fu2022-11-211-18/+25
|\
| * ; Fix typos (prefer US spelling)Stefan Kangas2022-11-181-2/+2
| |
| * itree.c: Make the iterator reentrant (bug#59183)Stefan Monnier2022-11-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get rid of the global iterator object and instead allocate a separate iterator for every loop. This still uses the "duplicate iterator" code, including the old iterator which needs a stack, make ITREE_FOREACH a bit more expensive than we'd like. * src/itree.h (init_itree, forget_itree, itree_iterator_busy_p): Delete declarations. (itree_iterator_start): Add iterator arg and remove `line` and `file` args. (struct itree_iterator): Move from `itree.c`. Remove `line` and `file` fields. (ITREE_FOREACH): Stack allocate an iterator object and pass it to `itree_iterator_start`. * src/itree.c (struct itree_iterator): Move to itree.h. (iter): Delete global variable. (itree_iterator_create, init_itree, forget_itree, itree_iterator_busy_p): Delete functions. (itree_contains): Adjust assertion. (itree_iterator_finish): Deallocate the iterator's stack. (itree_iterator_start): Take the (uninitialized) iterator as argument. Allocate a fresh new stack. Remove `file` and `line` arguments. Don't check `running` any more since the iterator is not expected to be initialized at all. * src/eval.c (signal_or_quit): * src/alloc.c (garbage_collect): Don't check `itree_iterator_busy_p` any more. * src/emacs.c (main): No need to `init_itree` any more. (Fdump_emacs): No need to `forget_itree` any more.
| * Fix the subr-arity returned by native compiled functions with lots of argsAlan Mackenzie2022-10-291-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes bug #58739. Make subr-arity return, e.g., (12 . 12) rather than (12 . many) for a function with a fixed number of arguments more than 8. * lisp/emacs-lisp/comp.el (comp-prepare-args-for-top-level): Only return a cdr of 'many when there are &rest arguments. * src/eval.c (eval_sub): Also check for a fixed number of args over 8 when using the nargs + *args calling convention. (funcall_subr): Also check numargs <= 8 before using the fixed args calling convention. Include the case numargs > 8 in the aMany calling convention. * src/lisp.h (DEFUN): Amend the comment about MANY.
| * Merge remote-tracking branch 'origin/feature/noverlay'Stefan Monnier2022-10-281-0/+1
| |\
| | * Rename itree iterators with itree_iterator prefixMatt Armstrong2022-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/itree.h: Rename struct interval_generator -> itree_iterator. Rename functions: itree_busy_p -> itree_iterator_busy_p, interval_tree_iter_start -> itree_iterator_start, interval_generator_narrow -> itree_iterator_narrow, interval_tree_iter_finish -> itree_iterator_finish, interval_generator_next -> itree_iterator_next. * src/itree.c: Use new names everywhere. * src/eval.c: ditto.
| | * itree: Try and detect non-local exits during itree iterationsStefan Monnier2022-10-071-0/+1
| | | | | | | | | | | | | | | | | | * src/itree.c (itree_busy_p): New function. * src/eval.c (signal_or_quit): Use it. * src/itree.h (itree_busy_p): Declare it.
| * | cconv.el: Fix regression in cconv-tests-interactive-closure-bug51695Stefan Monnier2022-10-281-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new code to make interpreted closures safe-for-space introduced a regression in `cconv-tests-interactive-closure-bug51695`, only seen when using TEST_LOAD_EL. A few other issues were found and fixed along the way. * lisp/emacs-lisp/cconv.el (cconv-fv): Change calling convention and focus on finding the free variables. (cconv-make-interpreted-closure): New function. * lisp/loadup.el: Use `compiled-function-p` rather than `byte-code-function-p` so we also use safe-for-space interpreted closures when we build with native compilation. (internal-make-interpreted-closure-function): Use `cconv-make-interpreted-closure`. * src/eval.c (syms_of_eval): Rename `internal-filter-closure-env-function` to `internal-make-interpreted-closure-function`. (Ffunction): Let that new var build the actual closure. * test/lisp/emacs-lisp/cconv-tests.el (cconv-tests-interactive-closure-bug51695): Test specifically the interpreted case.
| * | (Ffunction): Make interpreted closures safe for spaceStefan Monnier2022-10-251-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interpreted closures currently just grab a reference to the complete lexical environment, so (lambda (x) (+ x y)) can end up looking like (closure ((foo ...) (y 7) (bar ...) ...) (x) (+ x y)) where the foo/bar/... bindings are not only useless but can prevent the GC from collecting that memory (i.e. it's a representation that is not "safe for space") and it can also make that closure "unwritable" (or more specifically, it can cause the closure's print representation to be u`read`able). Compiled closures don't suffer from this problem because `cconv.el` actually looks at the code and only stores in the compiled closure those variables which are actually used. So, we fix this discrepancy by letting the existing code in `cconv.el` tell `Ffunction` which variables are actually used by the body of the function such that it can filter out the irrelevant elements and return a closure of the form: (closure ((y 7)) (x) (+ x y)) * lisp/loadup.el: Preload `cconv` and set `internal-filter-closure-env-function` once we have a usable `cconv-fv`. * lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): Adjust to new calling convention of `cconv-closure-convert`. (byte-compile-not-lexical-var-p): Delete function, moved to `cconv.el`. (byte-compile-bind): Use `cconv--not-lexical-var-p`. * lisp/emacs-lisp/cconv.el (cconv--dynbound-variables): New var. (cconv-closure-convert): New arg `dynbound-vars` (cconv--warn-unused-msg): Remove special case for `ignored`, so we don't get confused when a function uses an argument called `ignored`, e.g. holding a list of things that it should ignore. (cconv--not-lexical-var-p): New function, moved from `bytecomp.el`. Don't special case keywords and `nil` and `t` since they are already `special-variable-p`. (cconv--analyze-function): Use `cconv--not-lexical-var-p`. (cconv--dynbindings): New dynbound var. (cconv-analyze-form): Use `cconv--not-lexical-var-p`. Remember in `cconv--dynbindings` the vars for which we used dynamic scoping. (cconv-analyze-form): Use `cconv--dynbound-variables` rather than `byte-compile-bound-variables`. (cconv-fv): New function. * src/eval.c (Fsetq, eval_sub): Remove optimization designed when `lexical-binding == nil` was the common case. (Ffunction): Use `internal-filter-closure-env-function` when available. (eval_sub, Ffuncall): Improve error info for `excessive_lisp_nesting`. (internal-filter-closure-env-function): New defvar.
* | | Merge branch 'master' into feature/tree-sitterYuan Fu2022-10-061-0/+2
|\ \ \ | |/ /
| * | Inhibit GC in probably_quit (bug#58042)Gerd Möllmann2022-10-061-0/+2
| |/
* | Merge branch 'master' into feature/tree-sitterYuan Fu2022-10-051-59/+6
|\ \ | |/
| * Abolish max-specpdl-size (bug#57911)Mattias Engdegård2022-09-191-54/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The max-lisp-eval-depth limit is sufficient to prevent unbounded stack growth including the specbind stack; simplify matters for the user by not having them to worry about two different limits. This change turns max-specpdl-size into a harmless variable with no effects, to keep existing code happy. * lisp/subr.el (max-specpdl-size): Define as an ordinary (but obsolete) dynamic variable. * admin/grammars/Makefile.in: * doc/lispintro/emacs-lisp-intro.texi (Loops & Recursion): * doc/lispref/control.texi (Cleanups): * doc/lispref/edebug.texi (Checking Whether to Stop): * doc/lispref/eval.texi (Eval): * doc/lispref/variables.texi (Local Variables): * doc/misc/calc.texi (Recursion Depth): Update documentation. * etc/NEWS: Announce. * src/eval.c (FletX): Use safe iteration to guard against circular bindings list. (syms_of_eval): Remove old max-specpdl-size definition. (init_eval_once, restore_stack_limits, call_debugger) (signal_or_quit, grow_specpdl_allocation): * leim/Makefile.in: * lisp/Makefile.in: * lisp/calc/calc-stuff.el (calc-more-recursion-depth) (calc-less-recursion-depth): * lisp/calc/calc.el (calc-do): * lisp/cedet/semantic/ede-grammar.el (ede-proj-makefile-insert-rules): * lisp/cedet/semantic/grammar.el (semantic-grammar-batch-build-one-package): * lisp/cus-start.el (standard): * lisp/emacs-lisp/comp.el (comp--native-compile): * lisp/emacs-lisp/edebug.el (edebug-max-depth): (edebug-read-and-maybe-wrap-form, edebug-default-enter): * lisp/emacs-lisp/regexp-opt.el (regexp-opt): * lisp/eshell/esh-mode.el (eshell-mode): * lisp/loadup.el (max-specpdl-size): * lisp/mh-e/mh-e.el (mh-invisible-headers): * lisp/net/shr.el (shr-insert-document, shr-descend): * lisp/play/hanoi.el (hanoi-internal): * lisp/progmodes/cperl-mode.el: * src/fileio.c (Fdo_auto_save): Remove references to and modifications of max-specpdl-size.
| * Raise default max-specpdl-size and max-lisp-eval-depthMattias Engdegård2022-09-141-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent changes have caused bootstrapping to fail for certain configurations, and it was likely getting close to the limits for others. This change raises the limits to those previously used when configured for nativecomp: max-specpdl-size raised from 1800 to 2500 max-lisp-eval-depth raised from 800 to 1600 * src/eval.c (init_eval_once): Raise limits. * doc/lispref/eval.texi (Eval): * doc/lispref/variables.texi (Local Variables): Document new values.
* | Merge remote-tracking branch 'origin/master' into feature/tree-sitterYuan Fu2022-08-291-10/+76
|\ \ | |/
| * New debugging facility: backtraces from errors in Lisp called from redisplayAlan Mackenzie2022-08-111-1/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting backtrace-on-redisplay-error to non-nil enables the generation of a Lisp backtrace in buffer *Redisplay-trace* following an error in Lisp called from redisplay. * doc/lispref/debugging.texi (Debugging Redisplay): New subsection. (Error Debugging): Reference to the new subsection. * etc/NEWS: New entry for the new facility. * src/eval.c (redisplay_deep_handler): New variable. (init_eval): Initialize redisplay_deep_handler. (call_debugger): Don't throw to top-level after calling debug-early (internal_condition_case_n): "Bind" redisplay_deep_handler to the current handler. (backtrace_yet): New boolean variable. (signal_or_quit): New code section to handle Lisp errors occurring in redisplay. (syms_of_eval): New DEFVAR_BOOL backtrace-on-redisplay-error. * src/keyboard.c (command_loop_1): Set backtrace_yet to false each time around the loop. (safe_run_hooks_error): Allow args to be up to four Lisp_Objects long. (safe_run_hooks_2): New function. * src/lisp.h (top level): declare as externs backtrace_yet and safe_run_hooks_2. * src/xdisp.c (run_window_scroll_functions): Replace a call to run_hook_with_args_2 with one to safe_run_hooks_2.
| * * src/eval.c (Fdefvaralias): Clarify error messages. (Bug#56863)Eli Zaretskii2022-08-011-4/+8
| |
| * Make warning about require/autoload while bootstrapping not error outLars Ingebrigtsen2022-06-241-2/+7
| | | | | | | | | | | | | | * src/fns.c (Frequire): * src/eval.c (Fautoload_do_load): Avoid further errors while outputting the error about not being able to autoload/require while bootstrapping.
| * Use BASE_EQ instead of EQ where obviously safeMattias Engdegård2022-06-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (deadp): * src/buffer.c (reset_buffer_local_variables, candidate_buffer) (Fkill_buffer, Fbuffer_swap_text, Fmake_overlay, Fmove_overlay): * src/callint.c (Fcall_interactively): * src/coding.c (decode_coding_object, encode_coding_object) (code_convert_region, Ffind_operation_coding_system): * src/comp.c (Fcomp_el_to_eln_rel_filename): * src/conf_post.h (RE_TRANSLATE_P): * src/data.c (Fkill_local_variable, Fash, expt_integer): * src/dired.c (file_name_completion): * src/dispnew.c (set_window_cursor_after_update, update_frame_1) (Fframe_or_buffer_changed_p): * src/doc.c (Fdocumentation, Fdocumentation_property) (default_to_grave_quoting_style): * src/editfns.c (Fconstrain_to_field, save_excursion_save) (save_excursion_restore, Fngettext): * src/eval.c (Fautoload, un_autoload, specbind): * src/fileio.c (Fmake_temp_file_internal): * src/fns.c (string_char_to_byte, string_byte_to_char) (Fnthcdr, Fnreverse): * src/indent.c (vmotion): * src/inotify.c (add_watch): * src/keyboard.c (command_loop_1, read_char) (read_char_minibuf_menu_prompt): * src/lread.c (oblookup): * src/macfont.m (macfont_descriptor_entity, macfont_open): * src/minibuf.c (Finnermost_minibuffer_p, Ftry_completion) (Ftest_completion): * src/nsfns.m (ns_set_icon_name): * src/pdumper.c (dump_queue_dequeue): * src/pgtkfns.c (pgtk_set_icon_type, pgtk_set_icon_name): * src/process.c (Faccept_process_output): * src/textprop.c (set_text_properties): * src/w32fns.c (w32_set_icon_type, w32_set_icon_name): * src/w32select.c (validate_coding_system): * src/window.c (decode_next_window_args, window_loop) (save_window_save): * src/xdisp.c (wset_redisplay): * src/xfaces.c (Fx_family_fonts, resolve_face_name) (gui_supports_face_attributes_p): * src/xfns.c (x_set_icon_type, x_set_icon_name): * src/xselect.c (clean_local_selection_data): Use BASE_EQ instead of EQ where it is obvious that neither argument can be a symbol with properties or at least one argument is a non-symbol.
* | Merge remote-tracking branch 'savannah/master' into feature/tree-sitterYuan Fu2022-06-141-30/+76
|\ \ | |/
| * Use BASE_EQ when comparing with QunboundMattias Engdegård2022-06-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qunbound is uninterned and can therefore never be EQ to any symbol with position. * src/buffer.c (Fbuffer_local_value, buffer_lisp_local_variables) (buffer_local_variables_1): * src/bytecode.c (exec_byte_code): * src/comp.c (compile_function, Fcomp__compile_ctxt_to_file): * src/composite.c (composition_gstring_cache_clear_font): * src/data.c (Fboundp, Fsymbol_value, set_internal) (Fdefault_boundp, Fdefault_value, Fmake_variable_buffer_local): * src/emacs-module.c (module_global_reference_p): * src/eval.c (Fdefault_toplevel_value, defvar) (run_hook_with_args): * src/fns.c (hash_put, Fmaphash): * src/font.c (font_put_extra): * src/frame.c (gui_set_frame_parameters) (gui_frame_get_and_record_arg, gui_default_parameter) (gui_figure_window_size): * src/haikufns.c (get_geometry_from_preferences) (haiku_create_frame, haiku_create_tip_frame): * src/haikuterm.c (haiku_draw_text_decoration) (haiku_default_font_parameter): * src/json.c (lisp_to_json_nonscalar_1): * src/keymap.c (access_keymap_1, access_keymap, current_minor_maps): * src/lread.c (readevalloop, define_symbol): * src/minibuf.c (read_minibuf, Ftry_completion): (Fall_completions, Ftest_completion): * src/pgtkfns.c (pgtk_default_font_parameter, Fx_create_frame) (x_create_tip_frame): * src/pgtkselect.c (Fpgtk_own_selection_internal): * src/print.c (print): * src/profiler.c (evict_lower_half, record_backtrace): * src/terminal.c (create_terminal): * src/textprop.c (set_properties): * src/w32fns.c (my_create_window, w32_icon) (w32_default_font_parameter, Fx_create_frame) (w32_create_tip_frame): * src/w32term.c (w32_draw_glyph_string): * src/xdisp.c (handle_single_display_spec) (cursor_row_fully_visible_p, calc_pixel_width_or_height): * src/xfns.c (x_default_scroll_bar_color_parameter, x_icon_verify) (x_icon, x_default_font_parameter, Fx_create_frame) (x_create_tip_frame): * src/xselect.c (x_handle_selection_request): * src/xterm.c (x_draw_glyph_string, x_term_init): Use BASE_EQ instead of EQ when comparing with Qunbound.
| * Fix two crashes when a display connection is lostPo Lu2022-06-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes errors caused by invalid error traps being left on the error handler stack if an IO error causes a non-local exit out of the protected code, and another crash caused by delete_frame trying to read async input. * src/eval.c (unwind_to_catch, push_handler_nosignal): Save and restore the X error handler stack. * src/lisp.h (struct handler): [HAVE_X_WINDOWS]: New field `x_error_handler_depth'. * src/xterm.c (struct x_error_message_stack): Make string a regular string. (x_unwind_errors_to): New function. (x_error_catcher, x_catch_errors_with_handler) (x_uncatch_errors_after_check, x_uncatch_errors): Update the stack depth. (x_check_errors): Stop manually unwinding since unwind_to_catch now does that for us. (x_had_errors_p, x_clear_errors): Update for new type of `string'. (x_connection_closed): Block input between just before delete_frame to when the terminal is unlinked. * src/xterm.h: Update prototypes.
| * eval.c: New functions `defvar-1` and `defconst-1` (bug#55156)scratch/bug-55156Stefan Monnier2022-05-261-25/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bytecode interpreter can't directly call special forms, so the byte-compiler usually converts special forms into some sequence of byte codes (basically, providing a duplicate definition of the special form). There are still two exceptions to this: `defconst` and `defvar`, where the compiler instead generates a convoluted chunk of code like: (funcall '(lambda (x) (defvar <sym> x <doc>)) <value>) where the quote makes sure we keep the function non-compiled, so as to end up running the special form at run time. Get rid of this workaround by introducing `defvar-1` and `defconst-1` which provide a *functional* interface to the functionality of the corresponding special form. * src/eval.c (defvar, Fdefvar_1, Fdefconst_1): New functions, extracted from `Fdefvar` and `Fdefconst`. (Fdefvar, Fdefconst): Use them. (syms_of_eval): `defsubr` the new functions. * lisp/emacs-lisp/bytecomp.el (byte-compile-tmp-var): Delete const. (byte-compile-defvar): Simplify using the new functions. * doc/lispref/variables.texi (Defining Variables): Adjust the doc of `defvar` to reflect the actual semantics implemented.
| * Improve Finternal__define_uninitialized_variable erroringLars Ingebrigtsen2022-05-171-1/+3
| | | | | | | | | | * src/eval.c (Finternal__define_uninitialized_variable): Say what symbol we're bugging out on for easier debugging.
| * Add OVERRIDES argument to prin1/prin1-to-stringLars Ingebrigtsen2022-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/streams.texi (Output Functions): Document it. (Output Overrides): New node. * src/process.c (Faccept_process_output): * src/print.c (debug_print, print_error_message): * src/pdumper.c (print_paths_to_root_1, decode_emacs_reloc): * src/lread.c (readevalloop): * src/eval.c (internal_lisp_condition_case): * src/editfns.c (styled_format): Adjust prin1/prin1-to-string callers. * src/print.c (Fprin1): Take an OVERRIDES parameter. (print_bind_overrides, print_bind_all_defaults): New functions. (Fprin1_to_string): Take an OVERRIDES parameter.
| * functionp doc improvementPaul Eggert2022-05-111-3/+5
| | | | | | | | | | | | * doc/lispref/eval.texi, doc/lispref/functions.texi, src/eval.c: Document functionp a bit more carefully. It can return t on non-functions.