Mercurial > emacs
comparison lisp/gud.el @ 49354:cea1991cf560
(gud-display-line): If the current file is newer than its
buffer, offer to reread the file.
(gud-keep-buffer): New buffer local variable. Ensures offer to
reread file is made just once.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Mon, 20 Jan 2003 22:03:50 +0000 |
parents | 7ae18fc8cd2f |
children | 37645a051842 |
comparison
equal
deleted
inserted
replaced
49353:60b12919be0c | 49354:cea1991cf560 |
---|---|
68 (defun gud-marker-filter (&rest args) | 68 (defun gud-marker-filter (&rest args) |
69 (apply gud-marker-filter args)) | 69 (apply gud-marker-filter args)) |
70 | 70 |
71 (defvar gud-minor-mode nil) | 71 (defvar gud-minor-mode nil) |
72 (put 'gud-minor-mode 'permanent-local t) | 72 (put 'gud-minor-mode 'permanent-local t) |
73 | |
74 (defvar gud-keep-buffer nil) | |
73 | 75 |
74 (defun gud-symbol (sym &optional soft minor-mode) | 76 (defun gud-symbol (sym &optional soft minor-mode) |
75 "Return the symbol used for SYM in MINOR-MODE. | 77 "Return the symbol used for SYM in MINOR-MODE. |
76 MINOR-MODE defaults to `gud-minor-mode. | 78 MINOR-MODE defaults to `gud-minor-mode. |
77 The symbol returned is `gud-<MINOR-MODE>-<SYM>'. | 79 The symbol returned is `gud-<MINOR-MODE>-<SYM>'. |
186 (setq buf (and (file-readable-p buf) (find-file-noselect buf 'nowarn)))) | 188 (setq buf (and (file-readable-p buf) (find-file-noselect buf 'nowarn)))) |
187 (when buf | 189 (when buf |
188 ;; Copy `gud-minor-mode' to the found buffer to turn on the menu. | 190 ;; Copy `gud-minor-mode' to the found buffer to turn on the menu. |
189 (with-current-buffer buf | 191 (with-current-buffer buf |
190 (set (make-local-variable 'gud-minor-mode) minor-mode) | 192 (set (make-local-variable 'gud-minor-mode) minor-mode) |
191 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)) | 193 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
194 (make-local-variable 'gud-keep-buffer)) | |
192 buf))) | 195 buf))) |
193 | 196 |
194 ;; ====================================================================== | 197 ;; ====================================================================== |
195 ;; command definition | 198 ;; command definition |
196 | 199 |
2511 (pos)) | 2514 (pos)) |
2512 (if buffer | 2515 (if buffer |
2513 (progn | 2516 (progn |
2514 (save-excursion | 2517 (save-excursion |
2515 (set-buffer buffer) | 2518 (set-buffer buffer) |
2519 (if (not (or (verify-visited-file-modtime buffer) gud-keep-buffer)) | |
2520 (progn | |
2521 (if | |
2522 (yes-or-no-p | |
2523 (format "File %s changed on disk. Reread from disk? " | |
2524 (buffer-name))) | |
2525 (revert-buffer t t) | |
2526 (setq gud-keep-buffer t)))) | |
2516 (save-restriction | 2527 (save-restriction |
2517 (widen) | 2528 (widen) |
2518 (goto-line line) | 2529 (goto-line line) |
2519 (setq pos (point)) | 2530 (setq pos (point)) |
2520 (setq overlay-arrow-string "=>") | 2531 (setq overlay-arrow-string "=>") |
2521 (or overlay-arrow-position | 2532 (or overlay-arrow-position |
2522 (setq overlay-arrow-position (make-marker))) | 2533 (setq overlay-arrow-position (make-marker))) |
2523 (set-marker overlay-arrow-position (point) (current-buffer))) | 2534 (set-marker overlay-arrow-position (point) (current-buffer))) |
2524 (cond ((or (< pos (point-min)) (> pos (point-max))) | 2535 (cond ((or (< pos (point-min)) (> pos (point-max))) |
2525 (widen) | 2536 (widen) |
2526 (goto-char pos)))) | 2537 (goto-char pos)))) |
2527 (set-window-point window overlay-arrow-position))))) | 2538 (set-window-point window overlay-arrow-position))))) |
2528 | 2539 |
2529 ;; The gud-call function must do the right thing whether its invoking | 2540 ;; The gud-call function must do the right thing whether its invoking |
2530 ;; keystroke is from the GUD buffer itself (via major-mode binding) | 2541 ;; keystroke is from the GUD buffer itself (via major-mode binding) |
2531 ;; or a C buffer. In the former case, we want to supply data from | 2542 ;; or a C buffer. In the former case, we want to supply data from |