mmm-mode / mmm-rpm.el

;;; mmm-rpm.el --- MMM submode class for RPM spec files

;; Copyright (C) 2000 by Marcus Harnisch <Marcus.Harnisch@gmx.net>

;; Author:  Marcus Harnisch <Marcus.Harnisch@gmx.net>
;; Version: $Id$

;;{{{ GPL

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;}}}

;;; Commentary:

;; This file contains the definition of an MMM Mode submode class for
;; editing shell script sections within RPM (Redhat Package Manager)
;; spec files. I recommend to use it in combination with
;; rpm-spec-mode.el by Stig Bj�rlykke <stigb@tihlde.hist.no> and Steve
;; Sanbeg <sanbeg@dset.com> (http://www.xemacs.org/~stigb/rpm-spec-mode.el)

;;; Installation:

;; 1. Copy this file where Emacs can find it.
;;
;; 2. Add the following lines to one of your startup files (e.g. ~/.emacs):
;;
;;   (add-to-list 'mmm-mode-ext-classes-alist
;;                '(rpm-spec-mode "\\.spec\\'" rpm-sh))

;;; Code:

(require 'mmm-auto)

(defconst mmm-rpm-sh-start-tags
  '("prep" "build" "install" "clean" "preun" "postun" "pre"
    "post" "triggerin" "triggerun" "triggerpostun")
  "List containing RPM tags that start a shell-script section in a spec file")

(defvar mmm-rpm-sh-end-tags
  (append '("files" "description" "package") mmm-rpm-sh-start-tags)
  "List containing RPM tags that end a shell-script section in a spec file")

(defvar mmm-rpm-sh-start-regexp
  (concat "^%" (mmm-regexp-opt mmm-rpm-sh-start-tags t) "\\b.*$")
  "Regexp matching RPM tags that start a shell-script section in a spec file")

(defvar mmm-rpm-sh-end-regexp
  (concat "\\'\\|^%" (mmm-regexp-opt mmm-rpm-sh-end-tags t) "\\b.*$")
  "Regexp matching RPM tags that end a shell-script section in a spec file")

(mmm-add-group
 'rpm
 `((rpm-sh
    :submode sh-mode
    :face mmm-code-submode-face
    ;; match tags that starts sh-script region
    :front ,mmm-rpm-sh-start-regexp
    ;; match end of buffer or next tag that ends sh-script region
    :back ,mmm-rpm-sh-end-regexp
    :front-offset 1
    :back-offset 0
    :save-matches 0
    )))

(provide 'mmm-rpm)

;;; mmm-rpm.el ends here
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.