]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/idlwave.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / progmodes / idlwave.el
index 86b4bea321c972ca9bf26d9da59bd4df6157af7b..4c58919ec1fc04ff4b22491d00437957d44faa3c 100644 (file)
@@ -1,12 +1,13 @@
 ;; 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>
 ;;          Chris Chase <chase@att.com>
 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
-;; Version: 6.0_em22
+;; Version: 6.1_em22
 ;; Keywords: languages
 
 ;; This file is part of GNU Emacs.
@@ -427,11 +428,11 @@ t means to show all source files."
   :type 'integer)
 
 (defcustom idlwave-library-path nil
-  "Library path for Windows and MacOS (OS9).  Not needed under Unix.
+  "Library path for Windows and MacOS (OS9).  Not needed under UNIX.
 When selecting the directories to scan for IDL user catalog routine
 info, IDLWAVE can, under UNIX, query the shell for the exact search
 path \(the value of !PATH).  However, under Windows and MacOS
-(pre-OSX), the IDLWAVE shell does not work.  In this case, this
+\(pre-OSX), the IDLWAVE shell does not work.  In this case, this
 variable can be set to specify the paths where IDLWAVE can find PRO
 files.  The shell will only be asked for a list of paths when this
 variable is nil.  The value is a list of directories.  A directory
@@ -1393,7 +1394,7 @@ Normally a space.")
   "Character which is inserted as a last character on previous line by
    \\[idlwave-split-line] to begin a continuation line.  Normally $.")
 
-(defconst idlwave-mode-version "6.0_em22")
+(defconst idlwave-mode-version "6.1_em22")
 
 (defmacro idlwave-keyword-abbrev (&rest args)
   "Creates a function for abbrev hooks to call `idlwave-check-abbrev' with args."
@@ -1595,7 +1596,8 @@ Capitalize system variables - action only
 (define-key idlwave-mode-map "\C-c\C-t"   'idlwave-find-module-this-file)
 (define-key idlwave-mode-map "\C-c?"      'idlwave-routine-info)
 (define-key idlwave-mode-map "\M-?"       'idlwave-context-help)
-(define-key idlwave-mode-map [(control meta ?\?)] 'idlwave-online-help)
+(define-key idlwave-mode-map [(control meta ?\?)]
+  'idlwave-help-assistant-help-with-topic)
 ;; Pickup both forms of Esc/Meta binding
 (define-key idlwave-mode-map [(meta tab)] 'idlwave-complete)
 (define-key idlwave-mode-map [?\e?\t] 'idlwave-complete)
@@ -1779,7 +1781,7 @@ idlwave-mode-abbrev-table unless TABLE is non-nil."
 
 ;;;###autoload
 (defun idlwave-mode ()
-  "Major mode for editing IDL source files (version 6.0_em22).
+  "Major mode for editing IDL source files (version 6.1_em22).
 
 The main features of this mode are
 
@@ -1940,11 +1942,15 @@ The main features of this mode are
   (set (make-local-variable 'paragraph-ignore-fill-prefix) nil)
   (set (make-local-variable 'parse-sexp-ignore-comments) t)
 
+  ;; ChangeLog
+  (set (make-local-variable 'add-log-current-defun-function)
+       'idlwave-current-routine-fullname)
+
   ;; Set tag table list to use IDLTAGS as file name.
   (if (boundp 'tag-table-alist)
       (add-to-list 'tag-table-alist '("\\.pro$" . "IDLTAGS")))
 
-  ;; Font-lock additions - originally Phil Williams, then Ulrik Dickow
+  ;; Font-lock additions
   ;; 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)
@@ -1969,7 +1975,6 @@ The main features of this mode are
                     ";"
                     '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)
@@ -1980,7 +1985,7 @@ The main features of this mode are
   ;; (make-local-hook 'kill-buffer-hook)
   (add-hook 'kill-buffer-hook 'idlwave-kill-buffer-update nil 'local)
   ;; (make-local-hook 'after-save-hook)
-  ;; (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
+  (add-hook 'after-save-hook 'idlwave-save-buffer-update nil 'local)
   (add-hook 'after-save-hook 'idlwave-revoke-license-to-kill nil 'local)
 
   ;; Setup directories and file, if necessary
@@ -2406,16 +2411,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."
@@ -2522,11 +2529,15 @@ The marks are pushed."
          (message "Could not find doc library header start.")
          (goto-char here)))))
 
+(defun idlwave-current-routine-fullname ()
+  (let ((name (idlwave-current-routine)))
+    (idlwave-make-full-name (nth 2 name) (car name))))
+
 (defun idlwave-current-routine ()
   "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))
@@ -3478,7 +3489,6 @@ 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-start ".")
                (paragraph-separate ".")
                (fill-nobreak-predicate
                 (if (and (idlwave-in-quote)
@@ -3490,8 +3500,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))
@@ -3651,6 +3660,7 @@ location on mark ring so that the user can return to previous point."
          (run-hooks 'idlwave-timestamp-hook))
       (error "No valid DOCLIB header"))))
 
+
 ;;; CJC 3/16/93
 ;;; Interface to expand-region-abbrevs which did not work when the
 ;;; abbrev hook associated with an abbrev moves point backwards
@@ -4332,7 +4342,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
@@ -4644,7 +4654,11 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.")
              props (car (cdr pelem)))
        (cond
         ((eq ptype 'SUPERCLASS)
-         (push (cdr (assq 'name props)) inherits))
+         (let ((pname (cdr (assq 'name props)))
+               (plink (cdr (assq 'link props))))
+           (unless (and (string= pname "None")
+                        (string= plink "None"))
+             (push pname inherits))))
 
         ((eq ptype 'PROPERTY)
          (let ((pname (cdr (assq 'name props)))
@@ -4831,7 +4845,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)
@@ -4892,19 +4908,14 @@ Cache to disk for quick recovery."
         (elem-cnt 0)
         props rinfo msg-cnt elem type nelem class-result alias
         routines routine-aliases statement-aliases sysvar-aliases
-        buf version-string)
+        version-string)
     (if (not (file-exists-p catalog-file))
        (error "No such XML routine info file: %s" catalog-file)
       (if (not (file-readable-p catalog-file))
          (error "Cannot read XML routine info file: %s" catalog-file)))
     (require 'xml)
     (message "Reading XML routine info...")
-    (unwind-protect
-       (progn
-         ;; avoid warnings about read-only files
-         (setq buf (find-file-noselect catalog-file 'nowarn))
-         (setq rinfo (xml-parse-file catalog-file)))
-      (if (bufferp buf) (kill-buffer buf)))
+    (setq rinfo (xml-parse-file catalog-file))
     (message "Reading XML routine info...done")
     (setq rinfo (assq 'CATALOG rinfo))
     (unless rinfo (error "Failed to parse XML routine info"))
@@ -7084,7 +7095,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.
@@ -7713,7 +7724,7 @@ property indicating the link is added."
      ((eq mode 'set)
       (if entry
          (setq link
-               (if (setq target (cdr (assoc word tags)))
+               (if (setq target (cdr (assoc-string word tags t)))
                  (idlwave-substitute-link-target main target)
                main)))) ;; setting dynamic!!!
      (t (error "This should not happen")))))
@@ -7762,8 +7773,7 @@ property indicating the link is added."
 (defun idlwave-class-or-superclass-with-tag (class tag)
   "Find and return the CLASS or one of its superclass with the
 associated TAG, if any."
-  (let ((sclasses (cons class (cdr (assq 'all-inherits
-                                        (idlwave-class-info class)))))
+  (let ((sclasses (cons class (idlwave-all-class-inherits class)))
        cl)
    (catch 'exit
      (while sclasses
@@ -9231,6 +9241,8 @@ Assumes that point is at the beginning of the unit as found by
      "--"
      ["Info" idlwave-info t]
      "--"
+     ["Help with Topic" idlwave-help-assistant-help-with-topic
+      idlwave-help-use-assistant]
      ["Launch IDL Help" idlwave-launch-idlhelp t])))
 
 (defvar idlwave-mode-debug-menu-def