aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorTom Tromey1995-07-09 21:58:03 +0000
committerTom Tromey1995-07-09 21:58:03 +0000
commit370d8fcccf430fe509d3aa67fdb008d69fa77eef (patch)
tree36f005a188e4936858e543a52a93cea8391570dc /lisp
parentfdacefbd18da5caab1f932d7cfb1e0f8655fbf27 (diff)
downloademacs-370d8fcccf430fe509d3aa67fdb008d69fa77eef.tar.gz
emacs-370d8fcccf430fe509d3aa67fdb008d69fa77eef.zip
(tcl-do-fill-paragraph): New function.
(tcl-mode): Set up for paragraph filling.
Diffstat (limited to 'lisp')
-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 0ee54c9766e..bc0f75338d7 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -6,7 +6,7 @@
6;; Author: Tom Tromey <tromey@busco.lanl.gov> 6;; Author: Tom Tromey <tromey@busco.lanl.gov>
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.37 $ 9;; Version: $Revision: 1.38 $
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -51,7 +51,7 @@
51;; LCD Archive Entry: 51;; LCD Archive Entry:
52;; tcl|Tom Tromey|tromey@busco.lanl.gov| 52;; tcl|Tom Tromey|tromey@busco.lanl.gov|
53;; Major mode for editing Tcl| 53;; Major mode for editing Tcl|
54;; $Date: 1995/07/09 18:52:16 $|$Revision: 1.37 $|~/modes/tcl.el.Z| 54;; $Date: 1995/07/09 21:30:32 $|$Revision: 1.38 $|~/modes/tcl.el.Z|
55 55
56;; CUSTOMIZATION NOTES: 56;; CUSTOMIZATION NOTES:
57;; * tcl-proc-list can be used to customize a list of things that 57;; * tcl-proc-list can be used to customize a list of things that
@@ -65,6 +65,9 @@
65 65
66;; Change log: 66;; Change log:
67;; $Log: tcl.el,v $ 67;; $Log: tcl.el,v $
68;; Revision 1.38 1995/07/09 21:30:32 tromey
69;; (tcl-mode): Fixes to 19.29 paragraph variables.
70;;
68;; Revision 1.37 1995/07/09 18:52:16 tromey 71;; Revision 1.37 1995/07/09 18:52:16 tromey
69;; (tcl-do-auto-fill): Set fill-prefix. 72;; (tcl-do-auto-fill): Set fill-prefix.
70;; 73;;
@@ -322,7 +325,7 @@
322 (require 'imenu)) 325 (require 'imenu))
323 ())) 326 ()))
324 327
325(defconst tcl-version "$Revision: 1.37 $") 328(defconst tcl-version "$Revision: 1.38 $")
326(defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>") 329(defconst tcl-maintainer "Tom Tromey <tromey@drip.colorado.edu>")
327 330
328;; 331;;
@@ -912,6 +915,8 @@ Commands:
912 (setq paragraph-separate paragraph-start)) 915 (setq paragraph-separate paragraph-start))
913 (make-local-variable 'paragraph-ignore-fill-prefix) 916 (make-local-variable 'paragraph-ignore-fill-prefix)
914 (setq paragraph-ignore-fill-prefix t) 917 (setq paragraph-ignore-fill-prefix t)
918 (make-local-variable 'fill-paragraph-function)
919 (setq fill-paragraph-function 'tcl-do-fill-paragraph)
915 920
916 (make-local-variable 'indent-line-function) 921 (make-local-variable 'indent-line-function)
917 (setq indent-line-function 'tcl-indent-line) 922 (setq indent-line-function 'tcl-indent-line)
@@ -1660,6 +1665,47 @@ of comment."
1660 (tcl-hairy-in-comment) 1665 (tcl-hairy-in-comment)
1661 (tcl-simple-in-comment))) 1666 (tcl-simple-in-comment)))
1662 1667
1668(defun tcl-do-fill-paragraph (ignore)
1669 "fill-paragraph function for Tcl mode. Only fills in a comment."
1670 (let (in-comment col where)
1671 (save-excursion
1672 (end-of-line)
1673 (setq in-comment (tcl-in-comment))
1674 (if in-comment
1675 (progn
1676 (setq where (1+ (point)))
1677 (setq col (1- (current-column))))))
1678 (and in-comment
1679 (save-excursion
1680 (back-to-indentation)
1681 (= col (current-column)))
1682 ;; In a comment. Set the fill prefix, and find the paragraph
1683 ;; boundaries by searching for lines that look like
1684 ;; comment-only lines.
1685 (let ((fill-prefix (buffer-substring (progn
1686 (beginning-of-line)
1687 (point))
1688 where))
1689 p-start p-end)
1690 ;; Search backwards.
1691 (save-excursion
1692 (while (looking-at "^[ \t]*#")
1693 (forward-line -1))
1694 (forward-line)
1695 (setq p-start (point)))
1696
1697 ;; Search forwards.
1698 (save-excursion
1699 (while (looking-at "^[ \t]*#")
1700 (forward-line))
1701 (setq p-end (point)))
1702
1703 ;; Narrow and do the fill.
1704 (save-restriction
1705 (narrow-to-region p-start p-end)
1706 (fill-paragraph ignore)))))
1707 t)
1708
1663(defun tcl-do-auto-fill () 1709(defun tcl-do-auto-fill ()
1664 "Auto-fill function for Tcl mode. Only auto-fills in a comment." 1710 "Auto-fill function for Tcl mode. Only auto-fills in a comment."
1665 (let ((fill-prefix "# ") 1711 (let ((fill-prefix "# ")