(idlwave-push-mark): Removed obsolete compatibility function (Emacs 18/19).
authorJ.D. Smith <jdsmith@as.arizona.edu>
Wed, 10 May 2006 18:24:15 +0000 (18:24 +0000)
committerJ.D. Smith <jdsmith@as.arizona.edu>
Wed, 10 May 2006 18:24:15 +0000 (18:24 +0000)
(idlwave-is-continuation-line): Always return point at start of previous
non-blank continuation line.
`keyword-parameters': Fix continued comment font-lock matcher.
(idlwave-font-lock-fontify-region): Written, use as
font-lock-fontify-region-function, to fix continued keyword
fontification issues.

lisp/progmodes/idlwave.el

index 7a77876..2f26c90 100644 (file)
@@ -1208,8 +1208,8 @@ As a user, you should not set this to t.")
        ;; Treats continuation lines, works only during whole buffer
        ;; fontification.  Slow, use it only in fancy fontification.
        (keyword-parameters
-       '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\\(\n[ \t]*;.*\\)*\n[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)"
-         (5 font-lock-reference-face)))
+       '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\([ \t]*\\(;.*\\)?\n\\)*[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)"
+         (6 font-lock-reference-face)))
 
        ;; System variables start with a bang.
        (system-variables
@@ -1915,6 +1915,7 @@ The main features of this mode are
   
   (set (make-local-variable 'comment-start-skip) ";+[ \t]*")
   (set (make-local-variable 'comment-start) ";")
+  (set (make-local-variable 'comment-add) 1) ; ";;" for new and regions
   (set (make-local-variable 'require-final-newline) t)
   (set (make-local-variable 'abbrev-all-caps) t)
   (set (make-local-variable 'indent-tabs-mode) nil)
@@ -1947,6 +1948,10 @@ The main features of this mode are
   ;; Following line is for Emacs - XEmacs uses the corresponding property
   ;; on the `idlwave-mode' symbol.
   (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults)
+  (set (make-local-variable 'font-lock-mark-block-function)
+       'idlwave-mark-subprogram)
+  (set (make-local-variable 'font-lock-fontify-region-function)
+       'idlwave-font-lock-fontify-region)
 
   ;; Imenu setup
   (set (make-local-variable 'imenu-create-index-function)
@@ -1956,6 +1961,15 @@ The main features of this mode are
   (set (make-local-variable 'imenu-prev-index-position-function)
        'idlwave-prev-index-position)
 
+  ;; HideShow setup
+  (add-to-list 'hs-special-modes-alist
+              (list 'idlwave-mode
+                    idlwave-begin-block-reg
+                    idlwave-end-block-reg
+                    ";"
+                    'idlwave-forward-block nil))
+  
+
   ;; Make a local post-command-hook and add our hook to it
   ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
   ;; (make-local-hook 'post-command-hook)
@@ -2000,16 +2014,22 @@ The main features of this mode are
     (idlwave-read-paths)  ; we may need these early
     (setq idlwave-setup-done t)))
 
+(defun idlwave-font-lock-fontify-region (beg end &optional verbose)
+  "Fontify continuation lines correctly."
+  (let (pos)
+    (save-excursion
+      (goto-char beg)
+      (forward-line -1)
+      (when (setq pos (idlwave-is-continuation-line))
+       (goto-char pos)
+       (idlwave-beginning-of-statement)
+       (setq beg (point)))))
+  (font-lock-default-fontify-region beg end verbose))
+
 ;;
 ;; Code Formatting ----------------------------------------------------
 ;; 
 
-(defun idlwave-push-mark (&rest rest)
-  "Push mark for compatibility with Emacs 18/19."
-  (if (fboundp 'iconify-frame)
-      (apply 'push-mark rest)
-    (push-mark)))
-
 (defun idlwave-hard-tab ()
   "Inserts TAB in buffer in current position."
   (interactive)
@@ -2403,7 +2423,7 @@ non-nil."
   (idlwave-end-of-statement)
   (let ((end (point)))
     (idlwave-beginning-of-statement)
-    (idlwave-push-mark end nil t)))
+    (push-mark end nil t)))
 
 (defun idlwave-mark-block ()
   "Mark containing block."
@@ -2414,7 +2434,7 @@ non-nil."
   (let ((end (point)))
     (idlwave-backward-block)
     (idlwave-beginning-of-statement)
-    (idlwave-push-mark end nil t)))
+    (push-mark end nil t)))
 
 
 (defun idlwave-mark-subprogram ()
@@ -2425,7 +2445,7 @@ The marks are pushed."
   (idlwave-beginning-of-subprogram)
   (let ((beg (point)))
     (idlwave-forward-block)
-    (idlwave-push-mark beg nil t))
+    (push-mark beg nil t))
   (exchange-point-and-mark))
 
 (defun idlwave-backward-up-block (&optional arg)
@@ -2446,11 +2466,12 @@ If prefix ARG < 0 then move forward to enclosing block end."
   (idlwave-block-jump-out 1 'nomark)
   (backward-word 1))
 
-(defun idlwave-forward-block ()
+(defun idlwave-forward-block (&optional arg)
   "Move across next nested block."
   (interactive)
-  (if (idlwave-down-block 1)
-      (idlwave-block-jump-out 1 'nomark)))
+  (let ((arg (or arg 1)))
+    (if (idlwave-down-block arg)
+       (idlwave-block-jump-out arg 'nomark))))
 
 (defun idlwave-backward-block ()
   "Move backward across previous nested block."
@@ -2496,12 +2517,11 @@ The marks are pushed."
          (if (re-search-forward idlwave-doclib-end nil t)
              (progn
                (forward-line 1)
-               (idlwave-push-mark beg nil t)
+               (push-mark beg nil t)
                (message "Could not find end of doc library header.")))
          (message "Could not find doc library header start.")
          (goto-char here)))))
 
-
 (defun idlwave-current-routine ()
   "Return (NAME TYPE CLASS) of current routine."
   (idlwave-routines)
@@ -3194,13 +3214,14 @@ Skips any whitespace. Returns 0 if the end-of-line follows the whitespace."
   "Tests if current line is continuation line.
 Blank or comment-only lines following regular continuation lines (with
 `$') count as continuations too."
-  (save-excursion
-    (or 
-     (idlwave-look-at "\\<\\$")
-     (catch 'loop
-       (while (and (looking-at "^[ \t]*\\(;.*\\)?$") 
-                  (eq (forward-line -1) 0))
-        (if (idlwave-look-at "\\<\\$") (throw 'loop t)))))))
+  (let (p)
+    (save-excursion
+      (or 
+       (idlwave-look-at "\\<\\$")
+       (catch 'loop
+        (while (and (looking-at "^[ \t]*\\(;.*\\)?$") 
+                    (eq (forward-line -1) 0))
+          (if (setq p (idlwave-look-at "\\<\\$")) (throw 'loop p))))))))
 
 (defun idlwave-is-comment-line ()
   "Tests if the current line is a comment line."