comparison lisp/progmodes/gud.el @ 90386:2ecafc6d5db7

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-58 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 239-258) - Update from CVS - (Ffield_beginning, find_field): Undo change of 2006-04-23. - Rcirc patch from Ryan Yeske - Merge from gnus--rel--5.10 - Clean up lisp/gnus/ChangeLog a bit * gnus--rel--5.10 (patch 91-98) - Merge from emacs--devo--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Tue, 02 May 2006 05:51:52 +0000
parents 72dea2ff0142 da2f6762c09a
children 146cd8369025
comparison
equal deleted inserted replaced
90385:72dea2ff0142 90386:2ecafc6d5db7
80 (defun gud-marker-filter (&rest args) 80 (defun gud-marker-filter (&rest args)
81 (apply gud-marker-filter args)) 81 (apply gud-marker-filter args))
82 82
83 (defvar gud-minor-mode nil) 83 (defvar gud-minor-mode nil)
84 (put 'gud-minor-mode 'permanent-local t) 84 (put 'gud-minor-mode 'permanent-local t)
85
86 (defvar gud-comint-buffer nil)
85 87
86 (defvar gud-keep-buffer nil) 88 (defvar gud-keep-buffer nil)
87 89
88 (defun gud-symbol (sym &optional soft minor-mode) 90 (defun gud-symbol (sym &optional soft minor-mode)
89 "Return the symbol used for SYM in MINOR-MODE. 91 "Return the symbol used for SYM in MINOR-MODE.
299 (defmacro gud-def (func cmd key &optional doc) 301 (defmacro gud-def (func cmd key &optional doc)
300 "Define FUNC to be a command sending STR and bound to KEY, with 302 "Define FUNC to be a command sending STR and bound to KEY, with
301 optional doc string DOC. Certain %-escapes in the string arguments 303 optional doc string DOC. Certain %-escapes in the string arguments
302 are interpreted specially if present. These are: 304 are interpreted specially if present. These are:
303 305
304 %f name (without directory) of current source file. 306 %f -- Name (without directory) of current source file.
305 %F name (without directory or extension) of current source file. 307 %F -- Name (without directory or extension) of current source file.
306 %d directory of current source file. 308 %d -- Directory of current source file.
307 %l number of current source line 309 %l -- Number of current source line.
308 %e text of the C lvalue or function-call expression surrounding point. 310 %e -- Text of the C lvalue or function-call expression surrounding point.
309 %a text of the hexadecimal address surrounding point 311 %a -- Text of the hexadecimal address surrounding point.
310 %p prefix argument to the command (if any) as a number 312 %p -- Prefix argument to the command (if any) as a number.
313 %c -- Fully qualified class name derived from the expression
314 surrounding point (jdb only).
311 315
312 The `current' source file is the file of the current buffer (if 316 The `current' source file is the file of the current buffer (if
313 we're in a C file) or the source file current at the last break or 317 we're in a C file) or the source file current at the last break or
314 step (if we're in the GUD buffer). 318 step (if we're in the GUD buffer).
315 The `current' line is that of the current buffer (if we're in a 319 The `current' line is that of the current buffer (if we're in a
442 (cond 446 (cond
443 ((memq minor-mode '(gdbmi gdba)) 447 ((memq minor-mode '(gdbmi gdba))
444 (when (or gdb-force-update 448 (when (or gdb-force-update
445 (not (save-excursion 449 (not (save-excursion
446 (goto-char (point-min)) 450 (goto-char (point-min))
447 (let ((case-fold-search t)) 451 (looking-at "Watch Expressions:"))))
448 (looking-at "Watch Expressions:")))))
449 (erase-buffer) 452 (erase-buffer)
450 (insert "Watch Expressions:\n") 453 (insert "Watch Expressions:\n")
451 (if gdb-speedbar-auto-raise 454 (if gdb-speedbar-auto-raise
452 (raise-frame speedbar-frame)) 455 (raise-frame speedbar-frame))
453 (let ((var-list gdb-var-list) parent) 456 (let ((var-list gdb-var-list) parent)
738 (defvar gud-gdb-fetch-lines-break) 741 (defvar gud-gdb-fetch-lines-break)
739 742
740 ;; The completion list is constructed by the process filter. 743 ;; The completion list is constructed by the process filter.
741 (defvar gud-gdb-fetched-lines) 744 (defvar gud-gdb-fetched-lines)
742 745
743 (defvar gud-comint-buffer nil)
744
745 (defun gud-gdb-complete-command (&optional command a b) 746 (defun gud-gdb-complete-command (&optional command a b)
746 "Perform completion on the GDB command preceding point. 747 "Perform completion on the GDB command preceding point.
747 This is implemented using the GDB `complete' command which isn't 748 This is implemented using the GDB `complete' command which isn't
748 available with older versions of GDB." 749 available with older versions of GDB."
749 (interactive) 750 (interactive)
2802 2803
2803 (defun gud-format-command (str arg) 2804 (defun gud-format-command (str arg)
2804 (let ((insource (not (eq (current-buffer) gud-comint-buffer))) 2805 (let ((insource (not (eq (current-buffer) gud-comint-buffer)))
2805 (frame (or gud-last-frame gud-last-last-frame)) 2806 (frame (or gud-last-frame gud-last-last-frame))
2806 result) 2807 result)
2807 (while (and str (string-match "\\([^%]*\\)%\\([adeflpc]\\)" str)) 2808 (while (and str
2809 (let ((case-fold-search nil))
2810 (string-match "\\([^%]*\\)%\\([adefFlpc]\\)" str)))
2808 (let ((key (string-to-char (match-string 2 str))) 2811 (let ((key (string-to-char (match-string 2 str)))
2809 subst) 2812 subst)
2810 (cond 2813 (cond
2811 ((eq key ?f) 2814 ((eq key ?f)
2812 (setq subst (file-name-nondirectory (if insource 2815 (setq subst (file-name-nondirectory (if insource
2887 ;; Arrange for the current prompt to get deleted. 2890 ;; Arrange for the current prompt to get deleted.
2888 (save-excursion 2891 (save-excursion
2889 (set-buffer gud-comint-buffer) 2892 (set-buffer gud-comint-buffer)
2890 (save-restriction 2893 (save-restriction
2891 (widen) 2894 (widen)
2892 (goto-char (process-mark proc)) 2895 (if (marker-position gud-delete-prompt-marker)
2893 (forward-line 0) 2896 ;; We get here when printing an expression.
2897 (goto-char gud-delete-prompt-marker)
2898 (goto-char (process-mark proc))
2899 (forward-line 0))
2894 (if (looking-at comint-prompt-regexp) 2900 (if (looking-at comint-prompt-regexp)
2895 (set-marker gud-delete-prompt-marker (point))) 2901 (set-marker gud-delete-prompt-marker (point)))
2896 (if (memq gud-minor-mode '(gdbmi gdba)) 2902 (if (memq gud-minor-mode '(gdbmi gdba))
2897 (apply comint-input-sender (list proc command)) 2903 (apply comint-input-sender (list proc command))
2898 (process-send-string proc (concat command "\n"))))))) 2904 (process-send-string proc (concat command "\n")))))))
2909 ;; around point. 2915 ;; around point.
2910 2916
2911 (defvar gud-find-expr-function 'gud-find-c-expr) 2917 (defvar gud-find-expr-function 'gud-find-c-expr)
2912 2918
2913 (defun gud-find-expr (&rest args) 2919 (defun gud-find-expr (&rest args)
2914 (apply gud-find-expr-function args)) 2920 (let ((expr (if (and transient-mark-mode mark-active)
2921 (buffer-substring (region-beginning) (region-end))
2922 (apply gud-find-expr-function args))))
2923 (save-match-data
2924 (if (string-match "\n" expr)
2925 (error "Expression must not include a newline"))
2926 (with-current-buffer gud-comint-buffer
2927 (save-excursion
2928 (goto-char (process-mark (get-buffer-process gud-comint-buffer)))
2929 (forward-line 0)
2930 (when (looking-at comint-prompt-regexp)
2931 (set-marker gud-delete-prompt-marker (point))
2932 (set-marker-insertion-type gud-delete-prompt-marker t))
2933 (insert (concat expr " = ")))))
2934 expr))
2915 2935
2916 ;; The next eight functions are hacked from gdbsrc.el by 2936 ;; The next eight functions are hacked from gdbsrc.el by
2917 ;; Debby Ayers <ayers@asc.slb.com>, 2937 ;; Debby Ayers <ayers@asc.slb.com>,
2918 ;; Rich Schaefer <schaefer@asc.slb.com> Schlumberger, Austin, Tx. 2938 ;; Rich Schaefer <schaefer@asc.slb.com> Schlumberger, Austin, Tx.
2919 2939