emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/yaml-mode 20d12a2 001/124: init


From: ELPA Syncer
Subject: [nongnu] elpa/yaml-mode 20d12a2 001/124: init
Date: Sun, 29 Aug 2021 11:36:01 -0400 (EDT)

branch: elpa/yaml-mode
commit 20d12a2aff0bc9b21428f1421eaf097f4a355ad7
Author: root <root@c9fe89ab-c918-0410-b9be-faebe9bd2962>
Commit: root <root@c9fe89ab-c918-0410-b9be-faebe9bd2962>

    init
    
    git-svn-id: http://svn.clouder.jp/repos/public/yaml-mode/trunk@1 
c9fe89ab-c918-0410-b9be-faebe9bd2962
---
 Makefile     | 30 +++++++++++++++++++++
 README       | 44 +++++++++++++++++++++++++++++++
 yaml-mode.el | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..86c91d0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+VERSION=0.01
+EMACS = emacs
+PREFIX = /usr/local
+INSTALLLIBDIR = $(PREFIX)/share/emacs/site-lisp
+FLAGS = -batch -L $(INSTALLLIBDIR) -q -f batch-byte-compile
+SRC = yaml-mode.el
+INSTALL = /usr/bin/install -c -m 444
+
+all: bytecompile
+
+bytecompile:
+       $(EMACS) $(FLAGS) $(SRC)
+
+install: bytecompile
+       $(INSTALL) yaml-mode.elc $(INSTALLLIBDIR)
+       $(INSTALL) yaml-mode.el $(INSTALLLIBDIR)
+
+uninstall:
+       rm $(INSTALLLIBDIR)/yaml-mode.elc
+       rm $(INSTALLLIBDIR)/yaml-mode.el
+
+tardist:
+       mkdir yaml-mode-$(VERSION)
+       cp yaml-mode.el Makefile README yaml-mode-$(VERSION)
+       tar zcvf yaml-mode-$(VERSION).tar.gz yaml-mode-$(VERSION)
+       rm -fr yaml-mode-$(VERSION)
+
+clean:
+       rm -fr \#*\# *.elc *~ *.tar.gz
+
diff --git a/README b/README
new file mode 100644
index 0000000..cb426c7
--- /dev/null
+++ b/README
@@ -0,0 +1,44 @@
+NAME
+    yaml-mode - Simple major mode to edit YAML file for emacs
+
+SYNOPSIS
+      # You must add path installed yaml-mode.el to load-path.
+      (autoload 'yaml-mode "yaml-mode" "YAML" t)
+      (setq auto-mode-alist
+            (append '(("\\.yml$" . yaml-mode)) auto-mode-alist))
+
+DESCRIPTION
+    yaml-mode is major mode for emacs.
+
+INSTALL
+    You can install yaml-mode typing below.
+
+        % make
+        % make install
+
+        or
+
+        % make PREFIX=/your/home/dir
+        % make install PREFIX=/your/home/dir
+
+SETTING
+    see SYNOPSIS.
+
+AUTHOR
+    Yoshiki Kurihara <kurihara@cpan.org> Copyright (C) 2002 by Free Software
+    Foundation, Inc.
+
+    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.
diff --git a/yaml-mode.el b/yaml-mode.el
new file mode 100644
index 0000000..a53283a
--- /dev/null
+++ b/yaml-mode.el
@@ -0,0 +1,85 @@
+;;; yaml-mode.el ---
+;; $Id$
+
+;; Copyright (C) 2006  Free Software Foundation, Inc.
+
+;; Author: Yoshiki Kurihara <kurihara@livedoor.jp>
+;; Keywords: 
+
+;; 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:
+
+;; To handle files included with do 'filename.yml';, add something like
+;; (setq auto-mode-alist (append (list (cons "\\.yml\\'" 'yaml-mode))
+;;                               auto-mode-alist))
+;; to your .emacs file; otherwise the .pl suffix defaults to prolog-mode.
+
+;;; Code:
+
+(defcustom yaml-indent-offset 2
+  ""
+  :type 'integer
+  :group 'yaml-mode)
+
+(defun yaml-indent-line ()
+  (interactive)
+  (let ((pos (point))               ; position from the end of the buffer
+        (cur (current-indentation)) ; indentation of current line
+        (before (current-column))
+        (indentation 0)
+        new-column)
+    (save-excursion
+      (forward-line -1)
+      (if (and (not (bobp))
+               (looking-at "^[ \t]*\\(.+\\)[ \t]*:[ \r\n]"))
+          (if (< cur (+ (current-indentation) yaml-indent-offset))
+              (setq indentation (+ (current-indentation) yaml-indent-offset)))
+        (if (< cur (current-indentation))
+            (setq indentation (current-indentation))))
+      (if (and (not (bobp))
+               (looking-at "^[ \t]*\\(.+\\)[ \t]*: [^\r\n]+"))
+          (if (< cur (+ (current-indentation) yaml-indent-offset))
+              (setq indentation (current-indentation))))
+        )
+    (if (> indentation 0)
+        (indent-line-to indentation))
+    ))
+
+(defvar yaml-font-lock-keywords
+  (list
+   '("^[ \t]*\\(.+\\)[ \t]*:[ \r\n]" 0 font-lock-variable-name-face)
+   '("\\(%YAML\\|# \\(.*\\)\\|\\(---\\|\\.\\.\\.\\)\\(.*\\)\\)" 0 
font-lock-comment-face)
+   '("\\(\\*\\|\\&\\)\\(.*\\)" 0 (cons font-lock-variable-name-face 
'(underline)))
+   '("\\!\\!\\sw+[ \r\n]" 0 font-lock-function-name-face)
+   ))
+
+(define-derived-mode yaml-mode fundamental-mode "YAML"
+  "Simple mode to edit yaml
+
+\\{yaml-mode-map}"
+  
+  ;; font-lock
+  (set (make-local-variable 'comment-start) "# ")
+  (set (make-local-variable 'comment-start-skip) "\\(^\\|\\s-\\);?#+ *")
+  (set (make-local-variable 'font-lock-defaults) '(yaml-font-lock-keywords))
+
+  ;; indent-line
+  (set (make-local-variable 'indent-line-function) 'yaml-indent-line)
+  )
+
+(provide 'yaml-mode)
+;;; yaml-mode.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]