diff options
| author | Stefan Monnier | 2013-08-15 13:21:19 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-08-15 13:21:19 -0400 |
| commit | 10fa0ed32868f8a1c6efb68a8f2d47fec88d9064 (patch) | |
| tree | 995a0156cb0f85017d218b7833f451c373bd74bb | |
| parent | a5b5f73f32a8af8a45a252ed13a381d7526ad1b7 (diff) | |
| download | emacs-10fa0ed32868f8a1c6efb68a8f2d47fec88d9064.tar.gz emacs-10fa0ed32868f8a1c6efb68a8f2d47fec88d9064.zip | |
* 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
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/emacs-lisp/debug.el | 81 |
2 files changed, 51 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bcab8de10a4..9119b34d52c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-08-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/debug.el (debugger-setup-buffer): Put point on the | ||
| 4 | previous line (bug#15101). | ||
| 5 | (debugger-eval-expression, debugger-record-expression): | ||
| 6 | Use read--expression (bug#15102). | ||
| 7 | |||
| 1 | 2013-08-15 Michael Albinus <michael.albinus@gmx.de> | 8 | 2013-08-15 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 9 | ||
| 3 | Remove byte compiler warnings, visible when compiling with | 10 | Remove byte compiler warnings, visible when compiling with |
| @@ -20,8 +27,8 @@ | |||
| 20 | (tramp-flush-connection-property, tramp-list-connections) | 27 | (tramp-flush-connection-property, tramp-list-connections) |
| 21 | (tramp-parse-connection-properties): Prefix unused arguments with "_". | 28 | (tramp-parse-connection-properties): Prefix unused arguments with "_". |
| 22 | 29 | ||
| 23 | * net/tramp-compat.el (tramp-compat-make-temp-file): Rename | 30 | * net/tramp-compat.el (tramp-compat-make-temp-file): |
| 24 | FILENAME to F. | 31 | Rename FILENAME to F. |
| 25 | 32 | ||
| 26 | * net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch) | 33 | * net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch) |
| 27 | (tramp-gvfs-handle-write-region, tramp-bluez-parse-device-names) | 34 | (tramp-gvfs-handle-write-region, tramp-bluez-parse-device-names) |
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index aee48eef668..709a094e73b 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el | |||
| @@ -288,33 +288,41 @@ That buffer should be current already." | |||
| 288 | (insert "Debugger entered") | 288 | (insert "Debugger entered") |
| 289 | ;; lambda is for debug-on-call when a function call is next. | 289 | ;; lambda is for debug-on-call when a function call is next. |
| 290 | ;; debug is for debug-on-entry function called. | 290 | ;; debug is for debug-on-entry function called. |
| 291 | (pcase (car args) | 291 | (let ((pos (point))) |
| 292 | ((or `lambda `debug) | 292 | (pcase (car args) |
| 293 | (insert "--entering a function:\n")) | 293 | ((or `lambda `debug) |
| 294 | ;; Exiting a function. | 294 | (insert "--entering a function:\n") |
| 295 | (`exit | 295 | (setq pos (1- (point)))) |
| 296 | (insert "--returning value: ") | 296 | ;; Exiting a function. |
| 297 | (setq debugger-value (nth 1 args)) | 297 | (`exit |
| 298 | (prin1 debugger-value (current-buffer)) | 298 | (insert "--returning value: ") |
| 299 | (insert ?\n) | 299 | (setq pos (point)) |
| 300 | (delete-char 1) | 300 | (setq debugger-value (nth 1 args)) |
| 301 | (insert ? ) | 301 | (prin1 debugger-value (current-buffer)) |
| 302 | (beginning-of-line)) | 302 | (insert ?\n) |
| 303 | ;; Debugger entered for an error. | 303 | (delete-char 1) |
| 304 | (`error | 304 | (insert ? ) |
| 305 | (insert "--Lisp error: ") | 305 | (beginning-of-line)) |
| 306 | (prin1 (nth 1 args) (current-buffer)) | 306 | ;; Debugger entered for an error. |
| 307 | (insert ?\n)) | 307 | (`error |
| 308 | ;; debug-on-call, when the next thing is an eval. | 308 | (insert "--Lisp error: ") |
| 309 | (`t | 309 | (setq pos (point)) |
| 310 | (insert "--beginning evaluation of function call form:\n")) | 310 | (prin1 (nth 1 args) (current-buffer)) |
| 311 | ;; User calls debug directly. | 311 | (insert ?\n)) |
| 312 | (_ | 312 | ;; debug-on-call, when the next thing is an eval. |
| 313 | (insert ": ") | 313 | (`t |
| 314 | (prin1 (if (eq (car args) 'nil) | 314 | (insert "--beginning evaluation of function call form:\n") |
| 315 | (cdr args) args) | 315 | (setq pos (1- (point)))) |
| 316 | (current-buffer)) | 316 | ;; User calls debug directly. |
| 317 | (insert ?\n))) | 317 | (_ |
| 318 | (insert ": ") | ||
| 319 | (setq pos (point)) | ||
| 320 | (prin1 (if (eq (car args) 'nil) | ||
| 321 | (cdr args) args) | ||
| 322 | (current-buffer)) | ||
| 323 | (insert ?\n))) | ||
| 324 | ;; Place point on "stack frame 0" (bug#15101). | ||
| 325 | (goto-char pos)) | ||
| 318 | ;; After any frame that uses eval-buffer, | 326 | ;; After any frame that uses eval-buffer, |
| 319 | ;; insert a line that states the buffer position it's reading at. | 327 | ;; insert a line that states the buffer position it's reading at. |
| 320 | (save-excursion | 328 | (save-excursion |
| @@ -533,16 +541,15 @@ Applies to the frame whose line point is on in the backtrace." | |||
| 533 | (progn ,@body) | 541 | (progn ,@body) |
| 534 | (setq debugger-outer-match-data (match-data))))) | 542 | (setq debugger-outer-match-data (match-data))))) |
| 535 | 543 | ||
| 536 | (defun debugger-eval-expression (exp) | 544 | (defun debugger-eval-expression (exp &optional nframe) |
| 537 | "Eval an expression, in an environment like that outside the debugger. | 545 | "Eval an expression, in an environment like that outside the debugger. |
| 538 | The environment used is the one when entering the activation frame at point." | 546 | The environment used is the one when entering the activation frame at point." |
| 539 | (interactive | 547 | (interactive |
| 540 | (list (read-from-minibuffer "Eval: " | 548 | (list (read--expression "Eval in stack frame: "))) |
| 541 | nil read-expression-map t | 549 | (let ((nframe (or nframe |
| 542 | 'read-expression-history))) | 550 | (condition-case nil (1+ (debugger-frame-number 'skip-base)) |
| 543 | (let ((nframe (condition-case nil (1+ (debugger-frame-number 'skip-base)) | 551 | (error 0)))) ;; If on first line. |
| 544 | (error 0))) ;; If on first line. | 552 | (base (if (eq 'debug--implement-debug-on-entry |
| 545 | (base (if (eq 'debug--implement-debug-on-entry | ||
| 546 | (cadr (backtrace-frame 1 'debug))) | 553 | (cadr (backtrace-frame 1 'debug))) |
| 547 | 'debug--implement-debug-on-entry 'debug))) | 554 | 'debug--implement-debug-on-entry 'debug))) |
| 548 | (debugger-env-macro | 555 | (debugger-env-macro |
| @@ -651,11 +658,7 @@ Complete list of commands: | |||
| 651 | (defun debugger-record-expression (exp) | 658 | (defun debugger-record-expression (exp) |
| 652 | "Display a variable's value and record it in `*Backtrace-record*' buffer." | 659 | "Display a variable's value and record it in `*Backtrace-record*' buffer." |
| 653 | (interactive | 660 | (interactive |
| 654 | (list (read-from-minibuffer | 661 | (list (read--expression "Record Eval: "))) |
| 655 | "Record Eval: " | ||
| 656 | nil | ||
| 657 | read-expression-map t | ||
| 658 | 'read-expression-history))) | ||
| 659 | (let* ((buffer (get-buffer-create debugger-record-buffer)) | 662 | (let* ((buffer (get-buffer-create debugger-record-buffer)) |
| 660 | (standard-output buffer)) | 663 | (standard-output buffer)) |
| 661 | (princ (format "Debugger Eval (%s): " exp)) | 664 | (princ (format "Debugger Eval (%s): " exp)) |