annotate lisp/progmodes/vera-mode.el @ 94095:e8b7cae31fe3

(vc-status-fileinfo): Add new member directoryp. (vc-default-status-printer): Print directories. (vc-status-update): Sort files before subdirectories.
author Dan Nicolaescu <dann@ics.uci.edu>
date Tue, 15 Apr 2008 07:28:31 +0000
parents 107ccd98fa12
children 842d446b22d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1 ;;; vera-mode.el --- major mode for editing Vera files.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
2
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
79717
a1342e6e097a Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78234
diff changeset
4 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
5
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
6 ;; Author: Reto Zimmermann <reto@gnu.org>
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
7 ;; Maintainer: Reto Zimmermann <reto@gnu.org>
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
8 ;; Version: 2.28
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
9 ;; Keywords: languages vera
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
10 ;; WWW: http://www.iis.ee.ethz.ch/~zimmi/emacs/vera-mode.html
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
11
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
12 (defconst vera-version "2.18"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
13 "Vera Mode version number.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
14
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
15 (defconst vera-time-stamp "2007-06-21"
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
16 "Vera Mode time stamp for last update.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
17
78035
3475e1b1a4e4 Header changes: mark file as part of Emacs, update FSF address.
Glenn Morris <rgm@gnu.org>
parents: 78032
diff changeset
18 ;; This file is part of GNU Emacs.
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
19
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
20 ;; GNU Emacs is free software; you can redistribute it and/or modify
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
21 ;; it under the terms of the GNU General Public License as published by
78234
c1ec1c8a8d2e Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78086
diff changeset
22 ;; the Free Software Foundation; either version 3, or (at your option)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
23 ;; any later version.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
24
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
25 ;; GNU Emacs is distributed in the hope that it will be useful,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
26 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
27 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
28 ;; GNU General Public License for more details.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
29
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
30 ;; You should have received a copy of the GNU General Public License
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
31 ;; along with GNU Emacs; see the file COPYING. If not, write to the
78035
3475e1b1a4e4 Header changes: mark file as part of Emacs, update FSF address.
Glenn Morris <rgm@gnu.org>
parents: 78032
diff changeset
32 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
3475e1b1a4e4 Header changes: mark file as part of Emacs, update FSF address.
Glenn Morris <rgm@gnu.org>
parents: 78032
diff changeset
33 ;; Boston, MA 02110-1301, USA.
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
34
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
35 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
36 ;;; Commentary:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
38
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
39 ;; This package provides a simple Emacs major mode for editing Vera code.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
40 ;; It includes the following features:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
41
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
42 ;; - Syntax highlighting
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
43 ;; - Indentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
44 ;; - Word/keyword completion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
45 ;; - Block commenting
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
46 ;; - Works under GNU Emacs and XEmacs
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
47
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
48 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
49 ;; Documentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
50
81994
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
51 ;; See comment string of function `vera-mode' or type `C-h m' in Emacs.
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
52
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
54 ;; Installation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
55
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
56 ;; Prerequisites: GNU Emacs 20.X/21.X, XEmacs 20.X/21.X
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
57
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
58 ;; Put `vera-mode.el' into the `site-lisp' directory of your Emacs installation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
59 ;; or into an arbitrary directory that is added to the load path by the
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
60 ;; following line in your Emacs start-up file (`.emacs'):
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
61
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
62 ;; (setq load-path (cons (expand-file-name "<directory-name>") load-path))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
63
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
64 ;; If you already have the compiled `vera-mode.elc' file, put it in the same
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
65 ;; directory. Otherwise, byte-compile the source file:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
66 ;; Emacs: M-x byte-compile-file -> vera-mode.el
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
67 ;; Unix: emacs -batch -q -no-site-file -f batch-byte-compile vera-mode.el
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
68
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
69 ;; Add the following lines to the `site-start.el' file in the `site-lisp'
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
70 ;; directory of your Emacs installation or to your Emacs start-up file
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
71 ;; (`.emacs'):
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
72
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
73 ;; (autoload 'vera-mode "vera-mode" "Vera Mode" t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
74 ;; (setq auto-mode-alist (cons '("\\.vr[hi]?\\'" . vera-mode) auto-mode-alist))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
75
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
76 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
77
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
78 ;;; Code:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
79
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
80 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
81 ;;; Variables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
82 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
83
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
84 (defgroup vera nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
85 "Customizations for Vera Mode."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
86 :prefix "vera-"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
87 :version "22.2"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
88 :group 'languages)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
89
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
90 (defcustom vera-basic-offset 2
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
91 "*Amount of basic offset used for indentation."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
92 :type 'integer
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
93 :group 'vera)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
94
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
95 (defcustom vera-underscore-is-part-of-word nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
96 "*Non-nil means consider the underscore character `_' as part of word.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
97 An identifier containing underscores is then treated as a single word in
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
98 select and move operations. All parts of an identifier separated by underscore
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
99 are treated as single words otherwise."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
100 :type 'boolean
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
101 :group 'vera)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
102
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
103 (defcustom vera-intelligent-tab t
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
104 "*Non-nil means `TAB' does indentation, word completion and tab insertion.
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
105 That is, if preceding character is part of a word then complete word,
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
106 else if not at beginning of line then insert tab,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
107 else if last command was a `TAB' or `RET' then dedent one step,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
108 else indent current line.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
109 If nil, TAB always indents current line."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
110 :type 'boolean
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
111 :group 'vera)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
112
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
113
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
115 ;;; Mode definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
117
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
119 ;; Key bindings
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
120
81994
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
121 (defvar vera-mode-map
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
122 (let ((map (make-sparse-keymap)))
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
123 ;; Backspace/delete key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
124 (define-key map [backspace] 'backward-delete-char-untabify)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
125 (unless (boundp 'delete-key-deletes-forward) ; XEmacs variable
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
126 (define-key map [delete] 'delete-char)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
127 (define-key map [(meta delete)] 'kill-word))
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
128 ;; Standard key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
129 (define-key map "\M-e" 'vera-forward-statement)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
130 (define-key map "\M-a" 'vera-backward-statement)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
131 (define-key map "\M-\C-e" 'vera-forward-same-indent)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
132 (define-key map "\M-\C-a" 'vera-backward-same-indent)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
133 ;; Mode specific key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
134 (define-key map "\C-c\t" 'indent-according-to-mode)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
135 (define-key map "\M-\C-\\" 'vera-indent-region)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
136 (define-key map "\C-c\C-c" 'vera-comment-uncomment-region)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
137 (define-key map "\C-c\C-f" 'vera-fontify-buffer)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
138 (define-key map "\C-c\C-v" 'vera-version)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
139 (define-key map "\M-\t" 'tab-to-tab-stop)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
140 ;; Electric key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
141 (define-key map "\t" 'vera-electric-tab)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
142 (define-key map "\r" 'vera-electric-return)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
143 (define-key map " " 'vera-electric-space)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
144 (define-key map "{" 'vera-electric-opening-brace)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
145 (define-key map "}" 'vera-electric-closing-brace)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
146 (define-key map "#" 'vera-electric-pound)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
147 (define-key map "*" 'vera-electric-star)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
148 (define-key map "/" 'vera-electric-slash)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
149 map)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
150 "Keymap for Vera Mode.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
151
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
152 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
153 ;; Menu
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
154
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
155 (require 'easymenu)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
156
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
157 (easy-menu-define vera-mode-menu vera-mode-map
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
158 "Menu keymap for Vera Mode."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
159 '("Vera"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
160 ["(Un)Comment Out Region" vera-comment-uncomment-region (mark)]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
161 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
162 ["Move Forward Statement" vera-forward-statement t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
163 ["Move Backward Statement" vera-backward-statement t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
164 ["Move Forward Same Indent" vera-forward-same-indent t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
165 ["Move Backward Same Indent" vera-backward-same-indent t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
166 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
167 ["Indent Line" indent-according-to-mode t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
168 ["Indent Region" vera-indent-region (mark)]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
169 ["Indent Buffer" vera-indent-buffer t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
170 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
171 ["Fontify Buffer" vera-fontify-buffer t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
172 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
173 ["Documentation" describe-mode]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
174 ["Version" vera-version t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
175 ["Bug Report..." vera-submit-bug-report t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
176 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
177 ("Options"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
178 ["Indentation Offset..." (customize-option 'vera-basic-offset) t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
179 ["Underscore is Part of Word"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
180 (customize-set-variable 'vera-underscore-is-part-of-word
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
181 (not vera-underscore-is-part-of-word))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
182 :style toggle :selected vera-underscore-is-part-of-word]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
183 ["Use Intelligent Tab"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
184 (customize-set-variable 'vera-intelligent-tab
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
185 (not vera-intelligent-tab))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
186 :style toggle :selected vera-intelligent-tab]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
187 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
188 ["Save Options" customize-save-customized t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
189 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
190 ["Customize..." vera-customize t])))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
191
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
192 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
193 ;; Syntax table
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
194
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
195 (defvar vera-mode-syntax-table
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
196 (let ((syntax-table (make-syntax-table)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
197 ;; punctuation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
198 (modify-syntax-entry ?\# "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
199 (modify-syntax-entry ?\$ "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
200 (modify-syntax-entry ?\% "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
201 (modify-syntax-entry ?\& "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
202 (modify-syntax-entry ?\' "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
203 (modify-syntax-entry ?\* "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
204 (modify-syntax-entry ?\- "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
205 (modify-syntax-entry ?\+ "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
206 (modify-syntax-entry ?\. "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
207 (modify-syntax-entry ?\/ "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
208 (modify-syntax-entry ?\: "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
209 (modify-syntax-entry ?\; "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
210 (modify-syntax-entry ?\< "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
211 (modify-syntax-entry ?\= "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
212 (modify-syntax-entry ?\> "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
213 (modify-syntax-entry ?\\ "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
214 (modify-syntax-entry ?\| "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
215 ;; string
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
216 (modify-syntax-entry ?\" "\"" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
217 ;; underscore
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
218 (when vera-underscore-is-part-of-word
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
219 (modify-syntax-entry ?\_ "w" syntax-table))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
220 ;; escape
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
221 (modify-syntax-entry ?\\ "\\" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
222 ;; parentheses to match
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
223 (modify-syntax-entry ?\( "()" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
224 (modify-syntax-entry ?\) ")(" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
225 (modify-syntax-entry ?\[ "(]" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
226 (modify-syntax-entry ?\] ")[" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
227 (modify-syntax-entry ?\{ "(}" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
228 (modify-syntax-entry ?\} "){" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
229 ;; comment
85511
f873840f9fea * emulation/edt-mapper.el (function-key-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82140
diff changeset
230 (if (featurep 'xemacs)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
231 (modify-syntax-entry ?\/ ". 1456" syntax-table) ; XEmacs
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
232 (modify-syntax-entry ?\/ ". 124b" syntax-table)) ; Emacs
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
233 (modify-syntax-entry ?\* ". 23" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
234 ;; newline and CR
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
235 (modify-syntax-entry ?\n "> b" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
236 (modify-syntax-entry ?\^M "> b" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
237 syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
238 "Syntax table used in `vera-mode' buffers.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
239
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
240 (defvar vera-mode-ext-syntax-table
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
241 (let ((syntax-table (copy-syntax-table vera-mode-syntax-table)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
242 ;; extended syntax table including '_' (for simpler search regexps)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
243 (modify-syntax-entry ?_ "w" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
244 syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
245 "Syntax table extended by `_' used in `vera-mode' buffers.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
246
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
247 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
248 ;; Mode definition
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
249
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
250 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.vr[hi]?\\'" . vera-mode))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
251
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
252 ;;;###autoload
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
253 (defun vera-mode ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
254 "Major mode for editing Vera code.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
255
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
256 Usage:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
257 ------
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
258
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
259 INDENTATION: Typing `TAB' at the beginning of a line indents the line.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
260 The amount of indentation is specified by option `vera-basic-offset'.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
261 Indentation can be done for an entire region \(`M-C-\\') or buffer (menu).
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
262 `TAB' always indents the line if option `vera-intelligent-tab' is nil.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
263
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
264 WORD/COMMAND COMPLETION: Typing `TAB' after a (not completed) word looks
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
265 for a word in the buffer or a Vera keyword that starts alike, inserts it
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
266 and adjusts case. Re-typing `TAB' toggles through alternative word
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
267 completions.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
268
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
269 Typing `TAB' after a non-word character inserts a tabulator stop (if not
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
270 at the beginning of a line). `M-TAB' always inserts a tabulator stop.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
271
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
272 COMMENTS: `C-c C-c' comments out a region if not commented out, and
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
273 uncomments a region if already commented out.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
274
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
275 HIGHLIGHTING (fontification): Vera keywords, predefined types and
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
276 constants, function names, declaration names, directives, as well as
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
277 comments and strings are highlighted using different colors.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
278
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
279 VERA VERSION: OpenVera 1.4 and Vera version 6.2.8.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
280
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
281
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
282 Maintenance:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
283 ------------
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
284
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
285 To submit a bug report, use the corresponding menu entry within Vera Mode.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
286 Add a description of the problem and include a reproducible test case.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
287
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
288 Feel free to send questions and enhancement requests to <reto@gnu.org>.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
289
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
290 Official distribution is at
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
291 <http://www.iis.ee.ethz.ch/~zimmi/emacs/vera-mode.html>.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
292
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
293
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
294 The Vera Mode Maintainer
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
295 Reto Zimmermann <reto@gnu.org>
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
296
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
297 Key bindings:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
298 -------------
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
299
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
300 \\{vera-mode-map}"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
301 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
302 (kill-all-local-variables)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
303 (setq major-mode 'vera-mode)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
304 (setq mode-name "Vera")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
305 ;; set maps and tables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
306 (use-local-map vera-mode-map)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
307 (set-syntax-table vera-mode-syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
308 ;; set local variables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
309 (require 'cc-cmds)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
310 (set (make-local-variable 'comment-start) "//")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
311 (set (make-local-variable 'comment-end) "")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
312 (set (make-local-variable 'comment-column) 40)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
313 (set (make-local-variable 'comment-start-skip) "/\\*+ *\\|//+ *")
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
314 (set (make-local-variable 'comment-end-skip) " *\\*+/\\| *\n")
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
315 (set (make-local-variable 'comment-indent-function) 'c-comment-indent)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
316 (set (make-local-variable 'paragraph-start) "^$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
317 (set (make-local-variable 'paragraph-separate) paragraph-start)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
318 (set (make-local-variable 'require-final-newline) t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
319 (set (make-local-variable 'indent-tabs-mode) nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
320 (set (make-local-variable 'indent-line-function) 'vera-indent-line)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
321 (set (make-local-variable 'parse-sexp-ignore-comments) t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
322 ;; initialize font locking
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
323 (set (make-local-variable 'font-lock-defaults)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
324 '(vera-font-lock-keywords nil nil ((?\_ . "w"))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
325 ;; add menu (XEmacs)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
326 (easy-menu-add vera-mode-menu)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
327 ;; miscellaneous
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
328 (message "Vera Mode %s. Type C-c C-h for documentation." vera-version)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
329 ;; run hooks
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
330 (run-hooks 'vera-mode-hook))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
331
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
332
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
333 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
334 ;;; Vera definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
335 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
336
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
337 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
338 ;;; Keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
339
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
340 (defconst vera-keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
341 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
342 "after" "all" "any" "around" "assoc_index" "assoc_size" "async"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
343 "bad_state" "bad_trans" "before" "begin" "big_endian" "bind"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
344 "bin_activation" "bit_normal" "bit_reverse" "break" "breakpoint"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
345 "case" "casex" "casez" "class" "constraint" "continue"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
346 "coverage" "coverage_block" "coverage_def" "coverage_depth"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
347 "coverage_goal" "coverage_group" "coverage_option" "coverage_val"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
348 "cross_num_print_missing" "cross_auto_bin_max" "cov_comment"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
349 "default" "depth" "dist" "do"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
350 "else" "end" "enum" "exhaustive" "export" "extends" "extern"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
351 "for" "foreach" "fork" "function"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
352 "hdl_task" "hdl_node" "hide"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
353 "if" "illegal_self_transition" "illegal_state" "illegal_transition"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
354 "in" "interface" "invisible"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
355 "join"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
356 "little_endian" "local"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
357 "m_bad_state" "m_bad_trans" "m_state" "m_trans"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
358 "negedge" "new" "newcov" "non_rand" "none" "not" "null"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
359 "or" "ordered"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
360 "packed" "port" "posedge" "proceed" "prod" "prodget" "prodset"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
361 "program" "protected" "public"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
362 "rand" "randc" "randcase" "randseq" "repeat" "return" "rules"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
363 "sample" "sample_event" "shadow" "soft" "state" "static" "super"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
364 "task" "terminate" "this" "trans" "typedef"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
365 "unpacked"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
366 "var" "vca" "vector" "verilog_node" "verilog_task"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
367 "vhdl_node" "vhdl_task" "virtual" "virtuals" "visible" "void"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
368 "while" "wildcard" "with"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
369 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
370 "List of Vera keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
371
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
372 (defconst vera-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
373 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
374 "integer" "bit" "reg" "string" "bind_var" "event"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
375 "inout" "input" "output"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
376 "ASYNC" "CLOCK"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
377 "NDRIVE" "NHOLD" "NRX" "NRZ" "NR0" "NR1" "NSAMPLE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
378 "PDRIVE" "PHOLD" "PRX" "PRZ" "PR0" "PR1" "PSAMPLE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
379 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
380 "List of Vera predefined types.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
381
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
382 (defconst vera-q-values
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
383 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
384 "gnr" "grx" "grz" "gr0" "gr1"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
385 "nr" "rx" "rz" "r0" "r1"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
386 "snr" "srx" "srz" "sr0" "sr1"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
387 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
388 "List of Vera predefined VCA q_values.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
389
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
390 (defconst vera-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
391 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
392 ;; system functions and tasks
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
393 "alloc"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
394 "call_func" "call_task" "cast_assign" "close_conn" "cm_coverage"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
395 "cm_get_coverage" "cm_get_limit"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
396 "coverage_backup_database_file" "coverage_save_database"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
397 "delay"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
398 "error" "error_mode" "error_wait" "exit"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
399 "fclose" "feof" "ferror" "fflush" "flag" "fopen" "fprintf" "freadb"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
400 "freadb" "freadh" "freadstr"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
401 "get_bind" "get_bind_id" "get_conn_err" "get_cycle" "get_env"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
402 "get_memsize" "get_plus_arg" "get_systime" "get_time" "get_time_unit"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
403 "getstate"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
404 "initstate"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
405 "lock_file"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
406 "mailbox_get" "mailbox_put" "mailbox_receive" "mailbox_send"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
407 "make_client" "make_server"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
408 "os_command"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
409 "printf" "psprintf"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
410 "query" "query_str" "query_x"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
411 "rand48" "random" "region_enter" "region_exit" "rewind"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
412 "semaphore_get" "semaphore_put" "setstate" "signal_connect" "simwave_plot"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
413 "srandom" "sprintf" "sscanf" "stop" "suspend_thread" "sync"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
414 "timeout" "trace" "trigger"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
415 "unit_delay" "unlock_file" "up_connections"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
416 "urand48" "urandom" "urandom_range"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
417 "vera_bit_reverse" "vera_crc" "vera_pack" "vera_pack_big_endian"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
418 "vera_plot" "vera_report_profile" "vera_unpack" "vera_unpack_big_endian"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
419 "vsv_call_func" "vsv_call_task" "vsv_close_conn" "vsv_get_conn_err"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
420 "vsv_make_client" "vsv_make_server" "vsv_up_connections"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
421 "vsv_wait_for_done" "vsv_wait_for_input"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
422 "wait_child" "wait_var"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
423 ;; class methods
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
424 "Configure" "DisableTrigger" "DoAction" "EnableCount" "EnableTrigger"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
425 "Event" "GetAssert" "GetCount" "GetFirstAssert" "GetName" "GetNextAssert"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
426 "Wait"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
427 "atobin" "atohex" "atoi" "atooct"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
428 "backref" "bittostr" "capacity" "compare" "constraint_mode"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
429 "delete"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
430 "empty"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
431 "find" "find_index" "first" "first_index"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
432 "get_at_least" "get_auto_bin" "get_cov_weight" "get_coverage_goal"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
433 "get_cross_bin_max" "get_status" "get_status_msg" "getc"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
434 "hash"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
435 "icompare" "insert" "inst_get_at_least" "inst_get_auto_bin_max"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
436 "inst_get_collect" "inst_get_cov_weight" "inst_get_coverage_goal"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
437 "inst_getcross_bin_max" "inst_query" "inst_set_at_least"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
438 "inst_set_auto_bin_max" "inst_set_bin_activiation" "inst_set_collect"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
439 "inst_set_cov_weight" "inst_set_coverage_goal" "inst_set_cross_bin_max"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
440 "itoa"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
441 "last" "last_index" "len" "load"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
442 "match" "max" "max_index" "min" "min_index"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
443 "object_compare" "object_copy" "object_print"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
444 "pack" "pick_index" "pop_back" "pop_front" "post_pack" "post_randomize"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
445 "post_unpack" "postmatch" "pre_pack" "pre_randomize" "prematch" "push_back"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
446 "push_front" "putc"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
447 "query" "query_str"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
448 "rand_mode" "randomize" "reserve" "reverse" "rsort"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
449 "search" "set_at_least" "set_auto_bin_max" "set_bin_activiation"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
450 "set_cov_weight" "set_coverage_goal" "set_cross_bin_max" "set_name" "size"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
451 "sort" "substr" "sum"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
452 "thismatch" "tolower" "toupper"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
453 "unique_index" "unpack"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
454 ;; empty methods
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
455 "new" "object_compare"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
456 "post_boundary" "post_pack" "post_randomize" "post_unpack" "pre-randomize"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
457 "pre_boundary" "pre_pack" "pre_unpack"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
458 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
459 "List of Vera predefined system functions, tasks and class methods.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
460
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
461 (defconst vera-constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
462 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
463 "ALL" "ANY"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
464 "BAD_STATE" "BAD_TRANS"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
465 "CALL" "CHECK" "CHGEDGE" "CLEAR" "COPY_NO_WAIT" "COPY_WAIT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
466 "CROSS" "CROSS_TRANS"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
467 "DEBUG" "DELETE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
468 "EC_ARRAYX" "EC_CODE_END" "EC_CONFLICT" "EC_EVNTIMOUT" "EC_EXPECT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
469 "EC_FULLEXPECT" "EC_MBXTMOUT" "EC_NEXPECT" "EC_RETURN" "EC_RGNTMOUT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
470 "EC_SCONFLICT" "EC_SEMTMOUT" "EC_SEXPECT" "EC_SFULLEXPECT" "EC_SNEXTPECT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
471 "EC_USERSET" "EQ" "EVENT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
472 "FAIL" "FIRST" "FORK"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
473 "GE" "GOAL" "GT" "HAND_SHAKE" "HI" "HIGH" "HNUM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
474 "LE" "LIC_EXIT" "LIC_PRERR" "LIC_PRWARN" "LIC_WAIT" "LO" "LOAD" "LOW" "LT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
475 "MAILBOX" "MAX_COM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
476 "NAME" "NE" "NEGEDGE" "NEXT" "NO_OVERLAP" "NO_OVERLAP_STATE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
477 "NO_OVERLAP_TRANS" "NO_VARS" "NO_WAIT" "NUM" "NUM_BIN" "NUM_DET"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
478 "OFF" "OK" "OK_LAST" "ON" "ONE_BLAST" "ONE_SHOT" "ORDER"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
479 "PAST_IT" "PERCENT" "POSEDGE" "PROGRAM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
480 "RAWIN" "REGION" "REPORT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
481 "SAMPLE" "SAVE" "SEMAPHORE" "SET" "SILENT" "STATE" "STR"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
482 "STR_ERR_OUT_OF_RANGE" "STR_ERR_REGEXP_SYNTAX" "SUM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
483 "TRANS"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
484 "VERBOSE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
485 "WAIT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
486 "stderr" "stdin" "stdout"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
487 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
488 "List of Vera predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
489
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
490 (defconst vera-rvm-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
491 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
492 "VeraListIterator_VeraListIterator_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
493 "VeraListIterator_rvm_data" "VeraListIterator_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
494 "VeraListNodeVeraListIterator_rvm_log" "VeraListNodervm_data"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
495 "VeraListNodervm_log" "VeraList_VeraListIterator_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
496 "VeraList_rvm_data" "VeraList_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
497 "rvm_broadcast" "rvm_channel_class" "rvm_data" "rvm_data" "rvm_env"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
498 "rvm_log" "rvm_log_modifier" "rvm_log_msg" "rvm_log_msg" "rvm_log_msg_info"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
499 "rvm_log_watchpoint" "rvm_notify" "rvm_notify_event"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
500 "rvm_notify_event_config" "rvm_scheduler" "rvm_scheduler_election"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
501 "rvm_watchdog" "rvm_watchdog_port" "rvm_xactor" "rvm_xactor_callbacks"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
502 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
503 "List of Vera-RVM keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
504
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
505 (defconst vera-rvm-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
506 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
507 "extern_rvm_atomic_gen" "extern_rvm_channel" "extern_rvm_scenario_gen"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
508 "rvm_OO_callback" "rvm_atomic_gen" "rvm_atomic_gen_callbacks_decl"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
509 "rvm_atomic_gen_decl" "rvm_atomic_scenario_decl" "rvm_channel"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
510 "rvm_channel_" "rvm_channel_decl" "rvm_command" "rvm_cycle" "rvm_debug"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
511 "rvm_error" "rvm_fatal" "rvm_note" "rvm_protocol" "rvm_report"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
512 "rvm_scenario_decl" "rvm_scenario_election_decl" "rvm_scenario_gen"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
513 "rvm_scenario_gen_callbacks_decl" "rvm_scenario_gen_decl"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
514 "rvm_trace" "rvm_transaction" "rvm_user" "rvm_verbose" "rvm_warning"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
515 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
516 "List of Vera-RVM functions.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
517
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
518 (defconst vera-rvm-constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
519 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
520 "RVM_NUMERIC_VERSION_MACROS" "RVM_VERSION" "RVM_MINOR" "RVM_PATCH"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
521 "rvm_channel__SOURCE" "rvm_channel__SINK" "rvm_channel__NO_ACTIVE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
522 "rvm_channel__ACT_PENDING" "rvm_channel__ACT_STARTED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
523 "rvm_channel__ACT_COMPLETED" "rvm_channel__FULL" "rvm_channel__EMPTY"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
524 "rvm_channel__PUT" "rvm_channel__GOT" "rvm_channel__PEEKED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
525 "rvm_channel__ACTIVATED" "rvm_channel__STARTED" "rvm_channel__COMPLETED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
526 "rvm_channel__REMOVED" "rvm_channel__LOCKED" "rvm_channel__UNLOCKED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
527 "rvm_data__EXECUTE" "rvm_data__STARTED" "rvm_data__ENDED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
528 "rvm_env__CFG_GENED" "rvm_env__BUILT" "rvm_env__DUT_CFGED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
529 "rvm_env__STARTED" "rvm_env__RESTARTED" "rvm_env__ENDED" "rvm_env__STOPPED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
530 "rvm_env__CLEANED" "rvm_env__DONE" "rvm_log__DEFAULT" "rvm_log__UNCHANGED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
531 "rvm_log__FAILURE_TYP" "rvm_log__NOTE_TYP" "rvm_log__DEBUG_TYP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
532 "rvm_log__REPORT_TYP" "rvm_log__NOTIFY_TYP" "rvm_log__TIMING_TYP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
533 "rvm_log__XHANDLING_TYP" "rvm_log__PROTOCOL_TYP" "rvm_log__TRANSACTION_TYP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
534 "rvm_log__COMMAND_TYP" "rvm_log__CYCLE_TYP" "rvm_log__USER_TYP_0"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
535 "rvm_log__USER_TYP_1" "rvm_log__USER_TYP_2" "rvm_log__USER_TYP_3"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
536 "rvm_log__DEFAULT_TYP" "rvm_log__ALL_TYPES" "rvm_log__FATAL_SEV"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
537 "rvm_log__ERROR_SEV" "rvm_log__WARNING_SEV" "rvm_log__NORMAL_SEV"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
538 "rvm_log__TRACE_SEV" "rvm_log__DEBUG_SEV" "rvm_log__VERBOSE_SEV"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
539 "rvm_log__HIDDEN_SEV" "rvm_log__IGNORE_SEV" "rvm_log__DEFAULT_SEV"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
540 "rvm_log__ALL_SEVERITIES" "rvm_log__CONTINUE" "rvm_log__COUNT_AS_ERROR"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
541 "rvm_log__DEBUGGER" "rvm_log__DUMP" "rvm_log__STOP" "rvm_log__ABORT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
542 "rvm_notify__ONE_SHOT_TRIGGER" "rvm_notify__ONE_BLAST_TRIGGER"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
543 "rvm_notify__HAND_SHAKE_TRIGGER" "rvm_notify__ON_OFF_TRIGGER"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
544 "rvm_xactor__XACTOR_IDLE" "rvm_xactor__XACTOR_BUSY"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
545 "rvm_xactor__XACTOR_STARTED" "rvm_xactor__XACTOR_STOPPED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
546 "rvm_xactor__XACTOR_RESET" "rvm_xactor__XACTOR_SOFT_RST"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
547 "rvm_xactor__XACTOR_FIRM_RST" "rvm_xactor__XACTOR_HARD_RST"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
548 "rvm_xactor__XACTOR_PROTOCOL_RST" "rvm_broadcast__AFAP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
549 "rvm_broadcast__ALAP" "rvm_watchdog__TIMEOUT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
550 "rvm_env__DUT_RESET" "rvm_log__INTERNAL_TYP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
551 "RVM_SCHEDULER_IS_XACTOR" "RVM_BROADCAST_IS_XACTOR"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
552 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
553 "List of Vera-RVM predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
554
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
555 ;; `regexp-opt' undefined (`xemacs-devel' not installed)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
556 (unless (fboundp 'regexp-opt)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
557 (defun regexp-opt (strings &optional paren)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
558 (let ((open (if paren "\\(" "")) (close (if paren "\\)" "")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
559 (concat open (mapconcat 'regexp-quote strings "\\|") close))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
560
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
561 (defconst vera-keywords-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
562 (concat "\\<\\(" (regexp-opt vera-keywords) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
563 "Regexp for Vera keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
564
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
565 (defconst vera-types-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
566 (concat "\\<\\(" (regexp-opt vera-types) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
567 "Regexp for Vera predefined types.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
568
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
569 (defconst vera-q-values-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
570 (concat "\\<\\(" (regexp-opt vera-q-values) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
571 "Regexp for Vera predefined VCA q_values.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
572
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
573 (defconst vera-functions-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
574 (concat "\\<\\(" (regexp-opt vera-functions) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
575 "Regexp for Vera predefined system functions, tasks and class methods.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
576
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
577 (defconst vera-constants-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
578 (concat "\\<\\(" (regexp-opt vera-constants) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
579 "Regexp for Vera predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
580
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
581 (defconst vera-rvm-types-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
582 (concat "\\<\\(" (regexp-opt vera-rvm-types) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
583 "Regexp for Vera-RVM keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
584
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
585 (defconst vera-rvm-functions-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
586 (concat "\\<\\(" (regexp-opt vera-rvm-functions) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
587 "Regexp for Vera-RVM predefined system functions, tasks and class methods.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
588
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
589 (defconst vera-rvm-constants-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
590 (concat "\\<\\(" (regexp-opt vera-rvm-constants) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
591 "Regexp for Vera-RVM predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
592
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
593
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
594 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
595 ;;; Font locking
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
596 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
597
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
598 ;; XEmacs compatibility
85511
f873840f9fea * emulation/edt-mapper.el (function-key-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82140
diff changeset
599 (when (featurep 'xemacs)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
600 (require 'font-lock)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
601 (copy-face 'font-lock-reference-face 'font-lock-constant-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
602 (copy-face 'font-lock-preprocessor-face 'font-lock-builtin-face))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
603
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
604 (defun vera-font-lock-match-item (limit)
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
605 "Match, and move over, any declaration item after point.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
606 Adapted from `font-lock-match-c-style-declaration-item-and-skip-to-next'."
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
607 (condition-case nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
608 (save-restriction
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
609 (narrow-to-region (point-min) limit)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
610 ;; match item
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
611 (when (looking-at "\\s-*\\(\\w+\\)")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
612 (save-match-data
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
613 (goto-char (match-end 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
614 ;; move to next item
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
615 (if (looking-at "\\(\\s-*\\(\\[[^]]*\\]\\s-*\\)?,\\)")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
616 (goto-char (match-end 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
617 (end-of-line) t))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
618 (error t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
619
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
620 (defvar vera-font-lock-keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
621 (list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
622 ;; highlight keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
623 (list vera-keywords-regexp 1 'font-lock-keyword-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
624 ;; highlight types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
625 (list vera-types-regexp 1 'font-lock-type-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
626 ;; highlight RVM types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
627 (list vera-rvm-types-regexp 1 'font-lock-type-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
628 ;; highlight constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
629 (list vera-constants-regexp 1 'font-lock-constant-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
630 ;; highlight RVM constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
631 (list vera-rvm-constants-regexp 1 'font-lock-constant-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
632 ;; highlight q_values
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
633 (list vera-q-values-regexp 1 'font-lock-constant-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
634 ;; highlight predefined functions, tasks and methods
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
635 (list vera-functions-regexp 1 'vera-font-lock-function)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
636 ;; highlight predefined RVM functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
637 (list vera-rvm-functions-regexp 1 'vera-font-lock-function)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
638 ;; highlight functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
639 '("\\<\\(\\w+\\)\\s-*(" 1 font-lock-function-name-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
640 ;; highlight various declaration names
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
641 '("^\\s-*\\(port\\|program\\|task\\)\\s-+\\(\\w+\\)\\>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
642 2 font-lock-function-name-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
643 '("^\\s-*bind\\s-+\\(\\w+\\)\\s-+\\(\\w+\\)\\>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
644 (1 font-lock-function-name-face) (2 font-lock-function-name-face))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
645 ;; highlight interface declaration names
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
646 '("^\\s-*\\(class\\|interface\\)\\s-+\\(\\w+\\)\\>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
647 2 vera-font-lock-interface)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
648 ;; highlight variable name definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
649 (list (concat "^\\s-*" vera-types-regexp "\\s-*\\(\\[[^]]+\\]\\s-+\\)?")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
650 '(vera-font-lock-match-item nil nil (1 font-lock-variable-name-face)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
651 (list (concat "^\\s-*" vera-rvm-types-regexp "\\s-*\\(\\[[^]]+\\]\\s-+\\)?")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
652 '(vera-font-lock-match-item nil nil (1 font-lock-variable-name-face)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
653 ;; highlight numbers
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
654 '("\\([0-9]*'[bdoh][0-9a-fA-FxXzZ_]+\\)" 1 vera-font-lock-number)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
655 ;; highlight filenames in #include directives
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
656 '("^#\\s-*include\\s-*\\(<[^>\"\n]*>?\\)"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
657 1 font-lock-string-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
658 ;; highlight directives and directive names
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
659 '("^#\\s-*\\(\\w+\\)\\>[ \t!]*\\(\\w+\\)?"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
660 (1 font-lock-builtin-face) (2 font-lock-variable-name-face nil t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
661 ;; highlight `@', `$' and `#'
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
662 '("\\([@$#]\\)" 1 font-lock-keyword-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
663 ;; highlight @ and # definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
664 '("@\\s-*\\(\\w*\\)\\(\\s-*,\\s-*\\(\\w+\\)\\)?\\>[^.]"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
665 (1 vera-font-lock-number) (3 vera-font-lock-number nil t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
666 ;; highlight interface signal name
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
667 '("\\(\\w+\\)\\.\\w+" 1 vera-font-lock-interface)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
668 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
669 "Regular expressions to highlight in Vera Mode.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
670
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
671 (defvar vera-font-lock-number 'vera-font-lock-number
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
672 "Face name to use for @ definitions.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
673
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
674 (defvar vera-font-lock-function 'vera-font-lock-function
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
675 "Face name to use for predefined functions and tasks.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
676
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
677 (defvar vera-font-lock-interface 'vera-font-lock-interface
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
678 "Face name to use for interface names.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
679
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
680 (defface vera-font-lock-number
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
681 '((((class color) (background light)) (:foreground "Gold4"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
682 (((class color) (background dark)) (:foreground "BurlyWood1"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
683 (t (:italic t :bold t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
684 "Font lock mode face used to highlight @ definitions."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
685 :group 'font-lock-highlighting-faces)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
686
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
687 (defface vera-font-lock-function
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
688 '((((class color) (background light)) (:foreground "DarkCyan"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
689 (((class color) (background dark)) (:foreground "Orchid1"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
690 (t (:italic t :bold t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
691 "Font lock mode face used to highlight predefined functions and tasks."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
692 :group 'font-lock-highlighting-faces)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
693
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
694 (defface vera-font-lock-interface
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
695 '((((class color) (background light)) (:foreground "Grey40"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
696 (((class color) (background dark)) (:foreground "Grey80"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
697 (t (:italic t :bold t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
698 "Font lock mode face used to highlight interface names."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
699 :group 'font-lock-highlighting-faces)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
700
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
701 (defalias 'vera-fontify-buffer 'font-lock-fontify-buffer)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
702
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
703 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
704 ;;; Indentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
705 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
706
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
707 (defvar vera-echo-syntactic-information-p nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
708 "If non-nil, syntactic info is echoed when the line is indented.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
709
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
710 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
711 ;; offset functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
712
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
713 (defconst vera-offsets-alist
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
714 '((comment . vera-lineup-C-comments)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
715 (comment-intro . vera-lineup-comment)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
716 (string . -1000)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
717 (directive . -1000)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
718 (block-open . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
719 (block-intro . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
720 (block-close . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
721 (arglist-intro . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
722 (arglist-cont . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
723 (arglist-cont-nonempty . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
724 (arglist-close . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
725 (statement . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
726 (statement-cont . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
727 (substatement . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
728 (else-clause . 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
729 "Association list of syntactic element symbols and indentation offsets.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
730 Adapted from `c-offsets-alist'.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
731
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
732 (defun vera-evaluate-offset (offset langelem symbol)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
733 "OFFSET can be a number, a function, a variable, a list, or one of
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
734 the symbols + or -."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
735 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
736 ((eq offset '+) (setq offset vera-basic-offset))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
737 ((eq offset '-) (setq offset (- vera-basic-offset)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
738 ((eq offset '++) (setq offset (* 2 vera-basic-offset)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
739 ((eq offset '--) (setq offset (* 2 (- vera-basic-offset))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
740 ((eq offset '*) (setq offset (/ vera-basic-offset 2)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
741 ((eq offset '/) (setq offset (/ (- vera-basic-offset) 2)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
742 ((functionp offset) (setq offset (funcall offset langelem)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
743 ((listp offset)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
744 (setq offset
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
745 (let (done)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
746 (while (and (not done) offset)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
747 (setq done (vera-evaluate-offset (car offset) langelem symbol)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
748 offset (cdr offset)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
749 (if (not done)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
750 0
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
751 done))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
752 ((not (numberp offset)) (setq offset (symbol-value offset))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
753 offset)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
754
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
755 (defun vera-get-offset (langelem)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
756 "Get offset from LANGELEM which is a cons cell of the form:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
757 \(SYMBOL . RELPOS). The symbol is matched against
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
758 vera-offsets-alist and the offset found there is either returned,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
759 or added to the indentation at RELPOS. If RELPOS is nil, then
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
760 the offset is simply returned."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
761 (let* ((symbol (car langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
762 (relpos (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
763 (match (assq symbol vera-offsets-alist))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
764 (offset (cdr-safe match)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
765 (if (not match)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
766 (setq offset 0
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
767 relpos 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
768 (setq offset (vera-evaluate-offset offset langelem symbol)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
769 (+ (if (and relpos
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
770 (< relpos (save-excursion (beginning-of-line) (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
771 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
772 (goto-char relpos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
773 (current-column))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
774 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
775 (vera-evaluate-offset offset langelem symbol))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
776
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
777 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
778 ;; help functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
779
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
780 (defsubst vera-point (position)
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
781 "Return the value of point at certain commonly referenced POSITIONs.
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
782 POSITION can be one of the following symbols:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
783 bol -- beginning of line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
784 eol -- end of line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
785 boi -- back to indentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
786 ionl -- indentation of next line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
787 iopl -- indentation of previous line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
788 bonl -- beginning of next line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
789 bopl -- beginning of previous line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
790 This function does not modify point or mark."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
791 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
792 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
793 ((eq position 'bol) (beginning-of-line))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
794 ((eq position 'eol) (end-of-line))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
795 ((eq position 'boi) (back-to-indentation))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
796 ((eq position 'bonl) (forward-line 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
797 ((eq position 'bopl) (forward-line -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
798 ((eq position 'iopl) (forward-line -1) (back-to-indentation))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
799 ((eq position 'ionl) (forward-line 1) (back-to-indentation))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
800 (t (error "Unknown buffer position requested: %s" position)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
801 (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
802
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
803 (defun vera-in-literal (&optional lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
804 "Determine if point is in a Vera literal."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
805 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
806 (let ((state (parse-partial-sexp (or lim (point-min)) (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
807 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
808 ((nth 3 state) 'string)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
809 ((nth 4 state) 'comment)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
810 (t nil)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
811
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
812 (defun vera-skip-forward-literal ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
813 "Skip forward literal and return t if within one."
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
814 (let ((state (save-excursion
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
815 (if (fboundp 'syntax-ppss)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
816 (syntax-ppss)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
817 (parse-partial-sexp (point-min) (point))))))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
818 (when (nth 8 state)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
819 ;; Inside a string or comment.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
820 (goto-char (nth 8 state))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
821 (if (nth 3 state)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
822 ;; A string.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
823 (condition-case nil (forward-sexp 1)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
824 ;; Can't find end of string: it extends til end of buffer.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
825 (error (goto-char (point-max))))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
826 ;; A comment.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
827 (forward-comment 1))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
828 t)))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
829
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
830 (defun vera-skip-backward-literal ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
831 "Skip backward literal and return t if within one."
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
832 (let ((state (save-excursion
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
833 (if (fboundp 'syntax-ppss)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
834 (syntax-ppss)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
835 (parse-partial-sexp (point-min) (point))))))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
836 (when (nth 8 state)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
837 ;; Inside a string or comment.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
838 (goto-char (nth 8 state))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
839 t)))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
840
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
841 (defsubst vera-re-search-forward (regexp &optional bound noerror)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
842 "Like `re-search-forward', but skips over matches in literals."
81993
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
843 (let (ret)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
844 (while (and (setq ret (re-search-forward regexp bound noerror))
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
845 (vera-skip-forward-literal)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
846 (if bound (< (point) bound) t)))
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
847 ret))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
848
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
849 (defsubst vera-re-search-backward (regexp &optional bound noerror)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
850 "Like `re-search-backward', but skips over matches in literals."
81993
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
851 (let (ret)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
852 (while (and (setq ret (re-search-backward regexp bound noerror))
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
853 (vera-skip-backward-literal)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
854 (if bound (> (point) bound) t)))
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
855 ret))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
856
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
857 (defun vera-forward-syntactic-ws (&optional lim skip-directive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
858 "Forward skip of syntactic whitespace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
859 (save-restriction
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
860 (let* ((lim (or lim (point-max)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
861 (here lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
862 (hugenum (point-max)))
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
863 (narrow-to-region (point) lim)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
864 (while (/= here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
865 (setq here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
866 (forward-comment hugenum)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
867 (when (and skip-directive (looking-at "^\\s-*#"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
868 (end-of-line))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
869
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
870 (defun vera-backward-syntactic-ws (&optional lim skip-directive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
871 "Backward skip over syntactic whitespace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
872 (save-restriction
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
873 (let* ((lim (or lim (point-min)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
874 (here lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
875 (hugenum (- (point-max))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
876 (when (< lim (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
877 (narrow-to-region lim (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
878 (while (/= here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
879 (setq here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
880 (forward-comment hugenum)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
881 (when (and skip-directive
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
882 (save-excursion (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
883 (= (following-char) ?\#)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
884 (beginning-of-line)))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
885
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
886 (defmacro vera-prepare-search (&rest body)
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
887 "Execute BODY with a syntax table that includes '_'."
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
888 `(with-syntax-table vera-mode-ext-syntax-table ,@body))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
889
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
890 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
891 ;; comment indentation functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
892
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
893 (defsubst vera-langelem-col (langelem &optional preserve-point)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
894 "Convenience routine to return the column of LANGELEM's relpos.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
895 Leaves point at the relpos unless PRESERVE-POINT is non-nil."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
896 (let ((here (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
897 (goto-char (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
898 (prog1 (current-column)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
899 (if preserve-point
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
900 (goto-char here)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
901
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
902 (defun vera-lineup-C-comments (langelem)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
903 "Line up C block comment continuation lines.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
904 Nicked from `c-lineup-C-comments'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
905 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
906 (let ((here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
907 (stars (progn (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
908 (skip-chars-forward "*")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
909 (langelem-col (vera-langelem-col langelem)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
910 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
911 (if (not (re-search-forward "/\\([*]+\\)" (vera-point 'eol) t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
912 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
913 (if (not (looking-at "[*]+"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
914 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
915 ;; we now have to figure out where this comment begins.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
916 (goto-char here)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
917 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
918 (if (looking-at "[*]+/")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
919 (progn (goto-char (match-end 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
920 (forward-comment -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
921 (goto-char (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
922 (back-to-indentation))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
923 (- (current-column) langelem-col))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
924 (if (zerop stars)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
925 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
926 (skip-chars-forward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
927 (- (current-column) langelem-col))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
928 ;; how many stars on comment opening line? if greater than
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
929 ;; on current line, align left. if less than or equal,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
930 ;; align right. this should also pick up Javadoc style
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
931 ;; comments.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
932 (if (> (length (match-string 1)) stars)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
933 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
934 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
935 (- (current-column) -1 langelem-col))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
936 (- (current-column) stars langelem-col)))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
937
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
938 (defun vera-lineup-comment (langelem)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
939 "Line up a comment start."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
940 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
941 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
942 (if (bolp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
943 ;; not indent if at beginning of line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
944 -1000
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
945 ;; otherwise indent accordingly
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
946 (goto-char (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
947 (current-column))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
948
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
949 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
950 ;; move functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
951
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
952 (defconst vera-beg-block-re "{\\|\\<\\(begin\\|fork\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
953
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
954 (defconst vera-end-block-re "}\\|\\<\\(end\\|join\\(\\s-+\\(all\\|any\\|none\\)\\)?\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
955
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
956 (defconst vera-beg-substatement-re "\\<\\(else\\|for\\|if\\|repeat\\|while\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
957
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
958 (defun vera-corresponding-begin (&optional recursive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
959 "Find corresponding block begin if cursor is at a block end."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
960 (while (and (vera-re-search-backward
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
961 (concat "\\(" vera-end-block-re "\\)\\|" vera-beg-block-re)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
962 nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
963 (match-string 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
964 (vera-corresponding-begin t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
965 (unless recursive (vera-beginning-of-substatement)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
966
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
967 (defun vera-corresponding-if ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
968 "Find corresponding `if' if cursor is at `else'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
969 (while (and (vera-re-search-backward "}\\|\\<\\(if\\|else\\)\\>" nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
970 (not (equal (match-string 0) "if")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
971 (if (equal (match-string 0) "else")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
972 (vera-corresponding-if)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
973 (forward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
974 (backward-sexp))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
975
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
976 (defun vera-beginning-of-statement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
977 "Go to beginning of current statement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
978 (let (pos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
979 (while
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
980 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
981 ;; search for end of previous statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
982 (while
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
983 (and (vera-re-search-backward
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
984 (concat "[);]\\|" vera-beg-block-re
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
985 "\\|" vera-end-block-re) nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
986 (equal (match-string 0) ")"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
987 (forward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
988 (backward-sexp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
989 (setq pos (match-beginning 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
990 ;; go back to beginning of current statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
991 (goto-char (or (match-end 0) 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
992 (vera-forward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
993 (when (looking-at "(")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
994 (forward-sexp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
995 (vera-forward-syntactic-ws nil t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
996 ;; if "else" found, go to "if" and search again
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
997 (when (looking-at "\\<else\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
998 (vera-corresponding-if)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
999 (setq pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1000 t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1001 ;; if search is repeated, go to beginning of last search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1002 (goto-char pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1003
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1004 (defun vera-beginning-of-substatement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1005 "Go to beginning of current substatement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1006 (let ((lim (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1007 pos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1008 ;; go to beginning of statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1009 (vera-beginning-of-statement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1010 (setq pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1011 ;; go forward all substatement opening statements until at LIM
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1012 (while (and (< (point) lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1013 (vera-re-search-forward vera-beg-substatement-re lim t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1014 (setq pos (match-beginning 0)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1015 (vera-forward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1016 (when (looking-at "(")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1017 (forward-sexp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1018 (vera-forward-syntactic-ws nil t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1019 (when (< (point) lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1020 (setq pos (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1021 (goto-char pos)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1022
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1023 (defun vera-forward-statement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1024 "Move forward one statement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1025 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1026 (vera-prepare-search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1027 (while (and (vera-re-search-forward
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1028 (concat "[(;]\\|" vera-beg-block-re "\\|" vera-end-block-re)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1029 nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1030 (equal (match-string 0) "("))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1031 (backward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1032 (forward-sexp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1033 (vera-beginning-of-substatement)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1034
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1035 (defun vera-backward-statement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1036 "Move backward one statement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1037 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1038 (vera-prepare-search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1039 (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1040 (unless (= (preceding-char) ?\))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1041 (backward-char))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1042 (vera-beginning-of-substatement)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1043
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1044 (defun vera-forward-same-indent ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1045 "Move forward to next line with same indent."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1046 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1047 (let ((pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1048 (indent (current-indentation)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1049 (beginning-of-line 2)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1050 (while (and (not (eobp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1051 (or (looking-at "^\\s-*$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1052 (> (current-indentation) indent)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1053 (beginning-of-line 2))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1054 (if (= (current-indentation) indent)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1055 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1056 (message "No following line with same indent found in this block")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1057 (goto-char pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1058
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1059 (defun vera-backward-same-indent ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1060 "Move backward to previous line with same indent."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1061 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1062 (let ((pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1063 (indent (current-indentation)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1064 (beginning-of-line -0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1065 (while (and (not (bobp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1066 (or (looking-at "^\\s-*$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1067 (> (current-indentation) indent)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1068 (beginning-of-line -0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1069 (if (= (current-indentation) indent)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1070 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1071 (message "No preceding line with same indent found in this block")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1072 (goto-char pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1073
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1074 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1075 ;; syntax analysis
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1076
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1077 (defmacro vera-add-syntax (symbol &optional relpos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1078 "A simple macro to append the syntax in SYMBOL to the syntax list.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1079 try to increase performance by using this macro."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1080 `(setq syntax (cons (cons ,symbol ,(or relpos 0)) syntax)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1081
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1082 (defun vera-guess-basic-syntax ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1083 "Determine syntactic context of current line of code."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1084 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1085 (beginning-of-line)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1086 (let ((indent-point (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1087 syntax state placeholder pos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1088 ;; determine syntax state
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1089 (setq state (parse-partial-sexp (point-min) (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1090 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1091 ;; CASE 1: in a comment?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1092 ((nth 4 state)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1093 ;; skip empty lines
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1094 (while (and (zerop (forward-line -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1095 (looking-at "^\\s-*$")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1096 (vera-add-syntax 'comment (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1097 ;; CASE 2: in a string?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1098 ((nth 3 state)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1099 (vera-add-syntax 'string))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1100 ;; CASE 3: at a directive?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1101 ((save-excursion (back-to-indentation) (= (following-char) ?\#))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1102 (vera-add-syntax 'directive (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1103 ;; CASE 4: after an opening parenthesis (argument list continuation)?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1104 ((and (nth 1 state)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1105 (or (= (char-after (nth 1 state)) ?\()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1106 ;; also for concatenation (opening '{' and ',' on eol/eopl)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1107 (and (= (char-after (nth 1 state)) ?\{)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1108 (or (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1109 (vera-backward-syntactic-ws) (= (char-before) ?,))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1110 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1111 (end-of-line) (= (char-before) ?,))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1112 (goto-char (1+ (nth 1 state)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1113 ;; is there code after the opening parenthesis on the same line?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1114 (if (looking-at "\\s-*$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1115 (vera-add-syntax 'arglist-cont (vera-point 'boi))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1116 (vera-add-syntax 'arglist-cont-nonempty (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1117 ;; CASE 5: at a block closing?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1118 ((save-excursion (back-to-indentation) (looking-at vera-end-block-re))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1119 ;; look for the corresponding begin
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1120 (vera-corresponding-begin)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1121 (vera-add-syntax 'block-close (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1122 ;; CASE 6: at a block intro (the first line after a block opening)?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1123 ((and (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1124 (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1125 ;; previous line ends with a block opening?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1126 (or (/= (skip-chars-backward "{") 0) (backward-word 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1127 (when (looking-at vera-beg-block-re)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1128 ;; go to beginning of substatement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1129 (vera-beginning-of-substatement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1130 (setq placeholder (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1131 ;; not if "fork" is followed by "{"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1132 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1133 (not (and (progn (back-to-indentation) (looking-at "{"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1134 (progn (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1135 (looking-at "\\<fork\\>"))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1136 (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1137 (vera-add-syntax 'block-intro (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1138 ;; CASE 7: at the beginning of an else clause?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1139 ((save-excursion (back-to-indentation) (looking-at "\\<else\\>"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1140 ;; find corresponding if
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1141 (vera-corresponding-if)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1142 (vera-add-syntax 'else-clause (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1143 ;; CASE 8: at the beginning of a statement?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1144 ;; is the previous command completed?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1145 ((or (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1146 (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1147 (setq placeholder (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1148 ;; at the beginning of the buffer?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1149 (or (bobp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1150 ;; previous line ends with a semicolon or
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1151 ;; is a block opening or closing?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1152 (when (or (/= (skip-chars-backward "{};") 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1153 (progn (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1154 (looking-at (concat vera-beg-block-re "\\|"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1155 vera-end-block-re))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1156 ;; if at a block closing, go to beginning
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1157 (when (looking-at vera-end-block-re)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1158 (vera-corresponding-begin))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1159 ;; go to beginning of the statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1160 (vera-beginning-of-statement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1161 (setq placeholder (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1162 ;; at a directive?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1163 (when (progn (back-to-indentation) (looking-at "#"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1164 ;; go to previous statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1165 (vera-beginning-of-statement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1166 (setq placeholder (point)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1167 ;; at a block opening?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1168 (when (save-excursion (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1169 (looking-at vera-beg-block-re))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1170 ;; go to beginning of the substatement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1171 (vera-beginning-of-substatement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1172 (setq placeholder (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1173 (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1174 (vera-add-syntax 'statement (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1175 ;; CASE 9: at the beginning of a substatement?
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1176 ;; is this line preceded by a substatement opening statement?
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1177 ((save-excursion (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1178 (when (= (preceding-char) ?\)) (backward-sexp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1179 (backward-word 1)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1180 (setq placeholder (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1181 (looking-at vera-beg-substatement-re))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1182 (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1183 (vera-add-syntax 'substatement (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1184 ;; CASE 10: it must be a statement continuation!
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1185 (t
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1186 ;; go to beginning of statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1187 (vera-beginning-of-substatement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1188 (vera-add-syntax 'statement-cont (vera-point 'boi))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1189 ;; special case: look for a comment start
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1190 (goto-char indent-point)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1191 (skip-chars-forward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1192 (when (looking-at comment-start)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1193 (vera-add-syntax 'comment-intro))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1194 ;; return syntax
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1195 syntax)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1196
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1198 ;; indentation functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1199
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1200 (defun vera-indent-line ()
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1201 "Indent the current line as Vera code.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1202 Return the amount of indentation change (in columns)."
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1203 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1204 (vera-prepare-search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1205 (let* ((syntax (vera-guess-basic-syntax))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1206 (pos (- (point-max) (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1207 (indent (apply '+ (mapcar 'vera-get-offset syntax)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1208 (shift-amt (- (current-indentation) indent)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1209 (when vera-echo-syntactic-information-p
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1210 (message "syntax: %s, indent= %d" syntax indent))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1211 (unless (zerop shift-amt)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1212 (beginning-of-line)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1213 (delete-region (point) (vera-point 'boi))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1214 (indent-to indent))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1215 (if (< (point) (vera-point 'boi))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1216 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1217 ;; If initial point was within line's indentation, position after
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1218 ;; the indentation. Else stay at same point in text.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1219 (when (> (- (point-max) pos) (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1220 (goto-char (- (point-max) pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1221 shift-amt)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1222
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1223 (defun vera-indent-buffer ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1224 "Indent whole buffer as Vera code.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1225 Calls `indent-region' for whole buffer."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1226 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1227 (message "Indenting buffer...")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1228 (indent-region (point-min) (point-max) nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1229 (message "Indenting buffer...done"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1230
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1231 (defun vera-indent-region (start end column)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1232 "Indent region as Vera code."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1233 (interactive "r\nP")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1234 (message "Indenting region...")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1235 (indent-region start end column)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1236 (message "Indenting region...done"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1237
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1238 (defsubst vera-indent-block-closing ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1239 "If previous word is a block closing or `else', indent line again."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1240 (when (= (char-syntax (preceding-char)) ?w)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1241 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1242 (backward-word 1)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1243 (when (and (not (vera-in-literal))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1244 (looking-at (concat vera-end-block-re "\\|\\<else\\>")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1245 (indent-according-to-mode)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1246
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1247 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1248 ;; electrifications
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1249
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1250 (defun vera-electric-tab (&optional prefix-arg)
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1251 "Do what I mean (indent, expand, tab, change indent, etc..).
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1252 If preceding character is part of a word or a paren then `hippie-expand',
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1253 else if right of non whitespace on line then `tab-to-tab-stop',
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1254 else if last command was a tab or return then dedent one step or if a comment
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1255 toggle between normal indent and inline comment indent,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1256 else indent `correctly'.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1257 If `vera-intelligent-tab' is nil, always indent line."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1258 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1259 (if vera-intelligent-tab
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1260 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1261 (cond ((memq (char-syntax (preceding-char)) '(?w ?_))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1262 (let ((case-fold-search t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1263 (case-replace nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1264 (hippie-expand-only-buffers
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1265 (or (and (boundp 'hippie-expand-only-buffers)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1266 hippie-expand-only-buffers)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1267 '(vera-mode))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1268 (vera-expand-abbrev prefix-arg)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1269 ((> (current-column) (current-indentation))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1270 (tab-to-tab-stop))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1271 ((and (or (eq last-command 'vera-electric-tab)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1272 (eq last-command 'vera-electric-return))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1273 (/= 0 (current-indentation)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1274 (backward-delete-char-untabify vera-basic-offset nil))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1275 (t (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1276 (setq this-command 'vera-electric-tab))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1277 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1278
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1279 (defun vera-electric-return ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1280 "Insert newline and indent. Indent current line if it is a block closing."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1281 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1282 (vera-indent-block-closing)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1283 (newline-and-indent))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1284
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1285 (defun vera-electric-space (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1286 "Insert a space. Indent current line if it is a block closing."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1287 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1288 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1289 (vera-indent-block-closing))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1290 (self-insert-command (prefix-numeric-value arg)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1291
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1292 (defun vera-electric-opening-brace (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1293 "Outdent opening brace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1294 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1295 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1296 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1297 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1298
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1299 (defun vera-electric-closing-brace (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1300 "Outdent closing brace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1301 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1302 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1303 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1304 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1305
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1306 (defun vera-electric-pound (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1307 "Insert `#' and indent as directive it first character of line."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1308 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1309 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1310 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1311 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1312 (backward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1313 (skip-chars-backward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1314 (when (bolp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1315 (delete-horizontal-space)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1316
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1317 (defun vera-electric-star (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1318 "Insert a star character. Nicked from `c-electric-star'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1319 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1320 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1321 (if (and (not arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1322 (memq (vera-in-literal) '(comment))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1323 (eq (char-before) ?*)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1324 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1325 (forward-char -1)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1326 (skip-chars-backward "*")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1327 (if (eq (char-before) ?/)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1328 (forward-char -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1329 (skip-chars-backward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1330 (bolp)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1331 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1332
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1333 (defun vera-electric-slash (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1334 "Insert a slash character. Nicked from `c-electric-slash'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1335 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1336 (let* ((ch (char-before))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1337 (indentp (and (not arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1338 (eq last-command-char ?/)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1339 (or (and (eq ch ?/)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1340 (not (vera-in-literal)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1341 (and (eq ch ?*)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1342 (vera-in-literal))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1343 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1344 (when indentp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1345 (indent-according-to-mode))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1346
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1347
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1348 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1349 ;;; Miscellaneous
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1350 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1351
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1352 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1353 ;; Hippie expand customization (for expansion of Vera commands)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1354
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1355 (defvar vera-abbrev-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1356 (append (list nil) vera-keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1357 (list nil) vera-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1358 (list nil) vera-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1359 (list nil) vera-constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1360 (list nil) vera-rvm-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1361 (list nil) vera-rvm-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1362 (list nil) vera-rvm-constants)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1363 "Predefined abbreviations for Vera.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1364
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1365 (defvar vera-expand-upper-case nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1366
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1367 (eval-when-compile (require 'hippie-exp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1368
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1369 (defun vera-try-expand-abbrev (old)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1370 "Try expanding abbreviations from `vera-abbrev-list'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1371 (unless old
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1372 (he-init-string (he-dabbrev-beg) (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1373 (setq he-expand-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1374 (let ((abbrev-list vera-abbrev-list)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1375 (sel-abbrev-list '()))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1376 (while abbrev-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1377 (when (or (not (stringp (car abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1378 (string-match
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1379 (concat "^" he-search-string) (car abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1380 (setq sel-abbrev-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1381 (cons (car abbrev-list) sel-abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1382 (setq abbrev-list (cdr abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1383 (nreverse sel-abbrev-list))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1384 (while (and he-expand-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1385 (or (not (stringp (car he-expand-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1386 (he-string-member (car he-expand-list) he-tried-table t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1387 (unless (stringp (car he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1388 (setq vera-expand-upper-case (car he-expand-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1389 (setq he-expand-list (cdr he-expand-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1390 (if (null he-expand-list)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1391 (progn (when old (he-reset-string))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1392 nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1393 (he-substitute-string
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1394 (if vera-expand-upper-case
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1395 (upcase (car he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1396 (car he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1397 t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1398 (setq he-expand-list (cdr he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1399 t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1400
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1401 ;; function for expanding abbrevs and dabbrevs
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1402 (defalias 'vera-expand-abbrev
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1403 (make-hippie-expand-function '(try-expand-dabbrev
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1404 try-expand-dabbrev-all-buffers
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1405 vera-try-expand-abbrev)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1406
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1407 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1408 ;; Comments
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1409
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1410 (defun vera-comment-uncomment-region (beg end &optional arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1411 "Comment region if not commented, uncomment region if already commented."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1412 (interactive "r\nP")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1413 (goto-char beg)
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
1414 (if (looking-at comment-start-skip)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1415 (comment-region beg end '(4))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1416 (comment-region beg end)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1417
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1418 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1419 ;; Help functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1420
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1421 (defun vera-customize ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1422 "Call the customize function with `vera' as argument."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1423 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1424 (customize-group 'vera))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1425
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1426 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1427 ;; Other
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1428
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1429 ;; remove ".vr" from `completion-ignored-extensions'
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1430 (setq completion-ignored-extensions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1431 (delete ".vr" completion-ignored-extensions))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1432
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1433
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1434 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1435 ;;; Bug reports
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1436 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1437
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1438 (defconst vera-mode-help-address "Reto Zimmermann <reto@gnu.org>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1439 "Address for Vera Mode bug reports.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1440
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1441 ;; get reporter-submit-bug-report when byte-compiling
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1442 (eval-when-compile
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1443 (require 'reporter))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1444
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1445 (defun vera-submit-bug-report ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1446 "Submit via mail a bug report on Vera Mode."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1447 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1448 ;; load in reporter
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1449 (and
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1450 (y-or-n-p "Do you want to submit a report on Vera Mode? ")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1451 (require 'reporter)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1452 (let ((reporter-prompt-for-summary-p t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1453 (reporter-submit-bug-report
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1454 vera-mode-help-address
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1455 (concat "Vera Mode " vera-version)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1456 (list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1457 ;; report all important variables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1458 'vera-basic-offset
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1459 'vera-underscore-is-part-of-word
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1460 'vera-intelligent-tab
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1461 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1462 nil nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1463 "Hi Reto,"))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1464
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1465
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1466 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1467 ;;; Documentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1468 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1469
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1470 (defun vera-version ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1471 "Echo the current version of Vera Mode in the minibuffer."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1472 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1473 (message "Vera Mode %s (%s)" vera-version vera-time-stamp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1474
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1475
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1476 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1477
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1478 (provide 'vera-mode)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1479
78086
9a13508185dc Add arch tagline
Miles Bader <miles@gnu.org>
parents: 78038
diff changeset
1480 ;; arch-tag: 22eae722-7ac5-47ac-a713-c4db1cf623a9
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1481 ;;; vera-mode.el ends here