]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/tcl.el
Merge from emacs-23
[gnu-emacs] / lisp / progmodes / tcl.el
index 50c8ad2b99c409b54287eab101e3187732f6b332..250a5cce47c00b95b69c377a8e3e88fa4725c28f 100644 (file)
@@ -411,9 +411,10 @@ This variable is generally set from `tcl-proc-regexp',
 `tcl-typeword-list', and `tcl-keyword-list' by the function
 `tcl-set-font-lock-keywords'.")
 
-(defvar tcl-font-lock-syntactic-keywords
-  ;; Mark the few `#' that are not comment-markers.
-  '(("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")))
+(defconst tcl-syntax-propertize-function
+  (syntax-propertize-rules
+   ;; Mark the few `#' that are not comment-markers.
+   ("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")))
   "Syntactic keywords for `tcl-mode'.")
 
 ;; FIXME need some way to recognize variables because array refs look
@@ -545,7 +546,7 @@ Uses variables `tcl-proc-regexp' and `tcl-keyword-list'."
 ;;
 
 ;;;###autoload
-(define-derived-mode tcl-mode nil "Tcl"
+(define-derived-mode tcl-mode prog-mode "Tcl"
   "Major mode for editing Tcl code.
 Expression and list commands understand all Tcl brackets.
 Tab indents for Tcl code.
@@ -571,10 +572,7 @@ documentation for details):
 
 Turning on Tcl mode runs `tcl-mode-hook'.  Read the documentation for
 `tcl-mode-hook' to see what kinds of interesting hook functions
-already exist.
-
-Commands:
-\\{tcl-mode-map}"
+already exist."
   (unless (and (boundp 'filladapt-mode) filladapt-mode)
     (set (make-local-variable 'paragraph-ignore-fill-prefix) t))
 
@@ -593,9 +591,9 @@ Commands:
   (set (make-local-variable 'outline-level) 'tcl-outline-level)
 
   (set (make-local-variable 'font-lock-defaults)
-       '(tcl-font-lock-keywords nil nil nil beginning-of-defun
-        (font-lock-syntactic-keywords . tcl-font-lock-syntactic-keywords)
-        (parse-sexp-lookup-properties . t)))
+       '(tcl-font-lock-keywords nil nil nil beginning-of-defun))
+  (set (make-local-variable 'syntax-propertize-function)
+       tcl-syntax-propertize-function)
 
   (set (make-local-variable 'imenu-generic-expression)
        tcl-imenu-generic-expression)
@@ -1063,7 +1061,7 @@ With argument, positions cursor at end of buffer."
 (defun inferior-tcl-proc ()
   "Return current inferior Tcl process.
 See variable `inferior-tcl-buffer'."
-  (let ((proc (get-buffer-process (if (eq major-mode 'inferior-tcl-mode)
+  (let ((proc (get-buffer-process (if (derived-mode-p 'inferior-tcl-mode)
                                      (current-buffer)
                                    inferior-tcl-buffer))))
     (or proc
@@ -1199,8 +1197,7 @@ as input to future invocations.  FLAG is nil if not in comment,
 t otherwise.  If in comment, leaves point at beginning of comment."
   (let ((bol (save-excursion
               (goto-char end)
-              (beginning-of-line)
-              (point)))
+              (line-beginning-position)))
        real-comment
        last-cstart)
     (while (and (not last-cstart) (< (point) end))
@@ -1287,7 +1284,7 @@ to update the alist.")
 If FLAG is nil, just uses `current-word'.
 Otherwise scans backward for most likely Tcl command word."
   (if (and flag
-          (memq major-mode '(tcl-mode inferior-tcl-mode)))
+          (derived-mode-p 'tcl-mode 'inferior-tcl-mode))
       (condition-case nil
          (save-excursion
            ;; Look backward for first word actually in alist.
@@ -1363,7 +1360,7 @@ Prefix argument means switch to the Tcl buffer afterwards."
     ;; filename.
     (car (comint-get-source "Load Tcl file: "
                            (or (and
-                                (eq major-mode 'tcl-mode)
+                                (derived-mode-p 'tcl-mode)
                                 (buffer-file-name))
                                tcl-previous-dir/file)
                            '(tcl-mode) t))
@@ -1383,12 +1380,12 @@ Prefix argument means switch to the Tcl buffer afterwards."
    (list
     (car (comint-get-source "Restart with Tcl file: "
                            (or (and
-                                (eq major-mode 'tcl-mode)
+                                (derived-mode-p 'tcl-mode)
                                 (buffer-file-name))
                                tcl-previous-dir/file)
                            '(tcl-mode) t))
     current-prefix-arg))
-  (let* ((buf (if (eq major-mode 'inferior-tcl-mode)
+  (let* ((buf (if (derived-mode-p 'inferior-tcl-mode)
                  (current-buffer)
                inferior-tcl-buffer))
         (proc (and buf (get-process buf))))
@@ -1548,5 +1545,4 @@ The first line is assumed to look like \"#!.../program ...\"."
 
 (provide 'tcl)
 
-;; arch-tag: 8a032554-c3ef-422e-b84c-acec0522179d
 ;;; tcl.el ends here