At 12:16 PM 9/15/00 +0200, you wrote:
>Please look at the (setq jde-mode-line-format ...) in the hook below.
AFAIK this should customize the modeline
>in JDE-buffers like i want. But after opening a java-file the modeline has
always the default-value defined in
>jde-which-method.el. Why????????????????????????
>

Hi Klaus,

There are a couple of bugs that make which-method nonfunctional in the
current release. Most importantly, I forgot to make the variable that
stores the locations of the methods in the current buffer buffer local. As
a result, if you have more than one buffer open, the variable has faulty
locations for all the buffers. The next release, which I plan to make this
weekend, fixes these problems. As far as I can tell, which method works
very well in the next release.

Meanwhile, I am attaching a copy of jde-which-method.el that contains the
fixes. Try this version. If it does not solve your problem, let me know and
I will investigate further.

Regards,

- Paul

>I load my file user-jde-mode.el (look below) from my site-start.el, that�s
all.
>
>Klaus
>
>I have the following to customize 2.2.3:
>
>_______________________________________________________________
>;;; user-jde-mode.el --- user-defined settings, function... for jde-mode
>
>;; Copyright (C) 2000 by Free Software Foundation, Inc.
>
>;; Author:  <berndl@HICKERSTALL>
>
>;;; Code:
>
>(defun my-jde-complete-at-point (arg)
>  "Completes the method or field name at point. See `jde-complete-at-point'
>for further explanations. With any prefix argument ARG a popup menu is
>displayed listing the potential completions for the name at point. For
>further explanations see `jde-complete-at-point-menu'."
>  (interactive "P")
>  (if arg
>      (jde-complete-at-point-menu)
>    (jde-complete-at-point)))
>  
>
>(require 'user-cc-mode)
>(add-to-list 'load-path "d:/Programme/jpda1.0/bin")
>
>;; load the JDE, THE Java Development Environment
>(require 'jde)
>
>;; all settings begin here
>(add-hook 'jde-mode-hook
>          (lambda ()
>            (setq jde-mode-line-format
>                  (list
>                   ""
>                   " "                  ;-
>                   'mode-line-mule-info
>                   'mode-line-modified
>                   'my-modeline-bufname
>                   " "
>                   " %[("
>                   'mode-name
>                   'mode-line-process
>                   'minor-mode-alist
>                   "%n"
>                   ")%]  "
>                   '(line-number-mode "%l/")
>                   '(column-number-mode "%c ")
>                   '(jde-which-method-mode
>                     ("" jde-which-method-format "  "))
>                   "  "
>                   'global-mode-string
>                   " % "))
>            (local-set-key (if (eq system-type 'windows-nt)
>                               (kbd "C-S-<tab>")
>                             (kbd "C-S-<kp-tab>"))
>                             'my-jde-complete-at-point)))
>
>(provide 'user-jde-mode)
>
>;; user-jde-mode.el ends here.
>_______________________________________________________________
>
>
>--
>Klaus Berndl                   mailto: [EMAIL PROTECTED]
>sd&m AG                        http://www.sdm.de
>software design & management   
>Thomas-Dehler-Str. 27, 81737 M�nchen, Germany
>Tel +49 89 63812-392, Fax -220
>
>
;;; jde-which-method.el --- Print current method in mode line

;; Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc.

;; Author: Paul Kinnucan ([EMAIL PROTECTED])
;; Inspired by Alex Rezinsky's which-func package.
;; Keywords: mode-line, tools

;; This file is not part of GNU Emacs.

;; 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.

;;; Commentary:

;; This package displays the name of the method at point
;; in the Emacs mode line. 

;;; History:

;;  $Log: jde-which-method.el,v $
;;  Revision 1.3  2000/09/05 04:42:22  paulk
;;  Fixed a number of bugs.
;;
;;  Revision 1.2  2000/09/04 05:03:16  paulk
;;  Added test for existence of method map.
;;
;;  Revision 1.1  2000/08/31 05:27:49  paulk
;;  Initial revision.
;;

;;; Code:

;; Variables for customization
;; ---------------------------
;;  

(require 'jde-parse)


(defgroup jde-which-method nil
  "Mode to display the current function name in the modeline."
  :group 'jde
  :version "1.0")

;;;###autoload
(defcustom jde-which-method-mode t
  "Enables the JDE's which method mode.
When which method mode is enabled, the current method name is
displayed in the mode line."
  :group 'jde-which-method
  :type  'boolean)

(defcustom jde-which-method-format '(" [" jde-which-method-current "]")
  "Format for displaying the function in the mode line."
  :group 'jde-which-method
  :type 'sexp)

(defcustom jde-mode-line-format 
  '("-" 
    mode-line-mule-info
    mode-line-modified
    mode-line-frame-identification
    mode-line-buffer-identification
    "   "
    global-mode-string
    "   %[(" mode-name mode-line-process minor-mode-alist "%n" ")%]--"
    (jde-which-method-mode
         ("" jde-which-method-format "--"))
   (line-number-mode "L%l--")
   (column-number-mode "C%c--")
   (-3 . "%p")
   "-%-")
  "Format for the JDE source buffer mode line."
  :group 'jde
  :type 'sexp)
                                 

;;; Code, nothing to customize below here
;;; -------------------------------------
;;;

(defvar jde-which-method-unknown "???"
  "String to display in the mode line when the current method is unknown.")

(defvar jde-which-method-current  jde-which-method-unknown)
(make-variable-buffer-local 'jde-which-method-current)

(defvar jde-which-method-current-point-loc -1)
(make-variable-buffer-local 'jde-which-method-current-point-loc)

(defvar jde-which-method-current-method-bounds (cons -1 -1))
(make-variable-buffer-local 'jde-which-method-current-method-bounds)


(defun jde-which-method-update ()
  (interactive)
  (condition-case info
      (let ((p (point)))
        (if (or
             (= jde-which-method-current-point-loc p)
             (and
              (>= p (car jde-which-method-current-method-bounds))
              (<= p (cdr jde-which-method-current-method-bounds))))
            (setq jde-which-method-current-point p)
          (let ((name (if jde-parse-the-method-map
                          (jde-parse-method-map-get-method-at 
jde-parse-the-method-map))))
           (if name
               (let* ((name-pair (car name))
                      (class (car name-pair))
                      (method (cdr name-pair))
                      (bounds (cdr name)))
                 (setq jde-which-method-current
                       (format "%s.%s" class method))
                 (setq jde-which-method-current-point-loc p)
                 (setq jde-which-method-current-method-bounds bounds))
             (progn
               (setq name (jde-parse-get-innermost-class-at-point))
               (setq jde-which-method-current-point-loc p)
               (setq jde-which-method-current-method-bounds (cons -1 -1))
               (if name
                   (setq jde-which-method-current (car name))
                 (setq jde-which-method-current jde-which-method-unknown)))))))    
    (error
     ;; (debug)
     (remove-hook 'post-command-hook 'jde-which-method-update)
     (message "Error in jde-which-method-update: %s" info))))

(defun jde-which-method-update-on-entering-buffer ()
  (setq jde-which-method-current-point-loc 0)
  (setq jde-which-method-current-method-bounds (cons -1 -1))
  (jde-which-method-update))

(provide 'jde-which-method)

;; jde-which-method.el ends here

Reply via email to