emacs: Update mode file
This is a squashed commit including the following changes: 1) Update mode header 2) Clean up white-space 3) Fix free variable warning 4) Add proper file ending stuff 5) Rename to keep conventional naming scheme 6) Updates to the readme 7) Update to conform to `package-lint` criteria 8) Add license header 9) Add in-file instructions
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
=== Emacs Syntax Highlighting ===
|
||||
Created by Aidan Thompson 12/2010
|
||||
===============================
|
||||
Updated by Roit Goswami Mon Jul 30 2018
|
||||
|
||||
The lammps.el file provided in this directory will enable syntax
|
||||
highlighting for the lammps script syntax in emacs. The groupings
|
||||
@ -15,9 +16,40 @@ some basic syntax highlighting of strings, comments, etc.
|
||||
============================
|
||||
(0) Create/edit the emacs init file ~/.emacs to contain:
|
||||
|
||||
(load "~/.emacs.d/lammps")
|
||||
(load "~/.emacs.d/lammps-mode.el")
|
||||
|
||||
This file may also be called ~/.emacs.el, or ~/.emacs.d/init.el
|
||||
|
||||
(1) Copy lammps.el to the directory ~/.emacs.d
|
||||
(1) Copy lammps-mode.el to the directory ~/.emacs.d
|
||||
|
||||
=Update:
|
||||
========
|
||||
|
||||
The package may now also be installed by a MELPA style recipe, namely:
|
||||
|
||||
```lisp
|
||||
(lammps-mode :fetcher github :repo "HaoZeke/lammps-mode")
|
||||
```
|
||||
|
||||
For a simpler installation with `use-package` simply add:
|
||||
|
||||
```lisp
|
||||
(use-package lammps-mode)
|
||||
```
|
||||
|
||||
The latest version of the package will be kept in sync as a squashed update on
|
||||
the lammps repository as well.
|
||||
|
||||
It is advisable to use the MELPA installation methods listed here:
|
||||
https://melpa.org/#/getting-started
|
||||
|
||||
For autoloading and auto-recognizing "in.*" and "*.lmp" files add the following
|
||||
to `.emacs`:
|
||||
|
||||
```lisp
|
||||
(autoload 'lammps-mode "lammps-mode.el" "LAMMPS mode." t)
|
||||
(setq auto-mode-alist (append auto-mode-alist
|
||||
'(("in\\." . lammps-mode))
|
||||
'(("\\.lmp\\'" . lammps-mode))
|
||||
))
|
||||
```
|
||||
|
||||
@ -1,7 +1,49 @@
|
||||
;; LAMMPS auto-mode
|
||||
;;; lammps-mode.el --- basic syntax highlighting for LAMMPS files
|
||||
|
||||
;; Copyright (C) 2010-18 Aidan Thompson
|
||||
;; Copyright (C) 2018 Rohit Goswami
|
||||
|
||||
;; Author: Aidan Thompson <athomps at sandia.gov>
|
||||
;; Maintainer: Rohit Goswami <r95g10 at gmail.com>
|
||||
;; Created: December 4, 2010
|
||||
;; Modified: July 30, 2018
|
||||
;; Version: 1.5.0
|
||||
;; Keywords: languages, faces
|
||||
;; Homepage: https://github.com/lammps/lammps/tree/master/tools/emacs
|
||||
;; Package-Requires: ((emacs "24.4"))
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; 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 3, 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:
|
||||
;; translation of keyword classes from tools/vim
|
||||
;; see http://xahlee.org/emacs/elisp_syntax_coloring.html
|
||||
|
||||
;; Put this in your .emacs file to enable autoloading of lammps-mode
|
||||
;; and auto-recognition of "in.*" and "*.lmp" files:
|
||||
;;
|
||||
;; (autoload 'lammps-mode "lammps-mode.el" "LAMMPS mode." t)
|
||||
;; (setq auto-mode-alist (append auto-mode-alist
|
||||
;; '(("in\\." . lammps-mode))
|
||||
;; '(("\\.lmp\\'" . lammps-mode))
|
||||
;; ))
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
;; define several keyword classes
|
||||
(defvar lammps-output
|
||||
'("log"
|
||||
@ -136,6 +178,8 @@
|
||||
(defvar lammps-variable-regexp
|
||||
"\\$\\({[a-zA-Z0-9_]+}\\)\\|\\$[A-Za-z]")
|
||||
|
||||
(defvar lammps-font-lock-keywords)
|
||||
|
||||
;; clear memory
|
||||
(setq lammps-output nil)
|
||||
(setq lammps-read nil)
|
||||
@ -151,8 +195,7 @@
|
||||
|
||||
;; create the list for font-lock.
|
||||
;; each class of keyword is given a particular face
|
||||
(setq
|
||||
lammps-font-lock-keywords
|
||||
(setq lammps-font-lock-keywords
|
||||
`((,lammps-output-regexp . font-lock-function-name-face)
|
||||
(,lammps-read-regexp . font-lock-preprocessor-face)
|
||||
(,lammps-lattice-regexp . font-lock-type-face)
|
||||
@ -200,11 +243,11 @@
|
||||
(setq lammps-variable-regexp nil))
|
||||
|
||||
;; apply it to specified filename patterns
|
||||
(setq
|
||||
auto-mode-alist
|
||||
(append
|
||||
auto-mode-alist
|
||||
(setq auto-mode-alist
|
||||
(append auto-mode-alist
|
||||
'(("in\\." . lammps-mode))
|
||||
'(("\\.lmp\\'" . lammps-mode))
|
||||
))
|
||||
|
||||
(provide 'lammps-mode)
|
||||
;;; lammps-mode.el ends here
|
||||
Reference in New Issue
Block a user