]> git.eshelyaron.com Git - emacs.git/commitdiff
* progmodes/cfengine.el: Use symbol motion commands instead of extending the word...
authorTed Zlatanov <tzz@lifelogs.com>
Fri, 22 Mar 2013 19:06:53 +0000 (15:06 -0400)
committerTed Zlatanov <tzz@lifelogs.com>
Fri, 22 Mar 2013 19:06:53 +0000 (15:06 -0400)
lisp/ChangeLog
lisp/progmodes/cfengine.el

index f3a37e307bc0fe64b3f0eb8535a3b5f051955f16..ef14fd4a07752f7735d1a9d948848f4542ad6b86 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-22  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * progmodes/cfengine.el: Update docs to mention
+       `cfengine-auto-mode'.  Use \_> and \_< instead of \> and \< for
+       symbol motion.  Remove "_" from the word syntax.
+
 2013-03-21  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * progmodes/cfengine.el (cfengine-common-syntax): Add "_" to word
index 6b438fb06af87174ad67aaee4a56e3d270cde603..11eb0eeaf4922eca03d4a23ccf843931760f44e2 100644 (file)
 ;; The CFEngine 3.x support doesn't have Imenu support but patches are
 ;; welcome.
 
+;; By default, CFEngine 3.x syntax is used.
+
 ;; You can set it up so either `cfengine2-mode' (2.x and earlier) or
 ;; `cfengine3-mode' (3.x) will be picked, depending on the buffer
 ;; contents:
 
-;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine-mode))
+;; (add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine-auto-mode))
 
 ;; OR you can choose to always use a specific version, if you prefer
 ;; it:
@@ -181,7 +183,7 @@ This includes those for cfservd as well as cfagent.")
     ("$(\\([[:alnum:]_]+\\))" 1 font-lock-variable-name-face)
     ("${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face)
     ;; Variable definitions.
-    ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
+    ("\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
     ;; File, acl &c in group:   { token ... }
     ("{[ \t]*\\([^ \t\n]+\\)" 1 font-lock-constant-face)))
 
@@ -189,9 +191,9 @@ This includes those for cfservd as well as cfagent.")
   `(
     ;; Defuns.  This happens early so they don't get caught by looser
     ;; patterns.
-    (,(concat "\\<" cfengine3-defuns-regex "\\>"
-              "[ \t]+\\<\\([[:alnum:]_.:]+\\)\\>"
-              "[ \t]+\\<\\([[:alnum:]_.:]+\\)"
+    (,(concat "\\_<" cfengine3-defuns-regex "\\_>"
+              "[ \t]+\\_<\\([[:alnum:]_.:]+\\)\\_>"
+              "[ \t]+\\_<\\([[:alnum:]_.:]+\\)"
               ;; Optional parentheses with variable names inside.
               "\\(?:(\\([^)]*\\))\\)?")
      (1 font-lock-builtin-face)
@@ -212,10 +214,10 @@ This includes those for cfservd as well as cfagent.")
     ("[@$]{\\([[:alnum:]_.:]+\\)}" 1 font-lock-variable-name-face)
 
     ;; Variable definitions.
-    ("\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
+    ("\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
 
     ;; Variable types.
-    (,(concat "\\<" (eval-when-compile (regexp-opt cfengine3-vartypes t)) "\\>")
+    (,(concat "\\_<" (eval-when-compile (regexp-opt cfengine3-vartypes t)) "\\_>")
      1 font-lock-type-face)))
 
 (defvar cfengine2-imenu-expression
@@ -223,9 +225,9 @@ This includes those for cfservd as well as cfagent.")
                              (regexp-opt cfengine2-actions t))
                  ":[^:]")
         1)
-    ("Variables/classes" "\\<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1)
-    ("Variables/classes" "\\<define=\\([[:alnum:]_]+\\)" 1)
-    ("Variables/classes" "\\<DefineClass\\>[ \t]+\\([[:alnum:]_]+\\)" 1))
+    ("Variables/classes" "\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1)
+    ("Variables/classes" "\\_<define=\\([[:alnum:]_]+\\)" 1)
+    ("Variables/classes" "\\_<DefineClass\\>[ \t]+\\([[:alnum:]_]+\\)" 1))
   "`imenu-generic-expression' for CFEngine mode.")
 
 (defun cfengine2-outline-level ()
@@ -338,7 +340,7 @@ Intended as the value of `indent-line-function'."
 Treats body/bundle blocks as defuns."
   (unless (<= (current-column) (current-indentation))
     (end-of-line))
-  (if (re-search-backward (concat "^[ \t]*" cfengine3-defuns-regex "\\>") nil t)
+  (if (re-search-backward (concat "^[ \t]*" cfengine3-defuns-regex "\\_>") nil t)
       (beginning-of-line)
     (goto-char (point-min)))
   t)
@@ -347,7 +349,7 @@ Treats body/bundle blocks as defuns."
   "`end-of-defun' function for Cfengine 3 mode.
 Treats body/bundle blocks as defuns."
   (end-of-line)
-  (if (re-search-forward (concat "^[ \t]*" cfengine3-defuns-regex "\\>") nil t)
+  (if (re-search-forward (concat "^[ \t]*" cfengine3-defuns-regex "\\_>") nil t)
       (beginning-of-line)
     (goto-char (point-max)))
   t)
@@ -366,7 +368,7 @@ Intended as the value of `indent-line-function'."
 
       (cond
        ;; Body/bundle blocks start at 0.
-       ((looking-at (concat cfengine3-defuns-regex "\\>"))
+       ((looking-at (concat cfengine3-defuns-regex "\\_>"))
         (indent-line-to 0))
        ;; Categories are indented one step.
        ((looking-at (concat cfengine3-category-regex "[ \t]*\\(#.*\\)*$"))
@@ -516,7 +518,6 @@ Intended as the value of `indent-line-function'."
 
 (defun cfengine-common-syntax (table)
   ;; The syntax defaults seem OK to give reasonable word movement.
-  (modify-syntax-entry ?w "_" table)
   (modify-syntax-entry ?# "<" table)
   (modify-syntax-entry ?\n ">#" table)
   (modify-syntax-entry ?\" "\"" table)  ; "string"
@@ -584,7 +585,7 @@ on the buffer contents"
     (save-restriction
       (goto-char (point-min))
       (while (not (or (eobp) v3))
-        (setq v3 (looking-at (concat cfengine3-defuns-regex "\\>")))
+        (setq v3 (looking-at (concat cfengine3-defuns-regex "\\_>")))
         (forward-line)))
     (if v3 (cfengine3-mode) (cfengine2-mode))))