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

Micah Anderson micah at riseup.net
Wed May 7 16:20:13 UTC 2008


The following commit has been merged in the master branch:
commit 0e6b01c58ceecf2a506ef653ce5ac157faba5ed4
Author: Russ Allbery <rra at debian.org>
Date:   Fri May 2 12:54:35 2008 -0700

    Use our own count-matches for Emacs 21 compatibility
    
    Replace count-matches with a puppet-count-matches function that does
    the same as the Emacs 22 count-matches.  The Emacs 21 count-matches
    is different and not useful for our purposes.

diff --git a/ext/emacs/puppet-mode.el b/ext/emacs/puppet-mode.el
index 0a7ee1a..56a2b3a 100644
--- a/ext/emacs/puppet-mode.el
+++ b/ext/emacs/puppet-mode.el
@@ -56,6 +56,15 @@
   "*Indentation column of comments."
   :type 'integer :group 'puppet)
 
+(defun puppet-count-matches (re start end)
+  "The same as Emacs 22 count-matches, for portability to other versions
+of Emacs."
+  (save-excursion
+    (let ((n 0))
+      (goto-char start)
+      (while (re-search-forward re end t) (setq n (1+ n)))
+      n)))
+
 (defun puppet-comment-line-p ()
   "Return non-nil iff this line is a comment."
   (save-excursion
@@ -77,7 +86,7 @@ that array, else return nil."
           ;; ### 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 (= (count-matches "\\]" apoint opoint) 0)
+          (if (= (puppet-count-matches "\\]" apoint opoint) 0)
               apoint))))))
 
 (defun puppet-in-include ()

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list