comparison lisp/comint/gdbsrc.el @ 136:b980b6286996 r20-2b2

Import from CVS: tag r20-2b2
author cvs
date Mon, 13 Aug 2007 09:31:12 +0200
parents cf808b4c4290
children
comparison
equal deleted inserted replaced
135:4636a6841cd6 136:b980b6286996
292 ;; this can be used as a hook for gdb-mode.... 292 ;; this can be used as a hook for gdb-mode....
293 (or current-gdb-buffer 293 (or current-gdb-buffer
294 (and (eq major-mode 'gdb-mode) ; doesn't work w/ energize yet 294 (and (eq major-mode 'gdb-mode) ; doesn't work w/ energize yet
295 (setq current-gdb-buffer (current-buffer)) 295 (setq current-gdb-buffer (current-buffer))
296 ;; XEmacs change: 296 ;; XEmacs change:
297 (make-local-hook 'kill-buffer-hook) 297 (progn
298 (add-hook 'kill-buffer-hook 'gdbsrc-reset nil t)) 298 (make-local-hook 'kill-buffer-hook)
299 (add-hook 'kill-buffer-hook 'gdbsrc-reset nil t)))
299 (error "Cannot determine current-gdb-buffer")) 300 (error "Cannot determine current-gdb-buffer"))
300 ;;; (set-process-filter 301 ;;; (set-process-filter
301 ;;; (get-buffer-process current-gdb-buffer) 'gdbsrc-mode-filter) 302 ;;; (get-buffer-process current-gdb-buffer) 'gdbsrc-mode-filter)
302 ;;; (set-process-sentinel 303 ;;; (set-process-sentinel
303 ;;; (get-buffer-process current-gdb-buffer) 'gdbsrc-mode-sentinel) 304 ;;; (get-buffer-process current-gdb-buffer) 'gdbsrc-mode-sentinel)
500 (epnt (event-point click))) 501 (epnt (event-point click)))
501 (and ewin 502 (and ewin
502 epnt 503 epnt
503 extent 504 extent
504 (eq (window-buffer ewin) 505 (eq (window-buffer ewin)
505 (extent-buffer extent)) 506 (extent-object extent))
506 (extent-start-position extent) 507 (extent-start-position extent)
507 (> epnt (extent-start-position extent)) 508 (> epnt (extent-start-position extent))
508 (> (extent-end-position extent) epnt)))) 509 (> (extent-end-position extent) epnt))))
509 510
510 (defun point-inside-extent-p (extent) 511 (defun point-inside-extent-p (extent)
511 "Returns non-nil if the point is within or just after the bounds of the 512 "Returns non-nil if the point is within or just after the bounds of the
512 primary selection-extent, nil otherwise." 513 primary selection-extent, nil otherwise."
513 ;; stig@hackvan.com 514 ;; stig@hackvan.com
514 (and extent ; FIXME - I'm such a sinner... 515 (and extent ; FIXME - I'm such a sinner...
515 (eq (current-buffer) 516 (eq (current-buffer)
516 (extent-buffer extent)) 517 (extent-object extent))
517 (> (point) (extent-start-position extent)) 518 (> (point) (extent-start-position extent))
518 (>= (extent-end-position extent) (point)))) 519 (>= (extent-end-position extent) (point))))
519 520
520 (defun gdbsrc-select-or-yank (ee) 521 (defun gdbsrc-select-or-yank (ee)
521 ;; by Stig@hackvan.com 522 ;; by Stig@hackvan.com
561 ;; by Stig@hackvan.com 562 ;; by Stig@hackvan.com
562 (interactive) 563 (interactive)
563 (let ((gbuf (or gdbsrc-associated-buffer current-gdb-buffer))) 564 (let ((gbuf (or gdbsrc-associated-buffer current-gdb-buffer)))
564 (cond ((eq (current-buffer) gbuf) 565 (cond ((eq (current-buffer) gbuf)
565 (and gdb-arrow-extent 566 (and gdb-arrow-extent
566 (extent-buffer gdb-arrow-extent) 567 (extent-object gdb-arrow-extent)
567 (progn (pop-to-buffer (extent-buffer gdb-arrow-extent)) 568 (progn (pop-to-buffer (extent-object gdb-arrow-extent))
568 (goto-char (extent-start-position gdb-arrow-extent))))) 569 (goto-char (extent-start-position gdb-arrow-extent)))))
569 ((buffer-name gbuf) (pop-to-buffer gbuf)) 570 ((buffer-name gbuf) (pop-to-buffer gbuf))
570 ((y-or-n-p "No debugger. Start a new one? ") 571 ((y-or-n-p "No debugger. Start a new one? ")
571 (call-interactively 'gdbsrc)) 572 (call-interactively 'gdbsrc))
572 (t (error "No gdb buffer.")) 573 (t (error "No gdb buffer."))
841 "Advised to select the source buffer instead of the gdb-buffer" 842 "Advised to select the source buffer instead of the gdb-buffer"
842 ;; by Stig@hackvan.com 843 ;; by Stig@hackvan.com
843 (ad-set-arg 2 'source) ; tell it not to select the gdb window 844 (ad-set-arg 2 'source) ; tell it not to select the gdb window
844 ad-do-it 845 ad-do-it
845 (save-excursion 846 (save-excursion
846 (let* ((buf (extent-buffer gdb-arrow-extent)) 847 (let* ((buf (extent-object gdb-arrow-extent))
847 (win (get-buffer-window buf))) 848 (win (get-buffer-window buf)))
848 (setq gdbsrc-last-src-buffer buf) 849 (setq gdbsrc-last-src-buffer buf)
849 (select-window win) 850 (select-window win)
850 (set-window-point win (extent-start-position gdb-arrow-extent)) 851 (set-window-point win (extent-start-position gdb-arrow-extent))
851 (set-buffer buf)) 852 (set-buffer buf))