comparison lisp/progmodes/idlwave.el @ 83331:efa9e4606e7e

Merged from miles@gnu.org--gnu-2005 (patch 83-87, 449-468) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-449 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-450 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-451 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-452 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-453 Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-454 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-455 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-456 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-457 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-459 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-460 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-461 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-462 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-463 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-464 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-465 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-466 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-467 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-468 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-83 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-84 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-85 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-86 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-87 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-371
author Karoly Lorentey <lorentey@elte.hu>
date Tue, 05 Jul 2005 22:12:55 +0000
parents c016d82bf02b d7d0b751409c
children 6c13700d1c13
comparison
equal deleted inserted replaced
83330:233c9974025b 83331:efa9e4606e7e
1 ;; idlwave.el --- IDL editing mode for GNU Emacs 1 ;; idlwave.el --- IDL editing mode for GNU Emacs
2 ;; Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005 2 ;; Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005
3 ;; Free Software Foundation 3 ;; Free Software Foundation
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: 5.5 9 ;; Version: 5.7_22
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
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA. 27 ;; Boston, MA 02111-1307, USA.
28 28
29 ;;; Commentary: 29 ;;; Commentary:
30
31 ;; IDLWAVE enables feature-rich development and interaction with IDL.
30 32
31 ;; In the remotely distant past, based on pascal.el, though bears 33 ;; In the remotely distant past, based on pascal.el, though bears
32 ;; little resemblance to it now. 34 ;; little resemblance to it now.
33 ;; 35 ;;
34 ;; Incorporates many ideas, such as abbrevs, action routines, and 36 ;; Incorporates many ideas, such as abbrevs, action routines, and
109 ;; ============== 111 ;; ==============
110 ;; 112 ;;
111 ;; IDLWAVE support for the IDL-derived PV-WAVE CL language of Visual 113 ;; IDLWAVE support for the IDL-derived PV-WAVE CL language of Visual
112 ;; Numerics, Inc. is growing less and less complete as the two 114 ;; Numerics, Inc. is growing less and less complete as the two
113 ;; languages grow increasingly apart. The mode probably shouldn't 115 ;; languages grow increasingly apart. The mode probably shouldn't
114 ;; even have "WAVE" in it's title, but it's catchy, and was required 116 ;; even have "WAVE" in its title, but it's catchy, and was required
115 ;; to avoid conflict with the CORBA idl.el mode. Caveat WAVEor. 117 ;; to avoid conflict with the CORBA idl.el mode. Caveat WAVEor.
116 ;; 118 ;;
117 ;; Moving the point backwards in conjunction with abbrev expansion 119 ;; Moving the point backwards in conjunction with abbrev expansion
118 ;; does not work as I would like it, but this is a problem with 120 ;; does not work as I would like it, but this is a problem with
119 ;; emacs abbrev expansion done by the self-insert-command. It ends 121 ;; emacs abbrev expansion done by the self-insert-command. It ends
157 (unless (fboundp 'line-end-position) 159 (unless (fboundp 'line-end-position)
158 (defalias 'line-end-position 'point-at-eol)) 160 (defalias 'line-end-position 'point-at-eol))
159 (unless (fboundp 'char-valid-p) 161 (unless (fboundp 'char-valid-p)
160 (defalias 'char-valid-p 'characterp)) 162 (defalias 'char-valid-p 'characterp))
161 163
164 (if (not (fboundp 'cancel-timer))
165 (condition-case nil
166 (require 'timer)
167 (error nil)))
168
162 (eval-and-compile 169 (eval-and-compile
163 ;; Kludge to allow `defcustom' for Emacs 19. 170 ;; Kludge to allow `defcustom' for Emacs 19.
164 (condition-case () (require 'custom) (error nil)) 171 (condition-case () (require 'custom) (error nil))
165 (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) 172 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
166 nil ;; We've got what we needed 173 nil ;; We've got what we needed
168 (defmacro defgroup (&rest args) nil) 175 (defmacro defgroup (&rest args) nil)
169 (defmacro defcustom (var value doc &rest args) 176 (defmacro defcustom (var value doc &rest args)
170 `(defvar ,var ,value ,doc)))) 177 `(defvar ,var ,value ,doc))))
171 178
172 (defgroup idlwave nil 179 (defgroup idlwave nil
173 "Major mode for editing IDL .pro files" 180 "Major mode for editing IDL .pro files."
174 :tag "IDLWAVE" 181 :tag "IDLWAVE"
175 :link '(url-link :tag "Home Page" 182 :link '(url-link :tag "Home Page"
176 "http://idlwave.org") 183 "http://idlwave.org")
177 :link '(emacs-commentary-link :tag "Commentary in idlw-shell.el" 184 :link '(emacs-commentary-link :tag "Commentary in idlw-shell.el"
178 "idlw-shell.el") 185 "idlw-shell.el")
1375 1382
1376 (defconst idlwave-continuation-char ?$ 1383 (defconst idlwave-continuation-char ?$
1377 "Character which is inserted as a last character on previous line by 1384 "Character which is inserted as a last character on previous line by
1378 \\[idlwave-split-line] to begin a continuation line. Normally $.") 1385 \\[idlwave-split-line] to begin a continuation line. Normally $.")
1379 1386
1380 (defconst idlwave-mode-version "5.5") 1387 (defconst idlwave-mode-version "5.7_22")
1381 1388
1382 (defmacro idlwave-keyword-abbrev (&rest args) 1389 (defmacro idlwave-keyword-abbrev (&rest args)
1383 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args." 1390 "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
1384 `(quote (lambda () 1391 `(quote (lambda ()
1385 ,(append '(idlwave-check-abbrev) args)))) 1392 ,(append '(idlwave-check-abbrev) args))))
1482 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)" 1489 (idlwave-action-and-binding idlwave-sysvar '(capitalize-word 1) t)"
1483 (if (not (equal select 'noaction)) 1490 (if (not (equal select 'noaction))
1484 ;; Add action 1491 ;; Add action
1485 (let* ((table (if select 'idlwave-indent-action-table 1492 (let* ((table (if select 'idlwave-indent-action-table
1486 'idlwave-indent-expand-table)) 1493 'idlwave-indent-expand-table))
1487 (cell (assoc key (eval table)))) 1494 (table-key (regexp-quote key))
1495 (cell (assoc table-key (eval table))))
1488 (if cell 1496 (if cell
1489 ;; Replace action command 1497 ;; Replace action command
1490 (setcdr cell cmd) 1498 (setcdr cell cmd)
1491 ;; New action 1499 ;; New action
1492 (set table (append (eval table) (list (cons key cmd))))))) 1500 (set table (append (eval table) (list (cons table-key cmd)))))))
1493 ;; Make key binding for action 1501 ;; Make key binding for action
1494 (if (or (and (null select) (= (length key) 1)) 1502 (if (or (and (null select) (= (length key) 1))
1495 (equal select 'noaction) 1503 (equal select 'noaction)
1496 (equal select 'both)) 1504 (equal select 'both))
1497 (define-key idlwave-mode-map key 1505 (define-key idlwave-mode-map key
1514 (define-key idlwave-mode-map "\C-\M-a" 'idlwave-beginning-of-subprogram) 1522 (define-key idlwave-mode-map "\C-\M-a" 'idlwave-beginning-of-subprogram)
1515 (define-key idlwave-mode-map "\C-\M-e" 'idlwave-end-of-subprogram) 1523 (define-key idlwave-mode-map "\C-\M-e" 'idlwave-end-of-subprogram)
1516 (define-key idlwave-mode-map "\C-c{" 'idlwave-beginning-of-block) 1524 (define-key idlwave-mode-map "\C-c{" 'idlwave-beginning-of-block)
1517 (define-key idlwave-mode-map "\C-c}" 'idlwave-end-of-block) 1525 (define-key idlwave-mode-map "\C-c}" 'idlwave-end-of-block)
1518 (define-key idlwave-mode-map "\C-c]" 'idlwave-close-block) 1526 (define-key idlwave-mode-map "\C-c]" 'idlwave-close-block)
1519 (define-key idlwave-mode-map "\M-\C-h" 'idlwave-mark-subprogram) 1527 (define-key idlwave-mode-map [(meta control h)] 'idlwave-mark-subprogram)
1520 (define-key idlwave-mode-map "\M-\C-n" 'idlwave-forward-block) 1528 (define-key idlwave-mode-map "\M-\C-n" 'idlwave-forward-block)
1521 (define-key idlwave-mode-map "\M-\C-p" 'idlwave-backward-block) 1529 (define-key idlwave-mode-map "\M-\C-p" 'idlwave-backward-block)
1522 (define-key idlwave-mode-map "\M-\C-d" 'idlwave-down-block) 1530 (define-key idlwave-mode-map "\M-\C-d" 'idlwave-down-block)
1523 (define-key idlwave-mode-map "\M-\C-u" 'idlwave-backward-up-block) 1531 (define-key idlwave-mode-map "\M-\C-u" 'idlwave-backward-up-block)
1524 (define-key idlwave-mode-map "\M-\r" 'idlwave-split-line) 1532 (define-key idlwave-mode-map "\M-\r" 'idlwave-split-line)
1573 (autoload 'idlwave-shell-break-here "idlw-shell" 1581 (autoload 'idlwave-shell-break-here "idlw-shell"
1574 "Set breakpoint in current line." t) 1582 "Set breakpoint in current line." t)
1575 (autoload 'idlwave-shell-run-region "idlw-shell" 1583 (autoload 'idlwave-shell-run-region "idlw-shell"
1576 "Compile and run the region." t) 1584 "Compile and run the region." t)
1577 (define-key idlwave-mode-map "\C-c\C-v" 'idlwave-find-module) 1585 (define-key idlwave-mode-map "\C-c\C-v" 'idlwave-find-module)
1586 (define-key idlwave-mode-map "\C-c\C-t" 'idlwave-find-module-this-file)
1578 (define-key idlwave-mode-map "\C-c?" 'idlwave-routine-info) 1587 (define-key idlwave-mode-map "\C-c?" 'idlwave-routine-info)
1579 (define-key idlwave-mode-map "\M-?" 'idlwave-context-help) 1588 (define-key idlwave-mode-map "\M-?" 'idlwave-context-help)
1580 (define-key idlwave-mode-map [(control meta ?\?)] 'idlwave-online-help) 1589 (define-key idlwave-mode-map [(control meta ?\?)] 'idlwave-online-help)
1581 ;; Pickup both forms of Esc/Meta binding 1590 ;; Pickup both forms of Esc/Meta binding
1582 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete) 1591 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete)
1700 (idlwave-define-abbrev "inn" "if n_elements() ne 0 then" (idlwave-keyword-abbrev 11)) 1709 (idlwave-define-abbrev "inn" "if n_elements() ne 0 then" (idlwave-keyword-abbrev 11))
1701 (idlwave-define-abbrev "np" "n_params()" (idlwave-keyword-abbrev 0)) 1710 (idlwave-define-abbrev "np" "n_params()" (idlwave-keyword-abbrev 0))
1702 (idlwave-define-abbrev "s" "size()" (idlwave-keyword-abbrev 1)) 1711 (idlwave-define-abbrev "s" "size()" (idlwave-keyword-abbrev 1))
1703 (idlwave-define-abbrev "wi" "widget_info()" (idlwave-keyword-abbrev 1)) 1712 (idlwave-define-abbrev "wi" "widget_info()" (idlwave-keyword-abbrev 1))
1704 (idlwave-define-abbrev "wc" "widget_control," (idlwave-keyword-abbrev 0)) 1713 (idlwave-define-abbrev "wc" "widget_control," (idlwave-keyword-abbrev 0))
1714 (idlwave-define-abbrev "pv" "ptr_valid()" (idlwave-keyword-abbrev 1))
1715 (idlwave-define-abbrev "ipv" "if ptr_valid() then" (idlwave-keyword-abbrev 6))
1705 1716
1706 ;; This section is reserved words only. (From IDL user manual) 1717 ;; This section is reserved words only. (From IDL user manual)
1707 ;; 1718 ;;
1708 (idlwave-define-abbrev "and" "and" (idlwave-keyword-abbrev 0 t) t) 1719 (idlwave-define-abbrev "and" "and" (idlwave-keyword-abbrev 0 t) t)
1709 (idlwave-define-abbrev "begin" "begin" (idlwave-keyword-abbrev 0 t) t) 1720 (idlwave-define-abbrev "begin" "begin" (idlwave-keyword-abbrev 0 t) t)
1754 (defvar idlwave-mode-menu) 1765 (defvar idlwave-mode-menu)
1755 (defvar idlwave-mode-debug-menu) 1766 (defvar idlwave-mode-debug-menu)
1756 1767
1757 ;;;###autoload 1768 ;;;###autoload
1758 (defun idlwave-mode () 1769 (defun idlwave-mode ()
1759 "Major mode for editing IDL source files (version 5.5). 1770 "Major mode for editing IDL source files (version 5.7_22).
1760 1771
1761 The main features of this mode are 1772 The main features of this mode are
1762 1773
1763 1. Indentation and Formatting 1774 1. Indentation and Formatting
1764 -------------------------- 1775 --------------------------
1933 'idlwave-unit-name) 1944 'idlwave-unit-name)
1934 (set (make-local-variable 'imenu-prev-index-position-function) 1945 (set (make-local-variable 'imenu-prev-index-position-function)
1935 'idlwave-prev-index-position) 1946 'idlwave-prev-index-position)
1936 1947
1937 ;; Make a local post-command-hook and add our hook to it 1948 ;; Make a local post-command-hook and add our hook to it
1938 ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
1939 (make-local-hook 'post-command-hook)
1940 (add-hook 'post-command-hook 'idlwave-command-hook nil 'local) 1949 (add-hook 'post-command-hook 'idlwave-command-hook nil 'local)
1941 1950
1942 ;; Make local hooks for buffer updates 1951 ;; Make local hooks for buffer updates
1943 ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
1944 (make-local-hook 'kill-buffer-hook)
1945 (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local) 1952 (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local)
1946 (make-local-hook 'after-save-hook)
1947 (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local) 1953 (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
1948 (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local) 1954 (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local)
1949 1955
1950 ;; Setup directories and file, if necessary 1956 ;; Setup directories and file, if necessary
1951 (idlwave-setup) 1957 (idlwave-setup)
2694 (re-search-backward non-an-ops nil t) 2700 (re-search-backward non-an-ops nil t)
2695 ;; Why doesn't ##? work for both? 2701 ;; Why doesn't ##? work for both?
2696 (re-search-backward "\\(#\\)\\=" nil t)) 2702 (re-search-backward "\\(#\\)\\=" nil t))
2697 (setq len (1+ (length (match-string 1)))) 2703 (setq len (1+ (length (match-string 1))))
2698 (when (re-search-backward an-ops nil t) 2704 (when (re-search-backward an-ops nil t)
2699 (setq begin nil) ; won't modify begin 2705 ;(setq begin nil) ; won't modify begin
2700 (setq len (1+ (length (match-string 1)))))))) 2706 (setq len (1+ (length (match-string 1))))))))
2701 2707
2702 (if (eq t idlwave-pad-keyword) 2708 (if (eq t idlwave-pad-keyword)
2703 ;; Everything gets padded equally 2709 ;; Everything gets padded equally
2704 (idlwave-surround before after nil len) 2710 (idlwave-surround before after nil len)
4265 (defvar idlwave-unresolved-routines nil 4271 (defvar idlwave-unresolved-routines nil
4266 "Holds the unresolved routine-info obtained by asking the shell.") 4272 "Holds the unresolved routine-info obtained by asking the shell.")
4267 (defvar idlwave-user-catalog-routines nil 4273 (defvar idlwave-user-catalog-routines nil
4268 "Holds the procedure routine-info from the user scan.") 4274 "Holds the procedure routine-info from the user scan.")
4269 (defvar idlwave-library-catalog-routines nil 4275 (defvar idlwave-library-catalog-routines nil
4270 "Holds the procedure routine-info from the library catalog files.") 4276 "Holds the procedure routine-info from the .idlwave_catalog library files.")
4277 (defvar idlwave-library-catalog-libname nil
4278 "Name of library catalog loaded from .idlwave_catalog files.")
4271 (defvar idlwave-path-alist nil 4279 (defvar idlwave-path-alist nil
4272 "Alist with !PATH directories and zero or more flags if the dir has 4280 "Alist with !PATH directories and zero or more flags if the dir has
4273 been scanned in a user catalog ('user) or discovered in a library 4281 been scanned in a user catalog ('user) or discovered in a library
4274 catalog \('lib).") 4282 catalog \('lib).")
4275 (defvar idlwave-true-path-alist nil 4283 (defvar idlwave-true-path-alist nil
4382 ;; complete filepath, in which case DIR is unnecessary. HELPFILE can 4390 ;; complete filepath, in which case DIR is unnecessary. HELPFILE can
4383 ;; be nil, as can LINK1, etc., if no HTML help is available. 4391 ;; be nil, as can LINK1, etc., if no HTML help is available.
4384 4392
4385 4393
4386 (defvar idlwave-load-rinfo-idle-timer) 4394 (defvar idlwave-load-rinfo-idle-timer)
4395 (defvar idlwave-shell-path-query)
4396
4387 (defun idlwave-update-routine-info (&optional arg no-concatenate) 4397 (defun idlwave-update-routine-info (&optional arg no-concatenate)
4388 "Update the internal routine-info lists. 4398 "Update the internal routine-info lists.
4389 These lists are used by `idlwave-routine-info' (\\[idlwave-routine-info]) 4399 These lists are used by `idlwave-routine-info' (\\[idlwave-routine-info])
4390 and by `idlwave-complete' (\\[idlwave-complete]) to provide information 4400 and by `idlwave-complete' (\\[idlwave-complete]) to provide information
4391 about individual routines. 4401 about individual routines.
4505 (setq idlwave-load-rinfo-idle-timer 4515 (setq idlwave-load-rinfo-idle-timer
4506 (run-with-idle-timer 4516 (run-with-idle-timer
4507 idlwave-init-rinfo-when-idle-after 4517 idlwave-init-rinfo-when-idle-after
4508 nil 'idlwave-load-rinfo-next-step))) 4518 nil 'idlwave-load-rinfo-next-step)))
4509 (error nil)))) 4519 (error nil))))
4520
4521 (defvar idlwave-library-routines nil "Obsolete variable.")
4510 4522
4511 (defun idlwave-load-rinfo-next-step () 4523 (defun idlwave-load-rinfo-next-step ()
4512 (let ((inhibit-quit t) 4524 (let ((inhibit-quit t)
4513 (arr idlwave-load-rinfo-steps-done)) 4525 (arr idlwave-load-rinfo-steps-done))
4514 (when (catch 'exit 4526 (when (catch 'exit
4814 4826
4815 ;;----- Scanning the user catalog ------------------- 4827 ;;----- Scanning the user catalog -------------------
4816 4828
4817 (defun idlwave-sys-dir () 4829 (defun idlwave-sys-dir ()
4818 "Return the syslib directory, or a dummy that never matches." 4830 "Return the syslib directory, or a dummy that never matches."
4819 (if (string= idlwave-system-directory "") 4831 (cond
4820 "@@@@@@@@" 4832 ((and idlwave-system-directory
4821 idlwave-system-directory)) 4833 (not (string= idlwave-system-directory "")))
4822 4834 idlwave-system-directory)
4823 4835 ((getenv "IDL_DIR"))
4824 (defvar idlwave-shell-path-query) 4836 (t "@@@@@@@@")))
4837
4838
4839
4825 (defun idlwave-create-user-catalog-file (&optional arg) 4840 (defun idlwave-create-user-catalog-file (&optional arg)
4826 "Scan all files on selected dirs of IDL search path for routine information. 4841 "Scan all files on selected dirs of IDL search path for routine information.
4827 4842
4828 A widget checklist will allow you to choose the directories. Write 4843 A widget checklist will allow you to choose the directories. Write
4829 the result as a file `idlwave-user-catalog-file'. When this file 4844 the result as a file `idlwave-user-catalog-file'. When this file
5138 path1)) 5153 path1))
5139 5154
5140 5155
5141 ;;----- Scanning the library catalogs ------------------ 5156 ;;----- Scanning the library catalogs ------------------
5142 5157
5158
5159
5160
5143 (defun idlwave-scan-library-catalogs (&optional message-base no-load) 5161 (defun idlwave-scan-library-catalogs (&optional message-base no-load)
5144 "Scan for library catalog files (.idlwave_catalog) and ingest. 5162 "Scan for library catalog files (.idlwave_catalog) and ingest.
5145 5163
5146 All directories on `idlwave-path-alist' (or `idlwave-library-path' 5164 All directories on `idlwave-path-alist' (or `idlwave-library-path'
5147 instead, if present) are searched. Print MESSAGE-BASE along with the 5165 instead, if present) are searched. Print MESSAGE-BASE along with the
5486 (class-selector class) 5504 (class-selector class)
5487 (super-classes (idlwave-all-class-inherits class-selector)) 5505 (super-classes (idlwave-all-class-inherits class-selector))
5488 (isa (format "procedure%s-keyword" (if class "-method" ""))) 5506 (isa (format "procedure%s-keyword" (if class "-method" "")))
5489 (entry (idlwave-best-rinfo-assq 5507 (entry (idlwave-best-rinfo-assq
5490 name 'pro class (idlwave-routines))) 5508 name 'pro class (idlwave-routines)))
5509 (system (if entry (eq (car (nth 3 entry)) 'system)))
5491 (list (idlwave-entry-keywords entry 'do-link))) 5510 (list (idlwave-entry-keywords entry 'do-link)))
5492 (unless (or entry (eq class t)) 5511 (unless (or entry (eq class t))
5493 (error "Nothing known about procedure %s" 5512 (error "Nothing known about procedure %s"
5494 (idlwave-make-full-name class name))) 5513 (idlwave-make-full-name class name)))
5495 (setq list (idlwave-fix-keywords name 'pro class list super-classes)) 5514 (setq list (idlwave-fix-keywords name 'pro class list
5515 super-classes system))
5496 (unless list (error "No keywords available for procedure %s" 5516 (unless list (error "No keywords available for procedure %s"
5497 (idlwave-make-full-name class name))) 5517 (idlwave-make-full-name class name)))
5498 (setq idlwave-completion-help-info 5518 (setq idlwave-completion-help-info
5499 (list 'keyword name type-selector class-selector entry super-classes)) 5519 (list 'keyword name type-selector class-selector entry super-classes))
5500 (idlwave-complete-in-buffer 5520 (idlwave-complete-in-buffer
5501 'keyword 'keyword list nil 5521 'keyword 'keyword list nil
5502 (format "Select keyword for procedure %s%s" 5522 (format "Select keyword for procedure %s%s"
5517 (class-selector class) 5537 (class-selector class)
5518 (super-classes (idlwave-all-class-inherits class-selector)) 5538 (super-classes (idlwave-all-class-inherits class-selector))
5519 (isa (format "function%s-keyword" (if class "-method" ""))) 5539 (isa (format "function%s-keyword" (if class "-method" "")))
5520 (entry (idlwave-best-rinfo-assq 5540 (entry (idlwave-best-rinfo-assq
5521 name 'fun class (idlwave-routines))) 5541 name 'fun class (idlwave-routines)))
5542 (system (if entry (eq (car (nth 3 entry)) 'system)))
5522 (list (idlwave-entry-keywords entry 'do-link)) 5543 (list (idlwave-entry-keywords entry 'do-link))
5523 msg-name) 5544 msg-name)
5524 (unless (or entry (eq class t)) 5545 (unless (or entry (eq class t))
5525 (error "Nothing known about function %s" 5546 (error "Nothing known about function %s"
5526 (idlwave-make-full-name class name))) 5547 (idlwave-make-full-name class name)))
5527 (setq list (idlwave-fix-keywords name 'fun class list super-classes)) 5548 (setq list (idlwave-fix-keywords name 'fun class list
5549 super-classes system))
5528 ;; OBJ_NEW: Messages mention the proper Init method 5550 ;; OBJ_NEW: Messages mention the proper Init method
5529 (setq msg-name (if (and (null class) 5551 (setq msg-name (if (and (null class)
5530 (string= (upcase name) "OBJ_NEW")) 5552 (string= (upcase name) "OBJ_NEW"))
5531 (concat idlwave-current-obj_new-class 5553 (concat idlwave-current-obj_new-class
5532 "::Init (via OBJ_NEW)") 5554 "::Init (via OBJ_NEW)")
5533 (idlwave-make-full-name class name))) 5555 (idlwave-make-full-name class name)))
5534 (unless list (error "No keywords available for function %s" 5556 (unless list (error "No keywords available for function %s"
5535 msg-name)) 5557 msg-name))
5536 (setq idlwave-completion-help-info 5558 (setq idlwave-completion-help-info
5537 (list 'keyword name type-selector class-selector nil super-classes)) 5559 (list 'keyword name type-selector class-selector nil super-classes))
5538 (idlwave-complete-in-buffer 5560 (idlwave-complete-in-buffer
5539 'keyword 'keyword list nil 5561 'keyword 'keyword list nil
5540 (format "Select keyword for function %s%s" msg-name 5562 (format "Select keyword for function %s%s" msg-name
6153 (skip-chars-backward " \t") 6175 (skip-chars-backward " \t")
6154 (cond 6176 (cond
6155 ((memq (preceding-char) '(?\; ?\$)) (throw 'exit nil)) 6177 ((memq (preceding-char) '(?\; ?\$)) (throw 'exit nil))
6156 ((eq (preceding-char) ?\n) 6178 ((eq (preceding-char) ?\n)
6157 (beginning-of-line 0) 6179 (beginning-of-line 0)
6158 (if (looking-at "\\([^;\n]*\\)\\$[ \t]*\\(;[^\n]*\\)?\n") 6180 (if (looking-at "\\([^\n]*\\)\\$[ \t]*\\(;[^\n]*\\)?\n")
6159 ;; continuation line 6181 ;; continuation line
6160 (goto-char (match-end 1)) 6182 (goto-char (match-end 1))
6161 (throw 'exit nil))) 6183 (throw 'exit nil)))
6162 (t (throw 'exit (preceding-char)))))))) 6184 (t (throw 'exit (preceding-char))))))))
6163 6185
7157 "Select a system variable tag" 7179 "Select a system variable tag"
7158 "system variable tag") 7180 "system variable tag")
7159 t)) ; return t to skip other completions 7181 t)) ; return t to skip other completions
7160 (t nil)))) 7182 (t nil))))
7161 7183
7184 (defvar link) ;dynamic
7162 (defun idlwave-complete-sysvar-help (mode word) 7185 (defun idlwave-complete-sysvar-help (mode word)
7163 (let ((word (or (nth 1 idlwave-completion-help-info) word)) 7186 (let ((word (or (nth 1 idlwave-completion-help-info) word))
7164 (entry (assoc word idlwave-system-variables-alist))) 7187 (entry (assoc word idlwave-system-variables-alist)))
7165 (cond 7188 (cond
7166 ((eq mode 'test) 7189 ((eq mode 'test)
7459 (list 'idlwave-shell-send-command 7482 (list 'idlwave-shell-send-command
7460 (format "resolve_routine,'%s__%s'%s" 7483 (format "resolve_routine,'%s__%s'%s"
7461 (downcase class) (downcase name) kwd) 7484 (downcase class) (downcase name) kwd)
7462 '(idlwave-update-routine-info) 7485 '(idlwave-update-routine-info)
7463 nil t)))))) 7486 nil t))))))
7487
7488 (defun idlwave-find-module-this-file ()
7489 (interactive)
7490 (idlwave-find-module '(4)))
7464 7491
7465 (defun idlwave-find-module (&optional arg) 7492 (defun idlwave-find-module (&optional arg)
7466 "Find the source code of an IDL module. 7493 "Find the source code of an IDL module.
7467 Works for modules for which IDLWAVE has routine info available. The 7494 Works for modules for which IDLWAVE has routine info available. The
7468 function offers as default the module name `idlwave-routine-info' 7495 function offers as default the module name `idlwave-routine-info'
7660 (setq module (list (idlwave-sintern-method "Init") 7687 (setq module (list (idlwave-sintern-method "Init")
7661 'fun 7688 'fun
7662 (idlwave-sintern-class class))))) 7689 (idlwave-sintern-class class)))))
7663 module)) 7690 module))
7664 7691
7665 (defun idlwave-fix-keywords (name type class keywords &optional super-classes) 7692 (defun idlwave-fix-keywords (name type class keywords
7693 &optional super-classes system)
7666 "Update a list of keywords. 7694 "Update a list of keywords.
7667 Translate OBJ_NEW, adding all super-class keywords, or all keywords 7695 Translate OBJ_NEW, adding all super-class keywords, or all keywords
7668 from all classes if class equals t." 7696 from all classes if class equals t. If SYSTEM is non-nil, don't
7697 demand _EXTRA in the keyword list."
7669 (let ((case-fold-search t)) 7698 (let ((case-fold-search t))
7670 7699
7671 ;; If this is the OBJ_NEW function, try to figure out the class and use 7700 ;; If this is the OBJ_NEW function, try to figure out the class and use
7672 ;; the keywords from the corresponding INIT method. 7701 ;; the keywords from the corresponding INIT method.
7673 (if (and (equal (upcase name) "OBJ_NEW") 7702 (if (and (equal (upcase name) "OBJ_NEW")
7706 ;; the user indicated that method in `idlwave-keyword-class-inheritance' 7735 ;; the user indicated that method in `idlwave-keyword-class-inheritance'
7707 (when (and 7736 (when (and
7708 super-classes 7737 super-classes
7709 idlwave-keyword-class-inheritance 7738 idlwave-keyword-class-inheritance
7710 (stringp class) 7739 (stringp class)
7711 (or (assq (idlwave-sintern-keyword "_extra") keywords) 7740 (or
7712 (assq (idlwave-sintern-keyword "_ref_extra") keywords)) 7741 system
7742 (assq (idlwave-sintern-keyword "_extra") keywords)
7743 (assq (idlwave-sintern-keyword "_ref_extra") keywords))
7713 ;; Check if one of the keyword-class regexps matches the name 7744 ;; Check if one of the keyword-class regexps matches the name
7714 (let ((regexps idlwave-keyword-class-inheritance) re) 7745 (let ((regexps idlwave-keyword-class-inheritance) re)
7715 (catch 'exit 7746 (catch 'exit
7716 (while (setq re (pop regexps)) 7747 (while (setq re (pop regexps))
7717 (if (string-match re name) (throw 'exit t)))))) 7748 (if (string-match re name) (throw 'exit t))))))
8046 "Does the mouse actions in the routine info buffer. 8077 "Does the mouse actions in the routine info buffer.
8047 Optional args RIGHT and SHIFT indicate, if mouse-3 was used, and if SHIFT 8078 Optional args RIGHT and SHIFT indicate, if mouse-3 was used, and if SHIFT
8048 was pressed." 8079 was pressed."
8049 (interactive "e") 8080 (interactive "e")
8050 (if ev (mouse-set-point ev)) 8081 (if ev (mouse-set-point ev))
8051 (let (data id name type class buf bufwin source word initial-class) 8082 (let (data id name type class buf bufwin source link keyword
8083 word initial-class)
8052 (setq data (get-text-property (point) 'data) 8084 (setq data (get-text-property (point) 'data)
8053 source (get-text-property (point) 'source) 8085 source (get-text-property (point) 'source)
8054 keyword (get-text-property (point) 'keyword) 8086 keyword (get-text-property (point) 'keyword)
8055 link (get-text-property (point) 'link) 8087 link (get-text-property (point) 'link)
8056 id (car data) 8088 id (car data)
8331 (when (and (idlwave-syslib-scanned-p) 8363 (when (and (idlwave-syslib-scanned-p)
8332 (setq entry (assoc 'system alist))) 8364 (setq entry (assoc 'system alist)))
8333 (setcar entry 'builtin)) 8365 (setcar entry 'builtin))
8334 (sort alist 'idlwave-routine-twin-compare))) 8366 (sort alist 'idlwave-routine-twin-compare)))
8335 8367
8336 (defvar name)
8337 (defvar type) 8368 (defvar type)
8338 (defvar class) 8369 (defvar class)
8339 (defvar idlwave-sort-prefer-buffer-info t 8370 (defvar idlwave-sort-prefer-buffer-info t
8340 "Internal variable used to influence `idlwave-routine-twin-compare'.") 8371 "Internal variable used to influence `idlwave-routine-twin-compare'.")
8341 8372