]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cfengine.el
(sh-require-final-newline):
[gnu-emacs] / lisp / progmodes / cfengine.el
index 76b4efccdd277870acfc1a461c277b1ce84c0295..3f6c24c85c6a1d2787ba4a0d68aca593bc604bde 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cfengine.el --- mode for editing Cfengine files
 
-;; Copyright (C) 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: languages
@@ -102,7 +102,8 @@ This includes those for cfservd as well as cfagent."))
 (defun cfengine-beginning-of-defun ()
   "`beginning-of-defun' function for Cfengine mode.
 Treats actions as defuns."
-  (end-of-line)
+  (unless (<= (current-column) (current-indentation))
+    (end-of-line))
   (if (re-search-backward "^[[:alpha:]]+: *$" nil t)
       (beginning-of-line)
     (goto-char (point-min)))
@@ -113,7 +114,7 @@ Treats actions as defuns."
 Treats actions as defuns."
   (end-of-line)
   (if (re-search-forward "^[[:alpha:]]+: *$" nil t)
-      (progn (forward-line -1) (end-of-line))
+      (beginning-of-line)
     (goto-char (point-max)))
   t)
 
@@ -221,7 +222,7 @@ to the action header."
   ;; movement.
 
   (set (make-local-variable 'parens-require-spaces) nil)
-  (set (make-local-variable 'require-final-newline) t)
+  (set (make-local-variable 'require-final-newline) mode-require-final-newline)
   (set (make-local-variable 'comment-start)  "# ")
   (set (make-local-variable 'comment-start-skip)
        "\\(\\(?:^\\|[^\\\\\n]\\)\\(?:\\\\\\\\\\)*\\)#+[ \t]*")
@@ -239,8 +240,13 @@ to the action header."
   (setq imenu-generic-expression cfengine-imenu-expression)
   (set (make-local-variable 'beginning-of-defun-function)
        #'cfengine-beginning-of-defun)
-  (set (make-local-variable 'end-of-defun-function) #'cfengine-end-of-defun))
+  (set (make-local-variable 'end-of-defun-function) #'cfengine-end-of-defun)
+  ;; Like Lisp mode.  Without this, we lose with, say,
+  ;; `backward-up-list' when there's an unbalanced quote in a
+  ;; preceding comment.
+  (set (make-local-variable 'parse-sexp-ignore-comments) t))
 
 (provide 'cfengine)
 
+;;; arch-tag: 6b931be2-1505-4124-afa6-9675971e26d4
 ;;; cfengine.el ends here