;;;; patches to and config of gud.el ;;; Time-stamp: <02/12/04 20:34:36 jcgs> (defun gud:copy-face (old-face new-face &optional frame new-frame) "Safe caller for copy-face, which does not exist on TTY-only emacsen." (if (fboundp 'copy-face) (copy-face old-face new-face frame new-frame) new-face)) (defun gud:set-face-foreground (face color &optional frame) "Safe caller for set-face-foreground, which does not exist on TTY-only emacsen." (if (fboundp 'copy-face) (set-face-foreground face color frame))) (defun gud:set-face-background (face color &optional frame) "Safe caller for set-face-background, which does not exist on TTY-only emacsen." (if (fboundp 'copy-face) (set-face-background face color frame))) (defvar gud-red (gud:copy-face 'default 'gud-red)) (gud:set-face-background gud-red "red") (gud:set-face-foreground gud-red "orange") ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen ;; and that its line LINE is visible. ;; Put the overlay-arrow on the line LINE in that buffer. ;; Most of the trickiness in here comes from wanting to preserve the current ;; region-restriction if that's possible. We use an explicit display-buffer ;; to get around the fact that this is called inside a save-excursion. (defun gud-display-line (true-file line) (let* ((last-nonmenu-event t) ; Prevent use of dialog box for questions. (buffer (save-excursion (or (eq (current-buffer) gud-comint-buffer) (set-buffer gud-comint-buffer)) (gud-find-file true-file))) (window (and buffer (or (get-buffer-window buffer) (display-buffer buffer)))) (pos)) (if buffer (progn (save-excursion (set-buffer buffer) (save-restriction (widen) (goto-line line) (setq pos (point)) (setq overlay-arrow-string "=>") (put-text-property 0 2 'face gud-red overlay-arrow-string) (or overlay-arrow-position (setq overlay-arrow-position (make-marker))) (set-marker overlay-arrow-position (point) (current-buffer))) (cond ((or (< pos (point-min)) (> pos (point-max))) (widen) (goto-char pos)))) (set-window-point window overlay-arrow-position)))))