(require 'gud "my-gud.el") (defun dot () (point)) (defun my-jdb () (interactive) ; (load-file "my-gud.el") (if (file-exists-p "jdb-dirs.el") (load-file "./jdb-dirs.el") ) (global-unset-key "") (setq buffer-suffix (call-interactively 'jdb)) ; Goto the gud buffer to do the desired key bindings. (switch-to-buffer (concat "*gud" (if (not (string= buffer-suffix "")) "-") buffer-suffix "*")) ; (if (emacs-version-compare 19 27 '<) ; (progn ; (my-shell-bindings-old) ; (my-gdb-bindings-old) ; (setq gdb-command-name "/usersgfisher/bin/gdb.sortofnew") ; ) ; (progn (my-shell-bindings) (my-jdb-bindings) ; ) ; ) ) (defun gud-break () "Generate a jdb breakpoint command of the following form: stop at .: where is the buffer name minus the extension and is obtained by going to the beginning of the buffer to search for the package decl. A more efficient alternative to searching for the package decl every time would be to cash it in the gud-jdb-class-source-alist or some similar alist structure." (interactive) (setq line-num (int-to-string (1+ (count-lines 1 (point))))) (setq d (dot)) (beginning-of-buffer) (if (search-forward-regexp "^package \\(.*\\);" nil t) (setq package-prefix (match-string 1)) (setq package-prefix "") ) (goto-char d) (gud-call (concat "stop at " package-prefix (if (not (string= package-prefix "")) ".") (substring (buffer-name) 0 -5) ":" line-num ) ) ) (defun gud-up "Go up a stack frame, and move to the appropriate source file. Since the latest jdb up and down commands don't output a snapshot of the current stack frame, we need to run the where command manually, capture its output, and parse it accordingly to find the source file to display." (interactive) ; Capture up command output, which includes the stack frame number. ; Capture the ; ) (defun my-jdb-bindings() (interactive) (local-set-key "u" 'gud-up) (local-set-key "d" 'gud-down) (local-set-key "n" 'gud-next) (local-set-key "s" 'gud-step) (local-set-key "f" 'gud-display-frame) (local-set-key "c" 'gud-cont) (local-set-key "h" 'gud-where) ; Hmm, funky binding, but ^Xw is pretty ; taken by widen (local-set-key " " 'comint-dynamic-complete) (if (xemacs-p) (progn (local-set-key "u" 'gdb-up) (local-set-key "d" 'gdb-down) (local-set-key "n" 'gdb-next) (local-set-key "s" 'gdb-step) (local-set-key "f" 'gdb-display-frame) (local-set-key "c" 'gdb-cont) ) ) ) (defun my-gdb-bindings-old() (interactive) (local-set-key "u" 'gdb-up) (local-set-key "d" 'gdb-down) (local-set-key "n" 'gdb-next) (local-set-key "s" 'gdb-step) (local-set-key "f" 'gdb-display-frame) (local-set-key "c" 'gdb-cont) )