bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] XEmacs recent changes to tcl.el


From: Ville Skyttä
Subject: [PATCH] XEmacs recent changes to tcl.el
Date: 31 Mar 2002 15:59:30 +0300

Here's a patch with recent changes to tcl.el in XEmacs modified for the
GNU Emacs version.

Submitter's (Jeff Mincy <address@hidden>) description:

The problems are, tcl-mode default fill commands interacts badly with
filladapt.  Enable filladapt and use fill-paragraph-or-region command
in a tcl buffer.  Also, tcl-mode had some special purpose and obsolete
code for doing imenu.  All that is necessary for imenu support is to
create a imenu-generic-expression and to do imenu-add-menubar-index in
a hook.


--- tcl.el.1.67 Sun Mar 31 15:42:32 2002
+++ tcl.el      Sun Mar 31 15:48:14 2002
@@ -60,7 +60,7 @@
 ;; Jesper Pedersen <address@hidden>
 ;; address@hidden (Doug Farmer)
 ;; "Chris Alfeld" <address@hidden>
-;; Ben Wing <address@hidden>
+;; Ben Wing <address@hidden>
 
 ;; KNOWN BUGS:
 ;; * In Tcl "#" is not always a comment character.  This can confuse
@@ -506,6 +506,11 @@
     ()
   (tcl-set-font-lock-keywords))
 
+
+(defvar tcl-imenu-generic-expression
+  '((nil "^proc[ \t]+\\([-A-Za-z0-9_:+*]+\\)" 1))
+  "Imenu generic expression for `tcl-mode'.  See `imenu-generic-expression'.")
+
 
 
 ;;
@@ -549,8 +554,14 @@
   (set (make-local-variable 'paragraph-start) "$\\|")
   (set (make-local-variable 'paragraph-separate) paragraph-start)
 
-  (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
-  (set (make-local-variable 'fill-paragraph-function) 'tcl-do-fill-paragraph)
+  (if (not (and (boundp 'filladapt-mode)
+                filladapt-mode))
+      (progn
+        (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
+        (set (make-local-variable 'fill-paragraph-function)
+             'tcl-do-fill-paragraph)
+        )
+    )
 
   (set (make-local-variable 'indent-line-function) 'tcl-indent-line)
   (set (make-local-variable 'comment-indent-function) 'tcl-comment-indent)
@@ -571,8 +582,8 @@
         (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)
         (parse-sexp-lookup-properties . t)))
 
-  (set (make-local-variable 'imenu-create-index-function)
-       'tcl-imenu-create-index-function)
+  (set (make-local-variable 'imenu-generic-expression)
+       'tcl-imenu-generic-expression)
   
   ;; Settings for new dabbrev code.
   (set (make-local-variable 'dabbrev-case-fold-search) nil)
@@ -987,23 +998,6 @@
 ;; Interfaces to other packages.
 ;;
 
-(defun tcl-imenu-create-index-function ()
-  "Generate alist of indices for `imenu'."
-  (let ((re (concat tcl-proc-regexp "\\([^ \t\n{]+\\)"))
-       alist prev-pos)
-    (goto-char (point-min))
-    (imenu-progress-message prev-pos 0)
-    (save-match-data
-      (while (re-search-forward re nil t)
-       (imenu-progress-message prev-pos)
-       ;; Position on start of proc name, not beginning of line.
-       (setq alist (cons
-                    (cons (buffer-substring (match-beginning 2) (match-end 2))
-                          (match-beginning 2))
-                    alist))))
-    (imenu-progress-message prev-pos 100)
-    (nreverse alist)))
-
 ;; FIXME Definition of function is very ad-hoc.  Should use
 ;; beginning-of-defun.  Also has incestuous knowledge about the
 ;; format of tcl-proc-regexp.
@@ -1108,7 +1102,7 @@
 (define-derived-mode inferior-tcl-mode comint-mode "Inferior Tcl"
   "Major mode for interacting with Tcl interpreter.
 
-A Tcl process can be started with M-x inferior-tcl.
+A Tcl process can be started with \\[inferior-tcl].
 
 Entry to this mode runs the normal hooks `comint-mode-hook' and
 `inferior-tcl-mode-hook', in that order.
@@ -1246,7 +1240,7 @@
     (car (tcl-hairy-scan-for-comment nil save nil))))
 
 (defun tcl-do-fill-paragraph (ignore)
-  "fill-paragraph function for Tcl mode.  Only fills in a comment."
+  "`fill-paragraph' function for Tcl mode.  Only fills in a comment."
   (let (in-comment col where)
     (save-excursion
       (end-of-line)

-- 
Ville Skyttä
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]