summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2013-07-05 08:33:40 +0200
committerUlrich Müller <ulm@gentoo.org>2013-07-05 08:33:40 +0200
commitd4b8ace3bb564e39908e09f9e90fb1567918ccce (patch)
tree96dbe02fb8601a1566e52f74acf21cf8a56d1f7e /gentoo-newsitem-mode.el
parentRemove eselect-mode; it will be maintained in the eselect repository. (diff)
downloadebuild-mode-d4b8ace3bb564e39908e09f9e90fb1567918ccce.tar.gz
ebuild-mode-d4b8ace3bb564e39908e09f9e90fb1567918ccce.tar.bz2
ebuild-mode-d4b8ace3bb564e39908e09f9e90fb1567918ccce.zip
gentoo-newsitem-mode.el split off from gentoo-syntax.el.
* gentoo-newsitem-mode.el: New file, split off from gentoo-syntax.el. * gentoo-syntax.el (gentoo-newsitem-font-lock-keywords) (gentoo-newsitem-mode, gentoo-newsitem-insert-skeleton): Variable and functions moved to gentoo-newsitem-mode.el. * Makefile (DISTFILES): Update.
Diffstat (limited to 'gentoo-newsitem-mode.el')
-rw-r--r--gentoo-newsitem-mode.el95
1 files changed, 95 insertions, 0 deletions
diff --git a/gentoo-newsitem-mode.el b/gentoo-newsitem-mode.el
new file mode 100644
index 0000000..a965951
--- /dev/null
+++ b/gentoo-newsitem-mode.el
@@ -0,0 +1,95 @@
+;;; gentoo-newsitem-mode.el --- edit Gentoo GLEP 42 news items
+
+;; Copyright 2009-2013 Gentoo Foundation
+
+;; Author: Ulrich Müller <ulm@gentoo.org>
+;; Christian Faulhammer <fauli@gentoo.org>
+;; Maintainer: <emacs@gentoo.org>
+;; Keywords: languages
+
+;; 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 of the License, 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. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'font-lock)
+(require 'easymenu)
+(require 'skeleton)
+
+(defvar gentoo-newsitem-font-lock-keywords
+ (eval-when-compile
+ `(,(concat "^"
+ (regexp-opt
+ '("Title" "Author" "Translator" "Content-Type" "Posted"
+ "Revision" "News-Item-Format" "Display-If-Installed"
+ "Display-If-Keyword" "Display-If-Profile") t)
+ ":")
+ . font-lock-keyword-face))
+ "Expressions to highlight in Gentoo newsitem mode.")
+
+;;;###autoload
+(define-derived-mode gentoo-newsitem-mode text-mode "Newsitem"
+ "Major mode for Gentoo GLEP 42 news items."
+ (make-local-variable 'font-lock-defaults)
+ (setq font-lock-defaults '(gentoo-newsitem-font-lock-keywords t))
+ (setq fill-column 72))
+
+(define-skeleton gentoo-newsitem-insert-skeleton
+ "Insert a skeleton for a Gentoo GLEP 42 news item."
+ nil
+ "Title: " (skeleton-read "Title: ") "\n"
+ "Author: " (skeleton-read
+ "Author's real name and e-mail address: "
+ (concat user-full-name " <" user-mail-address ">"))
+ "\n"
+ ((skeleton-read "Further author (null string to terminate): ")
+ "Author: " str "\n")
+ ((skeleton-read "Translator (null string to terminate): ")
+ "Translator: " str "\n")
+ "Content-Type: text/plain\n"
+ "Posted: " (skeleton-read "Date of posting: "
+ (format-time-string "%Y-%m-%d"))
+ "\n"
+ "Revision: 1\n"
+ "News-Item-Format: 1.0\n"
+ ((skeleton-read "Display-If-Installed: (null string to terminate): ")
+ "Display-If-Installed: " str "\n")
+ ((skeleton-read "Display-If-Keyword: (null string to terminate): ")
+ "Display-If-Keyword: " str "\n")
+ ((skeleton-read "Display-If-Profile: (null string to terminate): ")
+ "Display-If-Profile: " str "\n")
+ "\n")
+
+
+(define-key gentoo-newsitem-mode-map
+ "\C-c\C-n" 'gentoo-newsitem-insert-skeleton)
+
+(easy-menu-define gentoo-newsitem-mode-menu gentoo-newsitem-mode-map
+ "Menu for gentoo-newsitem-mode."
+ `("Newsitem"
+ ["Insert skeleton" gentoo-newsitem-insert-skeleton]))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist
+ '("/[0-9]\\{4\\}-[01][0-9]-[0-3][0-9]-.+\\.[a-z]\\{2\\}\\.txt\\'"
+ . gentoo-newsitem-mode))
+
+(provide 'gentoo-newsitem-mode)
+
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
+;;; gentoo-newsitem-mode.el ends here