Mercurial > emacs
comparison lisp/emacs-lisp/debug.el @ 44517:5496c590d5ad
(debug-on-entry): Use push.
(debugger-make-xrefs): Don't assume point-min == 1.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 12 Apr 2002 03:19:09 +0000 |
parents | afe64ec4637c |
children | cacf84433461 |
comparison
equal
deleted
inserted
replaced
44516:fed44101d33a | 44517:5496c590d5ad |
---|---|
289 (interactive "b") | 289 (interactive "b") |
290 (save-excursion | 290 (save-excursion |
291 (set-buffer (or buffer (current-buffer))) | 291 (set-buffer (or buffer (current-buffer))) |
292 (setq buffer (current-buffer)) | 292 (setq buffer (current-buffer)) |
293 (let ((buffer-read-only nil) | 293 (let ((buffer-read-only nil) |
294 (old-end 1) (new-end 1)) | 294 (old-end (point-min)) (new-end (point-min))) |
295 ;; If we saved an old backtrace, find the common part | 295 ;; If we saved an old backtrace, find the common part |
296 ;; between the new and the old. | 296 ;; between the new and the old. |
297 ;; Compare line by line, starting from the end, | 297 ;; Compare line by line, starting from the end, |
298 ;; because that's the part that is likely to be unchanged. | 298 ;; because that's the part that is likely to be unchanged. |
299 (if debugger-previous-backtrace | 299 (if debugger-previous-backtrace |
315 buffer new-start new-end))) | 315 buffer new-start new-end))) |
316 (setq all-match nil)))) | 316 (setq all-match nil)))) |
317 ;; Now new-end is the position of the start of the | 317 ;; Now new-end is the position of the start of the |
318 ;; unchanged part in the current buffer, and old-end is | 318 ;; unchanged part in the current buffer, and old-end is |
319 ;; the position of that same text in the saved old | 319 ;; the position of that same text in the saved old |
320 ;; backtrace. But we must subtract 1 since strings are | 320 ;; backtrace. But we must subtract (point-min) since strings are |
321 ;; indexed in origin 0. | 321 ;; indexed in origin 0. |
322 | 322 |
323 ;; Replace the unchanged part of the backtrace | 323 ;; Replace the unchanged part of the backtrace |
324 ;; with the text from debugger-previous-backtrace, | 324 ;; with the text from debugger-previous-backtrace, |
325 ;; since that already has the proper xrefs. | 325 ;; since that already has the proper xrefs. |
326 ;; With this optimization, we only need to scan | 326 ;; With this optimization, we only need to scan |
327 ;; the changed part of the backtrace. | 327 ;; the changed part of the backtrace. |
328 (delete-region new-end (point-max)) | 328 (delete-region new-end (point-max)) |
329 (goto-char (point-max)) | 329 (goto-char (point-max)) |
330 (insert (substring debugger-previous-backtrace (1- old-end))) | 330 (insert (substring debugger-previous-backtrace |
331 (- old-end (point-min)))) | |
331 ;; Make the unchanged part of the backtrace inaccessible | 332 ;; Make the unchanged part of the backtrace inaccessible |
332 ;; so it won't be scanned. | 333 ;; so it won't be scanned. |
333 (narrow-to-region (point-min) new-end))) | 334 (narrow-to-region (point-min) new-end))) |
334 | 335 |
335 ;; Scan the new part of the backtrace, inserting xrefs. | 336 ;; Scan the new part of the backtrace, inserting xrefs. |
620 (debug-convert-byte-code function)) | 621 (debug-convert-byte-code function)) |
621 (or (consp (symbol-function function)) | 622 (or (consp (symbol-function function)) |
622 (error "Definition of %s is not a list" function)) | 623 (error "Definition of %s is not a list" function)) |
623 (fset function (debug-on-entry-1 function (symbol-function function) t)) | 624 (fset function (debug-on-entry-1 function (symbol-function function) t)) |
624 (or (memq function debug-function-list) | 625 (or (memq function debug-function-list) |
625 (setq debug-function-list (cons function debug-function-list))) | 626 (push function debug-function-list)) |
626 function) | 627 function) |
627 | 628 |
628 ;;;###autoload | 629 ;;;###autoload |
629 (defun cancel-debug-on-entry (&optional function) | 630 (defun cancel-debug-on-entry (&optional function) |
630 "Undo effect of \\[debug-on-entry] on FUNCTION. | 631 "Undo effect of \\[debug-on-entry] on FUNCTION. |