diff options
| author | Jim Porter | 2023-08-29 17:02:40 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-08-31 18:42:03 -0700 |
| commit | ccb62321d234993a66287c4e1a3cfdea63d140ff (patch) | |
| tree | 7ffd2b146ef96a19522ae701586fa82b73ddc680 /lisp/eshell/em-basic.el | |
| parent | 17188e07ab9084f8d25dedcb784957a461348fa9 (diff) | |
| download | emacs-ccb62321d234993a66287c4e1a3cfdea63d140ff.tar.gz emacs-ccb62321d234993a66287c4e1a3cfdea63d140ff.zip | |
Fix handling of Eshell debug modes
Previously, these were enabled/disabled at byte-compilation time, but
we want to control them at runtime.
* lisp/eshell/esh-cmd.el (eshell-eval-command): Call
'eshell-debug-command-start'.
(eshell-manipulate): Check 'eshell-debug-command' at runtime. Update
callers.
(eshell-debug-command): Move to "esh-util.el".
(eshell/eshell-debug, pcomplate/eshell-mode/eshell-debug): Move to
"em-basic.el".
(eshell-debug-show-parsed-args): Update implementation.
* lisp/eshell/esh-util.el (eshell-debug-command): Move from
"esh-cmd.el" and convert to a list.
(eshell-debug-command-buffer): New variable.
(eshell-condition-case): Check 'eshell-handle-errors' at runtime.
(eshell-debug-command-start): New function.
(eshell-debug-command): Move from "esh-cmd.el" and convert to a macro.
* lisp/eshell/em-basic.el (eshell/eshell-debug)
(pcomplete/eshell-mode/eshell-debug): Move from "esh-cmd.el" and
reimplement.
* lisp/eshell/eshell.el (eshell-command): Pass the original input to
'eshell-eval-command'.
* doc/misc/eshell.texi (Built-ins): Update documentation for
'eshell-debug'.
Diffstat (limited to 'lisp/eshell/em-basic.el')
| -rw-r--r-- | lisp/eshell/em-basic.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el index 016afe811b2..554ee83b015 100644 --- a/lisp/eshell/em-basic.el +++ b/lisp/eshell/em-basic.el | |||
| @@ -188,6 +188,37 @@ or `eshell-printn' for display." | |||
| 188 | 188 | ||
| 189 | (put 'eshell/umask 'eshell-no-numeric-conversions t) | 189 | (put 'eshell/umask 'eshell-no-numeric-conversions t) |
| 190 | 190 | ||
| 191 | (defun eshell/eshell-debug (&rest args) | ||
| 192 | "A command for toggling certain debug variables." | ||
| 193 | (eshell-eval-using-options | ||
| 194 | "eshell-debug" args | ||
| 195 | '((?h "help" nil nil "display this usage message") | ||
| 196 | :usage "[KIND]... | ||
| 197 | This command is used to aid in debugging problems related to Eshell | ||
| 198 | itself. It is not useful for anything else. The recognized `kinds' | ||
| 199 | are: | ||
| 200 | |||
| 201 | error stops Eshell from trapping errors | ||
| 202 | form shows command form manipulation in `*eshell last cmd*'") | ||
| 203 | (if args | ||
| 204 | (dolist (kind args) | ||
| 205 | (if (equal kind "error") | ||
| 206 | (setq eshell-handle-errors (not eshell-handle-errors)) | ||
| 207 | (let ((kind-sym (intern kind))) | ||
| 208 | (if (memq kind-sym eshell-debug-command) | ||
| 209 | (setq eshell-debug-command | ||
| 210 | (delq kind-sym eshell-debug-command)) | ||
| 211 | (push kind-sym eshell-debug-command))))) | ||
| 212 | ;; Output the currently-enabled debug kinds. | ||
| 213 | (unless eshell-handle-errors | ||
| 214 | (eshell-print "errors\n")) | ||
| 215 | (dolist (kind eshell-debug-command) | ||
| 216 | (eshell-printn (symbol-name kind)))))) | ||
| 217 | |||
| 218 | (defun pcomplete/eshell-mode/eshell-debug () | ||
| 219 | "Completion for the `debug' command." | ||
| 220 | (while (pcomplete-here '("error" "form")))) | ||
| 221 | |||
| 191 | (provide 'em-basic) | 222 | (provide 'em-basic) |
| 192 | 223 | ||
| 193 | ;; Local Variables: | 224 | ;; Local Variables: |