emacs: Major readme update and refactor

Also update the license and switch to GPL v2 like lammps
This commit is contained in:
HaoZeke 2018-07-30 20:10:29 +05:30
parent 2c9e96be11
commit a00d7becc3
No known key found for this signature in database
GPG Key ID: 9CCCE36402CB49A6
3 changed files with 83 additions and 63 deletions

76
tools/emacs/README.md Normal file
View File

@ -0,0 +1,76 @@
# GNU Emacs Syntax Highlighting
> Copyright (C) 2010-2018 Aidan Thompson <athomps at sandia.gov>
> Copyright (C) 2018 Rohit Goswami <r95g10 at gmail.com>
The `lammps-mode.el` file provided in this directory will enable syntax
highlighting for the lammps script syntax in GNU Emacs. The groupings of
commands were originally copied from `tools/vim`.
## Installation
**Requirements: GNU Emacs 24.\***
### Obtaining the Package
#### MELPA
The easiest installation method is via MELPA and it is advisable to use one of
the many [MELPA installation methods](https://melpa.org/#/getting-started).
For example, with [use-package](https://github.com/jwiegley/use-package) one can
simply use the following:
``` emacs-lisp
(use-package lammps-mode)
```
#### Manually
Assuming for some reason you have downloaded the file to `~/.emacs.d/lisp` you
would do the following (kanged [from here](http://ergoemacs.org/emacs/emacs_installing_packages.html)):
``` emacs-lisp
;; Tell emacs where is your personal elisp lib dir
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; load the package.
(load "lammps-mode")
```
### Autoloading \& Auto-recognition
For autoloading and auto-recognizing `in.*` and `*.lmp` files add the following
to `.emacs`:
``` 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))
))
```
## Status
By far not all commands are included in the syntax file (lammps-mode.el). You
can easily add new ones to the existing classes.
## Implementation Details
`lammps-mode` is derived from `shell-script-mode` which provides some basic
syntax highlighting of strings, comments, etc.
The MELPA recipe used for this package is simply:
``` emacs-lisp
(lammps-mode :fetcher github :repo "HaoZeke/lammps-mode")
```
## Caveats
* Does not work with Xemacs [See [this comment](https://github.com/lammps/lammps/pull/1022#issuecomment-408871233)]
## License
[GNU GPL v2](https://github.com/HaoZeke/lammps-mode/blob/master/LICENSE).
Check the file for more details.

View File

@ -1,55 +0,0 @@
=== 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
of commands were copied from tools/vim. The simulation scripts have to
end on *.lmp or start with in.* (see lammps.el). By far not all
commands are included in the syntax file (lammps.el).
You can easily add new ones to the existing classes.
'lammps-mode' is derived from 'shell-script-mode' which provides
some basic syntax highlighting of strings, comments, etc.
=To enable the highlighting:
============================
(0) Create/edit the emacs init file ~/.emacs to contain:
(load "~/.emacs.d/lammps-mode.el")
This file may also be called ~/.emacs.el, or ~/.emacs.d/init.el
(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))
))
```

View File

@ -14,20 +14,19 @@
;; This file is not part of GNU Emacs.
;; This file is free software; you can redistribute it and/or modify
;; This program 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.
;; 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,
;; This program 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.
;; You should have received a copy of the GNU General Public License along
;; with this program; if not, write to the Free Software Foundation, Inc.,
;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
;;; Commentary:
;; translation of keyword classes from tools/vim