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.el cedet/sr...


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog cedet/semantic.el cedet/sr...
Date: Sun, 04 Oct 2009 19:22:13 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/10/04 19:22:13

Modified files:
        lisp           : ChangeLog 
        lisp/cedet     : semantic.el 
        lisp/cedet/srecode: compile.el 

Log message:
        * cedet/semantic.el (semantic-new-buffer-setup-functions): New
        option.
        (semantic-new-buffer-fcn): Call parser setup functions here.
        (semantic-mode): Don't call parser setup functions here, it's done
        in semantic-new-buffer-fcn now.
        
        * cedet/srecode/compile.el (srecode-compile-file): Call
        semantic-new-buffer-fcn if the buffer has not been parsed.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16349&r2=1.16350
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/cedet/semantic.el?cvsroot=emacs&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/cedet/srecode/compile.el?cvsroot=emacs&r1=1.5&r2=1.6

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16349
retrieving revision 1.16350
diff -u -b -r1.16349 -r1.16350
--- ChangeLog   4 Oct 2009 19:00:54 -0000       1.16349
+++ ChangeLog   4 Oct 2009 19:22:09 -0000       1.16350
@@ -1,5 +1,16 @@
 2009-10-04  Chong Yidong  <address@hidden>
 
+       * cedet/semantic.el (semantic-new-buffer-setup-functions): New
+       option.
+       (semantic-new-buffer-fcn): Call parser setup functions here.
+       (semantic-mode): Don't call parser setup functions here, it's done
+       in semantic-new-buffer-fcn now.
+
+       * cedet/srecode/compile.el (srecode-compile-file): Call
+       semantic-new-buffer-fcn if the buffer has not been parsed.
+
+2009-10-04  Chong Yidong  <address@hidden>
+
        * cedet/ede/pmake.el (ede-pmake-insert-variable-once): Delete.
 
        * cedet/ede/proj-comp.el: Don't require ede/pmake at toplevel.

Index: cedet/semantic.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cedet/semantic.el,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- cedet/semantic.el   3 Oct 2009 20:30:46 -0000       1.6
+++ cedet/semantic.el   4 Oct 2009 19:22:12 -0000       1.7
@@ -260,6 +260,30 @@
   :group 'semantic
   :type 'hook)
 
+(defcustom semantic-new-buffer-setup-functions
+  '((js-mode . wisent-javascript-setup-parser)
+    (java-mode . wisent-java-default-setup)
+    (scheme-mode . semantic-default-scheme-setup)
+    (c-mode . semantic-default-c-setup)
+    (c++-mode . semantic-default-c-setup)
+    (html-mode . semantic-default-html-setup)
+    (srecode-template-mode . srecode-template-setup-parser)
+    (makefile-automake-mode . semantic-default-make-setup)
+    (makefile-gmake-mode . semantic-default-make-setup)
+    (makefile-makepp-mode . semantic-default-make-setup)
+    (makefile-bsdmake-mode . semantic-default-make-setup)
+    (makefile-imake-mode . semantic-default-make-setup)
+    (makefile-mode . semantic-default-make-setup))
+  "Alist of functions to call to set up Semantic parsing in the buffer.
+Each element has the form (MODE . FN), where MODE is a value of
+`major-mode' for the buffer and FN is the corresponding function
+to call, with no arguments, to set up the parser.
+
+These functions are called by `semantic-new-buffer-fcn', before
+`semantic-inhibit-functions'."
+  :group 'semantic
+  :type '(alist :key-type symbol :value-type function))
+
 (defvar semantic-init-hook nil
   "Hook run when a buffer is initialized with a parsing table.")
 
@@ -299,6 +323,11 @@
 If the major mode is ready for Semantic, and no
 `semantic-inhibit-functions' disabled it, the current buffer is setup
 to use Semantic, and `semantic-init-hook' is run."
+  ;; In upstream Semantic, the parser setup functions are called from
+  ;; mode hooks.  In the version bundled with Emacs, we do it here.
+  (let ((entry (assq major-mode semantic-new-buffer-setup-functions)))
+    (when entry
+      (funcall (cdr entry))))
   ;; Do stuff if semantic was activated by a mode hook in this buffer,
   ;; and not afterwards disabled.
   (when (and semantic--parse-table
@@ -1046,30 +1075,9 @@
                     (file-exists-p semanticdb-default-system-save-directory))
            (require 'semantic/db-ebrowse)
            (semanticdb-load-ebrowse-caches)))
-       (add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
-       ;; Add mode-local hooks
-       (add-hook 'js-mode-hook 'wisent-javascript-setup-parser)
-       (add-hook 'ecmascript-mode-hook 'wisent-javascript-setup-parser)
-       (add-hook 'java-mode-hook 'wisent-java-default-setup)
-       (add-hook 'scheme-mode-hook 'semantic-default-scheme-setup)
-       (add-hook 'makefile-mode-hook 'semantic-default-make-setup)
-       (add-hook 'c-mode-hook 'semantic-default-c-setup)
-       (add-hook 'c++-mode-hook 'semantic-default-c-setup)
-       (add-hook 'html-mode-hook 'semantic-default-html-setup)
-       (add-hook 'html-mode-hook 'semantic-default-html-setup)
-       (add-hook 'srecode-template-mode-hook 'srecode-template-setup-parser))
+       (add-hook 'mode-local-init-hook 'semantic-new-buffer-fcn))
     ;; Disable all Semantic features.
     (remove-hook 'mode-local-init-hook 'semantic-new-buffer-fcn)
-    (remove-hook 'js-mode-hook 'wisent-javascript-setup-parser)
-    (remove-hook 'ecmascript-mode-hook 'wisent-javascript-setup-parser)
-    (remove-hook 'java-mode-hook 'wisent-java-default-setup)
-    (remove-hook 'scheme-mode-hook 'semantic-default-scheme-setup)
-    (remove-hook 'makefile-mode-hook 'semantic-default-make-setup)
-    (remove-hook 'c-mode-hook 'semantic-default-c-setup)
-    (remove-hook 'c++-mode-hook 'semantic-default-c-setup)
-    (remove-hook 'html-mode-hook 'semantic-default-html-setup)
-    (remove-hook 'srecode-template-mode-hook 'srecode-template-setup-parser)
-
     ;; FIXME: handle semanticdb-load-ebrowse-caches
     (dolist (mode semantic-submode-list)
       (if (and (boundp mode) (eval mode))

Index: cedet/srecode/compile.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cedet/srecode/compile.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cedet/srecode/compile.el    2 Oct 2009 10:53:36 -0000       1.5
+++ cedet/srecode/compile.el    4 Oct 2009 19:22:13 -0000       1.6
@@ -188,6 +188,8 @@
          (set-buffer (semantic-find-file-noselect fname))
        (set-buffer peb))
       ;; Do the compile.
+      (unless (semantic-active-p)
+       (semantic-new-buffer-fcn))
       (srecode-compile-templates)
       ;; Trash the buffer if we had to read it in.
       (if (not peb)




reply via email to

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