aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-01-13 21:51:52 -0500
committerStefan Monnier2014-01-13 21:51:52 -0500
commitfd7fde15900b3dec3f2ecc9ad4f5a99b4a0e79f6 (patch)
tree71f9c4efbb9d5095f51cf2156583324ec93308fe
parentd1eaf34b2f6775dcefb8f299e0613c47bce736d8 (diff)
downloademacs-fd7fde15900b3dec3f2ecc9ad4f5a99b4a0e79f6.tar.gz
emacs-fd7fde15900b3dec3f2ecc9ad4f5a99b4a0e79f6.zip
* lisp/emacs-lisp/edebug.el (edebug--display): Move protective let-binding
so it applies in the right buffer. Fixes: debbugs:16410
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/edebug.el265
2 files changed, 139 insertions, 131 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bd194393fef..b9cd0f3aa07 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12014-01-14 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/edebug.el (edebug--display): Move protective let-binding
4 so it applies in the right buffer (bug#16410).
5
12014-01-13 Daniel Colascione <dancol@dancol.org> 62014-01-13 Daniel Colascione <dancol@dancol.org>
2 7
3 * textmodes/rst.el (rst-define-key): Provide deprecated 8 * textmodes/rst.el (rst-define-key): Provide deprecated
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 3329a8601bc..bb5f4baf9f9 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -2405,9 +2405,7 @@ MSG is printed after `::::} '."
2405 (edebug-outside-d-c-i-n-s-w 2405 (edebug-outside-d-c-i-n-s-w
2406 (default-value 'cursor-in-non-selected-windows))) 2406 (default-value 'cursor-in-non-selected-windows)))
2407 (unwind-protect 2407 (unwind-protect
2408 (let ((overlay-arrow-position overlay-arrow-position) 2408 (let ((cursor-in-echo-area nil)
2409 (overlay-arrow-string overlay-arrow-string)
2410 (cursor-in-echo-area nil)
2411 (unread-command-events nil) 2409 (unread-command-events nil)
2412 ;; any others?? 2410 ;; any others??
2413 ) 2411 )
@@ -2468,136 +2466,141 @@ MSG is printed after `::::} '."
2468 (edebug-stop) 2466 (edebug-stop)
2469 ;; (discard-input) ; is this unfriendly?? 2467 ;; (discard-input) ; is this unfriendly??
2470 )) 2468 ))
2471 ;; Now display arrow based on mode.
2472 (edebug-overlay-arrow)
2473 2469
2474 (cond 2470 ;; Make sure we bind those in the right buffer (bug#16410).
2475 ((eq 'error arg-mode) 2471 (let ((overlay-arrow-position overlay-arrow-position)
2476 ;; Display error message 2472 (overlay-arrow-string overlay-arrow-string))
2477 (setq edebug-execution-mode 'step) 2473 ;; Now display arrow based on mode.
2478 (edebug-overlay-arrow) 2474 (edebug-overlay-arrow)
2479 (beep)
2480 (if (eq 'quit (car value))
2481 (message "Quit")
2482 (edebug-report-error value)))
2483 (edebug-break
2484 (cond
2485 (edebug-global-break
2486 (message "Global Break: %s => %s"
2487 edebug-global-break-condition
2488 edebug-global-break-result))
2489 (edebug-break-condition
2490 (message "Break: %s => %s"
2491 edebug-break-condition
2492 edebug-break-result))
2493 ((not (eq edebug-execution-mode 'Continue-fast))
2494 (message "Break"))
2495 (t)))
2496
2497 (t (message "")))
2498
2499 (if (eq 'after arg-mode)
2500 (progn
2501 ;; Display result of previous evaluation.
2502 (if (and edebug-break
2503 (not (eq edebug-execution-mode 'Continue-fast)))
2504 (sit-for edebug-sit-for-seconds)) ; Show message.
2505 (edebug-previous-result)))
2506 2475
2507 (cond 2476 (cond
2508 (edebug-break 2477 ((eq 'error arg-mode)
2509 (cond 2478 ;; Display error message
2510 ((eq edebug-execution-mode 'continue) 2479 (setq edebug-execution-mode 'step)
2511 (sit-for edebug-sit-for-seconds)) 2480 (edebug-overlay-arrow)
2512 ((eq edebug-execution-mode 'Continue-fast) (sit-for 0)) 2481 (beep)
2513 (t (setq edebug-stop t)))) 2482 (if (eq 'quit (car value))
2514 ;; not edebug-break 2483 (message "Quit")
2515 ((eq edebug-execution-mode 'trace) 2484 (edebug-report-error value)))
2516 (sit-for edebug-sit-for-seconds)) ; Force update and pause. 2485 (edebug-break
2517 ((eq edebug-execution-mode 'Trace-fast) 2486 (cond
2518 (sit-for 0))) ; Force update and continue. 2487 (edebug-global-break
2519 2488 (message "Global Break: %s => %s"
2520 (unwind-protect 2489 edebug-global-break-condition
2521 (if (or edebug-stop 2490 edebug-global-break-result))
2522 (memq edebug-execution-mode '(step next)) 2491 (edebug-break-condition
2523 (eq arg-mode 'error)) 2492 (message "Break: %s => %s"
2524 (progn 2493 edebug-break-condition
2525 ;; (setq edebug-execution-mode 'step) 2494 edebug-break-result))
2526 ;; (edebug-overlay-arrow) ; This doesn't always show up. 2495 ((not (eq edebug-execution-mode 'Continue-fast))
2527 (edebug--recursive-edit arg-mode))) ; <----- Recursive edit 2496 (message "Break"))
2528 2497 (t)))
2529 ;; Reset the edebug-window-data to whatever it is now. 2498
2530 (let ((window (if (eq (window-buffer) edebug-buffer) 2499 (t (message "")))
2531 (selected-window) 2500
2532 (get-buffer-window edebug-buffer)))) 2501 (if (eq 'after arg-mode)
2533 ;; Remember window-start for edebug-buffer, if still displayed. 2502 (progn
2534 (if window 2503 ;; Display result of previous evaluation.
2535 (progn 2504 (if (and edebug-break
2536 (setcar edebug-window-data window) 2505 (not (eq edebug-execution-mode 'Continue-fast)))
2537 (setcdr edebug-window-data (window-start window))))) 2506 (sit-for edebug-sit-for-seconds)) ; Show message.
2538 2507 (edebug-previous-result)))
2539 ;; Save trace window point before restoring outside windows. 2508
2540 ;; Could generalize this for other buffers. 2509 (cond
2541 (setq edebug-trace-window (get-buffer-window edebug-trace-buffer)) 2510 (edebug-break
2542 (if edebug-trace-window 2511 (cond
2543 (setq edebug-trace-window-start 2512 ((eq edebug-execution-mode 'continue)
2544 (and edebug-trace-window 2513 (sit-for edebug-sit-for-seconds))
2545 (window-start edebug-trace-window)))) 2514 ((eq edebug-execution-mode 'Continue-fast) (sit-for 0))
2546 2515 (t (setq edebug-stop t))))
2547 ;; Restore windows before continuing. 2516 ;; not edebug-break
2548 (if edebug-save-windows 2517 ((eq edebug-execution-mode 'trace)
2549 (progn 2518 (sit-for edebug-sit-for-seconds)) ; Force update and pause.
2550 (edebug-set-windows edebug-outside-windows) 2519 ((eq edebug-execution-mode 'Trace-fast)
2551 2520 (sit-for 0))) ; Force update and continue.
2552 ;; Restore displayed buffer points. 2521
2553 ;; Needed even if restoring windows because 2522 (unwind-protect
2554 ;; window-points are not restored. (should they be??) 2523 (if (or edebug-stop
2555 (if edebug-save-displayed-buffer-points 2524 (memq edebug-execution-mode '(step next))
2556 (edebug-set-buffer-points edebug-buffer-points)) 2525 (eq arg-mode 'error))
2557 2526 (progn
2558 ;; Unrestore trace window's window-point. 2527 ;; (setq edebug-execution-mode 'step)
2559 (if edebug-trace-window 2528 ;; (edebug-overlay-arrow) ; This doesn't always show up.
2560 (set-window-start edebug-trace-window 2529 (edebug--recursive-edit arg-mode))) ; <--- Recursive edit
2561 edebug-trace-window-start)) 2530
2562 2531 ;; Reset the edebug-window-data to whatever it is now.
2563 ;; Unrestore edebug-buffer's window-start, if displayed. 2532 (let ((window (if (eq (window-buffer) edebug-buffer)
2564 (let ((window (car edebug-window-data))) 2533 (selected-window)
2565 (if (and (edebug-window-live-p window) 2534 (get-buffer-window edebug-buffer))))
2566 (eq (window-buffer) edebug-buffer)) 2535 ;; Remember window-start for edebug-buffer, if still displayed.
2567 (progn 2536 (if window
2568 (set-window-start window (cdr edebug-window-data) 2537 (progn
2569 'no-force) 2538 (setcar edebug-window-data window)
2570 ;; Unrestore edebug-buffer's window-point. 2539 (setcdr edebug-window-data (window-start window)))))
2571 ;; Needed in addition to setting the buffer point 2540
2572 ;; - otherwise quitting doesn't leave point as is. 2541 ;; Save trace window point before restoring outside windows.
2573 ;; But this causes point to not be restored at times. 2542 ;; Could generalize this for other buffers.
2574 ;; Also, it may not be a visible window. 2543 (setq edebug-trace-window
2575 ;; (set-window-point window edebug-point) 2544 (get-buffer-window edebug-trace-buffer))
2576 ))) 2545 (if edebug-trace-window
2577 2546 (setq edebug-trace-window-start
2578 ;; Unrestore edebug-buffer's point. Rerestored below. 2547 (and edebug-trace-window
2579 ;; (goto-char edebug-point) ;; in edebug-buffer 2548 (window-start edebug-trace-window))))
2580 ) 2549
2581 ;; Since we may be in a save-excursion, in case of quit, 2550 ;; Restore windows before continuing.
2582 ;; reselect the outside window only. 2551 (if edebug-save-windows
2583 ;; Only needed if we are not recovering windows?? 2552 (progn
2584 (if (edebug-window-live-p edebug-outside-window) 2553 (edebug-set-windows edebug-outside-windows)
2585 (select-window edebug-outside-window)) 2554
2586 ) ; if edebug-save-windows 2555 ;; Restore displayed buffer points.
2587 2556 ;; Needed even if restoring windows because
2588 ;; Restore current buffer always, in case application needs it. 2557 ;; window-points are not restored. (should they be??)
2589 (if (buffer-name edebug-outside-buffer) 2558 (if edebug-save-displayed-buffer-points
2590 (set-buffer edebug-outside-buffer)) 2559 (edebug-set-buffer-points edebug-buffer-points))
2591 ;; Restore point, and mark. 2560
2592 ;; Needed even if restoring windows because 2561 ;; Unrestore trace window's window-point.
2593 ;; that doesn't restore point and mark in the current buffer. 2562 (if edebug-trace-window
2594 ;; But don't restore point if edebug-buffer is current buffer. 2563 (set-window-start edebug-trace-window
2595 (if (not (eq edebug-buffer edebug-outside-buffer)) 2564 edebug-trace-window-start))
2596 (goto-char edebug-outside-point)) 2565
2597 (if (marker-buffer (edebug-mark-marker)) 2566 ;; Unrestore edebug-buffer's window-start, if displayed.
2598 ;; Does zmacs-regions need to be nil while doing set-marker? 2567 (let ((window (car edebug-window-data)))
2599 (set-marker (edebug-mark-marker) edebug-outside-mark)) 2568 (if (and (edebug-window-live-p window)
2600 ) ; unwind-protect 2569 (eq (window-buffer) edebug-buffer))
2570 (progn
2571 (set-window-start window (cdr edebug-window-data)
2572 'no-force)
2573 ;; Unrestore edebug-buffer's window-point.
2574 ;; Needed in addition to setting the buffer point
2575 ;; - otherwise quitting doesn't leave point as is.
2576 ;; But can this causes point to not be restored.
2577 ;; Also, it may not be a visible window.
2578 ;; (set-window-point window edebug-point)
2579 )))
2580
2581 ;; Unrestore edebug-buffer's point. Rerestored below.
2582 ;; (goto-char edebug-point) ;; in edebug-buffer
2583 )
2584 ;; Since we may be in a save-excursion, in case of quit,
2585 ;; reselect the outside window only.
2586 ;; Only needed if we are not recovering windows??
2587 (if (edebug-window-live-p edebug-outside-window)
2588 (select-window edebug-outside-window))
2589 ) ; if edebug-save-windows
2590
2591 ;; Restore current buffer always, in case application needs it.
2592 (if (buffer-name edebug-outside-buffer)
2593 (set-buffer edebug-outside-buffer))
2594 ;; Restore point, and mark.
2595 ;; Needed even if restoring windows because
2596 ;; that doesn't restore point and mark in the current buffer.
2597 ;; But don't restore point if edebug-buffer is current buffer.
2598 (if (not (eq edebug-buffer edebug-outside-buffer))
2599 (goto-char edebug-outside-point))
2600 (if (marker-buffer (edebug-mark-marker))
2601 ;; Does zmacs-regions need to be nil while doing set-marker?
2602 (set-marker (edebug-mark-marker) edebug-outside-mark))
2603 )) ; unwind-protect
2601 ;; None of the following is done if quit or signal occurs. 2604 ;; None of the following is done if quit or signal occurs.
2602 2605
2603 ;; Restore edebug-buffer's outside point. 2606 ;; Restore edebug-buffer's outside point.