Ive got a little bit of lisp here which people might
like to try out. Its in a very early stage of development, and I shall
make it work properly eventually, but I already find it quite useful
myself, so I thought Id let others play with it. 

        Its called jde-stack. What it does is renders stack traces
clickable (or return-key-able if there is such a word). Clicking jumps
to the relative bit of source if its available by the usual JDE
mechanism. 

        Like I say its at an early stage yet. It does somethings for
instance which will are distinctly dubious (like globally changing a
key binding in comint-mode for instance...wave good bye to your return
key!!!!). Its very much at the stage of a microsoft full release
(i.e. early alpha). If people think this would be useful, Ill think a
little bit more carefully on how it should work, and think about
making the changes.

     
       Cheers

       Phil


;; Author: Phillip Lord<[EMAIL PROTECTED]>
;; Copyright (C) 1999 Phillip Lord

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.


;; This now works okay. It is bound to both Shift mouse 2 or a
;; return key. These are reasonable keys to choose. The latter will
;; cover up somethings within comint mode, however return key is
;; disabled as soon as the process has ended, and generally you want
;; to follow stack traces one this is the case.

;; Changes to make.
;; The problems with key bindings need to be sorted. Some key other
;; than return is possible. I would also like to reduce the coverage
;; of these key bindings. There is really only any use for this in jde
;; spawned buffers, and this should be possible from within there.
;; It would also be nice to define a key somewhat like "next-error"
;; which would jump to the next stack trace. This should be pretty
;; easy to do. All I need is to set a marker in the comint buffer when
;; one of the first methods is found, and then jump to it forward a
;; line and call show-at-point

(require 'jde)

(defun jde-stack-show-class-stack(class line)
  (jde-show-class-source class)
  (set-buffer (concat class ".java" ))
  (goto-line (string-to-number line))
  (if (hs-already-hidden-p)
      (hs-show-block)))


(defun jde-stack-show-at-mouse (event)
  (interactive "e" )
  (save-excursion
    (set-buffer (jde-stack-url-event-buffer event))
    (goto-char (jde-stack-event-point event))
    (jde-stack-show-at-point)))
    
(defun jde-stack-show-at-point()
  (interactive)
  (save-excursion
    (let ((line-ending
           (progn(end-of-line)
                 (point))))
      (beginning-of-line)
      (if (re-search-forward "\\([A-Za-z0-9]*\\)\\([.]java\\)\\(:\\)\\([0-9]*\\)" 
line-ending 't)
          (jde-stack-show-class-stack (match-string 1) (match-string 4))
        (message "No stack found" )))))


(defun jde-stack-url-event-buffer (event)
  (window-buffer (posn-window (event-start event))))

(defun jde-stack-event-point (event)
  (posn-point (event-start event)))

(define-key comint-mode-map [S-mouse-1] 'jde-stack-show-at-mouse)
(define-key comint-mode-map [return] 'jde-stack-show-at-point)

(provide 'jde-stack)










Reply via email to