comparison lisp/textmodes/scribe.el @ 39893:942e743c5598

(scribe-mode): Use define-derived-mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 13 Oct 2001 19:13:38 +0000
parents 253f761ad37b
children 7308bbc423d5
comparison
equal deleted inserted replaced
39892:ef399b9ffc2b 39893:942e743c5598
108 (define-key scribe-mode-map "\C-c\C-i" 'scribe-italicize-word) 108 (define-key scribe-mode-map "\C-c\C-i" 'scribe-italicize-word)
109 (define-key scribe-mode-map "\C-c\C-b" 'scribe-bold-word) 109 (define-key scribe-mode-map "\C-c\C-b" 'scribe-bold-word)
110 (define-key scribe-mode-map "\C-c\C-u" 'scribe-underline-word)) 110 (define-key scribe-mode-map "\C-c\C-u" 'scribe-underline-word))
111 111
112 ;;;###autoload 112 ;;;###autoload
113 (defun scribe-mode () 113 (define-derived-mode scribe-mode text-mode "Scribe"
114 "Major mode for editing files of Scribe (a text formatter) source. 114 "Major mode for editing files of Scribe (a text formatter) source.
115 Scribe-mode is similar to text-mode, with a few extra commands added. 115 Scribe-mode is similar to text-mode, with a few extra commands added.
116 \\{scribe-mode-map} 116 \\{scribe-mode-map}
117 117
118 Interesting variables: 118 Interesting variables:
119 119
120 scribe-fancy-paragraphs 120 `scribe-fancy-paragraphs'
121 Non-nil makes Scribe mode use a different style of paragraph separation. 121 Non-nil makes Scribe mode use a different style of paragraph separation.
122 122
123 scribe-electric-quote 123 `scribe-electric-quote'
124 Non-nil makes insert of double quote use `` or '' depending on context. 124 Non-nil makes insert of double quote use `` or '' depending on context.
125 125
126 scribe-electric-parenthesis 126 `scribe-electric-parenthesis'
127 Non-nil makes an open-parenthesis char (one of `([<{') 127 Non-nil makes an open-parenthesis char (one of `([<{')
128 automatically insert its close if typed after an @Command form." 128 automatically insert its close if typed after an @Command form."
129 (interactive) 129 (set (make-local-variable 'comment-start) "@Comment[")
130 (kill-all-local-variables) 130 (set (make-local-variable 'comment-start-skip) (concat "@Comment[" scribe-open-parentheses "]"))
131 (use-local-map scribe-mode-map) 131 (set (make-local-variable 'comment-column) 0)
132 (setq mode-name "Scribe") 132 (set (make-local-variable 'comment-end) "]")
133 (setq major-mode 'scribe-mode) 133 (set (make-local-variable 'paragraph-start)
134 (define-abbrev-table 'scribe-mode-abbrev-table ()) 134 (concat "\\([\n\f]\\)\\|\\(@\\w+["
135 (setq local-abbrev-table scribe-mode-abbrev-table) 135 scribe-open-parentheses
136 (make-local-variable 'comment-start) 136 "].*["
137 (setq comment-start "@Comment[") 137 scribe-close-parentheses
138 (make-local-variable 'comment-start-skip) 138 "]$\\)"))
139 (setq comment-start-skip (concat "@Comment[" scribe-open-parentheses "]")) 139 (set (make-local-variable 'paragraph-separate)
140 (make-local-variable 'comment-column) 140 (if scribe-fancy-paragraphs paragraph-start "$"))
141 (setq comment-column 0) 141 (set (make-local-variable 'sentence-end)
142 (make-local-variable 'comment-end) 142 "\\([.?!]\\|@:\\)[]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*")
143 (setq comment-end "]") 143 (set (make-local-variable 'compile-command)
144 (make-local-variable 'paragraph-start) 144 (concat "scribe " (buffer-file-name))))
145 (setq paragraph-start (concat "\\([\n\f]\\)\\|\\(@\\w+["
146 scribe-open-parentheses
147 "].*["
148 scribe-close-parentheses
149 "]$\\)"))
150 (make-local-variable 'paragraph-separate)
151 (setq paragraph-separate (if scribe-fancy-paragraphs
152 paragraph-start "$"))
153 (make-local-variable 'sentence-end)
154 (setq sentence-end "\\([.?!]\\|@:\\)[]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*")
155 (make-local-variable 'compile-command)
156 (setq compile-command (concat "scribe " (buffer-file-name)))
157 (set-syntax-table scribe-mode-syntax-table)
158 (run-hooks 'text-mode-hook 'scribe-mode-hook))
159 145
160 (defun scribe-tab () 146 (defun scribe-tab ()
161 (interactive) 147 (interactive)
162 (insert "@\\")) 148 (insert "@\\"))
163 149