]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/decorate/mode.el
Remove obsolete leading * from defcustom, defface doc strings.
[gnu-emacs] / lisp / cedet / semantic / decorate / mode.el
index f7f33d09fb3e4f0c540f1dee949dae98fad15272..d4385e165c870dac518d6503c77e6340c8b03a68 100644 (file)
@@ -1,7 +1,6 @@
 ;;; semantic/decorate/mode.el --- Minor mode for decorating tags
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008,
-;;   2009, 2010, 2011  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: syntax
@@ -65,6 +64,14 @@ add items to this list."
   "Return the STYLE's highlighter function."
   (intern (format "%s-highlight" style)))
 
+(defsubst semantic-decorate-style-predicate-default (style)
+  "Return the STYLE's predicate function."
+  (intern (format "%s-p-default" style)))
+
+(defsubst semantic-decorate-style-highlighter-default (style)
+  "Return the STYLE's highlighter function."
+  (intern (format "%s-highlight-default" style)))
+
 ;;; Base decoration API
 ;;
 (defsubst semantic-decoration-p (object)
@@ -268,7 +275,13 @@ minor mode is enabled."
                   'semantic-decorate-tags-after-full-reparse nil t)
         ;; Add decorations to available tags.  The above hooks ensure
         ;; that new tags will be decorated when they become available.
-        (semantic-decorate-add-decorations (semantic-fetch-available-tags)))
+        ;; However, don't do this immediately, because EDE will be
+        ;; activated later by find-file-hook, and includes might not
+        ;; be found yet.
+       (run-with-idle-timer
+        0.1 nil
+        (lambda ()
+          (semantic-decorate-add-decorations (semantic-fetch-available-tags)))))
     ;; Remove decorations from available tags.
     (semantic-decorate-clear-decorations (semantic-fetch-available-tags))
     ;; Cleanup any leftover crap too.
@@ -324,6 +337,8 @@ Return non-nil if the decoration style is enabled."
            (flag  (if arg
                       (> (prefix-numeric-value arg) 0)
                     (not (cdr style)))))
+      (when (null style)
+       (error "Unknown decoration style %s" name))
       (unless (eq (cdr style) flag)
         ;; Store the new flag.
         (setcdr style flag)
@@ -365,9 +380,10 @@ IGNORE any input arguments."
   "Define a new decoration style with NAME.
 DOC is a documentation string describing the decoration style NAME.
 It is appended to auto-generated doc strings.
-An Optional list of FLAGS can also be specified.  Flags are:
+An optional list of FLAGS can also be specified.  Flags are:
   :enabled <value>  - specify the default enabled value for NAME.
-
+  :load <value>     - specify a feature (as a string) with the rest of
+                      the definition for decoration mode NAME.
 
 This defines two new overload functions respectively called `NAME-p'
 and `NAME-highlight', for which you must provide a default
@@ -377,7 +393,7 @@ must return non-nil to indicate that the tag should be decorated by
 `NAME-highlight'.
 
 To put primary decorations on a tag `NAME-highlight' must use
-functions like `semantic-set-tag-face', `semantic-set-tag-intangible',
+functions like `semantic-set-tag-face', `semantic-set-tag-read-only',
 etc., found in the semantic-decorate library.
 
 To add other kind of decorations on a tag, `NAME-highlight' must use
@@ -385,9 +401,14 @@ To add other kind of decorations on a tag, `NAME-highlight' must use
 decoration API found in this library."
   (let ((predicate   (semantic-decorate-style-predicate   name))
         (highlighter (semantic-decorate-style-highlighter name))
+       (predicatedef   (semantic-decorate-style-predicate-default   name))
+       (highlighterdef (semantic-decorate-style-highlighter-default name))
        (defaultenable (if (plist-member flags :enabled)
                           (plist-get flags :enabled)
                         t))
+       (loadfile (if (plist-member flags :load)
+                     (plist-get flags :load)
+                   nil))
        )
     `(progn
        ;; Clear the menu cache so that new items are added when
@@ -407,7 +428,18 @@ decoration API found in this library."
        (add-to-list 'semantic-decoration-styles
                     (cons ',(symbol-name name)
                          ,defaultenable))
-       )))
+       ;; If there is a load file, then create the autoload tokens for
+       ;; those functions to load the token, but only if the fsym
+       ;; doesn't exist yet.
+       (when (stringp ,loadfile)
+        (unless (fboundp ',predicatedef)
+          (autoload ',predicatedef ',loadfile "Return non-nil to decorate TAG."
+            ))
+
+        (unless (fboundp ',highlighterdef)
+          (autoload ',highlighterdef ',loadfile "Decorate TAG."))
+        ))
+    ))
 \f
 ;;; Predefined decoration styles
 ;;
@@ -423,7 +455,7 @@ Does not provide overlines for prototypes.")
      (:overline "cyan"))
     (((class color) (background light))
      (:overline "blue")))
-  "*Face used to show long tags in.
+  "Face used to show long tags in.
 Used by decoration style: `semantic-tag-boundary'."
   :group 'semantic-faces)
 
@@ -472,7 +504,7 @@ Used by decoration style: `semantic-tag-boundary'."
      (:background "#200000"))
     (((class color) (background light))
      (:background "#8fffff")))
-  "*Face used to show privately scoped tags in.
+  "Face used to show privately scoped tags in.
 Used by the decoration style: `semantic-decoration-on-private-members'."
   :group 'semantic-faces)
 
@@ -494,7 +526,7 @@ Use a primary decoration."
      (:background "#000020"))
     (((class color) (background light))
      (:background "#fffff8")))
-  "*Face used to show protected scoped tags in.
+  "Face used to show protected scoped tags in.
 Used by the decoration style: `semantic-decoration-on-protected-members'."
   :group 'semantic-faces)
 
@@ -513,6 +545,20 @@ Use a primary decoration."
   (semantic-set-tag-face
    tag 'semantic-decoration-on-protected-members-face))
 
+;;; Decoration Modes in other files
+;;
+(declare-function semantic-decoration-on-includes-p-default
+                 "semantic/decorate/include")
+(declare-function semantic-decoration-on-includes-highlight-default
+                 "semantic/decorate/include")
+(define-semantic-decoration-style semantic-decoration-on-includes
+  "Highlight class members that are includes.
+This mode provides a nice context menu on the include statements."
+  :enabled t
+  :load "semantic/decorate/include")
+
+
+
 (provide 'semantic/decorate/mode)
 
 ;; Local variables: