aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tromey <[email protected]>1995-07-09 21:58:03 +0000
committerTom Tromey <[email protected]>1995-07-09 21:58:03 +0000
commit370d8fcccf430fe509d3aa67fdb008d69fa77eef (patch)
tree36f005a188e4936858e543a52a93cea8391570dc
parentfdacefbd18da5caab1f932d7cfb1e0f8655fbf27 (diff)
(tcl-do-fill-paragraph): New function.
(tcl-mode): Set up for paragraph filling.
-rw-r--r--lisp/progmodes/tcl.el52
1 files changed, 49 insertions, 3 deletions
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 0ee54c9766..bc0f75338d 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -6,7 +6,7 @@
;; Author: Tom Tromey <[email protected]>
;; Chris Lindblad <[email protected]>
;; Keywords: languages tcl modes
-;; Version: $Revision: 1.37 $
+;; Version: $Revision: 1.38 $
;; This file is part of GNU Emacs.
@@ -51,7 +51,7 @@
;; LCD Archive Entry:
;; tcl|Tom Tromey|[email protected]|
;; Major mode for editing Tcl|
-;; $Date: 1995/07/09 18:52:16 $|$Revision: 1.37 $|~/modes/tcl.el.Z|
+;; $Date: 1995/07/09 21:30:32 $|$Revision: 1.38 $|~/modes/tcl.el.Z|
;; CUSTOMIZATION NOTES:
;; * tcl-proc-list can be used to customize a list of things that
@@ -65,6 +65,9 @@
;; Change log:
;; $Log: tcl.el,v $
+;; Revision 1.38 1995/07/09 21:30:32 tromey
+;; (tcl-mode): Fixes to 19.29 paragraph variables.
+;;
;; Revision 1.37 1995/07/09 18:52:16 tromey
;; (tcl-do-auto-fill): Set fill-prefix.
;;
@@ -322,7 +325,7 @@
(require 'imenu))
()))
-(defconst tcl-version "$Revision: 1.37 $")
+(defconst tcl-version "$Revision: 1.38 $")
(defconst tcl-maintainer "Tom Tromey <[email protected]>")
;;
@@ -912,6 +915,8 @@ Commands:
(setq paragraph-separate paragraph-start))
(make-local-variable 'paragraph-ignore-fill-prefix)
(setq paragraph-ignore-fill-prefix t)
+ (make-local-variable 'fill-paragraph-function)
+ (setq fill-paragraph-function 'tcl-do-fill-paragraph)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'tcl-indent-line)
@@ -1660,6 +1665,47 @@ of comment."
(tcl-hairy-in-comment)
(tcl-simple-in-comment)))
+(defun tcl-do-fill-paragraph (ignore)
+ "fill-paragraph function for Tcl mode. Only fills in a comment."
+ (let (in-comment col where)
+ (save-excursion
+ (end-of-line)
+ (setq in-comment (tcl-in-comment))
+ (if in-comment
+ (progn
+ (setq where (1+ (point)))
+ (setq col (1- (current-column))))))
+ (and in-comment
+ (save-excursion
+ (back-to-indentation)
+ (= col (current-column)))
+ ;; In a comment. Set the fill prefix, and find the paragraph
+ ;; boundaries by searching for lines that look like
+ ;; comment-only lines.
+ (let ((fill-prefix (buffer-substring (progn
+ (beginning-of-line)
+ (point))
+ where))
+ p-start p-end)
+ ;; Search backwards.
+ (save-excursion
+ (while (looking-at "^[ \t]*#")
+ (forward-line -1))
+ (forward-line)
+ (setq p-start (point)))
+
+ ;; Search forwards.
+ (save-excursion
+ (while (looking-at "^[ \t]*#")
+ (forward-line))
+ (setq p-end (point)))
+
+ ;; Narrow and do the fill.
+ (save-restriction
+ (narrow-to-region p-start p-end)
+ (fill-paragraph ignore)))))
+ t)
+
(defun tcl-do-auto-fill ()
"Auto-fill function for Tcl mode. Only auto-fills in a comment."
(let ((fill-prefix "# ")