[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. 90c4a6028cf6ebd530af736ce08f1b413698b162

Micah Anderson micah at riseup.net
Sat May 31 17:15:30 UTC 2008


The following commit has been merged in the master branch:
commit 46841b50f1f8b9110d4a3208842d5acd7e219a9c
Author: Russ Allbery <rra at debian.org>
Date:   Thu May 29 17:43:11 2008 -0700

    Further Emacs puppet-mode fixes
    
    More correctly handle indentation of lines enclosed in [] when the
    contents themselves contain [], such as arrays of object references
    for requires.
    
    Exclude newlines from more of the parsing regexes for more accurate
    results.
    
    Fontify references to objects even if they're not at the start of a
    line.

diff --git a/ext/emacs/puppet-mode.el b/ext/emacs/puppet-mode.el
index 65a6b68..11fcfea 100644
--- a/ext/emacs/puppet-mode.el
+++ b/ext/emacs/puppet-mode.el
@@ -103,15 +103,16 @@ that array, else return nil."
       (let ((opoint (point))
             (apoint (search-backward "[" nil t)))
         (when apoint
-          ;; An array opens before point.  If it doesn't close before
-          ;; point, then point must be in it.
-          ;; ### TODO: of course, the '[' could be in a string literal,
-          ;; ### in which case this whole idea is bogus.  But baby
-          ;; ### steps, baby steps.  A more robust strategy might be
-          ;; ### to walk backwards by sexps, until hit a wall, then
-          ;; ### inspect the nature of that wall.
-          (if (= (puppet-count-matches "\\]" apoint opoint) 0)
-              apoint))))))
+          ;; This is a bit of a hack and doesn't allow for strings.  We really
+          ;; want to parse by sexps at some point.
+          (let ((close-brackets (puppet-count-matches "]" apoint opoint))
+                (open-brackets 0))
+            (while (and apoint (> close-brackets open-brackets))
+              (setq apoint (search-backward "[" nil t))
+              (when apoint
+                (setq close-brackets (puppet-count-matches "]" apoint opoint))
+                (setq open-brackets (1+ open-brackets)))))
+          apoint)))))
 
 (defun puppet-in-include ()
   "If point is in a continued list of include statements, return the position
@@ -306,7 +307,6 @@ of the initial include plus puppet-include-indent."
      ;; variables
      '("\\(^\\|[^_:.@$]\\)\\b\\(true\\|false\\)\\>"
        2 font-lock-variable-name-face)
-     ;; variables
      '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"
        1 font-lock-variable-name-face)
      '("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\|:\\)+"
@@ -314,8 +314,8 @@ of the initial include plus puppet-include-indent."
      ;; usage of types
      '("^\\s *\\([a-zA-Z_-]+\\)\\s +{"
        1 font-lock-type-face)
-     ;; overrides
-     '("^\\s +\\([a-zA-Z_-]+\\)\\["
+     ;; overrides and type references
+     '("\\s +\\([A-Z][a-zA-Z_:-]*\\)\\["
        1 font-lock-type-face)
      ;; general delimited string
      '("\\(^\\|[[ \t\n<+(,=]\\)\\(%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\3\\)\\)"

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list