aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Use new error representaiton in ERTscratch/handler-bind-2João Távora2024-01-021-1/+4
| | | | | * lisp/emacs-lisp/ert.el (ert--run-test-debugger): Use new error representation.
* Call debug-early with new error representationJoão Távora2024-01-021-2/+2
| | | | | * lisp/emacs-lisp/debug-early.el (debug--early): Let debug--early called from C know about the new representation.
* Better .clangdJoão Távora2024-01-021-0/+2
| | | | * .clangd (CompileFlags): Always remove -fstruct-flex-*
* Introduce handler-case (bug#68075)João Távora2024-01-013-12/+52
| | | | | | | | | | | | * lisp/subr.el (handler-case): New macro. * lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings): Use handler-case. * test/src/eval-tests.el (eval-tests--handler-bind): Use handler-case, not condition-case. * lisp/subr.el (handler-case): Don't use pcase-lambda
* Experimental record type for all conditions (bug#68075)João Távora2024-01-012-26/+39
| | | | | | | | | | | | | | | * src/print.c (Ferror_message_string): Work with cons or with records. (print_error_message): Still work with cons errors, but rename parameter. * src/eval.c (signal_or_quit): Make a record, not a cons. Except in the sub-case of CONDITION_CASE, where a fresh cons is given. Name this object 'condition', not 'error'. (skip_debugger): Rename parameter 'data' to 'condition' (signal_quit_p) (maybe_call_debugger): Expect record, not cons. (syms_of_eval): Define symbol Qcondition.
* (backtrace-on-redisplay-error): Use `handler-bind`scratch/handler-bindStefan Monnier2023-12-285-91/+84
| | | | | | | | | | | | | | | | | | | | | | | | Reimplement `backtrace-on-redisplay-error` using `push_handler_bind`. This moves the code from `signal_or_quit` to `xdisp.c` and `debug-early.el`. * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Add `base` arg to strip "internal" frames. (debug--early): New function, extracted from `debug-early`. (debug-early, debug-early--handler): Use it. (debug-early--muted): New function, extracted (translated) from `signal_or_quit`; trim the buffer to a max of 10 backtraces. * src/xdisp.c (funcall_with_backtraces): New function. (dsafe_calln): Use it. (syms_of_xdisp): Defsym `Qdebug_early__muted`. * src/eval.c (redisplay_deep_handler): Delete var. (init_eval, internal_condition_case_n): Don't set it any more. (backtrace_yet): Delete var. (signal_or_quit): Remove special case for `backtrace_on_redisplay_error`. * src/keyboard.c (command_loop_1): Don't set `backtrace_yet` any more. * src/lisp.h (backtrace_yet): Don't declare.
* (signal_or_quit): Preserve error object identityStefan Monnier2023-12-283-38/+42
| | | | | | | | | | | | | | | | | | | | | Make sure we build the (ERROR-SYMBOL . ERROR-DATA) object only once when signaling an error, so that its `eq` identity can be used. It also gets us a tiny bit closer to having real "error objects" like in most other current programming languages. * src/eval.c (maybe_call_debugger): Change arglist to receive the error object instead of receiving the signal and the data separately. (signal_or_quit): Build the error object right at the beginning so it stays `eq` to itself. Rename the `keyboard_quit` arg to `continuable` so say what it does rather than what it's used for. (signal_quit_p): Change arg to be the error object rather than just the error-symbol. * src/keyboard.c (cmd_error_internal, menu_item_eval_property_1): Adjust calls to `signal_quit_p` accordingly. * test/src/eval-tests.el (eval-tests--error-id): New test.
* eval.c: Add new var `lisp-eval-depth-reserve`Stefan Monnier2023-12-283-26/+51
| | | | | | | | | | | | | | | | | | Rather than blindly increase `max-lisp-eval-depth` when entering the debugger or running `signal-hook-function`, use this new "reserve" to keep track of how much we have grown the stack for "debugger" purposes so that for example recursive calls to `signal-hook-function` can't eat up the whole C stack. * src/eval.c (max_ensure_room): Rewrite. (restore_stack_limits): Move before `max_ensure_room`. Rewrite. (call_debugger, signal_or_quit): Adjust calls accordingly. Also grow `max-lisp-eval-depth` for `hander-bind` handlers. (init_eval_once): Don't initialize `max_lisp_eval_depth` here. (syms_of_eval): Initialize it here instead. Add new var `lisp-eval-depth-reserve`. * doc/lispref/eval.texi (Eval): Add `lisp-eval-depth-reserve`.
* (macroexp--with-extended-form-stack): Use plain `let`Stefan Monnier2023-12-282-26/+25
| | | | | | | | | | | | | | | | `macroexp--with-extended-form-stack` used manual push/pop so that upon non-local exits the "deeper" value is kept, so the error handler gets to know what was the deeper value, so as to be able to compute more precise error locations. Replace this with a `handler-bind` which catches that "deeper" value more explicitly. * lisp/emacs-lisp/bytecomp.el (bytecomp--displaying-warnings): Use `handler-bind` to catch the value of `byte-compile-form-stack` at the time of the error. Also consolidate the duplicated code. * lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack): Use a plain dynbound let-rebinding.
* Move batch backtrace code to `top_level_2`Stefan Monnier2023-12-284-25/+31
| | | | | | | | | | | | | | | | | Move ad-hoc code meant to ease debugging of bootstrap (and batch mode) to `top_level_2` so it doesn't pollute `signal_or_quit`. * src/lisp.h (pop_handler, push_handler_bind): Declare. * src/keyboard.c (top_level_2): Setup an error handler to call `debug-early` when noninteractive. * src/eval.c (pop_handler): Not static any more. (signal_or_quit): Remove special case for noninteractive use. (push_handler_bind): New function, extracted from `Fhandler_bind_1`. (Fhandler_bind_1): Use it. (syms_of_eval): Declare `Qdebug_early__handler`. * lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Weed out frames below `debug-early`. (debug-early--handler): New function.
* startup.el: Use `handler-bind` to implement `--debug-init`Stefan Monnier2023-12-281-124/+97
| | | | | | | | | This provides a more reliable fix for bug#65267 since we don't touch `debug-on-error` nor `debug-ignore-errors` any more. * lisp/startup.el (startup--debug): New function. (startup--load-user-init-file): Use it and `handler-bind` instead of let-binding `debug-on-error`.
* emacs-module-tests.el (mod-test-non-local-exit-signal-test): Repair testStefan Monnier2023-12-281-7/+6
| | | | | | | | That test relied on `debugger` and `debug-on-signal` in a way that doesn't work with the new ERT code. * test/src/emacs-module-tests.el (mod-test-non-local-exit-signal-test): Use `handler-bind` rather than the debugger.
* Use handler-bind to repair bytecomp-testsMattias Engdegård2023-12-281-12/+6
| | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--error-frame, bytecomp--byte-op-error-backtrace): Make test pass again and simplify, using handler-bind instead of the previous debugger hack.
* Fix ert-tests.el for the new `handler-bind` codeStefan Monnier2023-12-281-51/+50
| | | | | | | | | | | | | | | Now that `ert.el` uses `handler-bind` instead of `debugger`, some details of the behavior have changed. More specifically, three tests are now broken, but these basically tested the failure of ERT's machinery to record errors when ERT was run within a `condition-case`. AFAICT, these tests do not check for a behavior that we want, so rather than "fix" them, I disabled them. * test/lisp/emacs-lisp/ert-tests.el (ert-test-error-debug) (ert-test-fail-debug-with-condition-case) (ert-test-should-failure-debugging): Comment out. (ert-test-with-demoted-errors): It now passes. Bug#11218 is fixed!
* ert.el: Use `handler-bind` to record backtracesStefan Monnier2023-12-282-86/+55
| | | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert--should-signal-hook): Delete function. (ert--expand-should-1): Don't bind `signal-hook-function`. (ert--test-execution-info): Remove `next-debugger` slot. (ert--run-test-debugger): Adjust to new calling convention. Pass the `:backtrace-base` info to the debugger. (ert--run-test-internal): Use `handler-bind` rather than let-binding `debugger` and `debug-on-error`. * lisp/emacs-lisp/ert-x.el (ert-remote-temporary-file-directory): Don't use `defconst` if it's not meant to stay constant (e.g. we let-bind it in tramp-tests.el).
* (eval-expression): Fix bug#67196Stefan Monnier2023-12-271-16/+13
| | | | | | * lisp/simple.el (eval-expression--debug): New function. (eval-expression): Use it together with `handler-bind` instead of let-binding `debug-on-error`.
* New special form `handler-bind`Stefan Monnier2023-12-277-20/+226
| | | | | | | | | | | | | | | | | | | | | | | AFAIK, this provides the same semantics as Common Lisp's `handler-bind`, modulo the differences about how error objects and conditions are represented. * lisp/subr.el (handler-bind): New macro. * src/eval.c (pop_handler): New function. (Fhandler_Bind_1): New function. (signal_or_quit): Handle new handlertypes `HANDLER` and `SKIP_CONDITIONS`. (find_handler_clause): Simplify. (syms_of_eval): Defsubr `Fhandler_bind_1`. * doc/lispref/control.texi (Handling Errors): Add `handler-bind`. * test/src/eval-tests.el (eval-tests--handler-bind): New test. * lisp/emacs-lisp/lisp-mode.el (lisp-font-lock-keywords): Move 'handler-bind' from CL-only to generic Lisp. (handler-bind): Remove indentation setting, it now lives in the macro definition.
* ; Fix typosStefan Kangas2023-12-283-5/+5
|
* Abbreviate the VC revision in vc-annotate's buffer nameJim Porter2023-12-274-3/+32
| | | | | | | | | | | | | | * lisp/vc/vc-hooks.el (vc-use-short-revision): New variable. (vc-short-revision): New function. * lisp/vc/vc-annotate.el (vc-annotate-use-short-revision): New option... (vc-annotate): ... use it. * lisp/vc/vc-git.el (vc-git--rev-parse): Consult 'vc-use-short-revision'. * etc/NEWS: Announce this change (bug#67062).
* ; * doc/misc/eglot.texi (Performance): Fix a typo.Eli Zaretskii2023-12-271-1/+1
|
* Eglot: experimental support for Eglot-only subprojectsJoão Távora2023-12-271-19/+29
| | | | | | | | | | * lisp/progmodes/eglot.el (eglot-alternatives) (eglot-server-programs): : Rework docstring. (eglot--guess-contact): Pass project to eglot-server-programs function. (project-root): Define for new experimental Eglot project type. Github-reference: https://github.com/joaotavora/eglot/discussions/1337
* Eglot: bump to 1.16João Távora2023-12-273-21/+55
| | | | | | | * etc/EGLOT-NEWS: Update. * lisp/progmodes/eglot.el (Version): Bump to 1.15 (Package-Requires): Bump jsonrpc depedency to 1.23
* Eglot: fix typoJoão Távora2023-12-271-1/+2
| | | | * lisp/progmodes/eglot.el (eglot--guess-contact): Fix typo.
* Eglot: introduce eglot-events-buffer-configJoão Távora2023-12-272-24/+40
| | | | | | | | | * doc/misc/eglot.texi (Eglot Variables): Reword. (Performance): Reword. * lisp/progmodes/eglot.el (eglot-events-buffer-size): Obsolete. (eglot-events-buffer-config): New customization variable. (eglot--connect): Use eglot-events-buffer-config.
* Jsonrpc: bump to 1.0.23João Távora2023-12-271-1/+1
| | | | * lisp/jsonrpc.el (Version): Bump to 1.0.23
* Revert e8df6c311fcf59bf23d31b9db2bb8fec9d78fbe7Yuan Fu2023-12-261-4/+7
|
* Fix Tramp error in project-find-fileDmitry Gutov2023-12-271-8/+9
| | | | | * lisp/progmodes/project.el (project--read-file-cpd-relative): Avoid new Tramp connections (bug#68041).
* Revert "Eglot: Make 'try-completion' less broken"João Távora2023-12-261-4/+3
| | | | | | | | This reverts commit 4dcbf61c1518dc53061707aeff8887517e050003. It's not correct, breaks tests. I declare it impossible to make C-M-i use of 'try-completion' behave sanely with LSP in its current state. YMMV. Use a completion tooltip, like Company.
* Eglot: Make 'try-completion' less brokenJoão Távora2023-12-261-3/+4
| | | | | | | | | | | | | | | | | | The 'try-completion' completion operation, used mostly in vanilla 'completion-at-point' invoked with C-M-i is close to impossible to get right in LSP because of the arbitrary edits handled in ':exit-function'. When this operation is invoked on the table, returning the pattern argument unchanged somehow (TM) makes a sole completion show the *Completions* buffer, where selecting it will recover context necessary for `:exit-function' and call that function. It doesn't break any other cases I know, and that's good enough for now. https://github.com/joaotavora/eglot/issues/1339 * lisp/progmodes/eglot.el (eglot-completion-at-point): Return pattern when 'try-completion' is invoked.
* ; * src/ftfont.c (ftfont_glyph_metrics): Comment on advance rounding.Po Lu2023-12-261-0/+6
|
* Consistently round glyph advances in the SFNT font backendPo Lu2023-12-262-7/+12
| | | | | | | | | | | * src/sfnt.h (SFNT_ROUND_FIXED): New macro. * src/sfntfont.c (sfntfont_get_glyph_outline): Don't apply advance width distortion before the glyph is instructed or decomposed. Round advance width as measured between both phantom points subsequent to instruction code execution. (sfntfont_draw): Don't take the advance's ceiling when advancing origin point.
* Eglot: partial fix for middle-of-symbol completionsJoão Távora2023-12-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/progmodes/eglot.el (eglot-completion-at-point): Fix completion reversion in :exit-function. In a rust-ts-mode buffer such as this main.rs file fn main() { let v: usize = 1; v.c<cursor-here>1234.1234567890 } the server wants to edit the line to read, after C-M-i and selecting "count_ones" v.count_ones<cursor-here>.1234567890 But it couldn't apply the edit to the correct initial state because that state wasn't correctly restored. This commit fixes that. However, if the initial state is v.count_on1234.1234567890 then completion still fails, because the 'try-completion' call in eglot-completion-at-point will just return complete to "count_ones" and Emacs doesn't consider this a completion "exit", so it'll completely ignore the exit function. I think 'try-completion' (and 'test-completion') simply can't be used here (for one, they obey styles, and styles are off-limits in LSP), but I'll leave that for another commit. Github-reference: https://github.com/joaotavora/eglot/issues/1339
* Add Python to `recentf-arrange-rules`Stefan Kangas2023-12-251-6/+12
| | | | * lisp/recentf.el (recentf-arrange-rules): Add rule for Python.
* Apply TTF advance width rounding to uninstructed glyphsPo Lu2023-12-252-12/+16
| | | | | | | | | * src/sfnt.c (sfnt_scale_metrics): * src/sfntfont.c (sfntfont_get_glyph_outline): Round advance and floor lbearing scaling glyph metrics. (sfntfont_measure_pcm): Don't round or truncate metrics which have already been.
* Optimize font edge filling loopPo Lu2023-12-251-54/+33
| | | | | | | * src/sfnt.c (sfnt_fedge_sort): Delete function. (sfnt_poly_edges_exact): Don't sort edges, iterate through each instead. (main): Adjust tests.
* Fix ses-formula-recordVincent Belaïche2023-12-241-14/+13
| | | | | | | | * lisp/ses.el (ses-is-cell-sym-p): Tighten test with checking argument is a local variable. (ses-formula-record): Fix definition. (ses-rename-cell): Loosen test on new-name, conversely to 'ses-is-cell-sym-p' tightening.
* Fix test about need for explicit printing inserted linesVincent Belaïche2023-12-241-9/+19
| | | | | | | | | | * lisp/ses.el (ses--blank-line-needs-printing-p): New function. Does not consider that printer `nil' produces a non empty string, as `ses-print-cell' removes nil printer by oring to fallback. (ses-insert-row): Replace the complex and erroneous test about blank newline needing printing by a call to 'ses--blank-line-needs-printing-p'.
* More doc on ses+ and argument orderVincent Belaïche2023-12-241-1/+6
| | | | | * doc/misc/ses.texi (Standard formula functions): Indicate that 'ses+' reverses argument order.
* * src/eval.c (signal_or_quit): Fix naming inconsistency with docsStefan Monnier2023-12-241-2/+2
| | | | | | The var's docstring and etc/NEWS refer to "*Redisplay-trace*", so better use that (which is also more in line with usual practice of Emacs buffer names).
* checkdoc: Avoid false positive for keybinding in docstringStefan Kangas2023-12-242-2/+14
| | | | | | | | * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine): Avoid false positive when a variable contains a keybinding (for example, "C-g"). (Bug#68002) * test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-docstring-avoid-false-positive-ok): New test.
* Make stty settings configurable in Tramp's make-processMichael Albinus2023-12-241-6/+24
| | | | | * lisp/net/tramp-sh.el (tramp-pipe-stty-settings): New defcustom. (tramp-sh-handle-make-process): Use it. (Bug#62093)
* Fix toolbar for Log Edit modeEli Zaretskii2023-12-242-16/+11
| | | | | | | * lisp/vc/log-edit.el (log-edit-tool-bar-map): Fix buttons and help messages. * etc/images/README (Files): Fix whitespace.
* ; * src/eval.c (Fdefvar): Doc fix (bug#67991).Eli Zaretskii2023-12-241-2/+8
|
* Introduce a toolbar for Log Edit modePo Lu2023-12-2413-4/+575
| | | | | | | | | | | | | | | | | | | | | * etc/NEWS: Announce new change. * etc/images/README: List the sources of the new image files. * etc/images/commit.xpm: * etc/images/commit.pbm: * etc/images/gen-changelog.xpm: * etc/images/gen-changelog.pbm: * etc/images/ins-changelog.xpm: * etc/images/ins-changelog.pbm: * etc/images/load-changelog.xpm: * etc/images/load-changelog.pbm: * etc/images/view-diff.xpm: New files. * lisp/vc/log-edit.el (log-edit-menu): Insert a menu item for "Generate ChangeLog". (log-edit-tool-bar-map): New keymap. (log-edit-mode): Install this keymap as the tool bar map.
* jit-lock-force-redisplay: Make it workDmitry Gutov2023-12-231-0/+1
| | | | | * lisp/jit-lock.el (jit-lock-force-redisplay): Make sure the buffer change is really performed (bug#66732).
* Optionally continue on error in erc-auth-source-searchF. Jason Park2023-12-232-8/+44
| | | | | | | | | | | * doc/misc/erc.texi (auth-source): Add new "Troubleshooting" subsection. * lisp/erc/erc.el (erc-open): Initialize markers before determining session parameters. Otherwise, functions that rely on `erc-inset-marker' being non-nil, like `erc-check-text-conversion', may fail during auth-source lookups. (erc-auth-source-search): When non-interactive, ask the user whether to continue connecting anyway. (Bug#67978)
* Fix overlapping logs from erc-truncate-buffer-on-saveF. Jason Park2023-12-235-13/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-button.el (erc-button--display-error-notice-with-keys): Currently, internal "error notices" do not have timestamps. However, this causes alignment issues for non-`fill-wrap' users of left-sided stamps. The heuristic used by this change for detecting such stamps is weak and prone to false negatives. * lisp/erc/erc-log.el (erc-log-mode, erc-log-enable): Set explicit depth for `erc--pre-clear-functions' to 50. (erc-save-buffer-in-logs): Fix partial regression in which redundant text would appear in logs that have undergone truncation via an interactive call to this command when the deprecated option `erc-truncate-on-save' is non-nil. * lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-enable): Set depth for `erc--pre-clear-functions' to 40. (erc-stamp--reset-on-clear): Only add `erc-stamp--insert-date-hook' when `erc-stamp--date-mode' is active. * lisp/erc/erc.el (erc-cmd-CLEAR): Rework to honor but improve upon the old behavior when called from lisp. Do this by attempting to find the beginning of the current message and excluding it from the truncated portion of the buffer. A NEWS entry describing this behavior already exists for 5.6. * test/lisp/erc/erc-scenarios-log.el (erc-scenarios-log--save-buffer-in-logs/truncate-on-save): New test. These changes originate from bug#60936.
* Replace some uses of erc-errorF. Jason Park2023-12-238-53/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/erc/erc-button.el (erc-button--display-error-notice-with-keys-and-warn): Use `erc--lwarn' so the warnings buffer is overridable for testing. * lisp/erc/erc-sasl.el (erc-sasl-mode, erc-sasl-enable): Signal an `error' instead of calling `erc-error', which continues execution. In this special case, the session cannot continue initializing, since connection registration can't reasonably be expected to complete successfully. (erc-sasl--destroy): Don't run `erc-quit-hook', and issue a warning of level `:error' to get users' attention instead of calling `ding'. * lisp/erc/erc-speedbar.el (erc-speedbar--emulate-sidebar-set-window-preserve-size): Don't set window parameters. Doing this basically made `erc-speedbar-toggle-nicknames-window-lock' unusable. (erc-speedbar--toggle-nicknames-sidebar): Manually unlock the window after toggling. (erc-nickbar-mode, erc-nickbar-enable, erc-nickbar-disable): Don't `ding' when called in a non-ERC buffer, and make sure to call `erc-speedbar--ensure' from an ERC buffer. Also, don't disable minor-mode var when speedbar buffer doesn't exist because that doesn't ensure it'll be created the next time around, and users may count on the activation state remaining consistent. (erc-speedbar-toggle-nicknames-window-lock): Make usable from lisp with explicit numeric arg. * lisp/erc/erc-status-sidebar.el (erc-bufbar-mode, erc-bufbar-enable): Only create the side window from an erc-mode buffer to ensure the ratio is preserved when burying the current buffer, e.g., with `custom-buffer-done'. * lisp/erc/erc.el (erc--warnings-buffer-name, erc--lwarn): New function, an analog of `lwarn', that allows for overriding the warnings buffer with the new variable `erc--warnings-buffer-name'. (erc-cmd-SERVER): Add comment. * test/lisp/erc/erc-scenarios-sasl.el (erc-scenarios-sasl--plain-fail): Expect warning instead of error. * test/lisp/erc/erc-scenarios-status-sidebar.el (erc-scenarios-status-sidebar--bufbar): Refresh when interactive as well. * test/lisp/erc/resources/sasl/plain-failed.eld: Expect EOF instead of "CAP END". (Bug#63595)
* Populate erc--msg-prop-overrides for CTCP repliesF. Jason Park2023-12-232-31/+32
| | | | | | | | | | | * lisp/erc/erc-backend.el (erc-server-PRIVMSG): Don't set string intended for insertion to the undefined return value of `erc-process-ctcp-reply' and `erc-process-ctcp-query'. Rework control flow slightly for clarity. * lisp/erc/erc.el (erc-process-ctcp-reply): Bind `erc--msg-prop-overrides' and populate with `erc--ctcp' and `erc--cmd' "msg props" for the benefit of `erc-display-message' calls made by the various CTCP reply handlers. (Bug#67677)
* ; Fix some doc strings in ERCF. Jason Park2023-12-233-9/+10
| | | | | | | | * lisp/erc/erc-networks.el: Lose some unneeded forward declarations. * lisp/erc/erc.el (erc-open-socks-tls-stream): Don't conflate SOCKS with TOR by mentioning a ".onion" address for the `host' parameter. * test/lisp/erc/erc-tests.el (erc--check-prompt-input-for-multiline-blanks): Extend timeout.