* erc-stamp.el (erc-echo-timestamp):
[bpt/emacs.git] / lisp / progmodes / idlwave.el
index 25f05b5..49e8859 100644 (file)
@@ -1,6 +1,7 @@
 ;; idlwave.el --- IDL editing mode for GNU Emacs
-;; Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-;;    Free Software Foundation
+
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   Free Software Foundation, Inc.
 
 ;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
 ;;          Carsten Dominik <dominik@science.uva.nl>
@@ -13,7 +14,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
     (defmacro defcustom (var value doc &rest args)
       `(defvar ,var ,value ,doc))))
 
+(declare-function idlwave-shell-get-path-info "idlw-shell")
+(declare-function idlwave-shell-temp-file "idlw-shell")
+(declare-function idlwave-shell-is-running "idlw-shell")
+(declare-function widget-value "wid-edit" (widget))
+(declare-function comint-dynamic-complete-filename "comint" ())
+(declare-function Info-goto-node "info" (nodename &optional fork))
+
 (defgroup idlwave nil
   "Major mode for editing IDL .pro files."
   :tag "IDLWAVE"
@@ -2410,16 +2418,18 @@ non-nil."
     ;; Reindent new line
     (idlwave-indent-line)))
 
-(defun idlwave-beginning-of-subprogram ()
-  "Moves point to the beginning of the current program unit."
+(defun idlwave-beginning-of-subprogram (&optional nomark)
+  "Moves point to the beginning of the current program unit.
+If NOMARK is non-nil, do not push mark."
   (interactive)
-  (idlwave-find-key idlwave-begin-unit-reg -1))
+  (idlwave-find-key idlwave-begin-unit-reg -1 nomark))
 
-(defun idlwave-end-of-subprogram ()
-  "Moves point to the start of the next program unit."
+(defun idlwave-end-of-subprogram (&optional nomark)
+  "Moves point to the start of the next program unit.
+If NOMARK is non-nil, do not push mark."
   (interactive)
   (idlwave-end-of-statement)
-  (idlwave-find-key idlwave-end-unit-reg 1))
+  (idlwave-find-key idlwave-end-unit-reg 1 nomark))
 
 (defun idlwave-mark-statement ()
   "Mark current IDL statement."
@@ -2534,7 +2544,7 @@ The marks are pushed."
   "Return (NAME TYPE CLASS) of current routine."
   (idlwave-routines)
   (save-excursion
-    (idlwave-beginning-of-subprogram)
+    (idlwave-beginning-of-subprogram 'nomark)
     (if (looking-at "[ \t]*\\<\\(pro\\|function\\)\\>\\s-+\\(\\([a-zA-Z0-9$_]+\\)::\\)?\\([a-zA-Z0-9$_]+\\)")
        (let* ((type (if (string= (downcase (match-string 1)) "pro")
                         'pro 'function))
@@ -2824,10 +2834,10 @@ If the optional argument EXPAND is non-nil then the actions in
         ;; Before indenting, run action routines.
         ;;
         (if (and expand idlwave-do-actions)
-            (mapcar 'idlwave-do-action idlwave-indent-expand-table))
+            (mapc 'idlwave-do-action idlwave-indent-expand-table))
         ;;
         (if idlwave-do-actions
-            (mapcar 'idlwave-do-action idlwave-indent-action-table))
+            (mapc 'idlwave-do-action idlwave-indent-action-table))
         ;;
         ;; No longer expand abbrevs on the line.  The user can do this
         ;; manually using expand-region-abbrevs.
@@ -3486,6 +3496,7 @@ if `idlwave-auto-fill-split-string' is non-nil."
          (idlwave-indent-line)
          ;; Prevent actions do-auto-fill which calls indent-line-function.
          (let (idlwave-do-actions
+               (paragraph-separate ".")
                (fill-nobreak-predicate
                 (if (and (idlwave-in-quote)
                          idlwave-auto-fill-split-string)
@@ -3496,8 +3507,7 @@ if `idlwave-auto-fill-split-string' is non-nil."
          (save-excursion
            (end-of-line 0)
            ;; Indent the split line
-           (idlwave-indent-line)
-           )
+           (idlwave-indent-line))
          (if (save-excursion
                (beginning-of-line)
                (looking-at idlwave-comment-line-start-skip))
@@ -3789,7 +3799,7 @@ unless the optional second argument NOINDENT is non-nil."
       (if (not noindent)
          (indent-region beg end nil))
       (if (stringp prompt)
-         (message prompt)))))
+         (message "%s" prompt)))))
 
 (defun idlwave-rw-case (string)
   "Make STRING have the case required by `idlwave-reserved-word-upcase'."
@@ -4239,9 +4249,9 @@ blank lines."
 
 (defun idlwave-sintern-keyword-list (kwd-list &optional set)
   "Sintern a set of keywords (file (key . link) (key2 . link2) ...)"
-  (mapcar (lambda(x)
-           (setcar x (idlwave-sintern-keyword (car x) set)))
-         (cdr kwd-list))
+  (mapc (lambda(x)
+         (setcar x (idlwave-sintern-keyword (car x) set)))
+       (cdr kwd-list))
   kwd-list)
 
 (defun idlwave-sintern-rinfo-list (list &optional set default-dir)
@@ -4339,7 +4349,7 @@ catalog \('lib).")
 (defvar idlwave-true-path-alist nil
   "Like `idlwave-path-alist', but with true filenames.")
 (defvar idlwave-routines nil
-  "Holds the combinded procedure/function/method routine-info.")
+  "Holds the combined procedure/function/method routine-info.")
 (defvar idlwave-class-alist nil
   "Holds the class names known to IDLWAVE.")
 (defvar idlwave-class-history nil
@@ -4842,7 +4852,9 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
 (defun idlwave-xml-create-sysvar-alist (xml-entry)
   ;; Create a sysvar list entry from the xml parsed list.
   (let* ((nameblock (nth 1 xml-entry))
-        (sysvar (substring (cdr (assq 'name nameblock)) 1))
+        (name (cdr (assq 'name nameblock)))
+        (sysvar (substring name (progn (string-match "^ *!" name)
+                                       (match-end 0))))
         (link (cdr (assq 'link nameblock)))
         (params (cddr xml-entry))
         (case-fold-search t)
@@ -5555,11 +5567,11 @@ directories and save the routine info.
     ;; Define the routine info list
     (insert "\n(setq idlwave-user-catalog-routines\n    '(")
     (let ((standard-output (current-buffer)))
-      (mapcar (lambda (x)
-               (insert "\n    ")
-               (prin1 x)
-               (goto-char (point-max)))
-             idlwave-user-catalog-routines))
+      (mapc (lambda (x)
+             (insert "\n    ")
+             (prin1 x)
+             (goto-char (point-max)))
+           idlwave-user-catalog-routines))
     (insert (format "))\n\n;;; %s ends here\n"
                    (file-name-nondirectory idlwave-user-catalog-file)))
     (goto-char (point-min))
@@ -5599,11 +5611,11 @@ directories and save the routine info.
     ;; Define the variable which contains a list of all scanned directories
     (insert "\n(setq idlwave-path-alist\n    '(")
     (let ((standard-output (current-buffer)))
-      (mapcar (lambda (x)
-               (insert "\n      ")
-               (prin1 x)
-               (goto-char (point-max)))
-             idlwave-path-alist))
+      (mapc (lambda (x)
+             (insert "\n      ")
+             (prin1 x)
+             (goto-char (point-max)))
+           idlwave-path-alist))
     (insert "))\n")
     (save-buffer 0)
     (kill-buffer (current-buffer))))
@@ -6314,12 +6326,12 @@ When TYPE is not specified, both procedures and functions will be considered."
   (if (null method)
       (mapcar 'car (idlwave-class-alist))
     (let (rtn)
-      (mapcar (lambda (x)
-               (and (nth 2 x)
-                    (or (not type)
-                        (eq type (nth 1 x)))
-                    (push (nth 2 x) rtn)))
-             (idlwave-all-assq method (idlwave-routines)))
+      (mapc (lambda (x)
+             (and (nth 2 x)
+                  (or (not type)
+                      (eq type (nth 1 x)))
+                  (push (nth 2 x) rtn)))
+           (idlwave-all-assq method (idlwave-routines)))
       (idlwave-uniquify rtn))))
 
 (defun idlwave-all-method-keyword-classes (method keyword &optional type)
@@ -6330,13 +6342,13 @@ When TYPE is not specified, both procedures and functions will be considered."
          (null keyword))
       nil
     (let (rtn)
-      (mapcar (lambda (x)
-               (and (nth 2 x)           ; non-nil class
-                    (or (not type)      ; correct or unspecified type
-                        (eq type (nth 1 x)))
-                    (assoc keyword (idlwave-entry-keywords x))
-                    (push (nth 2 x) rtn)))
-             (idlwave-all-assq method (idlwave-routines)))
+      (mapc (lambda (x)
+             (and (nth 2 x)            ; non-nil class
+                  (or (not type)       ; correct or unspecified type
+                      (eq type (nth 1 x)))
+                  (assoc keyword (idlwave-entry-keywords x))
+                  (push (nth 2 x) rtn)))
+           (idlwave-all-assq method (idlwave-routines)))
       (idlwave-uniquify rtn))))
 
 (defun idlwave-members-only (list club)
@@ -6780,12 +6792,12 @@ accumulate information on matching completions."
       (message "Making completion list...")
 
       (unless idlwave-completion-help-links ; already set somewhere?
-       (mapcar (lambda (x)  ; Pass link prop through to highlight-linked
-                 (let ((link (get-text-property 0 'link (car x))))
-                   (if link
-                       (push (cons (car x) link)
-                             idlwave-completion-help-links))))
-               list))
+       (mapc (lambda (x)  ; Pass link prop through to highlight-linked
+               (let ((link (get-text-property 0 'link (car x))))
+                 (if link
+                     (push (cons (car x) link)
+                           idlwave-completion-help-links))))
+             list))
       (let* ((list all-completions)
             ;; "complete" means, this is already a valid completion
             (complete (memq spart all-completions))
@@ -7026,7 +7038,7 @@ sort the list before displaying"
                         (select-window win)
                         (eval idlwave-complete-after-success-form))
                     (set-window-start cwin (point-min)))))
-         (and message (message message)))
+         (and message (message "%s" message)))
       (select-window win))))
 
 (defun idlwave-display-completion-list (list &optional message beg complete)
@@ -7057,7 +7069,7 @@ sort the list before displaying"
   (run-hooks 'idlwave-completion-setup-hook)
 
   ;; Display the message
-  (message (or message "Making completion list...done")))
+  (message "%s" (or message "Making completion list...done")))
 
 (defun idlwave-choose (function &rest args)
   "Call FUNCTION as a completion chooser and pass ARGS to it."
@@ -7090,7 +7102,7 @@ sort the list before displaying"
   "Make the user select an element from the alist in the variable SYM.
 The keys of the alist are expected to be strings.  The function returns the
 car of the selected association.
-To do this, PROMPT is displayed and and the user must hit a letter key to
+To do this, PROMPT is displayed and the user must hit a letter key to
 select an entry.  If the user does not reply within DELAY seconds, a help
 window with the options is displayed automatically.
 The key which is associated with each option is generated automatically.
@@ -7546,7 +7558,7 @@ The list is cached in `idlwave-class-info' for faster access."
 If RECORD-LINK is non-nil, the keyword text is copied and a text
 property indicating the link is added."
   (let (kwds)
-    (mapcar
+    (mapc
      (lambda (key-list)
        (let ((file (car key-list)))
         (mapcar (lambda (key-cons)
@@ -7594,6 +7606,7 @@ property indicating the link is added."
 (defvar idlwave-current-class-tags nil)
 (defvar idlwave-current-native-class-tags nil)
 (defvar idlwave-sint-class-tags nil)
+(declare-function idlwave-sintern-class-tag "idlwave" t t)
 (idlwave-new-sintern-type 'class-tag)
 (add-to-list 'idlwave-complete-special 'idlwave-complete-class-structure-tag)
 (add-hook 'idlwave-update-rinfo-hook 'idlwave-class-tag-reset)
@@ -7652,6 +7665,8 @@ property indicating the link is added."
 
 (defvar idlwave-sint-sysvars nil)
 (defvar idlwave-sint-sysvartags nil)
+(declare-function idlwave-sintern-sysvar    "idlwave" t t)
+(declare-function idlwave-sintern-sysvartag "idlwave" t t)
 (idlwave-new-sintern-type 'sysvar)
 (idlwave-new-sintern-type 'sysvartag)
 (add-to-list 'idlwave-complete-special 'idlwave-complete-sysvar-or-tag)
@@ -8272,8 +8287,8 @@ demand _EXTRA in the keyword list."
                 (memq (nth 2 entry) super-classes)      ; an inherited class
                 (eq (nth 1 entry) type)                 ; correct type
                 (eq (car entry) name)                   ; correct name
-                (mapcar (lambda (k) (add-to-list 'keywords k))
-                        (idlwave-entry-keywords entry 'do-link))))
+                (mapc (lambda (k) (add-to-list 'keywords k))
+                      (idlwave-entry-keywords entry 'do-link))))
       (setq keywords (idlwave-uniquify keywords)))
 
     ;; Return the final list
@@ -8432,7 +8447,7 @@ If we do not know about MODULE, just return KEYWORD literally."
        (if (null keywords)
            (insert " No keywords accepted.")
          (setq col 9)
-         (mapcar
+         (mapc
           (lambda (x)
             (if (>= (+ col 1 (length (car x)))
                     (window-width))