comparison lisp/progmodes/tcl.el @ 48192:1acfacdf062a

(tcl-mode): Don't set paragraph-start, paragraph-separate, comment-column, and fill-paragraph-function. Simplify outline-regexp. (tcl-do-fill-paragraph): Remove.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 07 Nov 2002 15:22:49 +0000
parents 40a69f39b79f
children 0d8b17d428b5
comparison
equal deleted inserted replaced
48191:2cda842f35f6 48192:1acfacdf062a
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Author: Tom Tromey <tromey@redhat.com> 6 ;; Author: Tom Tromey <tromey@redhat.com>
7 ;; Chris Lindblad <cjl@lcs.mit.edu> 7 ;; Chris Lindblad <cjl@lcs.mit.edu>
8 ;; Keywords: languages tcl modes 8 ;; Keywords: languages tcl modes
9 ;; Version: $Revision: 1.68 $ 9 ;; Version: $Revision: 1.69 $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
548 `tcl-mode-hook' to see what kinds of interesting hook functions 548 `tcl-mode-hook' to see what kinds of interesting hook functions
549 already exist. 549 already exist.
550 550
551 Commands: 551 Commands:
552 \\{tcl-mode-map}" 552 \\{tcl-mode-map}"
553 (set (make-local-variable 'paragraph-start) "$\\| ")
554 (set (make-local-variable 'paragraph-separate) paragraph-start)
555
556 (unless (and (boundp 'filladapt-mode) filladapt-mode) 553 (unless (and (boundp 'filladapt-mode) filladapt-mode)
557 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) 554 (set (make-local-variable 'paragraph-ignore-fill-prefix) t))
558 (set (make-local-variable 'fill-paragraph-function)
559 'tcl-do-fill-paragraph))
560 555
561 (set (make-local-variable 'indent-line-function) 'tcl-indent-line) 556 (set (make-local-variable 'indent-line-function) 'tcl-indent-line)
562 (set (make-local-variable 'comment-indent-function) 'tcl-comment-indent) 557 (set (make-local-variable 'comment-indent-function) 'tcl-comment-indent)
563 ;; Tcl doesn't require a final newline. 558 ;; Tcl doesn't require a final newline.
564 ;; (make-local-variable 'require-final-newline) 559 ;; (make-local-variable 'require-final-newline)
565 ;; (setq require-final-newline t) 560 ;; (setq require-final-newline t)
566 561
567 (set (make-local-variable 'comment-start) "# ") 562 (set (make-local-variable 'comment-start) "# ")
568 (set (make-local-variable 'comment-start-skip) "#+ *") 563 (set (make-local-variable 'comment-start-skip) "#+ *")
569 (set (make-local-variable 'comment-column) 40) ;why? -stef
570 (set (make-local-variable 'comment-end) "") 564 (set (make-local-variable 'comment-end) "")
571 565
572 (set (make-local-variable 'outline-regexp) "[^\n\^M]") 566 (set (make-local-variable 'outline-regexp) ".")
573 (set (make-local-variable 'outline-level) 'tcl-outline-level) 567 (set (make-local-variable 'outline-level) 'tcl-outline-level)
574 568
575 (set (make-local-variable 'font-lock-defaults) 569 (set (make-local-variable 'font-lock-defaults)
576 '(tcl-font-lock-keywords nil nil nil beginning-of-defun 570 '(tcl-font-lock-keywords nil nil nil beginning-of-defun
577 (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords) 571 (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)
1232 "Return t if point is in a comment, and leave point at beginning of comment." 1226 "Return t if point is in a comment, and leave point at beginning of comment."
1233 (let ((save (point))) 1227 (let ((save (point)))
1234 (beginning-of-defun) 1228 (beginning-of-defun)
1235 (car (tcl-hairy-scan-for-comment nil save nil)))) 1229 (car (tcl-hairy-scan-for-comment nil save nil))))
1236 1230
1237 (defun tcl-do-fill-paragraph (ignore)
1238 "fill-paragraph function for Tcl mode. Only fills in a comment."
1239 (let (in-comment col where)
1240 (save-excursion
1241 (end-of-line)
1242 (setq in-comment (tcl-in-comment))
1243 (if in-comment
1244 (progn
1245 (setq where (1+ (point)))
1246 (setq col (1- (current-column))))))
1247 (and in-comment
1248 (save-excursion
1249 (back-to-indentation)
1250 (= col (current-column)))
1251 ;; In a comment. Set the fill prefix, and find the paragraph
1252 ;; boundaries by searching for lines that look like
1253 ;; comment-only lines.
1254 (let ((fill-prefix (buffer-substring (progn
1255 (beginning-of-line)
1256 (point))
1257 where))
1258 p-start p-end)
1259 ;; Search backwards.
1260 (save-excursion
1261 (while (and (looking-at "^[ \t]*#[ \t]*[^ \t\n]")
1262 (not (bobp)))
1263 (forward-line -1))
1264 (setq p-start (point)))
1265
1266 ;; Search forwards.
1267 (save-excursion
1268 (while (looking-at "^[ \t]*#[ \t]*[^ \t\n]")
1269 (forward-line))
1270 (setq p-end (point)))
1271
1272 ;; Narrow and do the fill.
1273 (save-restriction
1274 (narrow-to-region p-start p-end)
1275 (fill-paragraph ignore)))))
1276 t)
1277
1278 1231
1279 1232
1280 ;; 1233 ;;
1281 ;; Help-related code. 1234 ;; Help-related code.
1282 ;; 1235 ;;