From a00d7becc30ae782fe3d991e7cc8693ae5ed5b9b Mon Sep 17 00:00:00 2001 From: HaoZeke Date: Mon, 30 Jul 2018 20:10:29 +0530 Subject: [PATCH] emacs: Major readme update and refactor Also update the license and switch to GPL v2 like lammps --- tools/emacs/README.md | 76 ++++++++++++++++++++++++++++++++++++++ tools/emacs/README.txt | 55 --------------------------- tools/emacs/lammps-mode.el | 15 ++++---- 3 files changed, 83 insertions(+), 63 deletions(-) create mode 100644 tools/emacs/README.md delete mode 100644 tools/emacs/README.txt diff --git a/tools/emacs/README.md b/tools/emacs/README.md new file mode 100644 index 0000000000..ce502a27e3 --- /dev/null +++ b/tools/emacs/README.md @@ -0,0 +1,76 @@ +# GNU Emacs Syntax Highlighting + +> Copyright (C) 2010-2018 Aidan Thompson +> Copyright (C) 2018 Rohit Goswami + +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. diff --git a/tools/emacs/README.txt b/tools/emacs/README.txt deleted file mode 100644 index 43add16505..0000000000 --- a/tools/emacs/README.txt +++ /dev/null @@ -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)) - )) -``` diff --git a/tools/emacs/lammps-mode.el b/tools/emacs/lammps-mode.el index 9ba2669982..37e8a32116 100644 --- a/tools/emacs/lammps-mode.el +++ b/tools/emacs/lammps-mode.el @@ -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