Mercurial > emacs
comparison lisp/progmodes/cfengine.el @ 55239:1af59a842b93
(cfengine-beginning-of-defun, cfengine-end-of-defun):
Ensure progress through buffer.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 29 Apr 2004 19:48:22 +0000 |
parents | 82f7cd1ab4eb |
children | 685fd8697e78 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
55238:373bc9e19710 | 55239:1af59a842b93 |
---|---|
1 ;;; cfengine.el --- mode for editing Cfengine files | 1 ;;; cfengine.el --- mode for editing Cfengine files |
2 | 2 |
3 ;; Copyright (C) 2003 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Dave Love <fx@gnu.org> | 5 ;; Author: Dave Love <fx@gnu.org> |
6 ;; Keywords: languages | 6 ;; Keywords: languages |
7 | 7 |
8 ;; This file is part of GNU Emacs. | 8 ;; This file is part of GNU Emacs. |
100 (length (match-string 1)))) | 100 (length (match-string 1)))) |
101 | 101 |
102 (defun cfengine-beginning-of-defun () | 102 (defun cfengine-beginning-of-defun () |
103 "`beginning-of-defun' function for Cfengine mode. | 103 "`beginning-of-defun' function for Cfengine mode. |
104 Treats actions as defuns." | 104 Treats actions as defuns." |
105 (end-of-line) | 105 (unless (<= (current-column) (current-indentation)) |
106 (end-of-line)) | |
106 (if (re-search-backward "^[[:alpha:]]+: *$" nil t) | 107 (if (re-search-backward "^[[:alpha:]]+: *$" nil t) |
107 (beginning-of-line) | 108 (beginning-of-line) |
108 (goto-char (point-min))) | 109 (goto-char (point-min))) |
109 t) | 110 t) |
110 | 111 |
111 (defun cfengine-end-of-defun () | 112 (defun cfengine-end-of-defun () |
112 "`end-of-defun' function for Cfengine mode. | 113 "`end-of-defun' function for Cfengine mode. |
113 Treats actions as defuns." | 114 Treats actions as defuns." |
114 (end-of-line) | 115 (end-of-line) |
115 (if (re-search-forward "^[[:alpha:]]+: *$" nil t) | 116 (if (re-search-forward "^[[:alpha:]]+: *$" nil t) |
116 (progn (forward-line -1) (end-of-line)) | 117 (beginning-of-line) |
117 (goto-char (point-max))) | 118 (goto-char (point-max))) |
118 t) | 119 t) |
119 | 120 |
120 ;; Fixme: Should get an extra indent step in editfiles BeginGroup...s. | 121 ;; Fixme: Should get an extra indent step in editfiles BeginGroup...s. |
121 | 122 |