comparison lisp/progmodes/idlwave.el @ 90667:dbe3f29e61d6

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 505-522) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: etc/TUTORIAL.cn: Updated. - Merge from erc--emacs--22 * gnus--rel--5.10 (patch 164-167) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-137
author Miles Bader <miles@gnu.org>
date Tue, 21 Nov 2006 08:56:38 +0000
parents 02cf29720f31 a15c9975c15b
children f1d13e615070
comparison
equal deleted inserted replaced
90666:00d54c8fa693 90667:dbe3f29e61d6
4 4
5 ;; Authors: J.D. Smith <jdsmith@as.arizona.edu> 5 ;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
6 ;; Carsten Dominik <dominik@science.uva.nl> 6 ;; Carsten Dominik <dominik@science.uva.nl>
7 ;; Chris Chase <chase@att.com> 7 ;; Chris Chase <chase@att.com>
8 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> 8 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
9 ;; Version: 6.0_em22 9 ;; Version: 6.1_em22
10 ;; Keywords: languages 10 ;; Keywords: languages
11 11
12 ;; This file is part of GNU Emacs. 12 ;; This file is part of GNU Emacs.
13 13
14 ;; GNU Emacs is free software; you can redistribute it and/or modify 14 ;; GNU Emacs is free software; you can redistribute it and/or modify
1391 1391
1392 (defconst idlwave-continuation-char ?$ 1392 (defconst idlwave-continuation-char ?$
1393 "Character which is inserted as a last character on previous line by 1393 "Character which is inserted as a last character on previous line by
1394 \\[idlwave-split-line] to begin a continuation line. Normally $.") 1394 \\[idlwave-split-line] to begin a continuation line. Normally $.")
1395 1395
1396 (defconst idlwave-mode-version "6.0_em22") 1396 (defconst idlwave-mode-version "6.1_em22")
1397 1397
1398 (defmacro idlwave-keyword-abbrev (&rest args) 1398 (defmacro idlwave-keyword-abbrev (&rest args)
1399 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args." 1399 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
1400 `(quote (lambda () 1400 `(quote (lambda ()
1401 ,(append '(idlwave-check-abbrev) args)))) 1401 ,(append '(idlwave-check-abbrev) args))))
1593 "Compile and run the region." t) 1593 "Compile and run the region." t)
1594 (define-key idlwave-mode-map "\C-c\C-v" 'idlwave-find-module) 1594 (define-key idlwave-mode-map "\C-c\C-v" 'idlwave-find-module)
1595 (define-key idlwave-mode-map "\C-c\C-t" 'idlwave-find-module-this-file) 1595 (define-key idlwave-mode-map "\C-c\C-t" 'idlwave-find-module-this-file)
1596 (define-key idlwave-mode-map "\C-c?" 'idlwave-routine-info) 1596 (define-key idlwave-mode-map "\C-c?" 'idlwave-routine-info)
1597 (define-key idlwave-mode-map "\M-?" 'idlwave-context-help) 1597 (define-key idlwave-mode-map "\M-?" 'idlwave-context-help)
1598 (define-key idlwave-mode-map [(control meta ?\?)] 'idlwave-online-help) 1598 (define-key idlwave-mode-map [(control meta ?\?)]
1599 'idlwave-help-assistant-help-with-topic)
1599 ;; Pickup both forms of Esc/Meta binding 1600 ;; Pickup both forms of Esc/Meta binding
1600 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete) 1601 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete)
1601 (define-key idlwave-mode-map [?\e?\t] 'idlwave-complete) 1602 (define-key idlwave-mode-map [?\e?\t] 'idlwave-complete)
1602 (define-key idlwave-mode-map "\M-\C-i" 'idlwave-complete) 1603 (define-key idlwave-mode-map "\M-\C-i" 'idlwave-complete)
1603 (define-key idlwave-mode-map "\C-c\C-i" 'idlwave-update-routine-info) 1604 (define-key idlwave-mode-map "\C-c\C-i" 'idlwave-update-routine-info)
1777 (defvar idlwave-mode-menu) 1778 (defvar idlwave-mode-menu)
1778 (defvar idlwave-mode-debug-menu) 1779 (defvar idlwave-mode-debug-menu)
1779 1780
1780 ;;;###autoload 1781 ;;;###autoload
1781 (defun idlwave-mode () 1782 (defun idlwave-mode ()
1782 "Major mode for editing IDL source files (version 6.0_em22). 1783 "Major mode for editing IDL source files (version 6.1_em22).
1783 1784
1784 The main features of this mode are 1785 The main features of this mode are
1785 1786
1786 1. Indentation and Formatting 1787 1. Indentation and Formatting
1787 -------------------------- 1788 --------------------------
1938 "[ \t\f]*$\\|[ \t]*;+[ \t]*$\\|;+[+=-_*]+$") 1939 "[ \t\f]*$\\|[ \t]*;+[ \t]*$\\|;+[+=-_*]+$")
1939 (set (make-local-variable 'paragraph-start) "[ \t\f]\\|[ \t]*;+[ \t]") 1940 (set (make-local-variable 'paragraph-start) "[ \t\f]\\|[ \t]*;+[ \t]")
1940 (set (make-local-variable 'paragraph-ignore-fill-prefix) nil) 1941 (set (make-local-variable 'paragraph-ignore-fill-prefix) nil)
1941 (set (make-local-variable 'parse-sexp-ignore-comments) t) 1942 (set (make-local-variable 'parse-sexp-ignore-comments) t)
1942 1943
1944 ;; ChangeLog
1945 (set (make-local-variable 'add-log-current-defun-function)
1946 'idlwave-current-routine-fullname)
1947
1943 ;; Set tag table list to use IDLTAGS as file name. 1948 ;; Set tag table list to use IDLTAGS as file name.
1944 (if (boundp 'tag-table-alist) 1949 (if (boundp 'tag-table-alist)
1945 (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS"))) 1950 (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS")))
1946 1951
1947 ;; Font-lock additions - originally Phil Williams, then Ulrik Dickow 1952 ;; Font-lock additions
1948 ;; Following line is for Emacs - XEmacs uses the corresponding property 1953 ;; Following line is for Emacs - XEmacs uses the corresponding property
1949 ;; on the `idlwave-mode' symbol. 1954 ;; on the `idlwave-mode' symbol.
1950 (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults) 1955 (set (make-local-variable 'font-lock-defaults) idlwave-font-lock-defaults)
1951 (set (make-local-variable 'font-lock-mark-block-function) 1956 (set (make-local-variable 'font-lock-mark-block-function)
1952 'idlwave-mark-subprogram) 1957 'idlwave-mark-subprogram)
1967 idlwave-begin-block-reg 1972 idlwave-begin-block-reg
1968 idlwave-end-block-reg 1973 idlwave-end-block-reg
1969 ";" 1974 ";"
1970 'idlwave-forward-block nil)) 1975 'idlwave-forward-block nil))
1971 1976
1972
1973 ;; Make a local post-command-hook and add our hook to it 1977 ;; Make a local post-command-hook and add our hook to it
1974 ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility 1978 ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
1975 ;; (make-local-hook 'post-command-hook) 1979 ;; (make-local-hook 'post-command-hook)
1976 (add-hook 'post-command-hook 'idlwave-command-hook nil 'local) 1980 (add-hook 'post-command-hook 'idlwave-command-hook nil 'local)
1977 1981
1978 ;; Make local hooks for buffer updates 1982 ;; Make local hooks for buffer updates
1979 ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility 1983 ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
1980 ;; (make-local-hook 'kill-buffer-hook) 1984 ;; (make-local-hook 'kill-buffer-hook)
1981 (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local) 1985 (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local)
1982 ;; (make-local-hook 'after-save-hook) 1986 ;; (make-local-hook 'after-save-hook)
1983 ;; (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local) 1987 (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
1984 (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local) 1988 (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local)
1985 1989
1986 ;; Setup directories and file, if necessary 1990 ;; Setup directories and file, if necessary
1987 (idlwave-setup) 1991 (idlwave-setup)
1988 1992
2519 (forward-line 1) 2523 (forward-line 1)
2520 (push-mark beg nil t) 2524 (push-mark beg nil t)
2521 (message "Could not find end of doc library header."))) 2525 (message "Could not find end of doc library header.")))
2522 (message "Could not find doc library header start.") 2526 (message "Could not find doc library header start.")
2523 (goto-char here))))) 2527 (goto-char here)))))
2528
2529 (defun idlwave-current-routine-fullname ()
2530 (let ((name (idlwave-current-routine)))
2531 (idlwave-make-full-name (nth 2 name) (car name))))
2524 2532
2525 (defun idlwave-current-routine () 2533 (defun idlwave-current-routine ()
2526 "Return (NAME TYPE CLASS) of current routine." 2534 "Return (NAME TYPE CLASS) of current routine."
2527 (idlwave-routines) 2535 (idlwave-routines)
2528 (save-excursion 2536 (save-excursion
3649 (insert comment-start " " idlwave-doc-modifications-keyword ":")) 3657 (insert comment-start " " idlwave-doc-modifications-keyword ":"))
3650 (insert "\n;\n;\t") 3658 (insert "\n;\n;\t")
3651 (run-hooks 'idlwave-timestamp-hook)) 3659 (run-hooks 'idlwave-timestamp-hook))
3652 (error "No valid DOCLIB header")))) 3660 (error "No valid DOCLIB header"))))
3653 3661
3662
3654 ;;; CJC 3/16/93 3663 ;;; CJC 3/16/93
3655 ;;; Interface to expand-region-abbrevs which did not work when the 3664 ;;; Interface to expand-region-abbrevs which did not work when the
3656 ;;; abbrev hook associated with an abbrev moves point backwards 3665 ;;; abbrev hook associated with an abbrev moves point backwards
3657 ;;; after abbrev expansion, e.g., as with the abbrev '.n'. 3666 ;;; after abbrev expansion, e.g., as with the abbrev '.n'.
3658 ;;; The original would enter an infinite loop in attempting to expand 3667 ;;; The original would enter an infinite loop in attempting to expand
4890 (expand-file-name "help/online_help" (idlwave-sys-dir)))) 4899 (expand-file-name "help/online_help" (idlwave-sys-dir))))
4891 (catalog-file (expand-file-name "idl_catalog.xml" dir)) 4900 (catalog-file (expand-file-name "idl_catalog.xml" dir))
4892 (elem-cnt 0) 4901 (elem-cnt 0)
4893 props rinfo msg-cnt elem type nelem class-result alias 4902 props rinfo msg-cnt elem type nelem class-result alias
4894 routines routine-aliases statement-aliases sysvar-aliases 4903 routines routine-aliases statement-aliases sysvar-aliases
4895 buf version-string) 4904 version-string)
4896 (if (not (file-exists-p catalog-file)) 4905 (if (not (file-exists-p catalog-file))
4897 (error "No such XML routine info file: %s" catalog-file) 4906 (error "No such XML routine info file: %s" catalog-file)
4898 (if (not (file-readable-p catalog-file)) 4907 (if (not (file-readable-p catalog-file))
4899 (error "Cannot read XML routine info file: %s" catalog-file))) 4908 (error "Cannot read XML routine info file: %s" catalog-file)))
4900 (require 'xml) 4909 (require 'xml)
4901 (message "Reading XML routine info...") 4910 (message "Reading XML routine info...")
4902 (unwind-protect 4911 (setq rinfo (xml-parse-file catalog-file))
4903 (progn
4904 ;; avoid warnings about read-only files
4905 (setq buf (find-file-noselect catalog-file 'nowarn))
4906 (setq rinfo (xml-parse-file catalog-file)))
4907 (if (bufferp buf) (kill-buffer buf)))
4908 (message "Reading XML routine info...done") 4912 (message "Reading XML routine info...done")
4909 (setq rinfo (assq 'CATALOG rinfo)) 4913 (setq rinfo (assq 'CATALOG rinfo))
4910 (unless rinfo (error "Failed to parse XML routine info")) 4914 (unless rinfo (error "Failed to parse XML routine info"))
4911 ;;(setq rinfo (car rinfo)) ; Skip the catalog stuff. 4915 ;;(setq rinfo (car rinfo)) ; Skip the catalog stuff.
4912 4916
7711 ((eq mode 'test) ; we can at least link the main 7715 ((eq mode 'test) ; we can at least link the main
7712 (and (stringp word) entry main)) 7716 (and (stringp word) entry main))
7713 ((eq mode 'set) 7717 ((eq mode 'set)
7714 (if entry 7718 (if entry
7715 (setq link 7719 (setq link
7716 (if (setq target (cdr (assoc word tags))) 7720 (if (setq target (cdr (assoc-string word tags t)))
7717 (idlwave-substitute-link-target main target) 7721 (idlwave-substitute-link-target main target)
7718 main)))) ;; setting dynamic!!! 7722 main)))) ;; setting dynamic!!!
7719 (t (error "This should not happen"))))) 7723 (t (error "This should not happen")))))
7720 7724
7721 (defun idlwave-split-link-target (link) 7725 (defun idlwave-split-link-target (link)
7760 (t (error "This should not happen")))) 7764 (t (error "This should not happen"))))
7761 7765
7762 (defun idlwave-class-or-superclass-with-tag (class tag) 7766 (defun idlwave-class-or-superclass-with-tag (class tag)
7763 "Find and return the CLASS or one of its superclass with the 7767 "Find and return the CLASS or one of its superclass with the
7764 associated TAG, if any." 7768 associated TAG, if any."
7765 (let ((sclasses (cons class (cdr (assq 'all-inherits 7769 (let ((sclasses (cons class (idlwave-all-class-inherits class)))
7766 (idlwave-class-info class)))))
7767 cl) 7770 cl)
7768 (catch 'exit 7771 (catch 'exit
7769 (while sclasses 7772 (while sclasses
7770 (setq cl (pop sclasses)) 7773 (setq cl (pop sclasses))
7771 (let ((tags (idlwave-class-tags cl))) 7774 (let ((tags (idlwave-class-tags cl)))
9229 ["Commentary in idlwave.el" idlwave-show-commentary t] 9232 ["Commentary in idlwave.el" idlwave-show-commentary t]
9230 ["Commentary in idlw-shell.el" idlwave-shell-show-commentary t] 9233 ["Commentary in idlw-shell.el" idlwave-shell-show-commentary t]
9231 "--" 9234 "--"
9232 ["Info" idlwave-info t] 9235 ["Info" idlwave-info t]
9233 "--" 9236 "--"
9237 ["Help with Topic" idlwave-help-assistant-help-with-topic
9238 idlwave-help-use-assistant]
9234 ["Launch IDL Help" idlwave-launch-idlhelp t]))) 9239 ["Launch IDL Help" idlwave-launch-idlhelp t])))
9235 9240
9236 (defvar idlwave-mode-debug-menu-def 9241 (defvar idlwave-mode-debug-menu-def
9237 '("Debug" 9242 '("Debug"
9238 ["Start IDL shell" idlwave-shell t] 9243 ["Start IDL shell" idlwave-shell t]