emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog cedet/semantic/lex-spp.el ...


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog cedet/semantic/lex-spp.el ...
Date: Wed, 21 Oct 2009 14:04:05 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/10/21 14:04:05

Modified files:
        lisp           : ChangeLog 
        lisp/cedet/semantic: lex-spp.el 
        lisp/cedet/semantic/bovine: c.el 

Log message:
        * cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
        (semantic-c-debug-mode-init-pch): New functions.
        (semantic-c-debug-mode-init-last-mode): New var.
        (semantic-c-parse-lexical-token): Use them.
        
        * cedet/semantic/lex-spp.el (semantic-lex-spp-anlyzer-do-replace):
        When extracting the argument list, limit only by point-max.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16465&r2=1.16466
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/cedet/semantic/lex-spp.el?cvsroot=emacs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/cedet/semantic/bovine/c.el?cvsroot=emacs&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16465
retrieving revision 1.16466
diff -u -b -r1.16465 -r1.16466
--- ChangeLog   21 Oct 2009 11:27:59 -0000      1.16465
+++ ChangeLog   21 Oct 2009 14:04:00 -0000      1.16466
@@ -1,3 +1,13 @@
+2009-10-21  Eric Ludlam  <address@hidden>
+
+       * cedet/semantic/bovine/c.el (semantic-c-debug-mode-init)
+       (semantic-c-debug-mode-init-pch): New functions.
+       (semantic-c-debug-mode-init-last-mode): New var.
+       (semantic-c-parse-lexical-token): Use them.
+
+       * cedet/semantic/lex-spp.el (semantic-lex-spp-anlyzer-do-replace):
+       When extracting the argument list, limit only by point-max.
+
 2009-10-21  Michael Albinus  <address@hidden>
 
        * net/tramp-smb.el (tramp-smb-get-stat-capability): New defun.

Index: cedet/semantic/lex-spp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cedet/semantic/lex-spp.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- cedet/semantic/lex-spp.el   2 Oct 2009 10:53:35 -0000       1.4
+++ cedet/semantic/lex-spp.el   21 Oct 2009 14:04:04 -0000      1.5
@@ -697,7 +697,14 @@
          (goto-char end)
          (setq arg-parsed
                (semantic-lex-spp-one-token-and-move-for-macro
-                (point-at-eol)))
+                ;; NOTE: This used to be (point-at-eol), but
+                ;;       that was too close for multi-line arguments
+                ;;       to a macro.  Point max may be too far if there
+                ;;       is a typo in the buffer.
+                ;;
+                ;; Look here for performance issues while a user is typing
+                ;; incomplete code.
+                (point-max)))
          (setq end (semantic-lex-token-end arg-parsed))
 
          (when (and (listp arg-parsed) (eq (car arg-parsed) 'semantic-list))

Index: cedet/semantic/bovine/c.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cedet/semantic/bovine/c.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cedet/semantic/bovine/c.el  4 Oct 2009 01:44:42 -0000       1.5
+++ cedet/semantic/bovine/c.el  21 Oct 2009 14:04:04 -0000      1.6
@@ -712,7 +712,14 @@
          ;; Protect against user hooks throwing errors.
          (condition-case nil
              (funcall mode)
-           (error nil))
+           (error
+            (if (y-or-n-p
+                 (format "There was an error initializing %s in buffer \"%s\". 
Debug your hooks? "
+                         mode (buffer-name)))
+                (semantic-c-debug-mode-init mode)
+              (message "Macro parsing state may be broken...")
+              (sit-for 1))))
+         ) ; save match data
 
          ;; Hack in mode-local
          (activate-mode-local-bindings)
@@ -724,7 +731,7 @@
          (semantic-clear-toplevel-cache)
          (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook
                       t)
-         ))
+       )
       ;; Get the macro symbol table right.
       (setq semantic-lex-spp-dynamic-macro-symbol-obarray spp-syms)
       ;; (message "%S" macros)
@@ -751,6 +758,41 @@
       )
     stream))
 
+(defvar semantic-c-debug-mode-init-last-mode nil
+  "The most recent mode needing debugging.")
+
+(defun semantic-c-debug-mode-init (mm)
+  "Debug mode init for major mode MM after we're done parsing now."
+  (interactive (list semantic-c-debug-mode-init-last-mode))
+  (if (interactive-p)
+      ;; Do the debug.
+      (progn
+       (switch-to-buffer (get-buffer-create "*MODE HACK TEST*"))
+       (let ((debug-on-error t))
+         (funcall mm)))
+
+    ;; Notify about the debug
+    (setq semantic-c-debug-mode-init-last-mode mm)
+
+    (add-hook 'post-command-hook 'semantic-c-debug-mode-init-pch)))
+
+(defun semantic-c-debug-mode-init-pch ()
+  "Notify user about needing to debug their major mode hooks."
+  (let ((mm semantic-c-debug-mode-init-last-mode))
+    (switch-to-buffer-other-window
+     (get-buffer-create "*MODE HACK TEST*"))
+    (erase-buffer)
+    (insert "A failure occured while parsing your buffers.
+
+The failure occured while attempting to initialize " (symbol-name mm) " in a
+buffer not associated with a file.  To debug this problem, type
+
+M-x semantic-c-debug-mode-init
+
+now.
+")
+    (remove-hook 'post-command-hook 'semantic-c-debug-mode-init-pch)))
+
 (defun semantic-expand-c-tag (tag)
   "Expand TAG into a list of equivalent tags, or nil."
   (let ((return-list nil)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]