Initial Commit
[packages] / xemacs-packages / mmm-mode / mmm-rpm.el
1 ;;; mmm-rpm.el --- MMM submode class for RPM spec files
2
3 ;; Copyright (C) 2000 by Marcus Harnisch <Marcus.Harnisch@gmx.net>
4
5 ;; Author:  Marcus Harnisch <Marcus.Harnisch@gmx.net>
6 ;; Version: $Id: mmm-rpm.el,v 1.2 2008-12-22 14:02:25 mharnisch Exp $
7
8 ;;{{{ GPL
9
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;}}}
26
27 ;;; Commentary:
28
29 ;; This file contains the definition of an MMM Mode submode class for
30 ;; editing shell script sections within RPM (Redhat Package Manager)
31 ;; spec files. I recommend to use it in combination with
32 ;; rpm-spec-mode.el by Stig Bjørlykke <stigb@tihlde.hist.no> and Steve
33 ;; Sanbeg <sanbeg@dset.com> (http://www.xemacs.org/~stigb/rpm-spec-mode.el)
34
35 ;;; Installation:
36
37 ;; 1. Copy this file where Emacs can find it.
38 ;;
39 ;; 2. Add the following lines to one of your startup files (e.g. ~/.emacs):
40 ;;
41 ;;   (add-to-list 'mmm-mode-ext-classes-alist
42 ;;                '(rpm-spec-mode "\\.spec\\'" rpm-sh))
43
44 ;;; Code:
45
46 (require 'mmm-auto)
47
48 (defconst mmm-rpm-sh-start-tags
49   '("prep" "build" "install" "clean" "preun" "postun" "pre"
50     "post" "triggerin" "triggerun" "triggerpostun")
51   "List containing RPM tags that start a shell-script section in a spec file")
52
53 (defvar mmm-rpm-sh-end-tags
54   (append '("files" "description" "package") mmm-rpm-sh-start-tags)
55   "List containing RPM tags that end a shell-script section in a spec file")
56
57 (defvar mmm-rpm-sh-start-regexp
58   (concat "^%" (mmm-regexp-opt mmm-rpm-sh-start-tags t) "\\b.*$")
59   "Regexp matching RPM tags that start a shell-script section in a spec file")
60
61 (defvar mmm-rpm-sh-end-regexp
62   (concat "\\'\\|^%" (mmm-regexp-opt mmm-rpm-sh-end-tags t) "\\b.*$")
63   "Regexp matching RPM tags that end a shell-script section in a spec file")
64
65 (mmm-add-group
66  'rpm
67  `((rpm-sh
68     :submode sh-mode
69     :face mmm-code-submode-face
70     ;; match tags that starts sh-script region
71     :front ,mmm-rpm-sh-start-regexp
72     ;; match end of buffer or next tag that ends sh-script region
73     :back ,mmm-rpm-sh-end-regexp
74     :front-offset 1
75     :back-offset 0
76     :save-matches 0
77     )))
78
79 (provide 'mmm-rpm)
80
81 ;;; mmm-rpm.el ends here