I just implemented the threshold based auto parsing behavior I mentioned in
my last reply and have included a patch for 2.2.5.  A new customizable
variable jde-auto-parse-disable-threshold is introduced:

(defcustom jde-auto-parse-disable-threshold 50000
  "Size in bytes.  Threshold value for disabling automatic reparsing of Java
source buffer.  If the Java source buffer is larger than the threshold, auto
parsing is disabled even if jde-auto-parse-enable is t.  Setting the
threshold to 0 will in effect always enable automatic reparsing if
jde-auto-parse-enable is t."
  :group 'jde-project
  :type 'number)

P.S.: Paul, how does patches like these get into releases these days?

Hope you find it useful.

Danny Siu writes:

  Danny> I suggest that the decision of turning the auto parsing on/off base
  Danny> upon the size of the file.  If the file size is larger than some
  Danny> threshold, the auto parsing will be off.  The threshold should also
  Danny> be customizable of course.

  Danny> In my project, most of the java files are quite small and auto
  Danny> parsing is done in secs.  However, there are couple large source
  Danny> files (>200K, >5000 lines!) that would taking forever to finish the
  Danny> initial parsing when the file is loaded, not to mention the auto
  Danny> reparsing after changes!

-- 
Danny Dick-Fung Siu        mailto:[EMAIL PROTECTED]
Acrobat Engineering @ Adobe Systems Incorporated

*** jde-parse.el.org	Tue Oct 10 01:33:38 2000
--- jde-parse.el	Tue Oct 24 15:41:49 2000
***************
*** 68,77 ****
--- 68,86 ----
    "Time in seconds between the time you change a Java source buffer
  and the time the JDE reparses the buffer."
    :group 'jde-project
    :type 'number)
  
+ (defcustom jde-auto-parse-disable-threshold 50000
+   "Size in bytes.  Threshold value for disabling automatic reparsing of Java
+ source buffer.  If the Java source buffer is larger than the threshold, auto
+ parsing is disabled even if jde-auto-parse-enable is t.  Setting the
+ threshold to 0 will in effect always enable automatic reparsing if
+ jde-auto-parse-enable is t."
+   :group 'jde-project
+   :type 'number)
+ 
  (defvar jde-parse-bovine-java-grammar
    `((bovine-toplevel
       ( package_declaration)
       ( import_declaration)
       ( type_declaration)
***************
*** 506,518 ****
  (make-variable-buffer-local 'jde-parse-buffer-changed-p)
  
  (defvar jde-auto-parse-buffer-timer nil)
  (make-variable-buffer-local 'jde-auto-parse-buffer-timer)
  
  (defun jde-parse-buffer-changed-hook (begin end length)
    (setq jde-parse-buffer-changed-p t)
!   (when jde-auto-parse-enable
      (if (not jde-auto-parse-buffer-timer)
  	(setq jde-auto-parse-buffer-timer 
  	      (run-with-timer 
  	       jde-auto-parse-buffer-interval 
  	       nil 'jde-parse-bovinate-buffer)))))
--- 515,534 ----
  (make-variable-buffer-local 'jde-parse-buffer-changed-p)
  
  (defvar jde-auto-parse-buffer-timer nil)
  (make-variable-buffer-local 'jde-auto-parse-buffer-timer)
  
+ 
+ (defun jde-should-auto-parse-buffer ()
+   "Return t if jde should do auto parsing to the buffer"
+   (and jde-auto-parse-enable
+        (< (buffer-size) jde-auto-parse-disable-threshold)))
+   
+   
  (defun jde-parse-buffer-changed-hook (begin end length)
    (setq jde-parse-buffer-changed-p t)
!   (when (jde-should-auto-parse-buffer)
      (if (not jde-auto-parse-buffer-timer)
  	(setq jde-auto-parse-buffer-timer 
  	      (run-with-timer 
  	       jde-auto-parse-buffer-interval 
  	       nil 'jde-parse-bovinate-buffer)))))
***************
*** 556,566 ****
      (semantic-bovinate-toplevel)
      (setq jde-parse-buffer-contains-multiple-classes-p
  	  (jde-parse-buffer-contains-multiple-classes-p))
      (setq jde-parse-buffer-changed-p nil)
      (setq jde-parse-the-method-map (jde-parse-method-map "Method map"))
!     (when jde-auto-parse-enable
        (if jde-auto-parse-buffer-timer
  	  (cancel-timer jde-auto-parse-buffer-timer))
        (setq jde-auto-parse-buffer-timer nil))))
  
  (defun jde-sort-tokens (tokens)
--- 572,582 ----
      (semantic-bovinate-toplevel)
      (setq jde-parse-buffer-contains-multiple-classes-p
  	  (jde-parse-buffer-contains-multiple-classes-p))
      (setq jde-parse-buffer-changed-p nil)
      (setq jde-parse-the-method-map (jde-parse-method-map "Method map"))
!     (when (jde-should-auto-parse-buffer)
        (if jde-auto-parse-buffer-timer
  	  (cancel-timer jde-auto-parse-buffer-timer))
        (setq jde-auto-parse-buffer-timer nil))))
  
  (defun jde-sort-tokens (tokens)
***************
*** 1271,1276 ****
  ;; Revision 1.2  1999/08/20 00:52:14  paulk
  ;; Added jde-parse-get-package-from-name function.
  ;;
  ;; Revision 1.1  1999/04/27 16:25:46  paulk
  ;; Initial revision
! ;;
\ No newline at end of file
--- 1287,1292 ----
  ;; Revision 1.2  1999/08/20 00:52:14  paulk
  ;; Added jde-parse-get-package-from-name function.
  ;;
  ;; Revision 1.1  1999/04/27 16:25:46  paulk
  ;; Initial revision
! ;;

Reply via email to