Cleanup uses of "-hooks".
[bpt/emacs.git] / lisp / cedet / semantic / edit.el
index 7f7e82a..5b39dec 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/edit.el --- Edit Management for Semantic
 
-;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 
@@ -72,7 +72,9 @@ updated in the current buffer.
 
 For language specific hooks, make sure you define this as a local hook.")
 
-(defvar semantic-change-hooks
+(define-obsolete-variable-alias 'semantic-change-hooks
+  'semantic-change-functions "24.3")
+(defvar semantic-change-functions
   '(semantic-edits-change-function-handle-changes)
   "Abnormal hook run when semantic detects a change in a buffer.
 Each hook function must take three arguments, identical to the
@@ -89,11 +91,15 @@ If the hook returns non-nil, then declare that a reparse is needed.
 For language specific hooks, make sure you define this as a local hook.
 Not used yet; part of the next generation reparse mechanism.")
 
-(defvar semantic-edits-new-change-hooks nil
+(define-obsolete-variable-alias 'semantic-edits-new-change-hooks
+  'semantic-edits-new-change-functions "24.3")
+(defvar semantic-edits-new-change-functions nil
   "Abnormal hook run when a new change is found.
 Functions must take one argument representing an overlay on that change.")
 
-(defvar semantic-edits-delete-change-hooks nil
+(define-obsolete-variable-alias 'semantic-edits-delete-change-hooks
+  'semantic-edits-delete-change-functions "24.3")
+(defvar semantic-edits-delete-change-functions nil
   "Abnormal hook run before a change overlay is deleted.
 Deleted changes occur when multiple changes are merged.
 Functions must take one argument representing an overlay being deleted.")
@@ -104,7 +110,9 @@ Changes move when a new change overlaps an old change.  The old change
 will be moved.
 Functions must take one argument representing an overlay being moved.")
 
-(defvar semantic-edits-reparse-change-hooks nil
+(define-obsolete-variable-alias 'semantic-edits-reparse-change-hooks
+  'semantic-edits-reparse-change-functions "24.3")
+(defvar semantic-edits-reparse-change-functions nil
   "Abnormal hook run after a change results in a reparse.
 Functions are called before the overlay is deleted, and after the
 incremental reparse.")
@@ -133,7 +141,7 @@ Argument START, END, and LENGTH specify the bounds of the change."
    (setq semantic-unmatched-syntax-cache-check t)
    (let ((inhibit-point-motion-hooks t)
         )
-     (run-hook-with-args 'semantic-change-hooks start end length)
+     (run-hook-with-args 'semantic-change-functions start end length)
      ))
 
 (defun semantic-changes-in-region (start end &optional buffer)
@@ -168,7 +176,7 @@ Argument START, END, and LENGTH specify the bounds of the change."
          ;; function will be removed from the list of active change
          ;; functions.
          (condition-case nil
-             (run-hook-with-args 'semantic-edits-new-change-hooks o)
+             (run-hook-with-args 'semantic-edits-new-change-functions o)
            (error nil)))
       (let ((tmp changes-in-change))
        ;; Find greatest bounds of all changes
@@ -188,7 +196,7 @@ Argument START, END, and LENGTH specify the bounds of the change."
        ;; Delete other changes.  They are now all bound here.
        (while changes-in-change
          (condition-case nil
-             (run-hook-with-args 'semantic-edits-delete-change-hooks
+             (run-hook-with-args 'semantic-edits-delete-change-functions
                                  (car changes-in-change))
            (error nil))
          (semantic-overlay-delete (car changes-in-change))
@@ -198,7 +206,7 @@ Argument START, END, and LENGTH specify the bounds of the change."
 (defsubst semantic-edits-flush-change (change)
   "Flush the CHANGE overlay."
   (condition-case nil
-      (run-hook-with-args 'semantic-edits-delete-change-hooks
+      (run-hook-with-args 'semantic-edits-delete-change-functions
                          change)
     (error nil))
   (semantic-overlay-delete change))
@@ -316,7 +324,7 @@ See `semantic-edits-change-leaf-tag' for details on parents."
                  (setq list-to-search nil)))
        ;; Search list is nil.
        ))
-    ;; If we have a search list, lets go.  Otherwise nothing.
+    ;; If we have a search list, let's go.  Otherwise nothing.
     (while (and list-to-search (not found))
       (if (cdr list-to-search)
           ;; We end when the start of the CDR is after the end of our
@@ -392,7 +400,7 @@ See `semantic-edits-change-leaf-tag' for details on parents."
              ;; There are no tags left, and all tags originally
              ;; found are encompassed by the change.  Setup our list
              ;; from the cache
-             (setq list-to-search semantic--buffer-cache);; We have a tag ouside the list.  Check for
+             (setq list-to-search semantic--buffer-cache);; We have a tag outside the list.  Check for
            ;; We know we have a parent because it would
            ;; completely cover the change.  A tag can only
            ;; do that if it is a parent after we get here.
@@ -427,7 +435,7 @@ See `semantic-edits-change-leaf-tag' for details on parents."
            ;; which must have a value by now.
 
            ;; Loop over the search list to find the preceding CDR.
-           ;; Fortunatly, (car overlapped-tags) happens to be
+           ;; Fortunately, (car overlapped-tags) happens to be
            ;; the first tag positionally.
            (let ((tokstart (semantic-tag-start (car overlapped-tags))))
              (while (and list-to-search
@@ -470,6 +478,7 @@ a 'semantic-parse-changes-failed exception with value t."
             (buffer-name (current-buffer))))
   (run-hooks 'semantic-edits-incremental-reparse-failed-hook))
 
+;;;###autoload
 (defun semantic-edits-incremental-parser ()
   "Incrementally reparse the current buffer.
 Incremental parser allows semantic to only reparse those sections of
@@ -537,7 +546,7 @@ This function is for internal use by `semantic-edits-incremental-parser'."
       ;; We want to take some set of changes, and group them
       ;; together into a small change group. One change forces
       ;; a reparse of a larger region (the size of some set of
-      ;; tags it encompases.)  It may contain several tags.
+      ;; tags it encompasses.)  It may contain several tags.
       ;; That region may have other changes in it (several small
       ;; changes in one function, for example.)
       ;; Optimize for the simple cases here, but try to handle
@@ -549,7 +558,7 @@ This function is for internal use by `semantic-edits-incremental-parser'."
                       ;; is not the first change for this
                       ;; iteration, and it starts before the end
                       ;; of current parse region, then it is
-                      ;; encompased within the bounds of tags
+                      ;; encompassed within the bounds of tags
                       ;; modified by the previous iteration's
                       ;; change.
                       (< (semantic-overlay-start (car changes))
@@ -595,7 +604,7 @@ This function is for internal use by `semantic-edits-incremental-parser'."
               ;; Feb 06 -
               ;; IDed when the first cache-list tag is after
               ;; our change, meaning there is nothing before
-              ;; the chnge.
+              ;; the change.
                ((> (semantic-tag-start (car cache-list))
                    (semantic-overlay-end (car changes)))
                (setq last-cond "Beginning of buffer")
@@ -649,7 +658,7 @@ This function is for internal use by `semantic-edits-incremental-parser'."
                     parent-tag (aref tmp 2))
               ;; We can calculate parse begin/end by checking
               ;; out what is in TAGS.  The one near start is
-              ;; always first.  Make sure the reprase includes
+              ;; always first.  Make sure the reparse includes
               ;; the `whitespace' around the snarfed tags.
               ;; Since cache-list is positioned properly, use it
               ;; to find that boundary.
@@ -707,7 +716,7 @@ This function is for internal use by `semantic-edits-incremental-parser'."
       ;; since that is how the multi-tag parser works.  Grab
       ;; the reparse symbol from the first of the returned tags.
       ;;
-      ;; Feb '06 - If repase-symbol is nil, then they are top level
+      ;; Feb '06 - If reparse-symbol is nil, then they are top level
       ;;     tags.  (I'm guessing.)  Is this right?
       (setq reparse-symbol
             (semantic--tag-get-property (car (or tags cache-list))
@@ -859,7 +868,7 @@ pre-positioned to a convenient location."
          (setq cacheend chil)
          (while (and cacheend (not (eq last (car cacheend))))
            (setq cacheend (cdr cacheend)))
-         ;; The splicable part is after cacheend.. so move cacheend
+         ;; The spliceable part is after cacheend.. so move cacheend
          ;; one more tag.
          (setq cacheend (cdr cacheend))
          ;; Splice the found end tag into the cons cell