Mercurial > emacs
comparison lisp/progmodes/icon.el @ 33200:5323492591dd
(icon-mode-map): Don't rebind \t.
(icon-mode): Define indent-line-function.
(icon-comment-indent): Simplify.
(icon-font-lock-keywords-2): Use the `words' arg to regexp-opt.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 03 Nov 2000 23:05:16 +0000 |
parents | 4888d3b1cf29 |
children | 0d8b17d428b5 |
comparison
equal
deleted
inserted
replaced
33199:92f44ab47ab5 | 33200:5323492591dd |
---|---|
44 (define-key icon-mode-map "\e\C-h" 'mark-icon-function) | 44 (define-key icon-mode-map "\e\C-h" 'mark-icon-function) |
45 (define-key icon-mode-map "\e\C-a" 'beginning-of-icon-defun) | 45 (define-key icon-mode-map "\e\C-a" 'beginning-of-icon-defun) |
46 (define-key icon-mode-map "\e\C-e" 'end-of-icon-defun) | 46 (define-key icon-mode-map "\e\C-e" 'end-of-icon-defun) |
47 (define-key icon-mode-map "\e\C-q" 'indent-icon-exp) | 47 (define-key icon-mode-map "\e\C-q" 'indent-icon-exp) |
48 (define-key icon-mode-map "\177" 'backward-delete-char-untabify) | 48 (define-key icon-mode-map "\177" 'backward-delete-char-untabify) |
49 (define-key icon-mode-map "\t" 'icon-indent-command) | |
50 | 49 |
51 (define-key icon-mode-map [menu-bar] (make-sparse-keymap "Icon")) | 50 (define-key icon-mode-map [menu-bar] (make-sparse-keymap "Icon")) |
52 (define-key icon-mode-map [menu-bar icon] | 51 (define-key icon-mode-map [menu-bar icon] |
53 (cons "Icon" map)) | 52 (cons "Icon" map)) |
54 (define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun)) | 53 (define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun)) |
185 (setq comment-end "") | 184 (setq comment-end "") |
186 (make-local-variable 'comment-start-skip) | 185 (make-local-variable 'comment-start-skip) |
187 (setq comment-start-skip "# *") | 186 (setq comment-start-skip "# *") |
188 (make-local-variable 'comment-indent-function) | 187 (make-local-variable 'comment-indent-function) |
189 (setq comment-indent-function 'icon-comment-indent) | 188 (setq comment-indent-function 'icon-comment-indent) |
189 (set (make-local-variable 'indent-line-function) 'icon-indent-line) | |
190 ;; font-lock support | 190 ;; font-lock support |
191 (make-local-variable 'font-lock-defaults) | |
192 (setq font-lock-defaults | 191 (setq font-lock-defaults |
193 '((icon-font-lock-keywords | 192 '((icon-font-lock-keywords |
194 icon-font-lock-keywords-1 icon-font-lock-keywords-2) | 193 icon-font-lock-keywords-1 icon-font-lock-keywords-2) |
195 nil nil ((?_ . "w")) beginning-of-defun | 194 nil nil ((?_ . "w")) beginning-of-defun |
196 ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. | 195 ;; Obsoleted by Emacs 19.35 parse-partial-sexp's COMMENTSTOP. |
209 (run-hooks 'icon-mode-hook)) | 208 (run-hooks 'icon-mode-hook)) |
210 | 209 |
211 ;; This is used by indent-for-comment to decide how much to | 210 ;; This is used by indent-for-comment to decide how much to |
212 ;; indent a comment in Icon code based on its context. | 211 ;; indent a comment in Icon code based on its context. |
213 (defun icon-comment-indent () | 212 (defun icon-comment-indent () |
214 (if (looking-at "^#") | 213 (if (looking-at "^#") 0 comment-column)) |
215 0 | |
216 (save-excursion | |
217 (skip-chars-backward " \t") | |
218 (max (if (bolp) 0 (1+ (current-column))) | |
219 comment-column)))) | |
220 | 214 |
221 (defun electric-icon-brace (arg) | 215 (defun electric-icon-brace (arg) |
222 "Insert character and correct line's indentation." | 216 "Insert character and correct line's indentation." |
223 (interactive "P") | 217 (interactive "P") |
224 (let (insertpos) | 218 (let (insertpos) |
622 (append | 616 (append |
623 icon-font-lock-keywords-1 | 617 icon-font-lock-keywords-1 |
624 (eval-when-compile | 618 (eval-when-compile |
625 (list | 619 (list |
626 ;; Fontify all type specifiers. | 620 ;; Fontify all type specifiers. |
627 (cons | 621 (cons |
628 (concat | 622 (regexp-opt '("null" "string" "co-expression" "table" "integer" |
629 "\\<" (regexp-opt '("null" "string" "co-expression" "table" "integer" | 623 "cset" "set" "real" "file" "list") 'words) |
630 "cset" "set" "real" "file" "list") t) | |
631 "\\>") | |
632 'font-lock-type-face) | 624 'font-lock-type-face) |
633 ;; Fontify all keywords. | 625 ;; Fontify all keywords. |
634 ;; | 626 ;; |
635 (cons | 627 (cons |
636 (concat | 628 (regexp-opt |
637 "\\<" | 629 '("break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return" |
638 (regexp-opt | 630 "until" "case" "of" "while" "create" "every" "suspend" "default" |
639 '("break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return" | 631 "fail" "record" "then") 'words) |
640 "until" "case" "of" "while" "create" "every" "suspend" "default" | |
641 "fail" "record" "then") t) | |
642 "\\>") | |
643 'font-lock-keyword-face) | 632 'font-lock-keyword-face) |
644 ;; "end" "initial" | 633 ;; "end" "initial" |
645 (cons (concat "\\<" (regexp-opt '("end" "initial") t) "\\>") | 634 (cons (regexp-opt '("end" "initial") 'words) |
646 'font-lock-builtin-face) | 635 'font-lock-builtin-face) |
647 ;; Fontify all system variables. | 636 ;; Fontify all system variables. |
648 (cons | 637 (cons |
649 (regexp-opt | 638 (regexp-opt |
650 '("&allocated" "&ascii" "&clock" "&col" "&collections" "&column" | 639 '("&allocated" "&ascii" "&clock" "&col" "&collections" "&column" |