Mercurial > emacs
annotate lisp/progmodes/modula2.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | 2cdce064065f |
| children | 10e417efb12a |
| rev | line source |
|---|---|
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
1 ;;; modula2.el --- Modula-2 editing support package |
|
791
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
2 |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
3 ;; Author: Michael Schmidt <michael@pbinfo.UUCP> |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
4 ;; Tom Perrine <Perrin@LOGICON.ARPA> |
|
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
791
diff
changeset
|
5 ;; Keywords: languages |
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
6 |
|
791
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
7 ;; The authors distributed this without a copyright notice |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
8 ;; back in 1988, so it is in the public domain. The original included |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
9 ;; the following credit: |
| 22 | 10 |
|
791
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
11 ;; Author Mick Jordan |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
12 ;; amended Peter Robinson |
| 22 | 13 |
|
791
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
14 ;;; Code: |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
15 |
|
203c23c9f22c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
663
diff
changeset
|
16 ;;; Added by Tom Perrine (TEP) |
| 22 | 17 (defvar m2-mode-syntax-table nil |
| 231 | 18 "Syntax table in use in Modula-2 buffers.") |
| 22 | 19 |
| 20 (defvar m2-compile-command "m2c" | |
| 21 "Command to compile Modula-2 programs") | |
| 22 | |
| 23 (defvar m2-link-command "m2l" | |
| 24 "Command to link Modula-2 programs") | |
| 25 | |
| 26 (defvar m2-link-name nil | |
| 27 "Name of the executable.") | |
| 28 | |
| 29 | |
| 30 (if m2-mode-syntax-table | |
| 31 () | |
| 32 (let ((table (make-syntax-table))) | |
| 33 (modify-syntax-entry ?\\ "\\" table) | |
| 34 (modify-syntax-entry ?\( ". 1" table) | |
| 35 (modify-syntax-entry ?\) ". 4" table) | |
| 36 (modify-syntax-entry ?* ". 23" table) | |
| 37 (modify-syntax-entry ?+ "." table) | |
| 38 (modify-syntax-entry ?- "." table) | |
| 39 (modify-syntax-entry ?= "." table) | |
| 40 (modify-syntax-entry ?% "." table) | |
| 41 (modify-syntax-entry ?< "." table) | |
| 42 (modify-syntax-entry ?> "." table) | |
| 43 (modify-syntax-entry ?\' "\"" table) | |
| 44 (setq m2-mode-syntax-table table))) | |
| 45 | |
| 46 ;;; Added by TEP | |
| 47 (defvar m2-mode-map nil | |
| 48 "Keymap used in Modula-2 mode.") | |
| 49 | |
| 50 (if m2-mode-map () | |
| 51 (let ((map (make-sparse-keymap))) | |
| 52 (define-key map "\^i" 'm2-tab) | |
| 53 (define-key map "\C-cb" 'm2-begin) | |
| 54 (define-key map "\C-cc" 'm2-case) | |
| 55 (define-key map "\C-cd" 'm2-definition) | |
| 56 (define-key map "\C-ce" 'm2-else) | |
| 57 (define-key map "\C-cf" 'm2-for) | |
| 58 (define-key map "\C-ch" 'm2-header) | |
| 59 (define-key map "\C-ci" 'm2-if) | |
| 60 (define-key map "\C-cm" 'm2-module) | |
| 61 (define-key map "\C-cl" 'm2-loop) | |
| 62 (define-key map "\C-co" 'm2-or) | |
| 63 (define-key map "\C-cp" 'm2-procedure) | |
| 64 (define-key map "\C-c\C-w" 'm2-with) | |
| 65 (define-key map "\C-cr" 'm2-record) | |
| 66 (define-key map "\C-cs" 'm2-stdio) | |
| 67 (define-key map "\C-ct" 'm2-type) | |
| 68 (define-key map "\C-cu" 'm2-until) | |
| 69 (define-key map "\C-cv" 'm2-var) | |
| 70 (define-key map "\C-cw" 'm2-while) | |
| 71 (define-key map "\C-cx" 'm2-export) | |
| 72 (define-key map "\C-cy" 'm2-import) | |
| 73 (define-key map "\C-c{" 'm2-begin-comment) | |
| 74 (define-key map "\C-c}" 'm2-end-comment) | |
| 75 (define-key map "\C-j" 'm2-newline) | |
| 76 (define-key map "\C-c\C-z" 'suspend-emacs) | |
| 77 (define-key map "\C-c\C-v" 'm2-visit) | |
| 78 (define-key map "\C-c\C-t" 'm2-toggle) | |
| 79 (define-key map "\C-c\C-l" 'm2-link) | |
| 80 (define-key map "\C-c\C-c" 'm2-compile) | |
| 81 (setq m2-mode-map map))) | |
| 82 | |
| 83 (defvar m2-indent 5 "*This variable gives the indentation in Modula-2-Mode") | |
| 84 | |
| 258 | 85 ;;;###autoload |
| 22 | 86 (defun modula-2-mode () |
| 231 | 87 "This is a mode intended to support program development in Modula-2. |
| 88 All control constructs of Modula-2 can be reached by typing C-c | |
| 89 followed by the first character of the construct. | |
| 90 \\<m2-mode-map> | |
| 91 \\[m2-begin] begin \\[m2-case] case | |
| 92 \\[m2-definition] definition \\[m2-else] else | |
| 93 \\[m2-for] for \\[m2-header] header | |
| 94 \\[m2-if] if \\[m2-module] module | |
| 95 \\[m2-loop] loop \\[m2-or] or | |
| 96 \\[m2-procedure] procedure Control-c Control-w with | |
| 97 \\[m2-record] record \\[m2-stdio] stdio | |
| 98 \\[m2-type] type \\[m2-until] until | |
| 99 \\[m2-var] var \\[m2-while] while | |
| 100 \\[m2-export] export \\[m2-import] import | |
| 101 \\[m2-begin-comment] begin-comment \\[m2-end-comment] end-comment | |
| 102 \\[suspend-emacs] suspend Emacs \\[m2-toggle] toggle | |
| 103 \\[m2-compile] compile \\[m2-next-error] next-error | |
| 104 \\[m2-link] link | |
| 22 | 105 |
| 231 | 106 `m2-indent' controls the number of spaces for each indentation. |
| 107 `m2-compile-command' holds the command to compile a Modula-2 program. | |
| 108 `m2-link-command' holds the command to link a Modula-2 program." | |
| 22 | 109 (interactive) |
| 110 (kill-all-local-variables) | |
| 111 (use-local-map m2-mode-map) | |
| 112 (setq major-mode 'modula-2-mode) | |
| 113 (setq mode-name "Modula-2") | |
| 114 (make-local-variable 'comment-column) | |
| 115 (setq comment-column 41) | |
| 116 (make-local-variable 'end-comment-column) | |
| 117 (setq end-comment-column 75) | |
| 118 (set-syntax-table m2-mode-syntax-table) | |
| 119 (make-local-variable 'paragraph-start) | |
| 120 (setq paragraph-start (concat "^$\\|" page-delimiter)) | |
| 121 (make-local-variable 'paragraph-separate) | |
| 122 (setq paragraph-separate paragraph-start) | |
| 123 (make-local-variable 'paragraph-ignore-fill-prefix) | |
| 124 (setq paragraph-ignore-fill-prefix t) | |
| 125 ; (make-local-variable 'indent-line-function) | |
| 126 ; (setq indent-line-function 'c-indent-line) | |
| 127 (make-local-variable 'require-final-newline) | |
| 128 (setq require-final-newline t) | |
| 129 (make-local-variable 'comment-start) | |
| 130 (setq comment-start "(* ") | |
| 131 (make-local-variable 'comment-end) | |
| 132 (setq comment-end " *)") | |
| 133 (make-local-variable 'comment-column) | |
| 134 (setq comment-column 41) | |
| 135 (make-local-variable 'comment-start-skip) | |
| 136 (setq comment-start-skip "/\\*+ *") | |
| 137 (make-local-variable 'comment-indent-hook) | |
| 138 (setq comment-indent-hook 'c-comment-indent) | |
| 139 (make-local-variable 'parse-sexp-ignore-comments) | |
| 140 (setq parse-sexp-ignore-comments t) | |
| 141 (run-hooks 'm2-mode-hook)) | |
| 142 | |
| 143 (defun m2-newline () | |
| 144 "Insert a newline and indent following line like previous line." | |
| 145 (interactive) | |
| 146 (let ((hpos (current-indentation))) | |
| 147 (newline) | |
| 148 (indent-to hpos))) | |
| 149 | |
| 150 (defun m2-tab () | |
| 151 "Indent to next tab stop." | |
| 152 (interactive) | |
| 153 (indent-to (* (1+ (/ (current-indentation) m2-indent)) m2-indent))) | |
| 154 | |
| 155 (defun m2-begin () | |
| 156 "Insert a BEGIN keyword and indent for the next line." | |
| 157 (interactive) | |
| 158 (insert "BEGIN") | |
| 159 (m2-newline) | |
| 160 (m2-tab)) | |
| 161 | |
| 162 (defun m2-case () | |
| 163 "Build skeleton CASE statment, prompting for the <expression>." | |
| 164 (interactive) | |
| 165 (let ((name (read-string "Case-Expression: "))) | |
| 166 (insert "CASE " name " OF") | |
| 167 (m2-newline) | |
| 168 (m2-newline) | |
| 169 (insert "END (* case " name " *);")) | |
| 170 (end-of-line 0) | |
| 171 (m2-tab)) | |
| 172 | |
| 173 (defun m2-definition () | |
| 174 "Build skeleton DEFINITION MODULE, prompting for the <module name>." | |
| 175 (interactive) | |
| 176 (insert "DEFINITION MODULE ") | |
| 177 (let ((name (read-string "Name: "))) | |
| 178 (insert name ";\n\n\n\nEND " name ".\n")) | |
| 179 (previous-line 3)) | |
| 180 | |
| 181 (defun m2-else () | |
| 182 "Insert ELSE keyword and indent for next line." | |
| 183 (interactive) | |
| 184 (m2-newline) | |
| 185 (backward-delete-char-untabify m2-indent ()) | |
| 186 (insert "ELSE") | |
| 187 (m2-newline) | |
| 188 (m2-tab)) | |
| 189 | |
| 190 (defun m2-for () | |
| 191 "Build skeleton FOR loop statment, prompting for the loop parameters." | |
| 192 (interactive) | |
| 193 (insert "FOR ") | |
| 194 (let ((name (read-string "Loop Initialiser: ")) limit by) | |
| 195 (insert name " TO ") | |
| 196 (setq limit (read-string "Limit: ")) | |
| 197 (insert limit) | |
| 198 (setq by (read-string "Step: ")) | |
| 199 (if (not (string-equal by "")) | |
| 200 (insert " BY " by)) | |
| 201 (insert " DO") | |
| 202 (m2-newline) | |
| 203 (m2-newline) | |
| 204 (insert "END (* for " name " to " limit " *);")) | |
| 205 (end-of-line 0) | |
| 206 (m2-tab)) | |
| 207 | |
| 208 (defun m2-header () | |
| 209 "Insert a comment block containing the module title, author, etc." | |
| 210 (interactive) | |
| 211 (insert "(*\n Title: \t") | |
| 212 (insert (read-string "Title: ")) | |
| 213 (insert "\n Created:\t") | |
| 214 (insert (current-time-string)) | |
| 215 (insert "\n Author: \t") | |
| 216 (insert (user-full-name)) | |
| 217 (insert (concat "\n\t\t<" (user-login-name) "@" (system-name) ">\n")) | |
| 218 (insert "*)\n\n")) | |
| 219 | |
| 220 (defun m2-if () | |
| 221 "Insert skeleton IF statment, prompting for <boolean-expression>." | |
| 222 (interactive) | |
| 223 (insert "IF ") | |
| 224 (let ((thecondition (read-string "<boolean-expression>: "))) | |
| 225 (insert thecondition " THEN") | |
| 226 (m2-newline) | |
| 227 (m2-newline) | |
| 228 (insert "END (* if " thecondition " *);")) | |
| 229 (end-of-line 0) | |
| 230 (m2-tab)) | |
| 231 | |
| 232 (defun m2-loop () | |
| 233 "Build skeleton LOOP (with END)." | |
| 234 (interactive) | |
| 235 (insert "LOOP") | |
| 236 (m2-newline) | |
| 237 (m2-newline) | |
| 238 (insert "END (* loop *);") | |
| 239 (end-of-line 0) | |
| 240 (m2-tab)) | |
| 241 | |
| 242 (defun m2-module () | |
| 243 "Build skeleton IMPLEMENTATION MODULE, prompting for <module-name>." | |
| 244 (interactive) | |
| 245 (insert "IMPLEMENTATION MODULE ") | |
| 246 (let ((name (read-string "Name: "))) | |
| 247 (insert name ";\n\n\n\nEND " name ".\n") | |
| 248 (previous-line 3) | |
| 249 (m2-header) | |
| 250 (m2-type) | |
| 251 (newline) | |
| 252 (m2-var) | |
| 253 (newline) | |
| 254 (m2-begin) | |
| 255 (m2-begin-comment) | |
| 256 (insert " Module " name " Initialisation Code ")) | |
| 257 (m2-end-comment) | |
| 258 (newline) | |
| 259 (m2-tab)) | |
| 260 | |
| 261 (defun m2-or () | |
| 262 (interactive) | |
| 263 (m2-newline) | |
| 264 (backward-delete-char-untabify m2-indent) | |
| 265 (insert "|") | |
| 266 (m2-newline) | |
| 267 (m2-tab)) | |
| 268 | |
| 269 (defun m2-procedure () | |
| 270 (interactive) | |
| 271 (insert "PROCEDURE ") | |
| 272 (let ((name (read-string "Name: " )) | |
| 273 args) | |
| 274 (insert name " (") | |
| 275 (insert (read-string "Arguments: ") ")") | |
| 276 (setq args (read-string "Result Type: ")) | |
| 277 (if (not (string-equal args "")) | |
| 278 (insert " : " args)) | |
| 279 (insert ";") | |
| 280 (m2-newline) | |
| 281 (insert "BEGIN") | |
| 282 (m2-newline) | |
| 283 (m2-newline) | |
| 284 (insert "END ") | |
| 285 (insert name) | |
| 286 (insert ";") | |
| 287 (end-of-line 0) | |
| 288 (m2-tab))) | |
| 289 | |
| 290 (defun m2-with () | |
| 291 (interactive) | |
| 292 (insert "WITH ") | |
| 293 (let ((name (read-string "Record-Type: "))) | |
| 294 (insert name) | |
| 295 (insert " DO") | |
| 296 (m2-newline) | |
| 297 (m2-newline) | |
| 298 (insert "END (* with " name " *);")) | |
| 299 (end-of-line 0) | |
| 300 (m2-tab)) | |
| 301 | |
| 302 (defun m2-record () | |
| 303 (interactive) | |
| 304 (insert "RECORD") | |
| 305 (m2-newline) | |
| 306 (m2-newline) | |
| 307 (insert "END (* record *);") | |
| 308 (end-of-line 0) | |
| 309 (m2-tab)) | |
| 310 | |
| 311 (defun m2-stdio () | |
| 312 (interactive) | |
| 313 (insert " | |
| 231 | 314 FROM TextIO IMPORT |
| 22 | 315 WriteCHAR, ReadCHAR, WriteINTEGER, ReadINTEGER, |
| 316 WriteCARDINAL, ReadCARDINAL, WriteBOOLEAN, ReadBOOLEAN, | |
| 317 WriteREAL, ReadREAL, WriteBITSET, ReadBITSET, | |
| 318 WriteBasedCARDINAL, ReadBasedCARDINAL, WriteChars, ReadChars, | |
| 319 WriteString, ReadString, WhiteSpace, EndOfLine; | |
| 320 | |
| 231 | 321 FROM SysStreams IMPORT sysIn, sysOut, sysErr; |
| 22 | 322 |
| 323 ")) | |
| 324 | |
| 325 (defun m2-type () | |
| 326 (interactive) | |
| 327 (insert "TYPE") | |
| 328 (m2-newline) | |
| 329 (m2-tab)) | |
| 330 | |
| 331 (defun m2-until () | |
| 332 (interactive) | |
| 333 (insert "REPEAT") | |
| 334 (m2-newline) | |
| 335 (m2-newline) | |
| 336 (insert "UNTIL ") | |
| 337 (insert (read-string "<boolean-expression>: ") ";") | |
| 338 (end-of-line 0) | |
| 339 (m2-tab)) | |
| 340 | |
| 341 (defun m2-var () | |
| 342 (interactive) | |
| 343 (m2-newline) | |
| 344 (insert "VAR") | |
| 345 (m2-newline) | |
| 346 (m2-tab)) | |
| 347 | |
| 348 (defun m2-while () | |
| 349 (interactive) | |
| 350 (insert "WHILE ") | |
| 351 (let ((name (read-string "<boolean-expression>: "))) | |
| 352 (insert name " DO" ) | |
| 353 (m2-newline) | |
| 354 (m2-newline) | |
| 355 (insert "END (* while " name " *);")) | |
| 356 (end-of-line 0) | |
| 357 (m2-tab)) | |
| 358 | |
| 359 (defun m2-export () | |
| 360 (interactive) | |
| 361 (insert "EXPORT QUALIFIED ")) | |
| 362 | |
| 363 (defun m2-import () | |
| 364 (interactive) | |
| 365 (insert "FROM ") | |
| 366 (insert (read-string "Module: ")) | |
| 367 (insert " IMPORT ")) | |
| 368 | |
| 369 (defun m2-begin-comment () | |
| 370 (interactive) | |
| 371 (if (not (bolp)) | |
| 372 (indent-to comment-column 0)) | |
| 373 (insert "(* ")) | |
| 374 | |
| 375 (defun m2-end-comment () | |
| 376 (interactive) | |
| 377 (if (not (bolp)) | |
| 378 (indent-to end-comment-column)) | |
| 379 (insert "*)")) | |
| 380 | |
| 381 (defun m2-compile () | |
| 382 (interactive) | |
| 383 (setq modulename (buffer-name)) | |
| 384 (compile (concat m2-compile-command " " modulename))) | |
| 385 | |
| 386 (defun m2-link () | |
| 387 (interactive) | |
| 388 (setq modulename (buffer-name)) | |
| 389 (if m2-link-name | |
| 390 (compile (concat m2-link-command " " m2-link-name)) | |
| 391 (compile (concat m2-link-command " " | |
| 392 (setq m2-link-name (read-string "Name of executable: " | |
| 393 modulename)))))) | |
| 394 | |
| 395 (defun execute-monitor-command (command) | |
| 396 (let* ((shell shell-file-name) | |
| 397 (csh (equal (file-name-nondirectory shell) "csh"))) | |
| 398 (call-process shell nil t t "-cf" (concat "exec " command)))) | |
| 399 | |
| 400 (defun m2-visit () | |
| 401 (interactive) | |
| 402 (let ((deffile nil) | |
| 403 (modfile nil) | |
| 404 modulename) | |
| 405 (save-excursion | |
| 406 (setq modulename | |
| 407 (read-string "Module name: ")) | |
| 408 (switch-to-buffer "*Command Execution*") | |
| 409 (execute-monitor-command (concat "m2whereis " modulename)) | |
| 410 (goto-char (point-min)) | |
| 411 (condition-case () | |
| 412 (progn (re-search-forward "\\(.*\\.def\\) *$") | |
| 413 (setq deffile (buffer-substring (match-beginning 1) | |
| 414 (match-end 1)))) | |
| 415 (search-failed ())) | |
| 416 (condition-case () | |
| 417 (progn (re-search-forward "\\(.*\\.mod\\) *$") | |
| 418 (setq modfile (buffer-substring (match-beginning 1) | |
| 419 (match-end 1)))) | |
| 420 (search-failed ())) | |
| 421 (if (not (or deffile modfile)) | |
| 422 (error "I can find neither definition nor implementation of %s" | |
| 423 modulename))) | |
| 424 (cond (deffile | |
| 425 (find-file deffile) | |
| 426 (if modfile | |
| 427 (save-excursion | |
| 428 (find-file modfile)))) | |
| 429 (modfile | |
| 430 (find-file modfile))))) | |
| 431 | |
| 432 (defun m2-toggle () | |
| 433 "Toggle between .mod and .def files for the module." | |
| 434 (interactive) | |
| 435 (cond ((string-equal (substring (buffer-name) -4) ".def") | |
| 436 (find-file-other-window | |
| 437 (concat (substring (buffer-name) 0 -4) ".mod"))) | |
| 438 ((string-equal (substring (buffer-name) -4) ".mod") | |
| 439 (find-file-other-window | |
| 440 (concat (substring (buffer-name) 0 -4) ".def"))) | |
| 441 ((string-equal (substring (buffer-name) -3) ".mi") | |
| 442 (find-file-other-window | |
| 443 (concat (substring (buffer-name) 0 -3) ".md"))) | |
| 444 ((string-equal (substring (buffer-name) -3) ".md") | |
| 445 (find-file-other-window | |
| 446 (concat (substring (buffer-name) 0 -3) ".mi"))))) | |
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
447 |
|
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
448 ;;; modula2.el ends here |
