annotate lisp/progmodes/vera-mode.el @ 111843:94c9743593b9

nnir.el (nnir-run-gmane): Restore sub-optimal test for gmane server. (nnir-request-article): Improve article retrieval.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Tue, 07 Dec 2010 14:10:11 +0000
parents 249a1455856a
children b47e85affa59
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,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105939
diff changeset
4 ;; 2006, 2007, 2008, 2009, 2010 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
94116
842d446b22d9 Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
12 ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
842d446b22d9 Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
13 ;; file on 18/3/2008, and the maintainer agreed that when a bug is
842d446b22d9 Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
14 ;; filed in the Emacs bug reporting system against this file, a copy
842d446b22d9 Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
15 ;; of the bug report be sent to the maintainer's email address.
842d446b22d9 Cleanup the bug-report email addresses and make sure the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
16
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
17 (defconst vera-version "2.18"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
18 "Vera Mode version number.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
19
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
20 (defconst vera-time-stamp "2007-06-21"
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
21 "Vera Mode time stamp for last update.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
22
78035
3475e1b1a4e4 Header changes: mark file as part of Emacs, update FSF address.
Glenn Morris <rgm@gnu.org>
parents: 78032
diff changeset
23 ;; This file is part of GNU Emacs.
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
24
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94116
diff changeset
25 ;; GNU Emacs is free software: you can redistribute it and/or modify
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
26 ;; it under the terms of the GNU General Public License as published by
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94116
diff changeset
27 ;; the Free Software Foundation, either version 3 of the License, or
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94116
diff changeset
28 ;; (at your option) any later version.
78032
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 ;; 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
31 ;; 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
32 ;; 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
33 ;; GNU General Public License for more details.
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 ;; You should have received a copy of the GNU General Public License
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94116
diff changeset
36 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
78032
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 ;;; Commentary:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 ;; 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
43 ;; It includes the following features:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
44
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
45 ;; - Syntax highlighting
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
46 ;; - Indentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
47 ;; - Word/keyword completion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
48 ;; - Block commenting
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
49 ;; - Works under GNU Emacs and XEmacs
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
50
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
52 ;; Documentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
53
81994
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
54 ;; 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
55
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
56 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
57 ;; Installation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
58
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
59 ;; 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
60
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
61 ;; 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
62 ;; 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
63 ;; 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
64
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
65 ;; (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
66
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
67 ;; 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
68 ;; directory. Otherwise, byte-compile the source file:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
69 ;; 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
70 ;; 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
71
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
72 ;; 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
73 ;; 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
74 ;; (`.emacs'):
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 ;; (autoload 'vera-mode "vera-mode" "Vera Mode" t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
77 ;; (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
78
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 ;;; Code:
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 ;;; Variables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
86
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
87 (defgroup vera nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
88 "Customizations for Vera Mode."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
89 :prefix "vera-"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
90 :version "22.2"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
91 :group 'languages)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
92
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
93 (defcustom vera-basic-offset 2
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
94 "*Amount of basic offset used for indentation."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
95 :type 'integer
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
96 :group 'vera)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
97
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
98 (defcustom vera-underscore-is-part-of-word nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
99 "*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
100 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
101 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
102 are treated as single words otherwise."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
103 :type 'boolean
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
104 :group 'vera)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
105
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
106 (defcustom vera-intelligent-tab t
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
107 "*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
108 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
109 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
110 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
111 else indent current line.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
112 If nil, TAB always indents current line."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
113 :type 'boolean
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
114 :group 'vera)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
115
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 ;;; Mode definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
119 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
120
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
122 ;; Key bindings
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
123
81994
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
124 (defvar vera-mode-map
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
125 (let ((map (make-sparse-keymap)))
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
126 ;; Backspace/delete key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
127 (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
128 (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
129 (define-key map [delete] 'delete-char)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
130 (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
131 ;; Standard key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
132 (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
133 (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
134 (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
135 (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
136 ;; Mode specific key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
137 (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
138 (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
139 (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
140 (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
141 (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
142 (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
143 ;; Electric key bindings.
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
144 (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
145 (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
146 (define-key map " " 'vera-electric-space)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
147 (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
148 (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
149 (define-key map "#" 'vera-electric-pound)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
150 (define-key map "*" 'vera-electric-star)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
151 (define-key map "/" 'vera-electric-slash)
10d258c6090d (vera-mode-map): Move initialization into declaration.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81993
diff changeset
152 map)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
153 "Keymap for Vera Mode.")
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
156 ;; Menu
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
157
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
158 (require 'easymenu)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
159
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
160 (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
161 "Menu keymap for Vera Mode."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
162 '("Vera"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
163 ["(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
164 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
165 ["Move Forward Statement" vera-forward-statement t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
166 ["Move Backward Statement" vera-backward-statement t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
167 ["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
168 ["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
169 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
170 ["Indent Line" indent-according-to-mode t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
171 ["Indent Region" vera-indent-region (mark)]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
172 ["Indent Buffer" vera-indent-buffer t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
173 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
174 ["Fontify Buffer" vera-fontify-buffer t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
175 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
176 ["Documentation" describe-mode]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
177 ["Version" vera-version t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
178 ["Bug Report..." vera-submit-bug-report t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
179 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
180 ("Options"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
181 ["Indentation Offset..." (customize-option 'vera-basic-offset) t]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
182 ["Underscore is Part of Word"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
183 (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
184 (not vera-underscore-is-part-of-word))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
185 :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
186 ["Use Intelligent Tab"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
187 (customize-set-variable 'vera-intelligent-tab
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
188 (not vera-intelligent-tab))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
189 :style toggle :selected vera-intelligent-tab]
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
190 "--"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
191 ["Save Options" customize-save-customized t]
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 ["Customize..." vera-customize t])))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
196 ;; Syntax table
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
197
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
198 (defvar vera-mode-syntax-table
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
199 (let ((syntax-table (make-syntax-table)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
200 ;; punctuation
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 (modify-syntax-entry ?\> "." syntax-table)
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 (modify-syntax-entry ?\| "." syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
218 ;; string
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
219 (modify-syntax-entry ?\" "\"" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
220 ;; underscore
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
221 (when vera-underscore-is-part-of-word
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
222 (modify-syntax-entry ?\_ "w" syntax-table))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
223 ;; escape
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 ;; parentheses to match
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 (modify-syntax-entry ?\] ")[" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
230 (modify-syntax-entry ?\{ "(}" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
231 (modify-syntax-entry ?\} "){" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
232 ;; comment
85511
f873840f9fea * emulation/edt-mapper.el (function-key-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82140
diff changeset
233 (if (featurep 'xemacs)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
234 (modify-syntax-entry ?\/ ". 1456" syntax-table) ; XEmacs
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
235 (modify-syntax-entry ?\/ ". 124b" syntax-table)) ; Emacs
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
236 (modify-syntax-entry ?\* ". 23" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
237 ;; newline and CR
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
238 (modify-syntax-entry ?\n "> b" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
239 (modify-syntax-entry ?\^M "> b" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
240 syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
241 "Syntax table used in `vera-mode' buffers.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
242
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
243 (defvar vera-mode-ext-syntax-table
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
244 (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
245 ;; extended syntax table including '_' (for simpler search regexps)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
246 (modify-syntax-entry ?_ "w" syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
247 syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
248 "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
249
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
250 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
251 ;; Mode definition
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
252
105939
a0f778f4a995 * term/x-win.el (x-gtk-stock-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104029
diff changeset
253 ;;;###autoload (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'") 'vera-mode))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
254
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
255 ;;;###autoload
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
256 (defun vera-mode ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
257 "Major mode for editing Vera code.
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 Usage:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
260 ------
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
261
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
262 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
263 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
264 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
265 `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
266
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
267 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
268 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
269 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
270 completions.
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 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
273 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
274
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
275 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
276 uncomments a region if already commented out.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
277
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
278 HIGHLIGHTING (fontification): Vera keywords, predefined types and
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
279 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
280 comments and strings are highlighted using different colors.
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 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
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 Maintenance:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
286 ------------
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 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
289 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
290
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
291 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
292
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
293 Official distribution is at
104029
55ba5af4bf3a Kevin Ryde <user42 at zip.com.au>
Glenn Morris <rgm@gnu.org>
parents: 101002
diff changeset
294 URL `http://www.iis.ee.ethz.ch/~zimmi/emacs/vera-mode.html'
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
295
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 The Vera Mode Maintainer
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
298 Reto Zimmermann <reto@gnu.org>
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 Key bindings:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
301 -------------
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
302
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
303 \\{vera-mode-map}"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
304 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
305 (kill-all-local-variables)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
306 (setq major-mode 'vera-mode)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
307 (setq mode-name "Vera")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
308 ;; set maps and tables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
309 (use-local-map vera-mode-map)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
310 (set-syntax-table vera-mode-syntax-table)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
311 ;; set local variables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
312 (require 'cc-cmds)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
313 (set (make-local-variable 'comment-start) "//")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
314 (set (make-local-variable 'comment-end) "")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
315 (set (make-local-variable 'comment-column) 40)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
316 (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
317 (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
318 (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
319 (set (make-local-variable 'paragraph-start) "^$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
320 (set (make-local-variable 'paragraph-separate) paragraph-start)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
321 (set (make-local-variable 'require-final-newline) t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
322 (set (make-local-variable 'indent-tabs-mode) nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
323 (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
324 (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
325 ;; initialize font locking
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
326 (set (make-local-variable 'font-lock-defaults)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
327 '(vera-font-lock-keywords nil nil ((?\_ . "w"))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
328 ;; add menu (XEmacs)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
329 (easy-menu-add vera-mode-menu)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
330 ;; miscellaneous
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
331 (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
332 ;; run hooks
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
333 (run-hooks 'vera-mode-hook))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
334
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 ;;; Vera definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
338 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
341 ;;; Keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
342
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
343 (defconst vera-keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
344 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
345 "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
346 "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
347 "bin_activation" "bit_normal" "bit_reverse" "break" "breakpoint"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
348 "case" "casex" "casez" "class" "constraint" "continue"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
349 "coverage" "coverage_block" "coverage_def" "coverage_depth"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
350 "coverage_goal" "coverage_group" "coverage_option" "coverage_val"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
351 "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
352 "default" "depth" "dist" "do"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
353 "else" "end" "enum" "exhaustive" "export" "extends" "extern"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
354 "for" "foreach" "fork" "function"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
355 "hdl_task" "hdl_node" "hide"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
356 "if" "illegal_self_transition" "illegal_state" "illegal_transition"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
357 "in" "interface" "invisible"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
358 "join"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
359 "little_endian" "local"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
360 "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
361 "negedge" "new" "newcov" "non_rand" "none" "not" "null"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
362 "or" "ordered"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
363 "packed" "port" "posedge" "proceed" "prod" "prodget" "prodset"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
364 "program" "protected" "public"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
365 "rand" "randc" "randcase" "randseq" "repeat" "return" "rules"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
366 "sample" "sample_event" "shadow" "soft" "state" "static" "super"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
367 "task" "terminate" "this" "trans" "typedef"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
368 "unpacked"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
369 "var" "vca" "vector" "verilog_node" "verilog_task"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
370 "vhdl_node" "vhdl_task" "virtual" "virtuals" "visible" "void"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
371 "while" "wildcard" "with"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
372 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
373 "List of Vera keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
374
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
375 (defconst vera-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
376 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
377 "integer" "bit" "reg" "string" "bind_var" "event"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
378 "inout" "input" "output"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
379 "ASYNC" "CLOCK"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
380 "NDRIVE" "NHOLD" "NRX" "NRZ" "NR0" "NR1" "NSAMPLE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
381 "PDRIVE" "PHOLD" "PRX" "PRZ" "PR0" "PR1" "PSAMPLE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
382 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
383 "List of Vera predefined types.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
384
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
385 (defconst vera-q-values
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
386 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
387 "gnr" "grx" "grz" "gr0" "gr1"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
388 "nr" "rx" "rz" "r0" "r1"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
389 "snr" "srx" "srz" "sr0" "sr1"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
390 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
391 "List of Vera predefined VCA q_values.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
392
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
393 (defconst vera-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
394 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
395 ;; system functions and tasks
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
396 "alloc"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
397 "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
398 "cm_get_coverage" "cm_get_limit"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
399 "coverage_backup_database_file" "coverage_save_database"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
400 "delay"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
401 "error" "error_mode" "error_wait" "exit"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
402 "fclose" "feof" "ferror" "fflush" "flag" "fopen" "fprintf" "freadb"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
403 "freadb" "freadh" "freadstr"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
404 "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
405 "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
406 "getstate"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
407 "initstate"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
408 "lock_file"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
409 "mailbox_get" "mailbox_put" "mailbox_receive" "mailbox_send"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
410 "make_client" "make_server"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
411 "os_command"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
412 "printf" "psprintf"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
413 "query" "query_str" "query_x"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
414 "rand48" "random" "region_enter" "region_exit" "rewind"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
415 "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
416 "srandom" "sprintf" "sscanf" "stop" "suspend_thread" "sync"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
417 "timeout" "trace" "trigger"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
418 "unit_delay" "unlock_file" "up_connections"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
419 "urand48" "urandom" "urandom_range"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
420 "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
421 "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
422 "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
423 "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
424 "vsv_wait_for_done" "vsv_wait_for_input"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
425 "wait_child" "wait_var"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
426 ;; class methods
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
427 "Configure" "DisableTrigger" "DoAction" "EnableCount" "EnableTrigger"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
428 "Event" "GetAssert" "GetCount" "GetFirstAssert" "GetName" "GetNextAssert"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
429 "Wait"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
430 "atobin" "atohex" "atoi" "atooct"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
431 "backref" "bittostr" "capacity" "compare" "constraint_mode"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
432 "delete"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
433 "empty"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
434 "find" "find_index" "first" "first_index"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
435 "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
436 "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
437 "hash"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
438 "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
439 "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
440 "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
441 "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
442 "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
443 "itoa"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
444 "last" "last_index" "len" "load"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
445 "match" "max" "max_index" "min" "min_index"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
446 "object_compare" "object_copy" "object_print"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
447 "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
448 "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
449 "push_front" "putc"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
450 "query" "query_str"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
451 "rand_mode" "randomize" "reserve" "reverse" "rsort"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
452 "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
453 "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
454 "sort" "substr" "sum"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
455 "thismatch" "tolower" "toupper"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
456 "unique_index" "unpack"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
457 ;; empty methods
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
458 "new" "object_compare"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
459 "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
460 "pre_boundary" "pre_pack" "pre_unpack"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
461 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
462 "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
463
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
464 (defconst vera-constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
465 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
466 "ALL" "ANY"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
467 "BAD_STATE" "BAD_TRANS"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
468 "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
469 "CROSS" "CROSS_TRANS"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
470 "DEBUG" "DELETE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
471 "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
472 "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
473 "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
474 "EC_USERSET" "EQ" "EVENT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
475 "FAIL" "FIRST" "FORK"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
476 "GE" "GOAL" "GT" "HAND_SHAKE" "HI" "HIGH" "HNUM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
477 "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
478 "MAILBOX" "MAX_COM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
479 "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
480 "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
481 "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
482 "PAST_IT" "PERCENT" "POSEDGE" "PROGRAM"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
483 "RAWIN" "REGION" "REPORT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
484 "SAMPLE" "SAVE" "SEMAPHORE" "SET" "SILENT" "STATE" "STR"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
485 "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
486 "TRANS"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
487 "VERBOSE"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
488 "WAIT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
489 "stderr" "stdin" "stdout"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
490 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
491 "List of Vera predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
492
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
493 (defconst vera-rvm-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
494 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
495 "VeraListIterator_VeraListIterator_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
496 "VeraListIterator_rvm_data" "VeraListIterator_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
497 "VeraListNodeVeraListIterator_rvm_log" "VeraListNodervm_data"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
498 "VeraListNodervm_log" "VeraList_VeraListIterator_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
499 "VeraList_rvm_data" "VeraList_rvm_log"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
500 "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
501 "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
502 "rvm_log_watchpoint" "rvm_notify" "rvm_notify_event"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
503 "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
504 "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
505 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
506 "List of Vera-RVM keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
507
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
508 (defconst vera-rvm-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
509 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
510 "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
511 "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
512 "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
513 "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
514 "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
515 "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
516 "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
517 "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
518 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
519 "List of Vera-RVM functions.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
520
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
521 (defconst vera-rvm-constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
522 '(
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
523 "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
524 "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
525 "rvm_channel__ACT_PENDING" "rvm_channel__ACT_STARTED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
526 "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
527 "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
528 "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
529 "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
530 "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
531 "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
532 "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
533 "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
534 "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
535 "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
536 "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
537 "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
538 "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
539 "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
540 "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
541 "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
542 "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
543 "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
544 "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
545 "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
546 "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
547 "rvm_xactor__XACTOR_IDLE" "rvm_xactor__XACTOR_BUSY"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
548 "rvm_xactor__XACTOR_STARTED" "rvm_xactor__XACTOR_STOPPED"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
549 "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
550 "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
551 "rvm_xactor__XACTOR_PROTOCOL_RST" "rvm_broadcast__AFAP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
552 "rvm_broadcast__ALAP" "rvm_watchdog__TIMEOUT"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
553 "rvm_env__DUT_RESET" "rvm_log__INTERNAL_TYP"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
554 "RVM_SCHEDULER_IS_XACTOR" "RVM_BROADCAST_IS_XACTOR"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
555 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
556 "List of Vera-RVM predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
557
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
558 ;; `regexp-opt' undefined (`xemacs-devel' not installed)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
559 (unless (fboundp 'regexp-opt)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
560 (defun regexp-opt (strings &optional paren)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
561 (let ((open (if paren "\\(" "")) (close (if paren "\\)" "")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
562 (concat open (mapconcat 'regexp-quote strings "\\|") close))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
563
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
564 (defconst vera-keywords-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
565 (concat "\\<\\(" (regexp-opt vera-keywords) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
566 "Regexp for Vera keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
567
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
568 (defconst vera-types-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
569 (concat "\\<\\(" (regexp-opt vera-types) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
570 "Regexp for Vera predefined types.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
571
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
572 (defconst vera-q-values-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
573 (concat "\\<\\(" (regexp-opt vera-q-values) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
574 "Regexp for Vera predefined VCA q_values.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
575
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
576 (defconst vera-functions-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
577 (concat "\\<\\(" (regexp-opt vera-functions) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
578 "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
579
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
580 (defconst vera-constants-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
581 (concat "\\<\\(" (regexp-opt vera-constants) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
582 "Regexp for Vera predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
583
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
584 (defconst vera-rvm-types-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
585 (concat "\\<\\(" (regexp-opt vera-rvm-types) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
586 "Regexp for Vera-RVM keywords.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
587
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
588 (defconst vera-rvm-functions-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
589 (concat "\\<\\(" (regexp-opt vera-rvm-functions) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
590 "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
591
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
592 (defconst vera-rvm-constants-regexp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
593 (concat "\\<\\(" (regexp-opt vera-rvm-constants) "\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
594 "Regexp for Vera-RVM predefined constants.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
595
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 ;;; Font locking
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
599 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
600
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
601 ;; XEmacs compatibility
85511
f873840f9fea * emulation/edt-mapper.el (function-key-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82140
diff changeset
602 (when (featurep 'xemacs)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
603 (require 'font-lock)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
604 (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
605 (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
606
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
607 (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
608 "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
609 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
610 (condition-case nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
611 (save-restriction
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
612 (narrow-to-region (point-min) limit)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
613 ;; match item
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
614 (when (looking-at "\\s-*\\(\\w+\\)")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
615 (save-match-data
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 ;; move to next item
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
618 (if (looking-at "\\(\\s-*\\(\\[[^]]*\\]\\s-*\\)?,\\)")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
619 (goto-char (match-end 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
620 (end-of-line) t))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
621 (error t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
622
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
623 (defvar vera-font-lock-keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
624 (list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
625 ;; highlight keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
626 (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
627 ;; highlight types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
628 (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
629 ;; highlight RVM types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
630 (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
631 ;; highlight constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
632 (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
633 ;; highlight RVM constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
634 (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
635 ;; highlight q_values
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
636 (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
637 ;; highlight predefined functions, tasks and methods
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
638 (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
639 ;; highlight predefined RVM functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
640 (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
641 ;; highlight functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
642 '("\\<\\(\\w+\\)\\s-*(" 1 font-lock-function-name-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
643 ;; highlight various declaration names
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
644 '("^\\s-*\\(port\\|program\\|task\\)\\s-+\\(\\w+\\)\\>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
645 2 font-lock-function-name-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
646 '("^\\s-*bind\\s-+\\(\\w+\\)\\s-+\\(\\w+\\)\\>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
647 (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
648 ;; highlight interface declaration names
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
649 '("^\\s-*\\(class\\|interface\\)\\s-+\\(\\w+\\)\\>"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
650 2 vera-font-lock-interface)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
651 ;; highlight variable name definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
652 (list (concat "^\\s-*" vera-types-regexp "\\s-*\\(\\[[^]]+\\]\\s-+\\)?")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
653 '(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
654 (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
655 '(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
656 ;; highlight numbers
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
657 '("\\([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
658 ;; highlight filenames in #include directives
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
659 '("^#\\s-*include\\s-*\\(<[^>\"\n]*>?\\)"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
660 1 font-lock-string-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
661 ;; highlight directives and directive names
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
662 '("^#\\s-*\\(\\w+\\)\\>[ \t!]*\\(\\w+\\)?"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
663 (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
664 ;; highlight `@', `$' and `#'
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
665 '("\\([@$#]\\)" 1 font-lock-keyword-face)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
666 ;; highlight @ and # definitions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
667 '("@\\s-*\\(\\w*\\)\\(\\s-*,\\s-*\\(\\w+\\)\\)?\\>[^.]"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
668 (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
669 ;; highlight interface signal name
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
670 '("\\(\\w+\\)\\.\\w+" 1 vera-font-lock-interface)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
671 )
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
672 "Regular expressions to highlight in Vera Mode.")
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-number 'vera-font-lock-number
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
675 "Face name to use for @ definitions.")
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-function 'vera-font-lock-function
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
678 "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
679
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
680 (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
681 "Face name to use for interface names.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
682
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
683 (defface vera-font-lock-number
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
684 '((((class color) (background light)) (:foreground "Gold4"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
685 (((class color) (background dark)) (:foreground "BurlyWood1"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
686 (t (:italic t :bold t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
687 "Font lock mode face used to highlight @ definitions."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
688 :group 'font-lock-highlighting-faces)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
689
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
690 (defface vera-font-lock-function
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
691 '((((class color) (background light)) (:foreground "DarkCyan"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
692 (((class color) (background dark)) (:foreground "Orchid1"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
693 (t (:italic t :bold t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
694 "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
695 :group 'font-lock-highlighting-faces)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
696
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
697 (defface vera-font-lock-interface
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
698 '((((class color) (background light)) (:foreground "Grey40"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
699 (((class color) (background dark)) (:foreground "Grey80"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
700 (t (:italic t :bold t)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
701 "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
702 :group 'font-lock-highlighting-faces)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
703
78038
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
704 (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
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 ;;; Indentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
708 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 (defvar vera-echo-syntactic-information-p nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
711 "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
712
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
713 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
714 ;; offset functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
715
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
716 (defconst vera-offsets-alist
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
717 '((comment . vera-lineup-C-comments)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
718 (comment-intro . vera-lineup-comment)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
719 (string . -1000)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
720 (directive . -1000)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
721 (block-open . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
722 (block-intro . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
723 (block-close . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
724 (arglist-intro . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
725 (arglist-cont . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
726 (arglist-cont-nonempty . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
727 (arglist-close . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
728 (statement . 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
729 (statement-cont . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
730 (substatement . +)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
731 (else-clause . 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
732 "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
733 Adapted from `c-offsets-alist'.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
734
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
735 (defun vera-evaluate-offset (offset langelem symbol)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
736 "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
737 the symbols + or -."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
738 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
739 ((eq offset '+) (setq offset 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)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
741 ((eq offset '++) (setq offset (* 2 vera-basic-offset)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
742 ((eq offset '--) (setq offset (* 2 (- vera-basic-offset))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
743 ((eq offset '*) (setq offset (/ vera-basic-offset 2)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
744 ((eq offset '/) (setq offset (/ (- vera-basic-offset) 2)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
745 ((functionp offset) (setq offset (funcall offset langelem)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
746 ((listp offset)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
747 (setq offset
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
748 (let (done)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
749 (while (and (not done) offset)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
750 (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
751 offset (cdr offset)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
752 (if (not done)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
753 0
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
754 done))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
755 ((not (numberp offset)) (setq offset (symbol-value offset))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
756 offset)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
757
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
758 (defun vera-get-offset (langelem)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
759 "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
760 \(SYMBOL . RELPOS). The symbol is matched against
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
761 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
762 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
763 the offset is simply returned."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
764 (let* ((symbol (car langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
765 (relpos (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
766 (match (assq symbol vera-offsets-alist))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
767 (offset (cdr-safe match)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
768 (if (not match)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
769 (setq offset 0
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
770 relpos 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
771 (setq offset (vera-evaluate-offset offset langelem symbol)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
772 (+ (if (and relpos
111429
249a1455856a Use line-end-position rather than end-of-line, etc.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
773 (< relpos (line-beginning-position)))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
774 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
775 (goto-char relpos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
776 (current-column))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
777 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
778 (vera-evaluate-offset offset langelem symbol))))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
781 ;; help functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
782
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
783 (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
784 "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
785 POSITION can be one of the following symbols:
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
786 bol -- beginning of line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
787 eol -- end of line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
788 boi -- back to indentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
789 ionl -- indentation of next line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
790 iopl -- indentation of previous line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
791 bonl -- beginning of next line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
792 bopl -- beginning of previous line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
793 This function does not modify point or mark."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
794 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
795 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
796 ((eq position 'bol) (beginning-of-line))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
797 ((eq position 'eol) (end-of-line))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
798 ((eq position 'boi) (back-to-indentation))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
799 ((eq position 'bonl) (forward-line 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
800 ((eq position 'bopl) (forward-line -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
801 ((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
802 ((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
803 (t (error "Unknown buffer position requested: %s" position)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
804 (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
805
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
806 (defun vera-in-literal (&optional lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
807 "Determine if point is in a Vera literal."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
808 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
809 (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
810 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
811 ((nth 3 state) 'string)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
812 ((nth 4 state) 'comment)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
813 (t nil)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
814
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
815 (defun vera-skip-forward-literal ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
816 "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
817 (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
818 (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
819 (syntax-ppss)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
820 (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
821 (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
822 ;; 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
823 (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
824 (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
825 ;; A string.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
826 (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
827 ;; 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
828 (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
829 ;; A comment.
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
830 (forward-comment 1))
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
831 t)))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
832
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
833 (defun vera-skip-backward-literal ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
834 "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
835 (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
836 (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
837 (syntax-ppss)
7332bae5b7e7 vera-mode.el (vera-mode): Fix `commend-end-skip' setting.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78035
diff changeset
838 (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
839 (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
840 ;; 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
841 (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
842 t)))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
843
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
844 (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
845 "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
846 (let (ret)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
847 (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
848 (vera-skip-forward-literal)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
849 (if bound (< (point) bound) t)))
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
850 ret))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
851
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
852 (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
853 "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
854 (let (ret)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
855 (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
856 (vera-skip-backward-literal)
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
857 (if bound (> (point) bound) t)))
83f3a5b8e58f (vera-re-search-forward, vera-re-search-backward):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 81757
diff changeset
858 ret))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
859
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
860 (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
861 "Forward skip of syntactic whitespace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
862 (save-restriction
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
863 (let* ((lim (or lim (point-max)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
864 (here lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
865 (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
866 (narrow-to-region (point) lim)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
867 (while (/= here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
868 (setq here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
869 (forward-comment hugenum)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
870 (when (and skip-directive (looking-at "^\\s-*#"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
871 (end-of-line))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
872
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
873 (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
874 "Backward skip over syntactic whitespace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
875 (save-restriction
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
876 (let* ((lim (or lim (point-min)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
877 (here lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
878 (hugenum (- (point-max))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
879 (when (< lim (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
880 (narrow-to-region lim (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
881 (while (/= here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
882 (setq here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
883 (forward-comment hugenum)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
884 (when (and skip-directive
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
885 (save-excursion (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
886 (= (following-char) ?\#)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
887 (beginning-of-line)))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
888
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
889 (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
890 "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
891 `(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
892
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
893 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
894 ;; comment indentation functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
895
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
896 (defsubst vera-langelem-col (langelem &optional preserve-point)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
897 "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
898 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
899 (let ((here (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
900 (goto-char (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
901 (prog1 (current-column)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
902 (if preserve-point
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
903 (goto-char here)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
904
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
905 (defun vera-lineup-C-comments (langelem)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
906 "Line up C block comment continuation lines.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
907 Nicked from `c-lineup-C-comments'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
908 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
909 (let ((here (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
910 (stars (progn (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
911 (skip-chars-forward "*")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
912 (langelem-col (vera-langelem-col langelem)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
913 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
914 (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
915 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
916 (if (not (looking-at "[*]+"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
917 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
918 ;; 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
919 (goto-char here)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
920 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
921 (if (looking-at "[*]+/")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
922 (progn (goto-char (match-end 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
923 (forward-comment -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
924 (goto-char (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
925 (back-to-indentation))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
926 (- (current-column) langelem-col))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
927 (if (zerop stars)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
928 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
929 (skip-chars-forward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
930 (- (current-column) langelem-col))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
931 ;; 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
932 ;; 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
933 ;; 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
934 ;; comments.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
935 (if (> (length (match-string 1)) stars)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
936 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
937 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
938 (- (current-column) -1 langelem-col))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
939 (- (current-column) stars langelem-col)))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
940
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
941 (defun vera-lineup-comment (langelem)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
942 "Line up a comment start."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
943 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
944 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
945 (if (bolp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
946 ;; not indent if at beginning of line
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
947 -1000
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
948 ;; otherwise indent accordingly
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
949 (goto-char (cdr langelem))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
950 (current-column))))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
953 ;; move functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
954
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
955 (defconst vera-beg-block-re "{\\|\\<\\(begin\\|fork\\)\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
956
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
957 (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
958
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
959 (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
960
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
961 (defun vera-corresponding-begin (&optional recursive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
962 "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
963 (while (and (vera-re-search-backward
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
964 (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
965 nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
966 (match-string 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
967 (vera-corresponding-begin t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
968 (unless recursive (vera-beginning-of-substatement)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
969
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
970 (defun vera-corresponding-if ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
971 "Find corresponding `if' if cursor is at `else'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
972 (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
973 (not (equal (match-string 0) "if")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
974 (if (equal (match-string 0) "else")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
975 (vera-corresponding-if)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
976 (forward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
977 (backward-sexp))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
978
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
979 (defun vera-beginning-of-statement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
980 "Go to beginning of current statement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
981 (let (pos)
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 (progn
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
984 ;; search for end of previous statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
985 (while
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
986 (and (vera-re-search-backward
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
987 (concat "[);]\\|" vera-beg-block-re
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
988 "\\|" vera-end-block-re) nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
989 (equal (match-string 0) ")"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
990 (forward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
991 (backward-sexp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
992 (setq pos (match-beginning 0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
993 ;; go back to beginning of current statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
994 (goto-char (or (match-end 0) 0))
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 (when (looking-at "(")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
997 (forward-sexp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
998 (vera-forward-syntactic-ws nil t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
999 ;; 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
1000 (when (looking-at "\\<else\\>")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1001 (vera-corresponding-if)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1002 (setq pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1003 t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1004 ;; 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
1005 (goto-char pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1006
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1007 (defun vera-beginning-of-substatement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1008 "Go to beginning of current substatement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1009 (let ((lim (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1010 pos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1011 ;; go to beginning of statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1012 (vera-beginning-of-statement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1013 (setq pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1014 ;; 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
1015 (while (and (< (point) lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1016 (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
1017 (setq pos (match-beginning 0)))
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 (looking-at "(")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1020 (forward-sexp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1021 (vera-forward-syntactic-ws nil t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1022 (when (< (point) lim)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1023 (setq pos (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1024 (goto-char pos)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1025
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1026 (defun vera-forward-statement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1027 "Move forward one statement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1028 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1029 (vera-prepare-search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1030 (while (and (vera-re-search-forward
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1031 (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
1032 nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1033 (equal (match-string 0) "("))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1034 (backward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1035 (forward-sexp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1036 (vera-beginning-of-substatement)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1037
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1038 (defun vera-backward-statement ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1039 "Move backward one statement."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1040 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1041 (vera-prepare-search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1042 (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1043 (unless (= (preceding-char) ?\))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1044 (backward-char))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1045 (vera-beginning-of-substatement)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1046
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1047 (defun vera-forward-same-indent ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1048 "Move forward to next line with same indent."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1049 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1050 (let ((pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1051 (indent (current-indentation)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1052 (beginning-of-line 2)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1053 (while (and (not (eobp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1054 (or (looking-at "^\\s-*$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1055 (> (current-indentation) indent)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1056 (beginning-of-line 2))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1057 (if (= (current-indentation) indent)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1058 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1059 (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
1060 (goto-char pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1061
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1062 (defun vera-backward-same-indent ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1063 "Move backward to previous line with same indent."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1064 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1065 (let ((pos (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1066 (indent (current-indentation)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1067 (beginning-of-line -0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1068 (while (and (not (bobp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1069 (or (looking-at "^\\s-*$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1070 (> (current-indentation) indent)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1071 (beginning-of-line -0))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1072 (if (= (current-indentation) indent)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1073 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1074 (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
1075 (goto-char pos))))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1078 ;; syntax analysis
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1079
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1080 (defmacro vera-add-syntax (symbol &optional relpos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1081 "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
1082 try to increase performance by using this macro."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1083 `(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
1084
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1085 (defun vera-guess-basic-syntax ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1086 "Determine syntactic context of current line of code."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1087 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1088 (beginning-of-line)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1089 (let ((indent-point (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1090 syntax state placeholder pos)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1091 ;; determine syntax state
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1092 (setq state (parse-partial-sexp (point-min) (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1093 (cond
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1094 ;; CASE 1: in a comment?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1095 ((nth 4 state)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1096 ;; skip empty lines
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1097 (while (and (zerop (forward-line -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1098 (looking-at "^\\s-*$")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1099 (vera-add-syntax 'comment (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1100 ;; CASE 2: in a string?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1101 ((nth 3 state)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1102 (vera-add-syntax 'string))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1103 ;; CASE 3: at a directive?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1104 ((save-excursion (back-to-indentation) (= (following-char) ?\#))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1105 (vera-add-syntax 'directive (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1106 ;; 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
1107 ((and (nth 1 state)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1108 (or (= (char-after (nth 1 state)) ?\()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1109 ;; also for concatenation (opening '{' and ',' on eol/eopl)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1110 (and (= (char-after (nth 1 state)) ?\{)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1111 (or (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1112 (vera-backward-syntactic-ws) (= (char-before) ?,))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1113 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1114 (end-of-line) (= (char-before) ?,))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1115 (goto-char (1+ (nth 1 state)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1116 ;; 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
1117 (if (looking-at "\\s-*$")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1118 (vera-add-syntax 'arglist-cont (vera-point 'boi))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1119 (vera-add-syntax 'arglist-cont-nonempty (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1120 ;; CASE 5: at a block closing?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1121 ((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
1122 ;; look for the corresponding begin
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1123 (vera-corresponding-begin)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1124 (vera-add-syntax 'block-close (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1125 ;; 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
1126 ((and (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1127 (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1128 ;; previous line ends with a block opening?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1129 (or (/= (skip-chars-backward "{") 0) (backward-word 1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1130 (when (looking-at vera-beg-block-re)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1131 ;; go to beginning of substatement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1132 (vera-beginning-of-substatement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1133 (setq placeholder (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1134 ;; not if "fork" is followed by "{"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1135 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1136 (not (and (progn (back-to-indentation) (looking-at "{"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1137 (progn (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1138 (looking-at "\\<fork\\>"))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1139 (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1140 (vera-add-syntax 'block-intro (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1141 ;; 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
1142 ((save-excursion (back-to-indentation) (looking-at "\\<else\\>"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1143 ;; find corresponding if
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1144 (vera-corresponding-if)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1145 (vera-add-syntax 'else-clause (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1146 ;; CASE 8: at the beginning of a statement?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1147 ;; is the previous command completed?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1148 ((or (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1149 (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1150 (setq placeholder (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1151 ;; at the beginning of the buffer?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1152 (or (bobp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1153 ;; previous line ends with a semicolon or
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1154 ;; is a block opening or closing?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1155 (when (or (/= (skip-chars-backward "{};") 0)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1156 (progn (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1157 (looking-at (concat vera-beg-block-re "\\|"
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1158 vera-end-block-re))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1159 ;; if at a block closing, go to beginning
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1160 (when (looking-at vera-end-block-re)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1161 (vera-corresponding-begin))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1162 ;; go to beginning of the statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1163 (vera-beginning-of-statement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1164 (setq placeholder (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1165 ;; at a directive?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1166 (when (progn (back-to-indentation) (looking-at "#"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1167 ;; go to previous statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1168 (vera-beginning-of-statement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1169 (setq placeholder (point)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1170 ;; at a block opening?
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1171 (when (save-excursion (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1172 (looking-at vera-beg-block-re))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1173 ;; go to beginning of the substatement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1174 (vera-beginning-of-substatement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1175 (setq placeholder (point))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1176 (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1177 (vera-add-syntax 'statement (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1178 ;; 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
1179 ;; 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
1180 ((save-excursion (vera-backward-syntactic-ws nil t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1181 (when (= (preceding-char) ?\)) (backward-sexp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1182 (backward-word 1)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1183 (setq placeholder (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1184 (looking-at vera-beg-substatement-re))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1185 (goto-char placeholder)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1186 (vera-add-syntax 'substatement (vera-point 'boi)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1187 ;; CASE 10: it must be a statement continuation!
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1188 (t
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1189 ;; go to beginning of statement
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1190 (vera-beginning-of-substatement)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1191 (vera-add-syntax 'statement-cont (vera-point 'boi))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1192 ;; special case: look for a comment start
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1193 (goto-char indent-point)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1194 (skip-chars-forward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1195 (when (looking-at comment-start)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1196 (vera-add-syntax 'comment-intro))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1197 ;; return syntax
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1198 syntax)))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1201 ;; indentation functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1202
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1203 (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
1204 "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
1205 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
1206 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1207 (vera-prepare-search
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1208 (let* ((syntax (vera-guess-basic-syntax))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1209 (pos (- (point-max) (point)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1210 (indent (apply '+ (mapcar 'vera-get-offset syntax)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1211 (shift-amt (- (current-indentation) indent)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1212 (when vera-echo-syntactic-information-p
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1213 (message "syntax: %s, indent= %d" syntax indent))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1214 (unless (zerop shift-amt)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1215 (beginning-of-line)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1216 (delete-region (point) (vera-point 'boi))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1217 (indent-to indent))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1218 (if (< (point) (vera-point 'boi))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1219 (back-to-indentation)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1220 ;; 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
1221 ;; 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
1222 (when (> (- (point-max) pos) (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1223 (goto-char (- (point-max) pos))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1224 shift-amt)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1225
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1226 (defun vera-indent-buffer ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1227 "Indent whole buffer as Vera code.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1228 Calls `indent-region' for whole buffer."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1229 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1230 (message "Indenting buffer...")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1231 (indent-region (point-min) (point-max) nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1232 (message "Indenting buffer...done"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1233
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1234 (defun vera-indent-region (start end column)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1235 "Indent region as Vera code."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1236 (interactive "r\nP")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1237 (message "Indenting region...")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1238 (indent-region start end column)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1239 (message "Indenting region...done"))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1240
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1241 (defsubst vera-indent-block-closing ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1242 "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
1243 (when (= (char-syntax (preceding-char)) ?w)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1244 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1245 (backward-word 1)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1246 (when (and (not (vera-in-literal))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1247 (looking-at (concat vera-end-block-re "\\|\\<else\\>")))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1248 (indent-according-to-mode)))))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1251 ;; electrifications
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1252
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1253 (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
1254 "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
1255 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
1256 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
1257 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
1258 toggle between normal indent and inline comment indent,
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1259 else indent `correctly'.
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1260 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
1261 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1262 (if vera-intelligent-tab
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1263 (progn
97329
541ff411cf6f * progmodes/vera-mode.el (vera-electric-tab):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94673
diff changeset
1264 (cond ((and (not (featurep 'xemacs)) (use-region-p))
541ff411cf6f * progmodes/vera-mode.el (vera-electric-tab):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94673
diff changeset
1265 (vera-indent-region (region-beginning) (region-end) nil))
541ff411cf6f * progmodes/vera-mode.el (vera-electric-tab):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94673
diff changeset
1266 ((memq (char-syntax (preceding-char)) '(?w ?_))
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1267 (let ((case-fold-search t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1268 (case-replace nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1269 (hippie-expand-only-buffers
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1270 (or (and (boundp 'hippie-expand-only-buffers)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1271 hippie-expand-only-buffers)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1272 '(vera-mode))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1273 (vera-expand-abbrev prefix-arg)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1274 ((> (current-column) (current-indentation))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1275 (tab-to-tab-stop))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1276 ((and (or (eq last-command 'vera-electric-tab)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1277 (eq last-command 'vera-electric-return))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1278 (/= 0 (current-indentation)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1279 (backward-delete-char-untabify vera-basic-offset nil))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1280 (t (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1281 (setq this-command 'vera-electric-tab))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1282 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1283
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1284 (defun vera-electric-return ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1285 "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
1286 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1287 (vera-indent-block-closing)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1288 (newline-and-indent))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1289
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1290 (defun vera-electric-space (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1291 "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
1292 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1293 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1294 (vera-indent-block-closing))
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
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1297 (defun vera-electric-opening-brace (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1298 "Outdent opening brace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1299 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1300 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1301 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1302 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1303
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1304 (defun vera-electric-closing-brace (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1305 "Outdent closing brace."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1306 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1307 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1308 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1309 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1310
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1311 (defun vera-electric-pound (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1312 "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
1313 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1314 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1315 (unless arg
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1316 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1317 (backward-char)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1318 (skip-chars-backward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1319 (when (bolp)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1320 (delete-horizontal-space)))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1321
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1322 (defun vera-electric-star (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1323 "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
1324 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1325 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1326 (if (and (not arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1327 (memq (vera-in-literal) '(comment))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1328 (eq (char-before) ?*)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1329 (save-excursion
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1330 (forward-char -1)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1331 (skip-chars-backward "*")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1332 (if (eq (char-before) ?/)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1333 (forward-char -1))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1334 (skip-chars-backward " \t")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1335 (bolp)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1336 (indent-according-to-mode)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1337
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1338 (defun vera-electric-slash (arg)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1339 "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
1340 (interactive "*P")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1341 (let* ((ch (char-before))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1342 (indentp (and (not arg)
101002
3b3c7e10cd97 Replace last-command-char with last-command-event.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1343 (eq last-command-event ?/)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1344 (or (and (eq ch ?/)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1345 (not (vera-in-literal)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1346 (and (eq ch ?*)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1347 (vera-in-literal))))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1348 (self-insert-command (prefix-numeric-value arg))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1349 (when indentp
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1350 (indent-according-to-mode))))
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1354 ;;; Miscellaneous
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1355 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1356
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1357 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1358 ;; Hippie expand customization (for expansion of Vera commands)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1359
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1360 (defvar vera-abbrev-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1361 (append (list nil) vera-keywords
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1362 (list nil) vera-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1363 (list nil) vera-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1364 (list nil) vera-constants
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1365 (list nil) vera-rvm-types
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1366 (list nil) vera-rvm-functions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1367 (list nil) vera-rvm-constants)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1368 "Predefined abbreviations for Vera.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1369
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1370 (defvar vera-expand-upper-case nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1371
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1372 (eval-when-compile (require 'hippie-exp))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1373
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1374 (defun vera-try-expand-abbrev (old)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1375 "Try expanding abbreviations from `vera-abbrev-list'."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1376 (unless old
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1377 (he-init-string (he-dabbrev-beg) (point))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1378 (setq he-expand-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1379 (let ((abbrev-list vera-abbrev-list)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1380 (sel-abbrev-list '()))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1381 (while abbrev-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1382 (when (or (not (stringp (car abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1383 (string-match
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1384 (concat "^" he-search-string) (car abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1385 (setq sel-abbrev-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1386 (cons (car abbrev-list) sel-abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1387 (setq abbrev-list (cdr abbrev-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1388 (nreverse sel-abbrev-list))))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1389 (while (and he-expand-list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1390 (or (not (stringp (car he-expand-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1391 (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
1392 (unless (stringp (car he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1393 (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
1394 (setq he-expand-list (cdr he-expand-list)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1395 (if (null he-expand-list)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1396 (progn (when old (he-reset-string))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1397 nil)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1398 (he-substitute-string
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1399 (if vera-expand-upper-case
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1400 (upcase (car he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1401 (car he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1402 t)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1403 (setq he-expand-list (cdr he-expand-list))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1404 t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1405
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1406 ;; 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
1407 (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
1408 (make-hippie-expand-function '(try-expand-dabbrev
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1409 try-expand-dabbrev-all-buffers
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1410 vera-try-expand-abbrev)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1411
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1412 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1413 ;; Comments
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1414
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1415 (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
1416 "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
1417 (interactive "r\nP")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1418 (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
1419 (if (looking-at comment-start-skip)
78032
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1420 (comment-region beg end '(4))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1421 (comment-region beg end)))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1422
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1423 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1424 ;; Help functions
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 (defun vera-customize ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1427 "Call the customize function with `vera' as argument."
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1428 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1429 (customize-group 'vera))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1430
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1431 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1432 ;; Other
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 ;; remove ".vr" from `completion-ignored-extensions'
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1435 (setq completion-ignored-extensions
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1436 (delete ".vr" completion-ignored-extensions))
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
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1439 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1440 ;;; Bug reports
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1441 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1442
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1443 (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
1444 "Address for Vera Mode bug reports.")
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1445
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1446 ;; get reporter-submit-bug-report when byte-compiling
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1447 (eval-when-compile
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1448 (require 'reporter))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1449
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1450 (defun vera-submit-bug-report ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1451 "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
1452 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1453 ;; load in reporter
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1454 (and
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1455 (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
1456 (require 'reporter)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1457 (let ((reporter-prompt-for-summary-p t))
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1458 (reporter-submit-bug-report
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1459 vera-mode-help-address
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1460 (concat "Vera Mode " vera-version)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1461 (list
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1462 ;; report all important variables
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1463 'vera-basic-offset
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1464 'vera-underscore-is-part-of-word
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1465 'vera-intelligent-tab
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 nil nil
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1468 "Hi Reto,"))))
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
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1471 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1472 ;;; Documentation
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1473 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 (defun vera-version ()
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1476 "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
1477 (interactive)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1478 (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
1479
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1480
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1481 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1482
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1483 (provide 'vera-mode)
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1484
cac7f84f6e31 progmodes/vera-mode.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1485 ;;; vera-mode.el ends here