mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 14:15:19 -04:00
Added folding/unfolding to emacs edit mode (Lianheng Tong)
svn-origin-rev: 13499
This commit is contained in:
parent
30ca1786be
commit
3797f203af
2 changed files with 27 additions and 8 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#+author: Lianheng Tong
|
||||
#+date: Wednesday, 2014/01/22
|
||||
|
||||
cp2k-mode.el is provides a major mode in emacs for editing CP2K input
|
||||
cp2k-mode.el provides a major mode in emacs for editing CP2K input
|
||||
files. It has been tested on emacs 2.1, 2.3 and 2.4.
|
||||
|
||||
* Functionalities
|
||||
|
|
@ -14,6 +14,13 @@ files. It has been tested on emacs 2.1, 2.3 and 2.4.
|
|||
- the keywords
|
||||
- the comment lines
|
||||
- Indents lines according to the CP2K input syntax using <tab> key
|
||||
- Input sections can be folded or unfolded, using emacs outline
|
||||
minor mode.
|
||||
- outline-toggle-children when called on a unfolded section, folds
|
||||
the section recursively; when called on a folded section,
|
||||
unfolds the top level tree.
|
||||
- show-all when called unfolds all sections recursively.
|
||||
- show-subtree when called unfolds a folded section recursively.
|
||||
- New interactive functions:
|
||||
- cp2k-indent-line: indents the line according to CP2K
|
||||
input syntax.
|
||||
|
|
@ -22,12 +29,14 @@ files. It has been tested on emacs 2.1, 2.3 and 2.4.
|
|||
- cp2k-end-of-block: goes to the ending of the subsection,
|
||||
marks the current cursor position.
|
||||
- Key Bindings:
|
||||
- <tab> cp2k-indent-line
|
||||
- C-j newline-and-indent
|
||||
- C-c ; comment-region
|
||||
- C-M-a cp2k-beginning-of-block
|
||||
- C-M-e cp2k-end-of-block
|
||||
|
||||
- <tab> cp2k-indent-line
|
||||
- C-j newline-and-indent
|
||||
- C-c ; comment-region
|
||||
- C-M-a cp2k-beginning-of-block
|
||||
- C-M-e cp2k-end-of-block
|
||||
- C-c C-c outline-toggle-children
|
||||
- C-c C-a show-all
|
||||
- C-c C-t show-subtree
|
||||
* Installation
|
||||
You need to put cp2k-mode.el in one of your local emacs lisp
|
||||
directories, which is in the search path of your emacs installation.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
;;;;; Emacs major mode for cp2k input, written by Lianheng Tong
|
||||
;;;;; Copyright (c) Lianheng Tong
|
||||
;;;;; Last modify date: Thursday, 2013/12/05
|
||||
;;;;; Last modify date: Saturday, 2014/01/25
|
||||
|
||||
;;;; Syntax highlighting of keywords
|
||||
(defconst cp2k-font-lock-keywords
|
||||
|
|
@ -49,6 +49,9 @@
|
|||
(define-key map (kbd "TAB") 'cp2k-indent-line)
|
||||
(define-key map (kbd "C-M-a") 'cp2k-beginning-of-block)
|
||||
(define-key map (kbd "C-M-e") 'cp2k-end-of-block)
|
||||
(define-key map (kbd "C-c C-c") 'outline-toggle-children)
|
||||
(define-key map (kbd "C-c C-a") 'show-all)
|
||||
(define-key map (kbd "C-c C-t") 'show-subtree)
|
||||
map)
|
||||
"Keymap for `cp2k-mode'.")
|
||||
|
||||
|
|
@ -239,5 +242,12 @@
|
|||
;;;; Add to autoload alist
|
||||
(add-to-list 'auto-mode-alist '("\\.cp2kin\\'" . cp2k-mode))
|
||||
|
||||
;;;; Setup outline mode
|
||||
(when (require 'outline nil 'noerror)
|
||||
(add-hook 'cp2k-mode-hook 'outline-minor-mode)
|
||||
;; in outline mode, the level of header depends on the length of
|
||||
;; match, which suits our purposes quite well
|
||||
(setq outline-regexp "[ \t]*\\(&\\|@\\(IF\\|EN\\)\\)"))
|
||||
|
||||
;;;; Last line
|
||||
(provide 'cp2k-mode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue