From: "Ulrich Mueller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect:master commit in: /, misc/
Date: Fri, 5 Jul 2013 13:37:46 +0000 (UTC) [thread overview]
Message-ID: <1372974023.70500045344b0cc9481a481fc026cb43f95d082b.ulm@gentoo> (raw)
commit: 70500045344b0cc9481a481fc026cb43f95d082b
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 4 21:40:23 2013 +0000
Commit: Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Jul 4 21:40:23 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=70500045
Add editing mode for Emacs, moved from emacs-tools repository to here.
* misc/eselect-mode.el: New file, editing mode for Emacs,
split off from app-emacs/gentoo-syntax.
* misc/Makefile.am (EXTRA_DIST): Add eselect-mode.el.
---
ChangeLog | 6 +++
misc/Makefile.am | 2 +-
misc/eselect-mode.el | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 136 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index d877459..1809cfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-04 Ulrich Müller <ulm@gentoo.org>
+
+ * misc/eselect-mode.el: New file, editing mode for Emacs,
+ split off from app-emacs/gentoo-syntax.
+ * misc/Makefile.am (EXTRA_DIST): Add eselect-mode.el.
+
2013-06-22 Ulrich Müller <ulm@gentoo.org>
* configure.ac: Update version to 1.3.5.
diff --git a/misc/Makefile.am b/misc/Makefile.am
index 626fe95..1933dee 100644
--- a/misc/Makefile.am
+++ b/misc/Makefile.am
@@ -1,2 +1,2 @@
-EXTRA_DIST = eselect.bashcomp
+EXTRA_DIST = eselect.bashcomp eselect-mode.el
MAINTAINERCLEANFILES = *~ Makefile.in
diff --git a/misc/eselect-mode.el b/misc/eselect-mode.el
new file mode 100644
index 0000000..065ee15
--- /dev/null
+++ b/misc/eselect-mode.el
@@ -0,0 +1,129 @@
+;;; eselect-mode.el --- edit eselect files
+
+;; Copyright 2006-2013 Gentoo Foundation
+
+;; Author: Matthew Kennedy <mkennedy@gentoo.org>
+;; Diego Pettenò <flameeyes@gentoo.org>
+;; Christian Faulhammer <fauli@gentoo.org>
+;; Ulrich Müller <ulm@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 'sh-script)
+(require 'font-lock)
+
+;;; Font-lock.
+
+(defvar eselect-mode-keywords-warn
+ '(("eval")
+ font-lock-warning-face))
+
+(defvar eselect-mode-keywords-core
+ '(("die" "check_do" "do_action" "inherit" "sed")
+ font-lock-type-face))
+
+(defvar eselect-mode-keywords-output
+ '(("write_error_msg" "write_warning_msg" "write_list_start"
+ "write_numbered_list_entry" "write_kv_list_entry"
+ "write_numbered_list" "highlight" "highlight_warning"
+ "highlight_marker" "is_output_mode" "space")
+ font-lock-type-face))
+
+(defvar eselect-mode-keywords-tests
+ '(("has" "is_function" "is_number")
+ font-lock-type-face))
+
+(defvar eselect-mode-keywords-path-manipulation
+ '(("basename" "dirname" "canonicalise" "relative_name")
+ font-lock-type-face))
+
+(defvar eselect-mode-keywords-config
+ '(("store_config" "load_config" "append_config")
+ font-lock-type-face))
+
+(defvar eselect-mode-keywords-multilib
+ '(("list_libdirs")
+ font-lock-type-face))
+
+(defvar eselect-mode-keywords-package-manager
+ '(("arch" "envvar" "best_version" "has_version" "get_repositories"
+ "get_repo_news_dir")
+ font-lock-type-face))
+
+(defun eselect-mode-make-keywords-list (keywords-list face
+ &optional prefix suffix)
+ ;; based on `generic-make-keywords-list' from generic.el
+ ;; Note: XEmacs doesn't have generic.el
+ (unless (listp keywords-list)
+ (error "Keywords argument must be a list of strings"))
+ (cons (concat prefix "\\<"
+ (regexp-opt keywords-list t)
+ "\\>" suffix)
+ face))
+
+(defvar eselect-mode-font-lock-keywords
+ (mapcar
+ (lambda (x) (apply 'eselect-mode-make-keywords-list x))
+ (list
+ eselect-mode-keywords-warn
+ eselect-mode-keywords-core
+ eselect-mode-keywords-output
+ eselect-mode-keywords-tests
+ eselect-mode-keywords-path-manipulation
+ eselect-mode-keywords-config
+ eselect-mode-keywords-multilib
+ eselect-mode-keywords-package-manager)))
+
+;;; Mode definitions.
+
+(defun eselect-mode-before-save ()
+ ;;(delete-trailing-whitespace) ; doesn't exist in XEmacs
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "[ \t]+$" nil t)
+ (delete-region (match-beginning 0) (point))))
+ ;; return nil, otherwise the file is presumed to be written
+ nil)
+
+;;;###autoload
+(define-derived-mode eselect-mode shell-script-mode "Eselect"
+ "Major mode for .eselect files."
+ (if (featurep 'xemacs)
+ (make-local-hook 'write-contents-hooks))
+ (add-hook 'write-contents-hooks 'eselect-mode-before-save t t)
+ (sh-set-shell "bash")
+ (setq tab-width 4)
+ (setq indent-tabs-mode t))
+
+(add-hook 'eselect-mode-hook
+ (lambda () (font-lock-add-keywords
+ nil eselect-mode-font-lock-keywords)))
+
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.eselect\\'" . eselect-mode))
+
+(provide 'eselect-mode)
+
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
+;;; eselect-mode.el ends here
next reply other threads:[~2013-07-05 13:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-05 13:37 Ulrich Mueller [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-09-18 7:10 [gentoo-commits] proj/eselect:master commit in: /, misc/ Ulrich Mueller
2013-11-15 8:01 [gentoo-commits] proj/eselect:nolinewrap " Ulrich Müller
2013-11-15 6:21 ` [gentoo-commits] proj/eselect:master " Ulrich Müller
2014-06-05 11:22 Ulrich Müller
2022-05-01 17:35 Ulrich Müller
2022-05-01 17:35 Ulrich Müller
2023-02-27 17:40 Ulrich Müller
2023-06-12 16:24 Ulrich Müller
2024-11-13 20:26 Ulrich Müller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372974023.70500045344b0cc9481a481fc026cb43f95d082b.ulm@gentoo \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox