;; 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
(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)
;; 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)
(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)
(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)
(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."
(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 ()
(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)
(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."
(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)
"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."