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