diff options
| author | J.D. Smith | 2006-05-10 18:24:15 +0000 |
|---|---|---|
| committer | J.D. Smith | 2006-05-10 18:24:15 +0000 |
| commit | 0dc2be2f9232e0920728b299bb3d9108ec3078a1 (patch) | |
| tree | d5664dac84c9126ecf5ba53e21909326e8fbde57 | |
| parent | 169f09711414775863316acc2754025f90ebd830 (diff) | |
| download | emacs-0dc2be2f9232e0920728b299bb3d9108ec3078a1.tar.gz emacs-0dc2be2f9232e0920728b299bb3d9108ec3078a1.zip | |
(idlwave-push-mark): Removed obsolete compatibility function (Emacs 18/19).
(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.
| -rw-r--r-- | lisp/progmodes/idlwave.el | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 7a778766821..2f26c90ac21 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el | |||
| @@ -1208,8 +1208,8 @@ As a user, you should not set this to t.") | |||
| 1208 | ;; Treats continuation lines, works only during whole buffer | 1208 | ;; Treats continuation lines, works only during whole buffer |
| 1209 | ;; fontification. Slow, use it only in fancy fontification. | 1209 | ;; fontification. Slow, use it only in fancy fontification. |
| 1210 | (keyword-parameters | 1210 | (keyword-parameters |
| 1211 | '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\\(\n[ \t]*;.*\\)*\n[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)" | 1211 | '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\([ \t]*\\(;.*\\)?\n\\)*[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)" |
| 1212 | (5 font-lock-reference-face))) | 1212 | (6 font-lock-reference-face))) |
| 1213 | 1213 | ||
| 1214 | ;; System variables start with a bang. | 1214 | ;; System variables start with a bang. |
| 1215 | (system-variables | 1215 | (system-variables |
| @@ -1915,6 +1915,7 @@ The main features of this mode are | |||
| 1915 | 1915 | ||
| 1916 | (set (make-local-variable 'comment-start-skip) ";+[ \t]*") | 1916 | (set (make-local-variable 'comment-start-skip) ";+[ \t]*") |
| 1917 | (set (make-local-variable 'comment-start) ";") | 1917 | (set (make-local-variable 'comment-start) ";") |
| 1918 | (set (make-local-variable 'comment-add) 1) ; ";;" for new and regions | ||
| 1918 | (set (make-local-variable 'require-final-newline) t) | 1919 | (set (make-local-variable 'require-final-newline) t) |
| 1919 | (set (make-local-variable 'abbrev-all-caps) t) | 1920 | (set (make-local-variable 'abbrev-all-caps) t) |
| 1920 | (set (make-local-variable 'indent-tabs-mode) nil) | 1921 | (set (make-local-variable 'indent-tabs-mode) nil) |
| @@ -1947,6 +1948,10 @@ The main features of this mode are | |||
| 1947 | ;; Following line is for Emacs - XEmacs uses the corresponding property | 1948 | ;; Following line is for Emacs - XEmacs uses the corresponding property |
| 1948 | ;; on the `idlwave-mode' symbol. | 1949 | ;; on the `idlwave-mode' symbol. |
| 1949 | (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults) | 1950 | (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults) |
| 1951 | (set (make-local-variable 'font-lock-mark-block-function) | ||
| 1952 | 'idlwave-mark-subprogram) | ||
| 1953 | (set (make-local-variable 'font-lock-fontify-region-function) | ||
| 1954 | 'idlwave-font-lock-fontify-region) | ||
| 1950 | 1955 | ||
| 1951 | ;; Imenu setup | 1956 | ;; Imenu setup |
| 1952 | (set (make-local-variable 'imenu-create-index-function) | 1957 | (set (make-local-variable 'imenu-create-index-function) |
| @@ -1956,6 +1961,15 @@ The main features of this mode are | |||
| 1956 | (set (make-local-variable 'imenu-prev-index-position-function) | 1961 | (set (make-local-variable 'imenu-prev-index-position-function) |
| 1957 | 'idlwave-prev-index-position) | 1962 | 'idlwave-prev-index-position) |
| 1958 | 1963 | ||
| 1964 | ;; HideShow setup | ||
| 1965 | (add-to-list 'hs-special-modes-alist | ||
| 1966 | (list 'idlwave-mode | ||
| 1967 | idlwave-begin-block-reg | ||
| 1968 | idlwave-end-block-reg | ||
| 1969 | ";" | ||
| 1970 | 'idlwave-forward-block nil)) | ||
| 1971 | |||
| 1972 | |||
| 1959 | ;; Make a local post-command-hook and add our hook to it | 1973 | ;; Make a local post-command-hook and add our hook to it |
| 1960 | ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility | 1974 | ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility |
| 1961 | ;; (make-local-hook 'post-command-hook) | 1975 | ;; (make-local-hook 'post-command-hook) |
| @@ -2000,16 +2014,22 @@ The main features of this mode are | |||
| 2000 | (idlwave-read-paths) ; we may need these early | 2014 | (idlwave-read-paths) ; we may need these early |
| 2001 | (setq idlwave-setup-done t))) | 2015 | (setq idlwave-setup-done t))) |
| 2002 | 2016 | ||
| 2017 | (defun idlwave-font-lock-fontify-region (beg end &optional verbose) | ||
| 2018 | "Fontify continuation lines correctly." | ||
| 2019 | (let (pos) | ||
| 2020 | (save-excursion | ||
| 2021 | (goto-char beg) | ||
| 2022 | (forward-line -1) | ||
| 2023 | (when (setq pos (idlwave-is-continuation-line)) | ||
| 2024 | (goto-char pos) | ||
| 2025 | (idlwave-beginning-of-statement) | ||
| 2026 | (setq beg (point))))) | ||
| 2027 | (font-lock-default-fontify-region beg end verbose)) | ||
| 2028 | |||
| 2003 | ;; | 2029 | ;; |
| 2004 | ;; Code Formatting ---------------------------------------------------- | 2030 | ;; Code Formatting ---------------------------------------------------- |
| 2005 | ;; | 2031 | ;; |
| 2006 | 2032 | ||
| 2007 | (defun idlwave-push-mark (&rest rest) | ||
| 2008 | "Push mark for compatibility with Emacs 18/19." | ||
| 2009 | (if (fboundp 'iconify-frame) | ||
| 2010 | (apply 'push-mark rest) | ||
| 2011 | (push-mark))) | ||
| 2012 | |||
| 2013 | (defun idlwave-hard-tab () | 2033 | (defun idlwave-hard-tab () |
| 2014 | "Inserts TAB in buffer in current position." | 2034 | "Inserts TAB in buffer in current position." |
| 2015 | (interactive) | 2035 | (interactive) |
| @@ -2403,7 +2423,7 @@ non-nil." | |||
| 2403 | (idlwave-end-of-statement) | 2423 | (idlwave-end-of-statement) |
| 2404 | (let ((end (point))) | 2424 | (let ((end (point))) |
| 2405 | (idlwave-beginning-of-statement) | 2425 | (idlwave-beginning-of-statement) |
| 2406 | (idlwave-push-mark end nil t))) | 2426 | (push-mark end nil t))) |
| 2407 | 2427 | ||
| 2408 | (defun idlwave-mark-block () | 2428 | (defun idlwave-mark-block () |
| 2409 | "Mark containing block." | 2429 | "Mark containing block." |
| @@ -2414,7 +2434,7 @@ non-nil." | |||
| 2414 | (let ((end (point))) | 2434 | (let ((end (point))) |
| 2415 | (idlwave-backward-block) | 2435 | (idlwave-backward-block) |
| 2416 | (idlwave-beginning-of-statement) | 2436 | (idlwave-beginning-of-statement) |
| 2417 | (idlwave-push-mark end nil t))) | 2437 | (push-mark end nil t))) |
| 2418 | 2438 | ||
| 2419 | 2439 | ||
| 2420 | (defun idlwave-mark-subprogram () | 2440 | (defun idlwave-mark-subprogram () |
| @@ -2425,7 +2445,7 @@ The marks are pushed." | |||
| 2425 | (idlwave-beginning-of-subprogram) | 2445 | (idlwave-beginning-of-subprogram) |
| 2426 | (let ((beg (point))) | 2446 | (let ((beg (point))) |
| 2427 | (idlwave-forward-block) | 2447 | (idlwave-forward-block) |
| 2428 | (idlwave-push-mark beg nil t)) | 2448 | (push-mark beg nil t)) |
| 2429 | (exchange-point-and-mark)) | 2449 | (exchange-point-and-mark)) |
| 2430 | 2450 | ||
| 2431 | (defun idlwave-backward-up-block (&optional arg) | 2451 | (defun idlwave-backward-up-block (&optional arg) |
| @@ -2446,11 +2466,12 @@ If prefix ARG < 0 then move forward to enclosing block end." | |||
| 2446 | (idlwave-block-jump-out 1 'nomark) | 2466 | (idlwave-block-jump-out 1 'nomark) |
| 2447 | (backward-word 1)) | 2467 | (backward-word 1)) |
| 2448 | 2468 | ||
| 2449 | (defun idlwave-forward-block () | 2469 | (defun idlwave-forward-block (&optional arg) |
| 2450 | "Move across next nested block." | 2470 | "Move across next nested block." |
| 2451 | (interactive) | 2471 | (interactive) |
| 2452 | (if (idlwave-down-block 1) | 2472 | (let ((arg (or arg 1))) |
| 2453 | (idlwave-block-jump-out 1 'nomark))) | 2473 | (if (idlwave-down-block arg) |
| 2474 | (idlwave-block-jump-out arg 'nomark)))) | ||
| 2454 | 2475 | ||
| 2455 | (defun idlwave-backward-block () | 2476 | (defun idlwave-backward-block () |
| 2456 | "Move backward across previous nested block." | 2477 | "Move backward across previous nested block." |
| @@ -2496,12 +2517,11 @@ The marks are pushed." | |||
| 2496 | (if (re-search-forward idlwave-doclib-end nil t) | 2517 | (if (re-search-forward idlwave-doclib-end nil t) |
| 2497 | (progn | 2518 | (progn |
| 2498 | (forward-line 1) | 2519 | (forward-line 1) |
| 2499 | (idlwave-push-mark beg nil t) | 2520 | (push-mark beg nil t) |
| 2500 | (message "Could not find end of doc library header."))) | 2521 | (message "Could not find end of doc library header."))) |
| 2501 | (message "Could not find doc library header start.") | 2522 | (message "Could not find doc library header start.") |
| 2502 | (goto-char here))))) | 2523 | (goto-char here))))) |
| 2503 | 2524 | ||
| 2504 | |||
| 2505 | (defun idlwave-current-routine () | 2525 | (defun idlwave-current-routine () |
| 2506 | "Return (NAME TYPE CLASS) of current routine." | 2526 | "Return (NAME TYPE CLASS) of current routine." |
| 2507 | (idlwave-routines) | 2527 | (idlwave-routines) |
| @@ -3194,13 +3214,14 @@ Skips any whitespace. Returns 0 if the end-of-line follows the whitespace." | |||
| 3194 | "Tests if current line is continuation line. | 3214 | "Tests if current line is continuation line. |
| 3195 | Blank or comment-only lines following regular continuation lines (with | 3215 | Blank or comment-only lines following regular continuation lines (with |
| 3196 | `$') count as continuations too." | 3216 | `$') count as continuations too." |
| 3197 | (save-excursion | 3217 | (let (p) |
| 3198 | (or | 3218 | (save-excursion |
| 3199 | (idlwave-look-at "\\<\\$") | 3219 | (or |
| 3200 | (catch 'loop | 3220 | (idlwave-look-at "\\<\\$") |
| 3201 | (while (and (looking-at "^[ \t]*\\(;.*\\)?$") | 3221 | (catch 'loop |
| 3202 | (eq (forward-line -1) 0)) | 3222 | (while (and (looking-at "^[ \t]*\\(;.*\\)?$") |
| 3203 | (if (idlwave-look-at "\\<\\$") (throw 'loop t))))))) | 3223 | (eq (forward-line -1) 0)) |
| 3224 | (if (setq p (idlwave-look-at "\\<\\$")) (throw 'loop p)))))))) | ||
| 3204 | 3225 | ||
| 3205 | (defun idlwave-is-comment-line () | 3226 | (defun idlwave-is-comment-line () |
| 3206 | "Tests if the current line is a comment line." | 3227 | "Tests if the current line is a comment line." |