* lisp/emacs-lisp/debug.el (debugger-setup-buffer): Put point on the
previous line. (debugger-eval-expression, debugger-record-expression): Use read--expression (bug#15102). Fixes: debbugs:15101
This commit is contained in:
parent
a5b5f73f32
commit
10fa0ed328
2 changed files with 51 additions and 41 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-08-15 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* emacs-lisp/debug.el (debugger-setup-buffer): Put point on the
|
||||
previous line (bug#15101).
|
||||
(debugger-eval-expression, debugger-record-expression):
|
||||
Use read--expression (bug#15102).
|
||||
|
||||
2013-08-15 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
Remove byte compiler warnings, visible when compiling with
|
||||
|
@ -20,8 +27,8 @@
|
|||
(tramp-flush-connection-property, tramp-list-connections)
|
||||
(tramp-parse-connection-properties): Prefix unused arguments with "_".
|
||||
|
||||
* net/tramp-compat.el (tramp-compat-make-temp-file): Rename
|
||||
FILENAME to F.
|
||||
* net/tramp-compat.el (tramp-compat-make-temp-file):
|
||||
Rename FILENAME to F.
|
||||
|
||||
* net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
|
||||
(tramp-gvfs-handle-write-region, tramp-bluez-parse-device-names)
|
||||
|
|
|
@ -288,33 +288,41 @@ That buffer should be current already."
|
|||
(insert "Debugger entered")
|
||||
;; lambda is for debug-on-call when a function call is next.
|
||||
;; debug is for debug-on-entry function called.
|
||||
(pcase (car args)
|
||||
((or `lambda `debug)
|
||||
(insert "--entering a function:\n"))
|
||||
;; Exiting a function.
|
||||
(`exit
|
||||
(insert "--returning value: ")
|
||||
(setq debugger-value (nth 1 args))
|
||||
(prin1 debugger-value (current-buffer))
|
||||
(insert ?\n)
|
||||
(delete-char 1)
|
||||
(insert ? )
|
||||
(beginning-of-line))
|
||||
;; Debugger entered for an error.
|
||||
(`error
|
||||
(insert "--Lisp error: ")
|
||||
(prin1 (nth 1 args) (current-buffer))
|
||||
(insert ?\n))
|
||||
;; debug-on-call, when the next thing is an eval.
|
||||
(`t
|
||||
(insert "--beginning evaluation of function call form:\n"))
|
||||
;; User calls debug directly.
|
||||
(_
|
||||
(insert ": ")
|
||||
(prin1 (if (eq (car args) 'nil)
|
||||
(cdr args) args)
|
||||
(current-buffer))
|
||||
(insert ?\n)))
|
||||
(let ((pos (point)))
|
||||
(pcase (car args)
|
||||
((or `lambda `debug)
|
||||
(insert "--entering a function:\n")
|
||||
(setq pos (1- (point))))
|
||||
;; Exiting a function.
|
||||
(`exit
|
||||
(insert "--returning value: ")
|
||||
(setq pos (point))
|
||||
(setq debugger-value (nth 1 args))
|
||||
(prin1 debugger-value (current-buffer))
|
||||
(insert ?\n)
|
||||
(delete-char 1)
|
||||
(insert ? )
|
||||
(beginning-of-line))
|
||||
;; Debugger entered for an error.
|
||||
(`error
|
||||
(insert "--Lisp error: ")
|
||||
(setq pos (point))
|
||||
(prin1 (nth 1 args) (current-buffer))
|
||||
(insert ?\n))
|
||||
;; debug-on-call, when the next thing is an eval.
|
||||
(`t
|
||||
(insert "--beginning evaluation of function call form:\n")
|
||||
(setq pos (1- (point))))
|
||||
;; User calls debug directly.
|
||||
(_
|
||||
(insert ": ")
|
||||
(setq pos (point))
|
||||
(prin1 (if (eq (car args) 'nil)
|
||||
(cdr args) args)
|
||||
(current-buffer))
|
||||
(insert ?\n)))
|
||||
;; Place point on "stack frame 0" (bug#15101).
|
||||
(goto-char pos))
|
||||
;; After any frame that uses eval-buffer,
|
||||
;; insert a line that states the buffer position it's reading at.
|
||||
(save-excursion
|
||||
|
@ -533,16 +541,15 @@ Applies to the frame whose line point is on in the backtrace."
|
|||
(progn ,@body)
|
||||
(setq debugger-outer-match-data (match-data)))))
|
||||
|
||||
(defun debugger-eval-expression (exp)
|
||||
(defun debugger-eval-expression (exp &optional nframe)
|
||||
"Eval an expression, in an environment like that outside the debugger.
|
||||
The environment used is the one when entering the activation frame at point."
|
||||
(interactive
|
||||
(list (read-from-minibuffer "Eval: "
|
||||
nil read-expression-map t
|
||||
'read-expression-history)))
|
||||
(let ((nframe (condition-case nil (1+ (debugger-frame-number 'skip-base))
|
||||
(error 0))) ;; If on first line.
|
||||
(base (if (eq 'debug--implement-debug-on-entry
|
||||
(list (read--expression "Eval in stack frame: ")))
|
||||
(let ((nframe (or nframe
|
||||
(condition-case nil (1+ (debugger-frame-number 'skip-base))
|
||||
(error 0)))) ;; If on first line.
|
||||
(base (if (eq 'debug--implement-debug-on-entry
|
||||
(cadr (backtrace-frame 1 'debug)))
|
||||
'debug--implement-debug-on-entry 'debug)))
|
||||
(debugger-env-macro
|
||||
|
@ -651,11 +658,7 @@ Complete list of commands:
|
|||
(defun debugger-record-expression (exp)
|
||||
"Display a variable's value and record it in `*Backtrace-record*' buffer."
|
||||
(interactive
|
||||
(list (read-from-minibuffer
|
||||
"Record Eval: "
|
||||
nil
|
||||
read-expression-map t
|
||||
'read-expression-history)))
|
||||
(list (read--expression "Record Eval: ")))
|
||||
(let* ((buffer (get-buffer-create debugger-record-buffer))
|
||||
(standard-output buffer))
|
||||
(princ (format "Debugger Eval (%s): " exp))
|
||||
|
|
Loading…
Add table
Reference in a new issue