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