comparison lisp/progmodes/octave-mod.el @ 94565:fe81b2cb42e0

(octave-abbrev-table): Move defvar and initialization into define-abbrev-table. Use :regexp. (octave-mode-syntax-table): Don't set word syntax for `.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 02 May 2008 18:32:18 +0000
parents 38eb904fa638
children 52b7a8c22af5
comparison
equal deleted inserted replaced
94564:e4c0c68d78b4 94565:fe81b2cb42e0
53 53
54 (defconst octave-maintainer-address 54 (defconst octave-maintainer-address
55 "Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>, bug-gnu-emacs@gnu.org" 55 "Kurt Hornik <Kurt.Hornik@wu-wien.ac.at>, bug-gnu-emacs@gnu.org"
56 "Current maintainer of the Emacs Octave package.") 56 "Current maintainer of the Emacs Octave package.")
57 57
58 (defvar octave-abbrev-table nil 58 (define-abbrev-table 'octave-abbrev-table
59 (mapcar (lambda (e) (append e '(nil 0 t)))
60 '(("`a" "all_va_args")
61 ("`b" "break")
62 ("`cs" "case")
63 ("`ca" "catch")
64 ("`c" "continue")
65 ("`el" "else")
66 ("`eli" "elseif")
67 ("`et" "end_try_catch")
68 ("`eu" "end_unwind_protect")
69 ("`ef" "endfor")
70 ("`efu" "endfunction")
71 ("`ei" "endif")
72 ("`es" "endswitch")
73 ("`ew" "endwhile")
74 ("`f" "for")
75 ("`fu" "function")
76 ("`gl" "global")
77 ("`gp" "gplot")
78 ("`gs" "gsplot")
79 ("`if" "if ()")
80 ("`o" "otherwise")
81 ("`rp" "replot")
82 ("`r" "return")
83 ("`s" "switch")
84 ("`t" "try")
85 ("`u" "until ()")
86 ("`up" "unwind_protect")
87 ("`upc" "unwind_protect_cleanup")
88 ("`w" "while ()")))
59 "Abbrev table for Octave's reserved words. 89 "Abbrev table for Octave's reserved words.
60 Used in `octave-mode' and inferior-octave-mode buffers. 90 Used in `octave-mode' and inferior-octave-mode buffers.
61 All Octave abbrevs start with a grave accent (`).") 91 All Octave abbrevs start with a grave accent (`)."
62 (unless octave-abbrev-table 92 :regexp "\\(?:[^`]\\|^\\)\\(\\(?:\\<\\|`\\)\\w+\\)\\W*")
63 (define-abbrev-table 'octave-abbrev-table ()))
64
65 (let ((abbrevs-changed abbrevs-changed))
66 (define-abbrev octave-abbrev-table "`a" "all_va_args" nil 0 t)
67 (define-abbrev octave-abbrev-table "`b" "break" nil 0 t)
68 (define-abbrev octave-abbrev-table "`cs" "case" nil 0 t)
69 (define-abbrev octave-abbrev-table "`ca" "catch" nil 0 t)
70 (define-abbrev octave-abbrev-table "`c" "continue" nil 0 t)
71 (define-abbrev octave-abbrev-table "`el" "else" nil 0 t)
72 (define-abbrev octave-abbrev-table "`eli" "elseif" nil 0 t)
73 (define-abbrev octave-abbrev-table "`et" "end_try_catch" nil 0 t)
74 (define-abbrev octave-abbrev-table "`eu" "end_unwind_protect" nil 0 t)
75 (define-abbrev octave-abbrev-table "`ef" "endfor" nil 0 t)
76 (define-abbrev octave-abbrev-table "`efu" "endfunction" nil 0 t)
77 (define-abbrev octave-abbrev-table "`ei" "endif" nil 0 t)
78 (define-abbrev octave-abbrev-table "`es" "endswitch" nil 0 t)
79 (define-abbrev octave-abbrev-table "`ew" "endwhile" nil 0 t)
80 (define-abbrev octave-abbrev-table "`f" "for" nil 0 t)
81 (define-abbrev octave-abbrev-table "`fu" "function" nil 0 t)
82 (define-abbrev octave-abbrev-table "`gl" "global" nil 0 t)
83 (define-abbrev octave-abbrev-table "`gp" "gplot" nil 0 t)
84 (define-abbrev octave-abbrev-table "`gs" "gsplot" nil 0 t)
85 (define-abbrev octave-abbrev-table "`if" "if ()" nil 0 t)
86 (define-abbrev octave-abbrev-table "`o" "otherwise" nil 0 t)
87 (define-abbrev octave-abbrev-table "`rp" "replot" nil 0 t)
88 (define-abbrev octave-abbrev-table "`r" "return" nil 0 t)
89 (define-abbrev octave-abbrev-table "`s" "switch" nil 0 t)
90 (define-abbrev octave-abbrev-table "`t" "try" nil 0 t)
91 (define-abbrev octave-abbrev-table "`u" "until ()" nil 0 t)
92 (define-abbrev octave-abbrev-table "`up" "unwind_protect" nil 0 t)
93 (define-abbrev octave-abbrev-table "`upc" "unwind_protect_cleanup" nil 0 t)
94 (define-abbrev octave-abbrev-table "`w" "while ()" nil 0 t))
95 93
96 (defvar octave-comment-char ?# 94 (defvar octave-comment-char ?#
97 "Character to start an Octave comment.") 95 "Character to start an Octave comment.")
98 (defvar octave-comment-start 96 (defvar octave-comment-start
99 (string octave-comment-char ?\ ) 97 (string octave-comment-char ?\ )
296 (modify-syntax-entry ?& "." table) 294 (modify-syntax-entry ?& "." table)
297 (modify-syntax-entry ?| "." table) 295 (modify-syntax-entry ?| "." table)
298 (modify-syntax-entry ?! "." table) 296 (modify-syntax-entry ?! "." table)
299 (modify-syntax-entry ?\\ "\\" table) 297 (modify-syntax-entry ?\\ "\\" table)
300 (modify-syntax-entry ?\' "." table) 298 (modify-syntax-entry ?\' "." table)
301 (modify-syntax-entry ?\` "w" table) 299 ;; Was "w" for abbrevs, but now that it's not necessary any more,
300 (modify-syntax-entry ?\` "." table)
302 (modify-syntax-entry ?\" "\"" table) 301 (modify-syntax-entry ?\" "\"" table)
303 (modify-syntax-entry ?. "w" table) 302 (modify-syntax-entry ?. "w" table)
304 (modify-syntax-entry ?_ "w" table) 303 (modify-syntax-entry ?_ "w" table)
305 (modify-syntax-entry ?\% "<" table) 304 (modify-syntax-entry ?\% "<" table)
306 (modify-syntax-entry ?\# "<" table) 305 (modify-syntax-entry ?\# "<" table)