emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/idlw-shell.el


From: John-David T . Smith
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/idlw-shell.el
Date: Sun, 03 Jul 2005 21:51:42 -0400

Index: emacs/lisp/progmodes/idlw-shell.el
diff -c emacs/lisp/progmodes/idlw-shell.el:3.38 
emacs/lisp/progmodes/idlw-shell.el:3.39
*** emacs/lisp/progmodes/idlw-shell.el:3.38     Tue Jun 14 23:20:55 2005
--- emacs/lisp/progmodes/idlw-shell.el  Mon Jul  4 01:51:24 2005
***************
*** 5,11 ****
  ;;          Carsten Dominik <address@hidden>
  ;;          Chris Chase <address@hidden>
  ;; Maintainer: J.D. Smith <address@hidden>
! ;; Version: 5.5
  ;; Keywords: processes
  
  ;; This file is part of GNU Emacs.
--- 5,11 ----
  ;;          Carsten Dominik <address@hidden>
  ;;          Chris Chase <address@hidden>
  ;; Maintainer: J.D. Smith <address@hidden>
! ;; Version: 5.7_22
  ;; Keywords: processes
  
  ;; This file is part of GNU Emacs.
***************
*** 45,51 ****
  ;;
  ;; INSTALLATION:
  ;; =============
! ;;
  ;; Follow the instructions in the INSTALL file of the distribution.
  ;; In short, put this file on your load path and add the following
  ;; lines to your .emacs file:
--- 45,51 ----
  ;;
  ;; INSTALLATION:
  ;; =============
! ;; 
  ;; Follow the instructions in the INSTALL file of the distribution.
  ;; In short, put this file on your load path and add the following
  ;; lines to your .emacs file:
***************
*** 58,66 ****
  ;;
  ;;   The newest version of this file can be found on the maintainers
  ;;   web site.
! ;;
  ;;     http://idlwave.org
! ;;
  ;; DOCUMENTATION
  ;; =============
  ;;
--- 58,66 ----
  ;;
  ;;   The newest version of this file can be found on the maintainers
  ;;   web site.
! ;; 
  ;;     http://idlwave.org
! ;; 
  ;; DOCUMENTATION
  ;; =============
  ;;
***************
*** 77,83 ****
  ;; it is a bug in XEmacs.
  ;; The Debug menu in source buffers *does* display the bindings correctly.
  ;;
! ;;
  ;; CUSTOMIZATION VARIABLES
  ;; =======================
  ;;
--- 77,83 ----
  ;; it is a bug in XEmacs.
  ;; The Debug menu in source buffers *does* display the bindings correctly.
  ;;
! ;; 
  ;; CUSTOMIZATION VARIABLES
  ;; =======================
  ;;
***************
*** 101,112 ****
    (condition-case () (require 'custom) (error nil))
    (if (and (featurep 'custom)
           (fboundp 'custom-declare-variable)
!          (fboundp 'defface))
        ;; We've got what we needed
        (setq idlwave-shell-have-new-custom t)
      ;; We have the old or no custom-library, hack around it!
      (defmacro defgroup (&rest args) nil)
!     (defmacro defcustom (var value doc &rest args)
        `(defvar ,var ,value ,doc))))
  
  ;;; Customizations: idlwave-shell group
--- 101,112 ----
    (condition-case () (require 'custom) (error nil))
    (if (and (featurep 'custom)
           (fboundp 'custom-declare-variable)
!          (fboundp 'defface))     
        ;; We've got what we needed
        (setq idlwave-shell-have-new-custom t)
      ;; We have the old or no custom-library, hack around it!
      (defmacro defgroup (&rest args) nil)
!     (defmacro defcustom (var value doc &rest args) 
        `(defvar ,var ,value ,doc))))
  
  ;;; Customizations: idlwave-shell group
***************
*** 117,127 ****
    :prefix "idlwave-shell"
    :group 'idlwave)
  
! (defcustom idlwave-shell-prompt-pattern "^ ?IDL> "
!   "*Regexp to match IDL prompt at beginning of a line.
! For example, \"^IDL> \" or \"^WAVE> \".
! The \"^\" means beginning of line, and is required.
! This variable is used to initialize `comint-prompt-regexp' in the
  process buffer.
  
  This is a fine thing to set in your `.emacs' file."
--- 117,128 ----
    :prefix "idlwave-shell"
    :group 'idlwave)
  
! (defcustom idlwave-shell-prompt-pattern "^\r? ?IDL> "
!   "*Regexp to match IDL prompt at beginning of a line. 
! For example, \"^\r?IDL> \" or \"^\r?WAVE> \". 
! The \"^\r?\" is needed, to indicate the beginning of the line, with
! optional return character (which IDL seems to output randomly).
! This variable is used to initialize `comint-prompt-regexp' in the 
  process buffer.
  
  This is a fine thing to set in your `.emacs' file."
***************
*** 210,216 ****
    :type 'boolean)
  
  (defcustom idlwave-shell-automatic-electric-debug 'breakpoint
!   "Enter the electric-debug minor mode automatically.
  This occurs at a breakpoint or any other halt.  The mode is exited
  upon return to the main level.  Can be set to 'breakpoint to enter
  electric debug mode only when breakpoints are tripped."
--- 211,217 ----
    :type 'boolean)
  
  (defcustom idlwave-shell-automatic-electric-debug 'breakpoint
!   "Enter the electric-debug minor mode automatically.  
  This occurs at a breakpoint or any other halt.  The mode is exited
  upon return to the main level.  Can be set to 'breakpoint to enter
  electric debug mode only when breakpoints are tripped."
***************
*** 295,301 ****
  is non-nil."
    :group 'idlwave-shell-command-setup
    :type 'file)
! 
  (defcustom idlwave-shell-show-commands
    '(run misc breakpoint)
    "*A list of command types to show output from in the shell.
--- 296,302 ----
  is non-nil."
    :group 'idlwave-shell-command-setup
    :type 'file)
!   
  (defcustom idlwave-shell-show-commands
    '(run misc breakpoint)
    "*A list of command types to show output from in the shell.
***************
*** 306,317 ****
    :type '(choice
          (const everything)
          (set :tag "Checklist" :greedy t
!              (const :tag "All .run and .compile commands"        run)
               (const :tag "All breakpoint commands"               breakpoint)
               (const :tag "All debug and stepping commands"       debug)
               (const :tag "Close, window, retall, etc. commands"  misc))))
  
! (defcustom idlwave-shell-examine-alist
    '(("Print"                  . "print,___")
      ("Help"                   . "help,___")
      ("Structure Help"         . "help,___,/STRUCTURE")
--- 307,318 ----
    :type '(choice
          (const everything)
          (set :tag "Checklist" :greedy t
!              (const :tag "All .run and .compile commands"        run)  
               (const :tag "All breakpoint commands"               breakpoint)
               (const :tag "All debug and stepping commands"       debug)
               (const :tag "Close, window, retall, etc. commands"  misc))))
  
! (defcustom idlwave-shell-examine-alist 
    '(("Print"                  . "print,___")
      ("Help"                   . "help,___")
      ("Structure Help"         . "help,___,/STRUCTURE")
***************
*** 322,335 ****
      ("Ptr Valid"              . "print,ptr_valid(___)")
      ("Widget Valid"     . "print,widget_info(___,/VALID)")
      ("Widget Geometry"  . "help,widget_info(___,/GEOMETRY)"))
!   "Alist of special examine commands for popup selection.
  The keys are used in the selection popup created by
  `idlwave-shell-examine-select', and the corresponding value is sent as
  a command to the shell, with special sequence `___' replaced by the
  expression being examined."
    :group 'idlwave-shell-command-setup
    :type '(repeat
!         (cons
           (string :tag "Label  ")
           (string :tag "Command"))))
  
--- 323,336 ----
      ("Ptr Valid"              . "print,ptr_valid(___)")
      ("Widget Valid"     . "print,widget_info(___,/VALID)")
      ("Widget Geometry"  . "help,widget_info(___,/GEOMETRY)"))
!   "Alist of special examine commands for popup selection.  
  The keys are used in the selection popup created by
  `idlwave-shell-examine-select', and the corresponding value is sent as
  a command to the shell, with special sequence `___' replaced by the
  expression being examined."
    :group 'idlwave-shell-command-setup
    :type '(repeat
!         (cons 
           (string :tag "Label  ")
           (string :tag "Command"))))
  
***************
*** 340,350 ****
    "*Non-nil mean, put output of examine commands in their own buffer."
    :group 'idlwave-shell-command-setup
    :type 'boolean)
! 
  (defcustom idlwave-shell-comint-settings
    '((comint-scroll-to-bottom-on-input . t)
      (comint-scroll-to-bottom-on-output . t)
!     (comint-scroll-show-maximum-output . nil))
  
    "Alist of special settings for the comint variables in the IDLWAVE Shell.
  Each entry is a cons cell with the name of a variable and a value.
--- 341,352 ----
    "*Non-nil mean, put output of examine commands in their own buffer."
    :group 'idlwave-shell-command-setup
    :type 'boolean)
!   
  (defcustom idlwave-shell-comint-settings
    '((comint-scroll-to-bottom-on-input . t)
      (comint-scroll-to-bottom-on-output . t)
!     (comint-scroll-show-maximum-output . nil)
!     (comint-prompt-read-only . t))
  
    "Alist of special settings for the comint variables in the IDLWAVE Shell.
  Each entry is a cons cell with the name of a variable and a value.
***************
*** 403,409 ****
    answer = GET_KBRD(1)
  
  Since the IDLWAVE shell defines the system variable `!IDLWAVE_VERSION',
! you could actually check if you are running under Emacs before printing
  the magic strings.  Here is a procedure which uses this.
  
  Usage:
--- 405,411 ----
    answer = GET_KBRD(1)
  
  Since the IDLWAVE shell defines the system variable `!IDLWAVE_VERSION',
! you could actually check if you are running under Emacs before printing 
  the magic strings.  Here is a procedure which uses this.
  
  Usage:
***************
*** 420,426 ****
        if keyword_set(on) then         print,'<chars>' $
          else if keyword_set(off) then print,'</chars>' $
          else                          print,'<onechar>'
!   endif
  end"
    :group 'idlwave-shell-command-setup
    :type '(list
--- 422,428 ----
        if keyword_set(on) then         print,'<chars>' $
          else if keyword_set(off) then print,'</chars>' $
          else                          print,'<onechar>'
!   endif 
  end"
    :group 'idlwave-shell-command-setup
    :type '(list
***************
*** 428,433 ****
--- 430,440 ----
          (regexp :tag "Char-mode regexp")
          (regexp :tag "Line-mode regexp")))
  
+ (defcustom idlwave-shell-breakpoint-popup-menu t
+   "*If non-nil, provide a menu on mouse-3 on breakpoint lines, and
+ popup help text on the line."
+   :group 'idlwave-shell-command-setup
+   :type 'boolean)
  
  ;; Breakpoint Overlays etc
  (defgroup idlwave-shell-highlighting-and-faces nil
***************
*** 478,487 ****
    :group 'idlwave-shell-highlighting-and-faces
    :type 'string)
  
! (defcustom idlwave-shell-electric-stop-line-face
    (prog1
        (copy-face 'modeline 'idlwave-shell-electric-stop-line-face)
!     (set-face-background 'idlwave-shell-electric-stop-line-face
                         idlwave-shell-electric-stop-color)
      (condition-case nil
        (set-face-foreground 'idlwave-shell-electric-stop-line-face nil)
--- 485,494 ----
    :group 'idlwave-shell-highlighting-and-faces
    :type 'string)
  
! (defcustom idlwave-shell-electric-stop-line-face 
    (prog1
        (copy-face 'modeline 'idlwave-shell-electric-stop-line-face)
!     (set-face-background 'idlwave-shell-electric-stop-line-face 
                         idlwave-shell-electric-stop-color)
      (condition-case nil
        (set-face-foreground 'idlwave-shell-electric-stop-line-face nil)
***************
*** 529,535 ****
    ;; backward-compatibility alias
    (put 'idlwave-shell-bp-face 'face-alias 'idlwave-shell-bp))
  
! (defcustom idlwave-shell-disabled-breakpoint-face
    'idlwave-shell-disabled-bp
    "*The face for disabled breakpoint lines in the source code.
  Allows you to choose the font, color and other properties for
--- 536,542 ----
    ;; backward-compatibility alias
    (put 'idlwave-shell-bp-face 'face-alias 'idlwave-shell-bp))
  
! (defcustom idlwave-shell-disabled-breakpoint-face 
    'idlwave-shell-disabled-bp
    "*The face for disabled breakpoint lines in the source code.
  Allows you to choose the font, color and other properties for
***************
*** 584,601 ****
  
  TYPE is either 'pro' or 'rinfo', and `idlwave-shell-temp-pro-file' or
  `idlwave-shell-temp-rinfo-save-file' is set (respectively)."
!   (cond
     ((eq type 'rinfo)
!     (or idlwave-shell-temp-rinfo-save-file
!       (setq idlwave-shell-temp-rinfo-save-file
              (idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix))))
     ((eq type 'pro)
      (or idlwave-shell-temp-pro-file
!       (setq idlwave-shell-temp-pro-file
              (idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix))))
!    (t (error "Wrong argument (idlwave-shell-temp-file): %s"
             (symbol-name type)))))
! 
  
  (defun idlwave-shell-make-temp-file (prefix)
    "Create a temporary file."
--- 591,608 ----
  
  TYPE is either 'pro' or 'rinfo', and `idlwave-shell-temp-pro-file' or
  `idlwave-shell-temp-rinfo-save-file' is set (respectively)."
!   (cond 
     ((eq type 'rinfo)
!     (or idlwave-shell-temp-rinfo-save-file 
!       (setq idlwave-shell-temp-rinfo-save-file 
              (idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix))))
     ((eq type 'pro)
      (or idlwave-shell-temp-pro-file
!       (setq idlwave-shell-temp-pro-file 
              (idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix))))
!    (t (error "Wrong argument (idlwave-shell-temp-file): %s" 
             (symbol-name type)))))
!     
  
  (defun idlwave-shell-make-temp-file (prefix)
    "Create a temporary file."
***************
*** 623,629 ****
  
  
  (defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur"
!   "Command used by `idlwave-shell-resync-dirs' to query IDL for
  the directory stack.")
  
  (defvar idlwave-shell-path-query 
"print,'PATH:<'+transpose(expand_path(!PATH,/ARRAY))+'>' & 
print,'SYSDIR:<'+!dir+'>'"
--- 630,636 ----
  
  
  (defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur"
!   "Command used by `idlwave-shell-resync-dirs' to query IDL for 
  the directory stack.")
  
  (defvar idlwave-shell-path-query 
"print,'PATH:<'+transpose(expand_path(!PATH,/ARRAY))+'>' & 
print,'SYSDIR:<'+!dir+'>'"
***************
*** 631,637 ****
    "The command which gets !PATH and !DIR info from the shell.")
  
  (defvar idlwave-shell-mode-line-info nil
!   "Additional info displayed in the mode line")
  
  (defvar idlwave-shell-default-directory nil
    "The default directory in the idlwave-shell buffer, of outside use.")
--- 638,644 ----
    "The command which gets !PATH and !DIR info from the shell.")
  
  (defvar idlwave-shell-mode-line-info nil
!   "Additional info displayed in the mode line")  
  
  (defvar idlwave-shell-default-directory nil
    "The default directory in the idlwave-shell buffer, of outside use.")
***************
*** 682,688 ****
            window-system)                ; Window systems always
      (progn
        (setq idlwave-shell-stop-line-overlay (make-overlay 1 1))
!       (overlay-put idlwave-shell-stop-line-overlay
                   'face idlwave-shell-stop-line-face))))
  
   (t
--- 689,695 ----
            window-system)                ; Window systems always
      (progn
        (setq idlwave-shell-stop-line-overlay (make-overlay 1 1))
!       (overlay-put idlwave-shell-stop-line-overlay 
                   'face idlwave-shell-stop-line-face))))
  
   (t
***************
*** 690,696 ****
    (if window-system
        (progn
        (setq idlwave-shell-stop-line-overlay (make-overlay 1 1))
!       (overlay-put idlwave-shell-stop-line-overlay
                     'face idlwave-shell-stop-line-face)))))
  
  ;; Now the expression and output overlays
--- 697,703 ----
    (if window-system
        (progn
        (setq idlwave-shell-stop-line-overlay (make-overlay 1 1))
!       (overlay-put idlwave-shell-stop-line-overlay 
                     'face idlwave-shell-stop-line-face)))))
  
  ;; Now the expression and output overlays
***************
*** 746,757 ****
  (defvar idlwave-shell-ready nil
    "If non-nil can send next command to IDL process.")
  
- (defvar idlwave-shell-wait-for-output nil
-   "Whether to wait for output to accumulate.")
- 
  ;;; The following are the types of messages we attempt to catch to
  ;;; resync our idea of where IDL execution currently is.
! ;;;
  
  (defvar idlwave-shell-halt-frame nil
    "The frame associated with halt/breakpoint messages.")
--- 753,761 ----
  (defvar idlwave-shell-ready nil
    "If non-nil can send next command to IDL process.")
  
  ;;; The following are the types of messages we attempt to catch to
  ;;; resync our idea of where IDL execution currently is.
! ;;; 
  
  (defvar idlwave-shell-halt-frame nil
    "The frame associated with halt/breakpoint messages.")
***************
*** 795,801 ****
  
  (defconst idlwave-shell-electric-debug-help
    "   ==> IDLWAVE Electric Debug Mode Help <==
! 
   Break Point Setting and Clearing:
    b                Set breakpoint ([C-u b] for conditional, [C-n b] nth hit, 
etc.).
    d                Clear nearby breakpoint.
--- 799,805 ----
  
  (defconst idlwave-shell-electric-debug-help
    "   ==> IDLWAVE Electric Debug Mode Help <==
!  
   Break Point Setting and Clearing:
    b                Set breakpoint ([C-u b] for conditional, [C-n b] nth hit, 
etc.).
    d                Clear nearby breakpoint.
***************
*** 821,827 ****
   Examining Expressions (with prefix for examining the region):
    p                Print expression near point or in region ([C-u p]).
    ?          Help on expression near point or in region ([C-u ?]).
!   x          Examine expression near point or in region ([C-u x]) with
               letter completion of the examine type.
  
   Miscellaneous:
--- 825,831 ----
   Examining Expressions (with prefix for examining the region):
    p                Print expression near point or in region ([C-u p]).
    ?          Help on expression near point or in region ([C-u ?]).
!   x          Examine expression near point or in region ([C-u x]) with 
               letter completion of the examine type.
  
   Miscellaneous:
***************
*** 875,892 ****
     `\\[idlwave-routine-info]' displays information about an IDL routine near 
point,
     just like in `idlwave-mode'.  The module used is the one at point or
     the one whose argument list is being edited.
!    To update IDLWAVE's knowledge about compiled or edited modules, use
     \\[idlwave-update-routine-info].
     \\[idlwave-find-module] find the source of a module.
     \\[idlwave-resolve] tells IDL to compile an unresolved module.
     \\[idlwave-context-help] shows the online help on the item at
     point, if online help has been installed.
! 
  
  4. Debugging
     ---------
     A complete set of commands for compiling and debugging IDL programs
!    is available from the menu.  Also keybindings starting with a
     `C-c C-d' prefix are available for most commands in the *idl* buffer
     and also in source buffers.  The best place to learn about the
     keybindings is again the menu.
--- 879,896 ----
     `\\[idlwave-routine-info]' displays information about an IDL routine near 
point,
     just like in `idlwave-mode'.  The module used is the one at point or
     the one whose argument list is being edited.
!    To update IDLWAVE's knowledge about compiled or edited modules, use 
     \\[idlwave-update-routine-info].
     \\[idlwave-find-module] find the source of a module.
     \\[idlwave-resolve] tells IDL to compile an unresolved module.
     \\[idlwave-context-help] shows the online help on the item at
     point, if online help has been installed.
!   
  
  4. Debugging
     ---------
     A complete set of commands for compiling and debugging IDL programs
!    is available from the menu.  Also keybindings starting with a 
     `C-c C-d' prefix are available for most commands in the *idl* buffer
     and also in source buffers.  The best place to learn about the
     keybindings is again the menu.
***************
*** 978,985 ****
    (idlwave-shell-display-line nil)
    (setq idlwave-shell-calling-stack-index 0)
    (setq idlwave-shell-only-prompt-pattern
!       (concat "\\`[ \t\n]*"
!               (substring idlwave-shell-prompt-pattern 1)
                "[ \t\n]*\\'"))
  
    (when idlwave-shell-query-for-class
--- 982,989 ----
    (idlwave-shell-display-line nil)
    (setq idlwave-shell-calling-stack-index 0)
    (setq idlwave-shell-only-prompt-pattern
!       (concat "\\`[ \t\n]*" 
!               (substring idlwave-shell-prompt-pattern 1) 
                "[ \t\n]*\\'"))
  
    (when idlwave-shell-query-for-class
***************
*** 992,1006 ****
    (set-marker comint-last-input-end (point))
    (setq idlwave-idlwave_routine_info-compiled nil)
    (setq idlwave-shell-ready nil)
-   (setq idlwave-shell-wait-for-output nil)
    (setq idlwave-shell-bp-alist nil)
    (idlwave-shell-update-bp-overlays) ; Throw away old overlays
    (setq idlwave-shell-sources-alist nil)
    (setq idlwave-shell-default-directory default-directory)
    (setq idlwave-shell-hide-output nil)
  
-   ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
-   ;;(make-local-hook 'kill-buffer-hook)
    (add-hook 'kill-buffer-hook 'idlwave-shell-kill-shell-buffer-confirm
            nil 'local)
    (add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local)
--- 996,1007 ----
***************
*** 1014,1027 ****
        (while (setq entry (pop list))
        (set (make-local-variable (car entry)) (cdr entry)))))
  
! 
!   (unless (memq 'comint-carriage-motion
                (default-value 'comint-output-filter-functions))
      ;; Strip those pesky ctrl-m's.
      (add-hook 'comint-output-filter-functions
              (lambda (string)
                (when (string-match "\r" string)
!                 (let ((pmark (process-mark (get-buffer-process
                                              (current-buffer)))))
                    (save-excursion
                      ;; bare CR -> delete preceding line
--- 1015,1028 ----
        (while (setq entry (pop list))
        (set (make-local-variable (car entry)) (cdr entry)))))
  
!   
!   (unless (memq 'comint-carriage-motion 
                (default-value 'comint-output-filter-functions))
      ;; Strip those pesky ctrl-m's.
      (add-hook 'comint-output-filter-functions
              (lambda (string)
                (when (string-match "\r" string)
!                 (let ((pmark (process-mark (get-buffer-process 
                                              (current-buffer)))))
                    (save-excursion
                      ;; bare CR -> delete preceding line
***************
*** 1043,1050 ****
    (set (make-local-variable 'comment-start) ";")
    (setq abbrev-mode t)
  
-   ;; NB: `make-local-hook' needed for older/alternative Emacs compatibility
-   ;;(make-local-hook 'post-command-hook)
    (add-hook 'post-command-hook 'idlwave-command-hook nil t)
  
    ;; Read the command history?
--- 1044,1049 ----
***************
*** 1063,1071 ****
    (idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide)
    ;; Turn off IDL's ^d interpreting, and define a system
    ;; variable which knows the version of IDLWAVE
!   (idlwave-shell-send-command
!    (format "defsysv,'!idlwave_version','%s',1"
!          idlwave-mode-version)
     nil 'hide)
    ;; Get the paths if they weren't read in from file
    (if (and (not idlwave-path-alist)
--- 1062,1069 ----
    (idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide)
    ;; Turn off IDL's ^d interpreting, and define a system
    ;; variable which knows the version of IDLWAVE
!   (idlwave-shell-send-command 
!    (format "defsysv,'!idlwave_version','%s',1" idlwave-mode-version)
     nil 'hide)
    ;; Get the paths if they weren't read in from file
    (if (and (not idlwave-path-alist)
***************
*** 1085,1091 ****
        (setq idlwave-system-directory sysdir)
        (put 'idlwave-system-directory 'from-shell t))
      ;; Preserve any existing flags
!     (setq idlwave-path-alist
          (mapcar (lambda (x)
                    (let ((old-entry (assoc x old-path-alist)))
                      (if old-entry
--- 1083,1089 ----
        (setq idlwave-system-directory sysdir)
        (put 'idlwave-system-directory 'from-shell t))
      ;; Preserve any existing flags
!     (setq idlwave-path-alist 
          (mapcar (lambda (x)
                    (let ((old-entry (assoc x old-path-alist)))
                      (if old-entry
***************
*** 1093,1099 ****
                        (list x))))
                  dirs))
      (put 'idlwave-path-alist 'from-shell t)
!     (if idlwave-path-alist
        (if (and idlwave-auto-write-paths
                 (not idlwave-library-path)
                 (not no-write) )
--- 1091,1097 ----
                        (list x))))
                  dirs))
      (put 'idlwave-path-alist 'from-shell t)
!     (if idlwave-path-alist 
        (if (and idlwave-auto-write-paths
                 (not idlwave-library-path)
                 (not no-write) )
***************
*** 1129,1136 ****
                         (frame (selected-frame)))
                     (catch 'exit
                       (while flist
!                        (if (not (eq (car flist)
!                                     idlwave-shell-idl-wframe))
                             (throw 'exit (car flist))
                           (setq flist (cdr flist))))))
                   (make-frame))
--- 1127,1134 ----
                         (frame (selected-frame)))
                     (catch 'exit
                       (while flist
!                        (if (not (eq (car flist) 
!                                     idlwave-shell-idl-wframe)) 
                             (throw 'exit (car flist))
                           (setq flist (cdr flist))))))
                   (make-frame))
***************
*** 1148,1156 ****
            ;; We do not have a source frame, so we use this one.
            (setq idlwave-shell-display-wframe (selected-frame)))
        ;; Return a new frame
!       (setq idlwave-shell-idl-wframe
              (make-frame idlwave-shell-frame-parameters)))))
! 
  ;;;###autoload
  (defun idlwave-shell (&optional arg quick)
    "Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'.
--- 1146,1154 ----
            ;; We do not have a source frame, so we use this one.
            (setq idlwave-shell-display-wframe (selected-frame)))
        ;; Return a new frame
!       (setq idlwave-shell-idl-wframe 
              (make-frame idlwave-shell-frame-parameters)))))
!   
  ;;;###autoload
  (defun idlwave-shell (&optional arg quick)
    "Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'.
***************
*** 1177,1190 ****
          (delete-other-windows))
        (and idlwave-shell-use-dedicated-frame
             (setq idlwave-shell-idl-wframe (selected-frame)))
!       (add-hook 'idlwave-shell-sentinel-hook
                  'save-buffers-kill-emacs t))
  
      ;; A non-nil arg means, we want a dedicated frame.  This will last
      ;; for the current editing session.
      (if arg (setq idlwave-shell-use-dedicated-frame t))
      (if (equal arg '(16)) (setq idlwave-shell-use-dedicated-frame nil))
! 
      ;; Check if the process still exists.  If not, create it.
      (unless (comint-check-proc (idlwave-shell-buffer))
        (let* ((prg (or idlwave-shell-explicit-file-name "idl"))
--- 1175,1188 ----
          (delete-other-windows))
        (and idlwave-shell-use-dedicated-frame
             (setq idlwave-shell-idl-wframe (selected-frame)))
!       (add-hook 'idlwave-shell-sentinel-hook 
                  'save-buffers-kill-emacs t))
  
      ;; A non-nil arg means, we want a dedicated frame.  This will last
      ;; for the current editing session.
      (if arg (setq idlwave-shell-use-dedicated-frame t))
      (if (equal arg '(16)) (setq idlwave-shell-use-dedicated-frame nil))
!     
      ;; Check if the process still exists.  If not, create it.
      (unless (comint-check-proc (idlwave-shell-buffer))
        (let* ((prg (or idlwave-shell-explicit-file-name "idl"))
***************
*** 1211,1219 ****
        (if (eq (selected-frame) (window-frame window))
          (select-window window))))
    ;; Save the paths at the end
!   (add-hook 'idlwave-shell-sentinel-hook
            (lambda ()
!             (if (and
                   idlwave-auto-write-paths
                   idlwave-path-alist
                   (not idlwave-library-path)
--- 1209,1217 ----
        (if (eq (selected-frame) (window-frame window))
          (select-window window))))
    ;; Save the paths at the end
!   (add-hook 'idlwave-shell-sentinel-hook 
            (lambda ()
!             (if (and 
                   idlwave-auto-write-paths
                   idlwave-path-alist
                   (not idlwave-library-path)
***************
*** 1244,1250 ****
      (setq idlwave-shell-show-commands (list type))))
  
  
! (defun idlwave-shell-send-command (&optional cmd pcmd hide preempt
                                             show-if-error)
    "Send a command to IDL process.
  
--- 1242,1248 ----
      (setq idlwave-shell-show-commands (list type))))
  
  
! (defun idlwave-shell-send-command (&optional cmd pcmd hide preempt 
                                             show-if-error)
    "Send a command to IDL process.
  
***************
*** 1265,1282 ****
  `idlwave-shell-pending-commands'.  If PREEMPT is 'wait, wait for all
  output to complete and the next prompt to arrive before returning
  \(useful if you need an answer now\). IDL is considered ready if the
! prompt is present and if `idlwave-shell-ready' is non-nil.
  
  If SHOW-IF-ERROR is non-nil, show the output it it contains an error
  message, independent of what HIDE is set to."
  
  ;  (setq hide nil)  ;  FIXME: turn this on for debugging only
! ;  (if (null cmd)
  ;      (progn
! ;     (message "SENDING Pending commands: %s"
  ;              (prin1-to-string idlwave-shell-pending-commands)))
! ;    (message "SENDING %s|||%s" cmd pcmd))
!   (if (and (symbolp idlwave-shell-show-commands)
           (eq idlwave-shell-show-commands 'everything))
        (setq hide nil))
    (let ((save-buffer (current-buffer))
--- 1263,1280 ----
  `idlwave-shell-pending-commands'.  If PREEMPT is 'wait, wait for all
  output to complete and the next prompt to arrive before returning
  \(useful if you need an answer now\). IDL is considered ready if the
! prompt is present and if `idlwave-shell-ready' is non-nil.  
  
  If SHOW-IF-ERROR is non-nil, show the output it it contains an error
  message, independent of what HIDE is set to."
  
  ;  (setq hide nil)  ;  FIXME: turn this on for debugging only
! ;  (if (null cmd) 
  ;      (progn
! ;     (message "SENDING Pending commands: %s" 
  ;              (prin1-to-string idlwave-shell-pending-commands)))
! ;  (message "SENDING %s|||%s" cmd pcmd))
!   (if (and (symbolp idlwave-shell-show-commands) 
           (eq idlwave-shell-show-commands 'everything))
        (setq hide nil))
    (let ((save-buffer (current-buffer))
***************
*** 1304,1310 ****
                    (append (list (list cmd pcmd hide show-if-error))
                            idlwave-shell-pending-commands)
                  ;; Put at end.
!                 (append idlwave-shell-pending-commands
                          (list (list cmd pcmd hide show-if-error))))))
        ;; Check if IDL ready
        (let ((save-point (point-marker)))
--- 1302,1308 ----
                    (append (list (list cmd pcmd hide show-if-error))
                            idlwave-shell-pending-commands)
                  ;; Put at end.
!                 (append idlwave-shell-pending-commands 
                          (list (list cmd pcmd hide show-if-error))))))
        ;; Check if IDL ready
        (let ((save-point (point-marker)))
***************
*** 1339,1347 ****
              (set-marker comint-last-input-end (point))
              (comint-simple-send proc cmd)
              (setq idlwave-shell-ready nil)
!             (when (equal preempt 'wait) ; Get all the output at once
!               (setq idlwave-shell-wait-for-output t)
!               (accept-process-output proc))))
        (goto-char save-point))
        (set-buffer save-buffer))))
  
--- 1337,1347 ----
              (set-marker comint-last-input-end (point))
              (comint-simple-send proc cmd)
              (setq idlwave-shell-ready nil)
!             (if (equal preempt 'wait) ; Get all the output at once
!               (while (not idlwave-shell-ready)
!                 (when (not (accept-process-output proc 6)) ; long wait
!                   (setq idlwave-shell-pending-commands nil)
!                   (error "Process timed out"))))))
        (goto-char save-point))
        (set-buffer save-buffer))))
  
***************
*** 1353,1359 ****
      (if (or (not (setq buf (get-buffer (idlwave-shell-buffer))))
            (not (setq proc (get-buffer-process buf))))
        (funcall errf "Shell is not running"))
!     (if (equal c ?\C-g)
        (funcall errf "Abort")
        (comint-send-string proc (char-to-string c)))))
  
--- 1353,1359 ----
      (if (or (not (setq buf (get-buffer (idlwave-shell-buffer))))
            (not (setq proc (get-buffer-process buf))))
        (funcall errf "Shell is not running"))
!     (if (equal c ?\C-g)       
        (funcall errf "Abort")
        (comint-send-string proc (char-to-string c)))))
  
***************
*** 1394,1400 ****
      (if idlwave-shell-ready
        (funcall errf "No IDL program seems to be waiting for input"))
  
!     ;; OK, start the loop
      (message "Character mode on:  Sending single chars (`C-g' to exit)")
      (message
       (catch 'exit
--- 1394,1400 ----
      (if idlwave-shell-ready
        (funcall errf "No IDL program seems to be waiting for input"))
  
!     ;; OK, start the loop 
      (message "Character mode on:  Sending single chars (`C-g' to exit)")
      (message
       (catch 'exit
***************
*** 1474,1606 ****
    (setq output (substring output (string-match "\n" output)))
    (while (string-match "\\(\n\\|\\`\\)%.*\\(\n  .*\\)*" output)
      (setq output (replace-match "" nil t output)))
!   (unless
        (string-match idlwave-shell-only-prompt-pattern output)
      output))
  
  (defvar idlwave-shell-hidden-output-buffer " *idlwave-shell-hidden-output*"
    "Buffer containing hidden output from IDL commands.")
  (defvar idlwave-shell-current-state nil)
! 
  (defun idlwave-shell-filter (proc string)
    "Watch for IDL prompt and filter incoming text.
  When the IDL prompt is received executes `idlwave-shell-post-command-hook'
  and then calls `idlwave-shell-send-command' for any pending commands."
    ;; We no longer do the cleanup here - this is done by the process sentinel
!   (when (eq (process-status idlwave-shell-process-name) 'run)
!     ;; OK, process is still running, so we can use it.
!     (let ((data (match-data)) p full-output)
!       (unwind-protect
!           (progn
!           ;; Ring the bell if necessary
!           (while (setq p (string-match "\C-G" string))
!             (ding)
!             (aset string p ?\C-j ))
!             (if idlwave-shell-hide-output
!               (save-excursion
!                 (while (setq p (string-match "\C-M" string))
!                   (aset string p ?\  ))
!                 (set-buffer
!                  (get-buffer-create idlwave-shell-hidden-output-buffer))
!                 (goto-char (point-max))
!                 (insert string))
!             (idlwave-shell-comint-filter proc string))
!             ;; Watch for magic - need to accumulate the current line
!             ;; since it may not be sent all at once.
!             (if (string-match "\n" string)
!               (progn
!                 (if idlwave-shell-use-input-mode-magic
!                     (idlwave-shell-input-mode-magic
!                      (concat idlwave-shell-accumulation string)))
!                 (setq idlwave-shell-accumulation
!                       (substring string
!                                  (progn (string-match "\\(.*[\n\r]+\\)*"
!                                                       string)
!                                         (match-end 0)))))
!               (setq idlwave-shell-accumulation
!                     (concat idlwave-shell-accumulation string)))
! 
! 
  ;;; Test/Debug code
  ;           (save-excursion (set-buffer
  ;                            (get-buffer-create "*idlwave-shell-output*"))
  ;                           (goto-char (point-max))
  ;                           (insert "\nSTRING===>\n" string "\n<====\n"))
! 
!           ;; Check for prompt in current accumulating output
!           (if (setq idlwave-shell-ready
!                     (string-match idlwave-shell-prompt-pattern
!                                   idlwave-shell-accumulation))
!               (progn
!                 ;; Gather the command output
                  (if idlwave-shell-hide-output
!                     (save-excursion
!                       (set-buffer idlwave-shell-hidden-output-buffer)
!                       (setq full-output (buffer-string))
!                       (goto-char (point-max))
!                       (re-search-backward idlwave-shell-prompt-pattern nil t)
!                       (goto-char (match-end 0))
!                       (setq idlwave-shell-command-output
!                             (buffer-substring (point-min) (point)))
!                       (delete-region (point-min) (point)))
!                     (setq idlwave-shell-command-output
!                         (with-current-buffer (process-buffer proc)
!                           (buffer-substring
!                            (save-excursion
!                              (goto-char (process-mark proc))
!                              (beginning-of-line nil)
!                              (point))
!                            comint-last-input-end))))
! 
!                   ;; Scan for state and do post commands - bracket
!                   ;; them with idlwave-shell-ready=nil since they may
!                   ;; call idlwave-shell-send-command themselves.
!                   (let ((idlwave-shell-ready nil))
!                   (idlwave-shell-scan-for-state)
!                   ;; Show the output in the shell if it contains an error
!                   (if idlwave-shell-hide-output
!                       (if (and idlwave-shell-show-if-error
!                                (eq idlwave-shell-current-state 'error))
!                           (idlwave-shell-comint-filter proc full-output)
!                         ;; If it's only *mostly* hidden, filter % lines,
!                         ;; and show anything that remains
!                         (if (eq idlwave-shell-hide-output 'mostly)
!                             (let ((filtered
!                                    (idlwave-shell-filter-hidden-output
!                                     full-output)))
!                               (if filtered
!                                   (idlwave-shell-comint-filter
!                                    proc filtered))))))
! 
!                   ;; Call the post-command hook
!                     (if (listp idlwave-shell-post-command-hook)
!                         (progn
!                         ;(message "Calling list")
!                         ;(prin1 idlwave-shell-post-command-hook)
!                         (eval idlwave-shell-post-command-hook))
!                     ;(message "Calling command function")
!                       (funcall idlwave-shell-post-command-hook))
! 
!                   ;; Reset to default state for next command.
!                     ;; Also we do not want to find this prompt again.
!                     (setq idlwave-shell-accumulation nil
!                           idlwave-shell-command-output nil
!                           idlwave-shell-post-command-hook nil
!                           idlwave-shell-hide-output nil
!                         idlwave-shell-show-if-error nil
!                         idlwave-shell-wait-for-output nil))
!                   ;; Done with post command. Do pending command if
!                   ;; any.
!                   (idlwave-shell-send-command))
!             ;; We didn't get the prompt yet... maybe accept more output
!             (when idlwave-shell-wait-for-output
! ;;; Test/Debug code
! ;             (save-excursion (set-buffer
! ;                              (get-buffer-create "*idlwave-shell-output*"))
! ;                             (goto-char (point-max))
! ;                             (insert "\n<=== WAITING ON OUTPUT ==>\n"))
!                 (accept-process-output proc 1))))
!         (store-match-data data)))))
  
  (defun idlwave-shell-sentinel (process event)
    "The sentinel function for the IDLWAVE shell process."
--- 1474,1596 ----
    (setq output (substring output (string-match "\n" output)))
    (while (string-match "\\(\n\\|\\`\\)%.*\\(\n  .*\\)*" output)
      (setq output (replace-match "" nil t output)))
!   (unless 
        (string-match idlwave-shell-only-prompt-pattern output)
      output))
  
  (defvar idlwave-shell-hidden-output-buffer " *idlwave-shell-hidden-output*"
    "Buffer containing hidden output from IDL commands.")
  (defvar idlwave-shell-current-state nil)
!   
  (defun idlwave-shell-filter (proc string)
    "Watch for IDL prompt and filter incoming text.
  When the IDL prompt is received executes `idlwave-shell-post-command-hook'
  and then calls `idlwave-shell-send-command' for any pending commands."
    ;; We no longer do the cleanup here - this is done by the process sentinel
!   (if (eq (process-status idlwave-shell-process-name) 'run)
!       ;; OK, process is still running, so we can use it.
!       (let ((data (match-data)) p full-output)
!       (unwind-protect
!           (progn
!             ;; Ring the bell if necessary
!             (while (setq p (string-match "\C-G" string))
!               (ding)
!               (aset string p ?\C-j ))
!             (if idlwave-shell-hide-output
!                 (save-excursion
!                   (while (setq p (string-match "\C-M" string))
!                     (aset string p ?\  ))
!                   (set-buffer
!                    (get-buffer-create idlwave-shell-hidden-output-buffer))
!                   (goto-char (point-max))
!                   (insert string))
!               (idlwave-shell-comint-filter proc string))
!             ;; Watch for magic - need to accumulate the current line
!             ;; since it may not be sent all at once.
!             (if (string-match "\n" string)
!                 (progn
!                   (if idlwave-shell-use-input-mode-magic
!                       (idlwave-shell-input-mode-magic
!                        (concat idlwave-shell-accumulation string)))
!                   (setq idlwave-shell-accumulation
!                         (substring string 
!                                    (progn (string-match "\\(.*[\n\r]+\\)*" 
!                                                         string)
!                                           (match-end 0)))))
!               (setq idlwave-shell-accumulation
!                     (concat idlwave-shell-accumulation string)))
!           
!           
  ;;; Test/Debug code
  ;           (save-excursion (set-buffer
  ;                            (get-buffer-create "*idlwave-shell-output*"))
  ;                           (goto-char (point-max))
  ;                           (insert "\nSTRING===>\n" string "\n<====\n"))
!           
!             ;; Check for prompt in current accumulating output
!             (when (setq idlwave-shell-ready
!                         (string-match idlwave-shell-prompt-pattern
!                                       idlwave-shell-accumulation))
!               ;; Gather the command output
!               (if idlwave-shell-hide-output
!                   (save-excursion
!                     (set-buffer idlwave-shell-hidden-output-buffer)
!                     (setq full-output (buffer-string))
!                     (goto-char (point-max))
!                     (re-search-backward idlwave-shell-prompt-pattern nil t)
!                     (goto-char (match-end 0))
!                     (setq idlwave-shell-command-output
!                     (buffer-substring (point-min) (point)))
!                     (delete-region (point-min) (point)))
!                 (setq idlwave-shell-command-output
!                       (with-current-buffer (process-buffer proc)
!                       (buffer-substring
!                        (save-excursion
!                          (goto-char (process-mark proc))
!                          (forward-line 0)
!                          (point))
!                        comint-last-input-end))))
! 
!               ;; Scan for state and do post commands - bracket
!               ;; them with idlwave-shell-ready=nil since they may
!               ;; call idlwave-shell-send-command themselves.
!               (let ((idlwave-shell-ready nil))
!                 (idlwave-shell-scan-for-state)
!                 ;; Show the output in the shell if it contains an error
                  (if idlwave-shell-hide-output
!                     (if (and idlwave-shell-show-if-error
!                              (eq idlwave-shell-current-state 'error))
!                         (idlwave-shell-comint-filter proc full-output)
!                       ;; If it's only *mostly* hidden, filter % lines, 
!                       ;; and show anything that remains
!                       (if (eq idlwave-shell-hide-output 'mostly)
!                           (let ((filtered
!                                  (idlwave-shell-filter-hidden-output 
!                                   full-output)))
!                             (if filtered 
!                                 (idlwave-shell-comint-filter 
!                                  proc filtered))))))
!                   
!                 ;; Call the post-command hook
!                 (if (listp idlwave-shell-post-command-hook)
!                     (progn
!                                       ;(message "Calling list")
!                                       ;(prin1 idlwave-shell-post-command-hook)
!                       (eval idlwave-shell-post-command-hook))
!                                       ;(message "Calling command function")
!                   (funcall idlwave-shell-post-command-hook))
! 
!                 ;; Reset to default state for next command.
!                 ;; Also we do not want to find this prompt again.
!                 (setq idlwave-shell-accumulation nil
!                       idlwave-shell-command-output nil
!                       idlwave-shell-post-command-hook nil
!                       idlwave-shell-hide-output nil
!                       idlwave-shell-show-if-error nil))
!               ;; Done with post command. Do pending command if
!               ;; any.
!               (idlwave-shell-send-command)))
!         (store-match-data data)))))
  
  (defun idlwave-shell-sentinel (process event)
    "The sentinel function for the IDLWAVE shell process."
***************
*** 1616,1622 ****
            (condition-case nil
                (comint-write-input-ring)
              (error nil)))))
! 
      (when (and (> (length (frame-list)) 1)
               (frame-live-p idlwave-shell-idl-wframe))
        (delete-frame idlwave-shell-idl-wframe)
--- 1606,1612 ----
            (condition-case nil
                (comint-write-input-ring)
              (error nil)))))
!           
      (when (and (> (length (frame-list)) 1)
               (frame-live-p idlwave-shell-idl-wframe))
        (delete-frame idlwave-shell-idl-wframe)
***************
*** 1640,1647 ****
  ;; in module and file names.  I am not sure if it will be necessary to
  ;; change this.  Currently it seems to work the way it is.
  (defvar idlwave-shell-syntax-error
!   "^% Syntax error.\\s-*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)"
!   "A regular expression to match an IDL syntax error.
  The 1st pair matches the file name, the second pair matches the line
  number.")
  
--- 1630,1637 ----
  ;; in module and file names.  I am not sure if it will be necessary to
  ;; change this.  Currently it seems to work the way it is.
  (defvar idlwave-shell-syntax-error
!   "^% Syntax error.\\s-*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)" 
!   "A regular expression to match an IDL syntax error.  
  The 1st pair matches the file name, the second pair matches the line
  number.")
  
***************
*** 1649,1664 ****
    "^% .*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)"
    "A regular expression to match any IDL error.")
  
! (defvar idlwave-shell-halting-error
    "^% .*\n\\([^%].*\n\\)*% Execution halted 
at:\\(\\s-*\\S-+\\s-*[0-9]+\\s-*.*\\)\n"
    "A regular expression to match errors which halt execution.")
  
! (defvar idlwave-shell-cant-continue-error
    "^% Can't continue from this point.\n"
    "A regular expression to match errors stepping errors.")
  
  (defvar idlwave-shell-file-line-message
!   (concat
     "\\("                                 ; program name group (1)
     "\\$MAIN\\$\\|"                     ; main level routine
     "\\<[a-zA-Z][a-zA-Z0-9_$:]*"          ; start with a letter followed by 
[..]
--- 1639,1654 ----
    "^% .*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)"
    "A regular expression to match any IDL error.")
  
! (defvar idlwave-shell-halting-error 
    "^% .*\n\\([^%].*\n\\)*% Execution halted 
at:\\(\\s-*\\S-+\\s-*[0-9]+\\s-*.*\\)\n"
    "A regular expression to match errors which halt execution.")
  
! (defvar idlwave-shell-cant-continue-error 
    "^% Can't continue from this point.\n"
    "A regular expression to match errors stepping errors.")
  
  (defvar idlwave-shell-file-line-message
!   (concat 
     "\\("                                 ; program name group (1)
     "\\$MAIN\\$\\|"                     ; main level routine
     "\\<[a-zA-Z][a-zA-Z0-9_$:]*"          ; start with a letter followed by 
[..]
***************
*** 1676,1682 ****
     "\\)"                                 ; end line number group (5)
     )
    "*A regular expression to parse out the file name and line number.
! The 1st group should match the subroutine name.
  The 3rd group is the line number.
  The 5th group is the file name.
  All parts may contain linebreaks surrounded by spaces.  This is important
--- 1666,1672 ----
     "\\)"                                 ; end line number group (5)
     )
    "*A regular expression to parse out the file name and line number.
! The 1st group should match the subroutine name.  
  The 3rd group is the line number.
  The 5th group is the file name.
  All parts may contain linebreaks surrounded by spaces.  This is important
***************
*** 1695,1703 ****
      (cond
       ;; Make sure we have output
       ((not idlwave-shell-command-output))
! 
       ;; First Priority: Syntax and other errors
!      ((or
         (string-match idlwave-shell-syntax-error
                     idlwave-shell-command-output)
         (string-match idlwave-shell-other-error
--- 1685,1693 ----
      (cond
       ;; Make sure we have output
       ((not idlwave-shell-command-output))
!      
       ;; First Priority: Syntax and other errors
!      ((or 
         (string-match idlwave-shell-syntax-error
                     idlwave-shell-command-output)
         (string-match idlwave-shell-other-error
***************
*** 1711,1729 ****
        (setq idlwave-shell-error-last (point)))
        (setq idlwave-shell-current-state 'error)
        (idlwave-shell-goto-next-error))
! 
       ;; Second Priority: Halting errors
       ((string-match idlwave-shell-halting-error
                    idlwave-shell-command-output)
        ;; Grab the file and line state info.
        (setq idlwave-shell-calling-stack-index 0)
        (setq idlwave-shell-halt-frame
!           (idlwave-shell-parse-line
!            (substring idlwave-shell-command-output
                        (match-beginning 2)))
            idlwave-shell-current-state 'error)
        (idlwave-shell-display-line (idlwave-shell-pc-frame)))
! 
       ;; Third Priority: Various types of innocuous HALT and
       ;; TRACEBACK messages.
       ((or (setq trace (string-match idlwave-shell-trace-message-re
--- 1701,1719 ----
        (setq idlwave-shell-error-last (point)))
        (setq idlwave-shell-current-state 'error)
        (idlwave-shell-goto-next-error))
!    
       ;; Second Priority: Halting errors
       ((string-match idlwave-shell-halting-error
                    idlwave-shell-command-output)
        ;; Grab the file and line state info.
        (setq idlwave-shell-calling-stack-index 0)
        (setq idlwave-shell-halt-frame
!           (idlwave-shell-parse-line 
!            (substring idlwave-shell-command-output 
                        (match-beginning 2)))
            idlwave-shell-current-state 'error)
        (idlwave-shell-display-line (idlwave-shell-pc-frame)))
!      
       ;; Third Priority: Various types of innocuous HALT and
       ;; TRACEBACK messages.
       ((or (setq trace (string-match idlwave-shell-trace-message-re
***************
*** 1733,1757 ****
        ;; Grab the file and line state info.
        (setq idlwave-shell-calling-stack-index 0)
        (setq idlwave-shell-halt-frame
!           (idlwave-shell-parse-line
             (substring idlwave-shell-command-output (match-end 0))))
        (setq idlwave-shell-current-state 'halt)
        ;; Don't debug trace messages
        (idlwave-shell-display-line (idlwave-shell-pc-frame) nil
                                  (if trace 'no-debug)))
! 
!      ;; Fourth Priority: Breakpoints
       ((string-match idlwave-shell-break-message
                    idlwave-shell-command-output)
        (setq idlwave-shell-calling-stack-index 0)
!       (setq idlwave-shell-halt-frame
!           (idlwave-shell-parse-line
             (substring idlwave-shell-command-output (match-end 0))))
        ;; We used to count hits on breakpoints
        ;; this is no longer supported since IDL breakpoints
        ;; have learned counting.
        ;; Do breakpoint command processing
!       (let ((bp (assoc
                 (list
                  (nth 0 idlwave-shell-halt-frame)
                  (nth 1 idlwave-shell-halt-frame))
--- 1723,1747 ----
        ;; Grab the file and line state info.
        (setq idlwave-shell-calling-stack-index 0)
        (setq idlwave-shell-halt-frame
!           (idlwave-shell-parse-line 
             (substring idlwave-shell-command-output (match-end 0))))
        (setq idlwave-shell-current-state 'halt)
        ;; Don't debug trace messages
        (idlwave-shell-display-line (idlwave-shell-pc-frame) nil
                                  (if trace 'no-debug)))
!      
!      ;; Fourth Priority: Breakpoints 
       ((string-match idlwave-shell-break-message
                    idlwave-shell-command-output)
        (setq idlwave-shell-calling-stack-index 0)
!       (setq idlwave-shell-halt-frame 
!           (idlwave-shell-parse-line 
             (substring idlwave-shell-command-output (match-end 0))))
        ;; We used to count hits on breakpoints
        ;; this is no longer supported since IDL breakpoints
        ;; have learned counting.
        ;; Do breakpoint command processing
!       (let ((bp (assoc 
                 (list
                  (nth 0 idlwave-shell-halt-frame)
                  (nth 1 idlwave-shell-halt-frame))
***************
*** 1764,1772 ****
          ;; A breakpoint that we did not know about - perhaps it was
          ;; set by the user...  Let's update our list.
          (idlwave-shell-bp-query)))
!       (setq idlwave-shell-current-state 'breakpoint)
        (idlwave-shell-display-line (idlwave-shell-pc-frame)))
! 
       ;; Last Priority: Can't Step errors
       ((string-match idlwave-shell-cant-continue-error
                    idlwave-shell-command-output)
--- 1754,1762 ----
          ;; A breakpoint that we did not know about - perhaps it was
          ;; set by the user...  Let's update our list.
          (idlwave-shell-bp-query)))
!       (setq idlwave-shell-current-state 'breakpoint)      
        (idlwave-shell-display-line (idlwave-shell-pc-frame)))
!      
       ;; Last Priority: Can't Step errors
       ((string-match idlwave-shell-cant-continue-error
                    idlwave-shell-command-output)
***************
*** 1775,1787 ****
       ;; Otherwise, no particular state
       (t (setq idlwave-shell-current-state nil)))))
  
  (defun idlwave-shell-parse-line (string &optional skip-main)
    "Parse IDL message for the subroutine, file name and line number.
  We need to work hard here to remove the stupid line breaks inserted by
  IDL5.  These line breaks can be right in the middle of procedure
  or file names.
  It is very difficult to come up with a robust solution.  This one seems
! to be pretty good though.
  
  Here is in what ways it improves over the previous solution:
  
--- 1765,1778 ----
       ;; Otherwise, no particular state
       (t (setq idlwave-shell-current-state nil)))))
  
+ 
  (defun idlwave-shell-parse-line (string &optional skip-main)
    "Parse IDL message for the subroutine, file name and line number.
  We need to work hard here to remove the stupid line breaks inserted by
  IDL5.  These line breaks can be right in the middle of procedure
  or file names.
  It is very difficult to come up with a robust solution.  This one seems
! to be pretty good though.  
  
  Here is in what ways it improves over the previous solution:
  
***************
*** 1806,1812 ****
        (setq procedure (match-string 1 string)
            number (match-string 3 string)
            file (match-string 5 string))
! 
        ;; Repair the strings
        (setq procedure (idlwave-shell-repair-string procedure))
        (setq number (idlwave-shell-repair-string number))
--- 1797,1803 ----
        (setq procedure (match-string 1 string)
            number (match-string 3 string)
            file (match-string 5 string))
!       
        ;; Repair the strings
        (setq procedure (idlwave-shell-repair-string procedure))
        (setq number (idlwave-shell-repair-string number))
***************
*** 1832,1838 ****
  file name."
    (let ((file1 "") (file2 "") (start 0))
      ;; We scan no further than to the next "^%" line
!     (if (string-match "^%" file)
        (setq file (substring file 0 (match-beginning 0))))
      ;; Take out the line breaks
      (while (string-match "[ \t]*\n[ \t]*" file start)
--- 1823,1829 ----
  file name."
    (let ((file1 "") (file2 "") (start 0))
      ;; We scan no further than to the next "^%" line
!     (if (string-match "^%" file) 
        (setq file (substring file 0 (match-beginning 0))))
      ;; Take out the line breaks
      (while (string-match "[ \t]*\n[ \t]*" file start)
***************
*** 1887,1893 ****
  The size is given by `idlwave-shell-graphics-window-size'."
    (interactive "P")
    (let ((n (if n (prefix-numeric-value n) 0)))
!     (idlwave-shell-send-command
       (apply 'format "window,%d,xs=%d,ys=%d"
            n idlwave-shell-graphics-window-size)
       nil (idlwave-shell-hide-p 'misc) nil t)))
--- 1878,1884 ----
  The size is given by `idlwave-shell-graphics-window-size'."
    (interactive "P")
    (let ((n (if n (prefix-numeric-value n) 0)))
!     (idlwave-shell-send-command 
       (apply 'format "window,%d,xs=%d,ys=%d"
            n idlwave-shell-graphics-window-size)
       nil (idlwave-shell-hide-p 'misc) nil t)))
***************
*** 1907,1922 ****
  Also get rid of widget events in the queue."
    (interactive "P")
    (save-selected-window
!     ;;if (widget_info(/MANAGED))[0] gt 0 then for 
i=0,n_elements(widget_info(/MANAGED))-1 do 
widget_control,(widget_info(/MANAGED))[i],/clear_events &
!     (idlwave-shell-send-command "retall" nil
!                               (if (idlwave-shell-hide-p 'misc) 'mostly)
                                nil t)
      (idlwave-shell-display-line nil)))
  
  (defun idlwave-shell-closeall (&optional arg)
    "Close all open files."
    (interactive "P")
!   (idlwave-shell-send-command "close,/all" nil
                              (idlwave-shell-hide-p 'misc) nil t))
  
  (defun idlwave-shell-quit (&optional arg)
--- 1898,1913 ----
  Also get rid of widget events in the queue."
    (interactive "P")
    (save-selected-window
!     ;;if (widget_info(/MANAGED))[0] gt 0 then for 
i=0,n_elements(widget_info(/MANAGED))-1 do 
widget_control,(widget_info(/MANAGED))[i],/clear_events & 
!     (idlwave-shell-send-command "retall" nil 
!                               (if (idlwave-shell-hide-p 'misc) 'mostly) 
                                nil t)
      (idlwave-shell-display-line nil)))
  
  (defun idlwave-shell-closeall (&optional arg)
    "Close all open files."
    (interactive "P")
!   (idlwave-shell-send-command "close,/all" nil 
                              (idlwave-shell-hide-p 'misc) nil t))
  
  (defun idlwave-shell-quit (&optional arg)
***************
*** 1932,1938 ****
  
  (defun idlwave-shell-reset (&optional hidden)
    "Reset IDL.  Return to main level and destroy the leftover variables.
! This issues the following commands:
  RETALL
  WIDGET_CONTROL,/RESET
  CLOSE, /ALL
--- 1923,1929 ----
  
  (defun idlwave-shell-reset (&optional hidden)
    "Reset IDL.  Return to main level and destroy the leftover variables.
! This issues the following commands:  
  RETALL
  WIDGET_CONTROL,/RESET
  CLOSE, /ALL
***************
*** 1982,1995 ****
        ;; Set dummy values and kill the text
        (setq sep "@" sep-re "@ *" text "")
        (if idlwave-idlwave_routine_info-compiled
!         (message
!          "Routine Info warning: No match for BEGIN line in \n>>>\n%s\n<<<\n"
           idlwave-shell-command-output)))
      (if (string-match "^>>>END OF IDLWAVE ROUTINE INFO.*" text)
        (setq text (substring text 0 (match-beginning 0)))
        (if idlwave-idlwave_routine_info-compiled
!         (message
!          "Routine Info warning: No match for END line in \n>>>\n%s\n<<<\n"
           idlwave-shell-command-output)))
      (if (string-match "\\S-" text)
        ;; Obviously, the pro worked.  Make a note that we have it now.
--- 1973,1986 ----
        ;; Set dummy values and kill the text
        (setq sep "@" sep-re "@ *" text "")
        (if idlwave-idlwave_routine_info-compiled
!         (message 
!          "Routine Info warning: No match for BEGIN line in \n>>>\n%s\n<<<\n" 
           idlwave-shell-command-output)))
      (if (string-match "^>>>END OF IDLWAVE ROUTINE INFO.*" text)
        (setq text (substring text 0 (match-beginning 0)))
        (if idlwave-idlwave_routine_info-compiled
!         (message 
!          "Routine Info warning: No match for END line in \n>>>\n%s\n<<<\n" 
           idlwave-shell-command-output)))
      (if (string-match "\\S-" text)
        ;; Obviously, the pro worked.  Make a note that we have it now.
***************
*** 2007,2065 ****
            key (nth 4 specs)
            keys (if (and (stringp key)
                          (not (string-match "\\` *\\'" key)))
!                    (mapcar 'list
                             (delete "" (idlwave-split-string key " +")))))
        (setq name (idlwave-sintern-routine-or-method name class t)
            class (idlwave-sintern-class class t)
            file (if (equal file "") nil file)
!           keys (mapcar (lambda (x)
                           (list (idlwave-sintern-keyword (car x) t))) keys))
! 
        ;; In the following ignore routines already defined in buffers,
        ;; assuming that if the buffer stuff differs, it is a "new"
        ;; version, not yet compiled, and should take precedence.
        ;; We could do the same for the library to avoid duplicates -
        ;; but I think frequently a user might have several versions of
!       ;; the same function in different programs, and in this case the
        ;; compiled one will be the best guess of all versions.
        ;; Therefore, we leave duplicates of library routines in.
        (cond ((string= name "$MAIN$"))    ; ignore this one
            ((and (string= type "PRO")
                  ;; FIXME: is it OK to make the buffer routines dominate?
                  (or t (null file)
!                     (not (idlwave-rinfo-assq name 'pro class
                                               idlwave-buffer-routines)))
                  ;; FIXME: is it OK to make the library routines dominate?
!                 ;;(not (idlwave-rinfo-assq name 'pro class
                  ;;                       idlwave-library-routines))
                  )
!            (setq entry (list name 'pro class
!                              (cons 'compiled
                                     (if file
                                         (list
                                          (file-name-nondirectory file)
!                                         (idlwave-sintern-dir
                                           (file-name-directory file)))))
                               cs (cons nil keys)))
!            (if file
                 (push entry idlwave-compiled-routines)
               (push entry idlwave-unresolved-routines)))
! 
            ((and (string= type "FUN")
                  ;; FIXME: is it OK to make the buffer routines dominate?
                  (or t (not file)
!                     (not (idlwave-rinfo-assq name 'fun class
                                               idlwave-buffer-routines)))
                  ;; FIXME: is it OK to make the library routines dominate?
!                 ;; (not (idlwave-rinfo-assq name 'fun class
                  ;;                       idlwave-library-routines))
                  )
!            (setq entry (list name 'fun class
                               (cons 'compiled
                                     (if file
                                         (list
                                          (file-name-nondirectory file)
!                                         (idlwave-sintern-dir
                                           (file-name-directory file)))))
                               cs (cons nil keys)))
             (if file
--- 1998,2056 ----
            key (nth 4 specs)
            keys (if (and (stringp key)
                          (not (string-match "\\` *\\'" key)))
!                    (mapcar 'list 
                             (delete "" (idlwave-split-string key " +")))))
        (setq name (idlwave-sintern-routine-or-method name class t)
            class (idlwave-sintern-class class t)
            file (if (equal file "") nil file)
!           keys (mapcar (lambda (x) 
                           (list (idlwave-sintern-keyword (car x) t))) keys))
!       
        ;; In the following ignore routines already defined in buffers,
        ;; assuming that if the buffer stuff differs, it is a "new"
        ;; version, not yet compiled, and should take precedence.
        ;; We could do the same for the library to avoid duplicates -
        ;; but I think frequently a user might have several versions of
!       ;; the same function in different programs, and in this case the 
        ;; compiled one will be the best guess of all versions.
        ;; Therefore, we leave duplicates of library routines in.
        (cond ((string= name "$MAIN$"))    ; ignore this one
            ((and (string= type "PRO")
                  ;; FIXME: is it OK to make the buffer routines dominate?
                  (or t (null file)
!                     (not (idlwave-rinfo-assq name 'pro class 
                                               idlwave-buffer-routines)))
                  ;; FIXME: is it OK to make the library routines dominate?
!                 ;;(not (idlwave-rinfo-assq name 'pro class 
                  ;;                       idlwave-library-routines))
                  )
!            (setq entry (list name 'pro class 
!                              (cons 'compiled 
                                     (if file
                                         (list
                                          (file-name-nondirectory file)
!                                         (idlwave-sintern-dir 
                                           (file-name-directory file)))))
                               cs (cons nil keys)))
!            (if file 
                 (push entry idlwave-compiled-routines)
               (push entry idlwave-unresolved-routines)))
!           
            ((and (string= type "FUN")
                  ;; FIXME: is it OK to make the buffer routines dominate?
                  (or t (not file)
!                     (not (idlwave-rinfo-assq name 'fun class 
                                               idlwave-buffer-routines)))
                  ;; FIXME: is it OK to make the library routines dominate?
!                 ;; (not (idlwave-rinfo-assq name 'fun class 
                  ;;                       idlwave-library-routines))
                  )
!            (setq entry (list name 'fun class 
                               (cons 'compiled
                                     (if file
                                         (list
                                          (file-name-nondirectory file)
!                                         (idlwave-sintern-dir 
                                           (file-name-directory file)))))
                               cs (cons nil keys)))
             (if file
***************
*** 2076,2082 ****
      (set-buffer (idlwave-shell-buffer))
      (if (string-match ",___cur[\n\r]\\(\\S-*\\) *[\n\r]"
                      idlwave-shell-command-output)
!       (let ((dir (substring idlwave-shell-command-output
                              (match-beginning 1) (match-end 1))))
  ;       (message "Setting Emacs working dir to %s" dir)
          (setq idlwave-shell-default-directory dir)
--- 2067,2073 ----
      (set-buffer (idlwave-shell-buffer))
      (if (string-match ",___cur[\n\r]\\(\\S-*\\) *[\n\r]"
                      idlwave-shell-command-output)
!       (let ((dir (substring idlwave-shell-command-output 
                              (match-beginning 1) (match-end 1))))
  ;       (message "Setting Emacs working dir to %s" dir)
          (setq idlwave-shell-default-directory dir)
***************
*** 2090,2099 ****
        expression)
      (save-excursion
        (goto-char apos)
!       (setq expression (buffer-substring
                        (catch 'exit
                          (while t
!                           (if (not (re-search-backward
                                      "[^][.A-Za-z0-9_() ]" bos t))
                                (throw 'exit bos)) ;ran into bos
                            (if (not (idlwave-is-pointer-dereference bol))
--- 2081,2090 ----
        expression)
      (save-excursion
        (goto-char apos)
!       (setq expression (buffer-substring 
                        (catch 'exit
                          (while t
!                           (if (not (re-search-backward 
                                      "[^][.A-Za-z0-9_() ]" bos t))
                                (throw 'exit bos)) ;ran into bos
                            (if (not (idlwave-is-pointer-dereference bol))
***************
*** 2102,2108 ****
      (when (not (string= expression ""))
        (setq idlwave-shell-get-object-class nil)
        (idlwave-shell-send-command
!        (concat "print,obj_class(" expression ")")
         'idlwave-shell-parse-object-class
         'hide 'wait)
        ;; If we don't know anything about the class, update shell routines
--- 2093,2100 ----
      (when (not (string= expression ""))
        (setq idlwave-shell-get-object-class nil)
        (idlwave-shell-send-command
!        (concat "if obj_valid(" expression ") then print,obj_class(" 
!              expression ")")
         'idlwave-shell-parse-object-class
         'hide 'wait)
        ;; If we don't know anything about the class, update shell routines
***************
*** 2114,2127 ****
  
  (defun idlwave-shell-parse-object-class ()
    "Parse the output of the obj_class command."
!   (let ((match "print,obj_class([^\n\r]+[\n\r ]"))
!     (if (and
!        (not (string-match (concat match match "\\s-*^[\n\r]+"
!                                   "% Syntax error")
!                           idlwave-shell-command-output))
!        (string-match (concat match "\\([A-Za-z_0-9]+\\)")
!                      idlwave-shell-command-output))
!       (setq idlwave-shell-get-object-class
              (match-string 1 idlwave-shell-command-output)))))
  
  (defvar idlwave-sint-sysvars nil)
--- 2106,2116 ----
  
  (defun idlwave-shell-parse-object-class ()
    "Parse the output of the obj_class command."
!   (let ((match "obj_class([^\n\r]+[\n\r ]"))
!     (if (string-match (concat match "\\([A-Za-z_0-9]+\\) *[\n\r]\\(" 
!                             idlwave-shell-prompt-pattern "\\)")
!                     idlwave-shell-command-output)
!       (setq idlwave-shell-get-object-class 
              (match-string 1 idlwave-shell-command-output)))))
  
  (defvar idlwave-sint-sysvars nil)
***************
*** 2135,2141 ****
    (interactive "P")
    (let (exec-cmd)
      (cond
!      ((and
         (setq exec-cmd (idlwave-shell-executive-command))
         (cdr exec-cmd)
         (member (upcase (cdr exec-cmd))
--- 2124,2130 ----
    (interactive "P")
    (let (exec-cmd)
      (cond
!      ((and 
         (setq exec-cmd (idlwave-shell-executive-command))
         (cdr exec-cmd)
         (member (upcase (cdr exec-cmd))
***************
*** 2145,2151 ****
        (idlwave-shell-complete-filename))
  
       ((car-safe exec-cmd)
!       (setq idlwave-completion-help-info
            '(idlwave-shell-complete-execcomm-help))
        (idlwave-complete-in-buffer 'execcomm 'execcomm
                                  idlwave-executive-commands-alist nil
--- 2134,2140 ----
        (idlwave-shell-complete-filename))
  
       ((car-safe exec-cmd)
!       (setq idlwave-completion-help-info 
            '(idlwave-shell-complete-execcomm-help))
        (idlwave-complete-in-buffer 'execcomm 'execcomm
                                  idlwave-executive-commands-alist nil
***************
*** 2164,2170 ****
             (let ((case-fold-search t))
               (not (looking-at ".*obj_new")))))
        (idlwave-shell-complete-filename))
! 
       (t
        ;; Default completion of modules and keywords
        (idlwave-complete arg)))))
--- 2153,2159 ----
             (let ((case-fold-search t))
               (not (looking-at ".*obj_new")))))
        (idlwave-shell-complete-filename))
!      
       (t
        ;; Default completion of modules and keywords
        (idlwave-complete arg)))))
***************
*** 2186,2192 ****
  We assume that we are after a file name when completing one of the
  args of an executive .run, .rnew or .compile."
    ;; CWD might have changed, resync, to set default directory
!   (idlwave-shell-resync-dirs)
    (let ((comint-file-name-chars idlwave-shell-file-name-chars))
      (comint-dynamic-complete-as-filename)))
  
--- 2175,2181 ----
  We assume that we are after a file name when completing one of the
  args of an executive .run, .rnew or .compile."
    ;; CWD might have changed, resync, to set default directory
!   (idlwave-shell-resync-dirs) 
    (let ((comint-file-name-chars idlwave-shell-file-name-chars))
      (comint-dynamic-complete-as-filename)))
  
***************
*** 2227,2233 ****
  
  (defun idlwave-shell-redisplay (&optional hide)
    "Tries to resync the display with where execution has stopped.
! Issues a \"help,/trace\" command followed by a call to
  `idlwave-shell-display-line'.  Also updates the breakpoint
  overlays."
    (interactive)
--- 2216,2222 ----
  
  (defun idlwave-shell-redisplay (&optional hide)
    "Tries to resync the display with where execution has stopped.
! Issues a \"help,/trace\" command followed by a call to 
  `idlwave-shell-display-line'.  Also updates the breakpoint
  overlays."
    (interactive)
***************
*** 2240,2246 ****
    (idlwave-shell-bp-query))
  
  (defun idlwave-shell-display-level-in-calling-stack (&optional hide)
!   (idlwave-shell-send-command
     "help,/trace"
     `(progn
        ;; scanning for the state will reset the stack level - restore it
--- 2229,2235 ----
    (idlwave-shell-bp-query))
  
  (defun idlwave-shell-display-level-in-calling-stack (&optional hide)
!   (idlwave-shell-send-command 
     "help,/trace"
     `(progn
        ;; scanning for the state will reset the stack level - restore it
***************
*** 2271,2284 ****
        (setq idlwave-shell-calling-stack-index nmin
            message (format "%d is the current calling stack level - can't go 
further down"
                            (- nmin)))))
!     (setq idlwave-shell-calling-stack-routine
          (nth 2 (nth idlwave-shell-calling-stack-index stack)))
  
      ;; only edebug if in that mode already
!     (idlwave-shell-display-line
       (nth idlwave-shell-calling-stack-index stack) nil
!      (unless idlwave-shell-electric-debug-mode 'no-debug))
!     (message (or message
                 (format "In routine %s (stack level %d)"
                         idlwave-shell-calling-stack-routine
                         (- idlwave-shell-calling-stack-index))))))
--- 2260,2273 ----
        (setq idlwave-shell-calling-stack-index nmin
            message (format "%d is the current calling stack level - can't go 
further down"
                            (- nmin)))))
!     (setq idlwave-shell-calling-stack-routine 
          (nth 2 (nth idlwave-shell-calling-stack-index stack)))
  
      ;; only edebug if in that mode already
!     (idlwave-shell-display-line 
       (nth idlwave-shell-calling-stack-index stack) nil
!      (unless idlwave-shell-electric-debug-mode 'no-debug)) 
!     (message (or message 
                 (format "In routine %s (stack level %d)"
                         idlwave-shell-calling-stack-routine
                         (- idlwave-shell-calling-stack-index))))))
***************
*** 2309,2315 ****
  (defun idlwave-shell-pc-frame ()
    "Returns the frame for IDL execution."
    (and idlwave-shell-halt-frame
!        (list (nth 0 idlwave-shell-halt-frame)
             (nth 1 idlwave-shell-halt-frame)
             (nth 2 idlwave-shell-halt-frame))))
  
--- 2298,2304 ----
  (defun idlwave-shell-pc-frame ()
    "Returns the frame for IDL execution."
    (and idlwave-shell-halt-frame
!        (list (nth 0 idlwave-shell-halt-frame) 
             (nth 1 idlwave-shell-halt-frame)
             (nth 2 idlwave-shell-halt-frame))))
  
***************
*** 2327,2333 ****
  debug mode."
    (if (not frame)
        ;; Remove stop-line overlay from old position
!       (progn
          (setq overlay-arrow-string nil)
        (setq idlwave-shell-mode-line-info nil)
        (setq idlwave-shell-is-stopped nil)
--- 2316,2322 ----
  debug mode."
    (if (not frame)
        ;; Remove stop-line overlay from old position
!       (progn 
          (setq overlay-arrow-string nil)
        (setq idlwave-shell-mode-line-info nil)
        (setq idlwave-shell-is-stopped nil)
***************
*** 2344,2353 ****
  ;;;
  ;;; buffer : the buffer to display a line in.
  ;;; select-shell: current buffer is the shell.
! ;;;
        (setq idlwave-shell-mode-line-info
            (if (nth 2 frame)
!               (format "[%d:%s]"
                        (- idlwave-shell-calling-stack-index)
                        (nth 2 frame))))
        (let* ((buffer (idlwave-find-file-noselect (car frame) 'shell))
--- 2333,2342 ----
  ;;;
  ;;; buffer : the buffer to display a line in.
  ;;; select-shell: current buffer is the shell.
! ;;; 
        (setq idlwave-shell-mode-line-info
            (if (nth 2 frame)
!               (format "[%d:%s]" 
                        (- idlwave-shell-calling-stack-index)
                        (nth 2 frame))))
        (let* ((buffer (idlwave-find-file-noselect (car frame) 'shell))
***************
*** 2371,2377 ****
            (forward-line 0)
              (setq pos (point))
            (setq idlwave-shell-is-stopped t)
! 
              (if idlwave-shell-stop-line-overlay
                  ;; Move overlay
                (move-overlay idlwave-shell-stop-line-overlay
--- 2360,2366 ----
            (forward-line 0)
              (setq pos (point))
            (setq idlwave-shell-is-stopped t)
!           
              (if idlwave-shell-stop-line-overlay
                  ;; Move overlay
                (move-overlay idlwave-shell-stop-line-overlay
***************
*** 2393,2404 ****
          ;; If we have the column of the error, move the cursor there.
            (if col (move-to-column col))
            (setq pos (point))
! 
          ;; Enter electric debug mode, if not prohibited and not in
          ;; it already
!         (when (and (or
                      (eq idlwave-shell-automatic-electric-debug t)
!                     (and
                       (eq idlwave-shell-automatic-electric-debug 'breakpoint)
                       (not (eq idlwave-shell-current-state 'error))))
                     (not no-debug)
--- 2382,2393 ----
          ;; If we have the column of the error, move the cursor there.
            (if col (move-to-column col))
            (setq pos (point))
!         
          ;; Enter electric debug mode, if not prohibited and not in
          ;; it already
!         (when (and (or 
                      (eq idlwave-shell-automatic-electric-debug t)
!                     (and 
                       (eq idlwave-shell-automatic-electric-debug 'breakpoint)
                       (not (eq idlwave-shell-current-state 'error))))
                     (not no-debug)
***************
*** 2406,2419 ****
                     (not idlwave-shell-electric-debug-mode))
            (idlwave-shell-electric-debug-mode)
            (setq electric t)))
! 
        ;; Make sure pos is really displayed in the window.
        (set-window-point window pos)
! 
!       ;; If we came from the shell, go back there.  Otherwise select
        ;; the window where the error is displayed.
          (if (or (and idlwave-shell-electric-zap-to-file electric)
!               (and (equal (buffer-name) (idlwave-shell-buffer))
                     (not select-shell)))
              (select-window window))))))
  
--- 2395,2408 ----
                     (not idlwave-shell-electric-debug-mode))
            (idlwave-shell-electric-debug-mode)
            (setq electric t)))
!       
        ;; Make sure pos is really displayed in the window.
        (set-window-point window pos)
!       
!       ;; If we came from the shell, go back there.  Otherwise select 
        ;; the window where the error is displayed.
          (if (or (and idlwave-shell-electric-zap-to-file electric)
!               (and (equal (buffer-name) (idlwave-shell-buffer)) 
                     (not select-shell)))
              (select-window window))))))
  
***************
*** 2423,2445 ****
    (interactive "p")
    (or (not arg) (< arg 1)
        (setq arg 1))
!   (idlwave-shell-send-command
     (concat ".s " (if (integerp arg) (int-to-string arg) arg))
     nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t))
  
  (defun idlwave-shell-stepover (arg)
    "Stepover one source line.
! If given prefix argument ARG, step ARG source lines.
  Uses IDL's stepover executive command which does not enter called functions."
    (interactive "p")
    (or (not arg) (< arg 1)
        (setq arg 1))
!   (idlwave-shell-send-command
     (concat ".so " (if (integerp arg) (int-to-string arg) arg))
     nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t))
  
! (defun idlwave-shell-break-here (&optional count cmd condition no-show)
!   "Set breakpoint at current line.
  
  If Count is nil then an ordinary breakpoint is set.  We treat a count
  of 1 as a temporary breakpoint using the ONCE keyword.  Counts greater
--- 2412,2435 ----
    (interactive "p")
    (or (not arg) (< arg 1)
        (setq arg 1))
!   (idlwave-shell-send-command 
     (concat ".s " (if (integerp arg) (int-to-string arg) arg))
     nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t))
  
  (defun idlwave-shell-stepover (arg)
    "Stepover one source line.
! If given prefix argument ARG, step ARG source lines. 
  Uses IDL's stepover executive command which does not enter called functions."
    (interactive "p")
    (or (not arg) (< arg 1)
        (setq arg 1))
!   (idlwave-shell-send-command 
     (concat ".so " (if (integerp arg) (int-to-string arg) arg))
     nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t))
  
! (defun idlwave-shell-break-here (&optional count cmd condition disabled 
!                                          no-show)
!   "Set breakpoint at current line.  
  
  If Count is nil then an ordinary breakpoint is set.  We treat a count
  of 1 as a temporary breakpoint using the ONCE keyword.  Counts greater
***************
*** 2447,2463 ****
  the statement count times.
  
  Optional argument CMD is a list or function to evaluate upon reaching
! the breakpoint."
! 
    (interactive "P")
    (when (listp count)
!     (if (equal (car count) 4)
        (setq condition (read-string "Break Condition: ")))
      (setq count nil))
    (idlwave-shell-set-bp
     ;; Create breakpoint
     (idlwave-shell-bp (idlwave-shell-current-frame)
!                    (list count cmd condition nil)
                     (idlwave-shell-current-module))
     no-show))
  
--- 2437,2453 ----
  the statement count times.
  
  Optional argument CMD is a list or function to evaluate upon reaching
! the breakpoint.  CONDITION is a break condition, and DISABLED, if
! non-nil disables the breakpoint"
    (interactive "P")
    (when (listp count)
!     (if (equal (car count) 4) 
        (setq condition (read-string "Break Condition: ")))
      (setq count nil))
    (idlwave-shell-set-bp
     ;; Create breakpoint
     (idlwave-shell-bp (idlwave-shell-current-frame)
!                    (list count cmd condition disabled)
                     (idlwave-shell-current-module))
     no-show))
  
***************
*** 2467,2480 ****
  Offers to recompile the procedure if we failed.  This usually fixes
  the problem with not being able to set the breakpoint."
    ;; Scan for message
!   (if (and idlwave-shell-command-output
!            (string-match "% BREAKPOINT: *Unable to find code"
!                          idlwave-shell-command-output))
!       ;; Offer to recompile
!       (progn
          (if (progn
                (beep)
!               (y-or-n-p
                 (concat "Okay to recompile file "
                         (idlwave-shell-bp-get bp 'file) " ")))
              ;; Recompile
--- 2457,2470 ----
  Offers to recompile the procedure if we failed.  This usually fixes
  the problem with not being able to set the breakpoint."
    ;; Scan for message
!   (if idlwave-shell-command-output
!       (cond
!        ((string-match "% BREAKPOINT: *Unable to find code"
!                     idlwave-shell-command-output)
!       ;; Offer to recompile
          (if (progn
                (beep)
!               (y-or-n-p 
                 (concat "Okay to recompile file "
                         (idlwave-shell-bp-get bp 'file) " ")))
              ;; Recompile
***************
*** 2482,2498 ****
                ;; Clean up before retrying
                (idlwave-shell-command-failure)
                (idlwave-shell-send-command
!                (concat ".run " (idlwave-shell-bp-get bp 'file)) nil
               (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
                ;; Try setting breakpoint again
                (idlwave-shell-set-bp bp))
            (beep)
            (message "Unable to set breakpoint.")
!           (idlwave-shell-command-failure)
!           )
!         ;; return non-nil if no error found
!         nil)
!     'okay))
  
  (defun idlwave-shell-command-failure ()
    "Do any necessary clean up when an IDL command fails.
--- 2472,2492 ----
                ;; Clean up before retrying
                (idlwave-shell-command-failure)
                (idlwave-shell-send-command
!                (concat ".run " (idlwave-shell-bp-get bp 'file)) nil 
               (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
                ;; Try setting breakpoint again
                (idlwave-shell-set-bp bp))
            (beep)
            (message "Unable to set breakpoint.")
!           (idlwave-shell-command-failure))
!       nil)
! 
!        ((string-match "% Syntax error" idlwave-shell-command-output)
!       (message "Syntax error in condition.")
!       (idlwave-shell-command-failure)
!       nil)
!       
!        (t 'okay))))
  
  (defun idlwave-shell-command-failure ()
    "Do any necessary clean up when an IDL command fails.
***************
*** 2506,2514 ****
  (defun idlwave-shell-cont (&optional no-show)
    "Continue executing."
    (interactive)
!   (idlwave-shell-send-command ".c" (unless no-show
                                     '(idlwave-shell-redisplay 'hide))
!                             (if (idlwave-shell-hide-p 'debug) 'mostly)
                              nil t))
  
  (defun idlwave-shell-go ()
--- 2500,2508 ----
  (defun idlwave-shell-cont (&optional no-show)
    "Continue executing."
    (interactive)
!   (idlwave-shell-send-command ".c" (unless no-show 
                                     '(idlwave-shell-redisplay 'hide))
!                             (if (idlwave-shell-hide-p 'debug) 'mostly) 
                              nil t))
  
  (defun idlwave-shell-go ()
***************
*** 2589,2595 ****
          ((eq force 'enable) (setq disabled t)))
      (when bp
        (setf (nth 3 (cdr (cdr bp))) (not disabled))
!       (idlwave-shell-send-command
         (concat "breakpoint,"
               (if disabled "/enable," "/disable,")
               (int-to-string (idlwave-shell-bp-get bp)))
--- 2583,2589 ----
          ((eq force 'enable) (setq disabled t)))
      (when bp
        (setf (nth 3 (cdr (cdr bp))) (not disabled))
!       (idlwave-shell-send-command 
         (concat "breakpoint,"
               (if disabled "/enable," "/disable,")
               (int-to-string (idlwave-shell-bp-get bp)))
***************
*** 2603,2620 ****
      (while bpl
        (setq disabled (idlwave-shell-bp-get (car bpl) 'disabled))
        (when (idlwave-xor (not disabled) (eq enable 'enable))
!       (idlwave-shell-toggle-enable-current-bp
         (car bpl) (if (eq enable 'enable) 'enable 'disable) no-update)
        (push (car bpl) modified))
        (setq bpl (cdr bpl)))
      (unless no-update (idlwave-shell-bp-query))
      modified))
! 
  (defun idlwave-shell-to-here ()
    "Set a breakpoint with count 1 then continue."
    (interactive)
    (let ((disabled (idlwave-shell-enable-all-bp 'disable 'no-update)))
!     (idlwave-shell-break-here 1 nil nil 'no-show)
      (idlwave-shell-cont 'no-show)
      (idlwave-shell-enable-all-bp 'enable 'no-update disabled))
    (idlwave-shell-redisplay)) ; sync up everything at the end
--- 2597,2614 ----
      (while bpl
        (setq disabled (idlwave-shell-bp-get (car bpl) 'disabled))
        (when (idlwave-xor (not disabled) (eq enable 'enable))
!       (idlwave-shell-toggle-enable-current-bp 
         (car bpl) (if (eq enable 'enable) 'enable 'disable) no-update)
        (push (car bpl) modified))
        (setq bpl (cdr bpl)))
      (unless no-update (idlwave-shell-bp-query))
      modified))
!   
  (defun idlwave-shell-to-here ()
    "Set a breakpoint with count 1 then continue."
    (interactive)
    (let ((disabled (idlwave-shell-enable-all-bp 'disable 'no-update)))
!     (idlwave-shell-break-here 1 nil nil nil 'no-show)
      (idlwave-shell-cont 'no-show)
      (idlwave-shell-enable-all-bp 'enable 'no-update disabled))
    (idlwave-shell-redisplay)) ; sync up everything at the end
***************
*** 2631,2653 ****
  for the first line of the corresponding module.  If MODULE is `t', set
  in the current routine."
    (interactive)
!   (let (module)
!     (save-excursion
!       (skip-chars-backward "a-zA-Z0-9_$")
!       (if (looking-at idlwave-identifier)
!         (setq module (match-string 0))
!       (error "No identifier at point")))
!     (idlwave-shell-send-command
!      idlwave-shell-sources-query
!      `(progn
!       (idlwave-shell-sources-filter)
!       (idlwave-shell-set-bp-in-module ,module))
!      'hide)))
  
  (defun idlwave-shell-set-bp-in-module (module)
    "Set breakpoint in module.  Assumes that `idlwave-shell-sources-alist'
  contains an entry for that module."
!   (let ((source-file (car-safe
                      (cdr-safe
                       (assoc (upcase module)
                              idlwave-shell-sources-alist))))
--- 2625,2643 ----
  for the first line of the corresponding module.  If MODULE is `t', set
  in the current routine."
    (interactive)
!   (let ((module (idlwave-fix-module-if-obj_new (idlwave-what-module))))
!     (if module
!       (progn 
!         (setq module (idlwave-make-full-name (nth 2 module) (car module)))
!         (idlwave-shell-module-source-query module)
!         (idlwave-shell-set-bp-in-module module))
!       (error "No identifier at point"))))
! 
  
  (defun idlwave-shell-set-bp-in-module (module)
    "Set breakpoint in module.  Assumes that `idlwave-shell-sources-alist'
  contains an entry for that module."
!   (let ((source-file (car-safe 
                      (cdr-safe
                       (assoc (upcase module)
                              idlwave-shell-sources-alist))))
***************
*** 2666,2672 ****
        (save-excursion
          (goto-char (point-min))
          (let ((case-fold-search t))
!           (if (re-search-forward
                 (concat "^[ \t]*\\(pro\\|function\\)[ \t]+"
                         (downcase module)
                         "[ \t\n,]") nil t)
--- 2656,2662 ----
        (save-excursion
          (goto-char (point-min))
          (let ((case-fold-search t))
!           (if (re-search-forward 
                 (concat "^[ \t]*\\(pro\\|function\\)[ \t]+"
                         (downcase module)
                         "[ \t\n,]") nil t)
***************
*** 2708,2714 ****
    "Attempt to run until this procedure exits.
  Runs to the last statement and then steps 1 statement.  Use the .out command."
    (interactive)
!   (idlwave-shell-send-command ".o" nil
                              (if (idlwave-shell-hide-p 'debug) 'mostly)
                              nil t))
  
--- 2698,2704 ----
    "Attempt to run until this procedure exits.
  Runs to the last statement and then steps 1 statement.  Use the .out command."
    (interactive)
!   (idlwave-shell-send-command ".o" nil 
                              (if (idlwave-shell-hide-p 'debug) 'mostly)
                              nil t))
  
***************
*** 2755,2761 ****
       (interactive "e")
       (let ((transient-mark-mode t)
           (zmacs-regions t)
!          (tracker (if (featurep 'xemacs)
                        (if (fboundp 'default-mouse-track-event-is-with-button)
                            'idlwave-xemacs-hack-mouse-track
                          'mouse-track)
--- 2745,2751 ----
       (interactive "e")
       (let ((transient-mark-mode t)
           (zmacs-regions t)
!          (tracker (if (featurep 'xemacs) 
                        (if (fboundp 'default-mouse-track-event-is-with-button)
                            'idlwave-xemacs-hack-mouse-track
                          'mouse-track)
***************
*** 2773,2779 ****
    (let ((oldfunc (symbol-function 'default-mouse-track-event-is-with-button)))
      (unwind-protect
        (progn
!         (fset 'default-mouse-track-event-is-with-button
                'idlwave-default-mouse-track-event-is-with-button)
          (mouse-track event))
        (fset 'default-mouse-track-event-is-with-button oldfunc))))
--- 2763,2769 ----
    (let ((oldfunc (symbol-function 'default-mouse-track-event-is-with-button)))
      (unwind-protect
        (progn
!         (fset 'default-mouse-track-event-is-with-button 
                'idlwave-default-mouse-track-event-is-with-button)
          (mouse-track event))
        (fset 'default-mouse-track-event-is-with-button oldfunc))))
***************
*** 2805,2811 ****
  (defvar idlwave-shell-examine-completion-list nil)
  
  (defun idlwave-shell-print (arg &optional help ev complete-help-type)
!   "Print current expression.
  
  With HELP non-nil, show help on expression.  If HELP is a string,
  the expression will be put in place of ___, e.g.:
--- 2795,2801 ----
  (defvar idlwave-shell-examine-completion-list nil)
  
  (defun idlwave-shell-print (arg &optional help ev complete-help-type)
!   "Print current expression.  
  
  With HELP non-nil, show help on expression.  If HELP is a string,
  the expression will be put in place of ___, e.g.:
***************
*** 2838,2848 ****
    (save-excursion
      (let* ((process (get-buffer-process (current-buffer)))
           (process-mark (if process (process-mark process)))
!          (stack-label
            (if (and (integerp idlwave-shell-calling-stack-index)
                     (> idlwave-shell-calling-stack-index 0))
!               (format "  [-%d:%s]"
!                       idlwave-shell-calling-stack-index
                        idlwave-shell-calling-stack-routine)))
           expr beg end cmd examine-hook)
        (cond
--- 2828,2838 ----
    (save-excursion
      (let* ((process (get-buffer-process (current-buffer)))
           (process-mark (if process (process-mark process)))
!          (stack-label 
            (if (and (integerp idlwave-shell-calling-stack-index)
                     (> idlwave-shell-calling-stack-index 0))
!               (format "  [-%d:%s]" 
!                       idlwave-shell-calling-stack-index 
                        idlwave-shell-calling-stack-routine)))
           expr beg end cmd examine-hook)
        (cond
***************
*** 2872,2878 ****
           ;; an array
           (forward-sexp))
         (setq end (point)))))
! 
        ;; Get expression, but first move the begin mark if a
        ;; process-mark is inside the region, to keep the overlay from
        ;; wandering in the Shell.
--- 2862,2868 ----
           ;; an array
           (forward-sexp))
         (setq end (point)))))
!       
        ;; Get expression, but first move the begin mark if a
        ;; process-mark is inside the region, to keep the overlay from
        ;; wandering in the Shell.
***************
*** 2883,2943 ****
  
        ;; Show the overlay(s) and attach any necessary hooks and filters
        (when (and beg end idlwave-shell-expression-overlay)
!       (move-overlay idlwave-shell-expression-overlay beg end
                      (current-buffer))
!       (add-hook 'pre-command-hook
                  'idlwave-shell-delete-expression-overlay))
!       (setq examine-hook
            (if idlwave-shell-separate-examine-output
                'idlwave-shell-examine-display
              'idlwave-shell-examine-highlight))
        (add-hook 'pre-command-hook
                'idlwave-shell-delete-output-overlay)
! 
        ;; Remove empty or comment-only lines
        (while (string-match "\n[ \t]*\\(;.*\\)?\r*\n" expr)
        (setq expr (replace-match "\n" t t expr)))
        ;; Concatenate continuation lines
!       (while (string-match "[ \t]*\\$.*\\(;.*\\)?\\(\n[ \t]*\\|$\\)" expr)
        (setq expr (replace-match "" t t expr)))
        ;; Remove final newline
        (if (string-match "\n[ \t\r]*\\'" expr)
          (setq expr (replace-match "" t t expr)))
! 
        (catch 'exit
        ;; Pop-up or complete on the examine selection list, if appropriate
        (if (or
             complete-help-type
             (and ev idlwave-shell-examine-alist)
             (consp help))
!           (let ((help-cons
                   (if (consp help) help
!                    (assoc
                      ;; A cons from either a pop-up or mini-buffer completion
                      (if complete-help-type
                          (idlwave-one-key-select 'idlwave-shell-examine-alist
                                                  "Examine with: " 1.5)
  ;;                      (idlwave-completing-read
! ;;                       "Examine with: "
  ;;                       idlwave-shell-examine-alist nil nil nil
  ;;                       'idlwave-shell-examine-completion-list
  ;;                       "Print")
!                       (idlwave-popup-select
!                        ev
!                        (mapcar 'car idlwave-shell-examine-alist)
                         "Examine with"))
                      idlwave-shell-examine-alist))))
              (setq help (cdr help-cons))
              (if (null help) (throw 'exit nil))
              (if idlwave-shell-separate-examine-output
!                 (setq idlwave-shell-examine-label
!                       (concat
                         (format "==>%s<==\n%s:" expr (car help-cons))
                         stack-label "\n"))))
          ;; The regular help label (no popups, cons cells, etc.)
          (setq idlwave-shell-examine-label
                (concat
!                (format "==>%s<==\n%s:" expr
                         (cond ((null help) "print")
                               ((stringp help) help)
                               (t (symbol-name help))))
--- 2873,2933 ----
  
        ;; Show the overlay(s) and attach any necessary hooks and filters
        (when (and beg end idlwave-shell-expression-overlay)
!       (move-overlay idlwave-shell-expression-overlay beg end 
                      (current-buffer))
!       (add-hook 'pre-command-hook 
                  'idlwave-shell-delete-expression-overlay))
!       (setq examine-hook 
            (if idlwave-shell-separate-examine-output
                'idlwave-shell-examine-display
              'idlwave-shell-examine-highlight))
        (add-hook 'pre-command-hook
                'idlwave-shell-delete-output-overlay)
!       
        ;; Remove empty or comment-only lines
        (while (string-match "\n[ \t]*\\(;.*\\)?\r*\n" expr)
        (setq expr (replace-match "\n" t t expr)))
        ;; Concatenate continuation lines
!       (while (string-match "[ \t]*\\$[ \t]*\\(;.*\\)?\\(\n[ \t]*\\|$\\)" expr)
        (setq expr (replace-match "" t t expr)))
        ;; Remove final newline
        (if (string-match "\n[ \t\r]*\\'" expr)
          (setq expr (replace-match "" t t expr)))
!       
        (catch 'exit
        ;; Pop-up or complete on the examine selection list, if appropriate
        (if (or
             complete-help-type
             (and ev idlwave-shell-examine-alist)
             (consp help))
!           (let ((help-cons 
                   (if (consp help) help
!                    (assoc 
                      ;; A cons from either a pop-up or mini-buffer completion
                      (if complete-help-type
                          (idlwave-one-key-select 'idlwave-shell-examine-alist
                                                  "Examine with: " 1.5)
  ;;                      (idlwave-completing-read
! ;;                       "Examine with: " 
  ;;                       idlwave-shell-examine-alist nil nil nil
  ;;                       'idlwave-shell-examine-completion-list
  ;;                       "Print")
!                       (idlwave-popup-select 
!                        ev 
!                        (mapcar 'car idlwave-shell-examine-alist) 
                         "Examine with"))
                      idlwave-shell-examine-alist))))
              (setq help (cdr help-cons))
              (if (null help) (throw 'exit nil))
              (if idlwave-shell-separate-examine-output
!                 (setq idlwave-shell-examine-label 
!                       (concat 
                         (format "==>%s<==\n%s:" expr (car help-cons))
                         stack-label "\n"))))
          ;; The regular help label (no popups, cons cells, etc.)
          (setq idlwave-shell-examine-label
                (concat
!                (format "==>%s<==\n%s:" expr 
                         (cond ((null help) "print")
                               ((stringp help) help)
                               (t (symbol-name help))))
***************
*** 2950,2958 ****
                        idlwave-shell-calling-stack-index)))
        (setq cmd (idlwave-shell-help-statement help expr))
        ;;(idlwave-shell-recenter-shell-window)
!       (idlwave-shell-send-command
!        cmd
!        examine-hook
         (if idlwave-shell-separate-examine-output 'hide))))))
  
  (defvar idlwave-shell-examine-window-alist nil
--- 2940,2948 ----
                        idlwave-shell-calling-stack-index)))
        (setq cmd (idlwave-shell-help-statement help expr))
        ;;(idlwave-shell-recenter-shell-window)
!       (idlwave-shell-send-command 
!        cmd 
!        examine-hook 
         (if idlwave-shell-separate-examine-output 'hide))))))
  
  (defvar idlwave-shell-examine-window-alist nil
***************
*** 2979,2987 ****
          (let* ((end (or
                       (re-search-backward idlwave-shell-prompt-pattern nil t)
                       (point-max)))
!                (beg (progn
                        (goto-char
!                        (or (progn (if (re-search-backward
                                         idlwave-shell-prompt-pattern nil t)
                                        (match-end 0)))
                             (point-min)))
--- 2969,2977 ----
          (let* ((end (or
                       (re-search-backward idlwave-shell-prompt-pattern nil t)
                       (point-max)))
!                (beg (progn 
                        (goto-char
!                        (or (progn (if (re-search-backward 
                                         idlwave-shell-prompt-pattern nil t)
                                        (match-end 0)))
                             (point-min)))
***************
*** 2998,3018 ****
        (setq buffer-read-only t)
        (move-overlay idlwave-shell-output-overlay cur-beg cur-end
                      (current-buffer))
! 
        ;; Look for the examine buffer in all windows.  If one is
        ;; found in a frame all by itself, use that, otherwise, switch
        ;; to or create an examine window in this frame, and resize if
        ;; it's a newly created window
        (let* ((winlist (get-buffer-window-list "*Examine*" nil 'visible)))
!         (setq win (idlwave-display-buffer
!                    "*Examine*"
                     nil
                     (let ((list winlist) thiswin)
                       (catch 'exit
                         (save-selected-window
                           (while (setq thiswin (pop list))
                             (select-window thiswin)
!                            (if (one-window-p)
                                 (throw 'exit (window-frame thiswin)))))))))
          (set-window-start win (point-min)) ; Ensure the point is visible.
          (save-selected-window
--- 2988,3008 ----
        (setq buffer-read-only t)
        (move-overlay idlwave-shell-output-overlay cur-beg cur-end
                      (current-buffer))
!       
        ;; Look for the examine buffer in all windows.  If one is
        ;; found in a frame all by itself, use that, otherwise, switch
        ;; to or create an examine window in this frame, and resize if
        ;; it's a newly created window
        (let* ((winlist (get-buffer-window-list "*Examine*" nil 'visible)))
!         (setq win (idlwave-display-buffer 
!                    "*Examine*" 
                     nil
                     (let ((list winlist) thiswin)
                       (catch 'exit
                         (save-selected-window
                           (while (setq thiswin (pop list))
                             (select-window thiswin)
!                            (if (one-window-p) 
                                 (throw 'exit (window-frame thiswin)))))))))
          (set-window-start win (point-min)) ; Ensure the point is visible.
          (save-selected-window
***************
*** 3033,3039 ****
                ;; And add the new value.
                (if (setq elt (assoc win idlwave-shell-examine-window-alist))
                    (setcdr elt (window-height))
!                 (add-to-list 'idlwave-shell-examine-window-alist
                               (cons win (window-height)))))))))
        ;; Recenter for maximum output, after widened
        (save-selected-window
--- 3023,3029 ----
                ;; And add the new value.
                (if (setq elt (assoc win idlwave-shell-examine-window-alist))
                    (setcdr elt (window-height))
!                 (add-to-list 'idlwave-shell-examine-window-alist 
                               (cons win (window-height)))))))))
        ;; Recenter for maximum output, after widened
        (save-selected-window
***************
*** 3051,3057 ****
  
  (defun idlwave-shell-examine-display-clear ()
    (interactive)
!   (save-excursion
      (let ((buf (get-buffer "*Examine*")))
        (when (bufferp buf)
        (set-buffer buf)
--- 3041,3047 ----
  
  (defun idlwave-shell-examine-display-clear ()
    (interactive)
!   (save-excursion 
      (let ((buf (get-buffer "*Examine*")))
        (when (bufferp buf)
        (set-buffer buf)
***************
*** 3072,3107 ****
  versions of IDL."
    (let ((fetch (- 0 level))
        (start 0)
!         var rnvar pre post)
  
      ;; FIXME: In the following we try to find the variables in expression
      ;; This is quite empirical - I don't know in what situations this will
      ;; break.  We will look for identifiers and exclude cases where we
      ;; know it is not a variable.  To distinguish array references from
      ;; function calls, we require that arrays use [] instead of ()
! 
      (while (string-match
            "\\(\\`\\|[^a-zA-Z0-9$_][ \t]*\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)\\([ 
\t]*[^a-zA-Z0-9$_]\\|\\'\\)" expr start)
        (setq var (match-string 2 expr)
!           start (match-beginning 2)
            pre (substring expr 0 (match-beginning 2))
            post (substring expr (match-end 2)))
!       (cond
!        ;; Exclude identifiers which are not variables
!        ((string-match ",[ \t]*/\\'" pre))        ;; a `/' KEYWORD
!        ((and (string-match "[,(][ \t]*\\'" pre)
!            (string-match "\\`[ \t]*=" post)))  ;; a `=' KEYWORD
!        ((string-match "\\`(" post))              ;; a function
!        ((string-match "->[ \t]*\\'" pre))        ;; a method
!        ((string-match "\\.\\'" pre))             ;; structure member
         ((and (string-match "\\([\"\']\\)[^\1]*$" pre)
!            (string-match (concat "^[^" (match-string 1 pre) "]*"
!                                  (match-string 1 pre)) post)))
!        (t ;; seems to be a variable - replace its name in the
!         ;; expression with the fetch.
!       (setq rnvar (format "(routine_names('%s',fetch=%d))" var fetch)
!             expr  (concat pre rnvar post)
!             start (+ start (length rnvar))))))
      expr))
  
  
--- 3062,3119 ----
  versions of IDL."
    (let ((fetch (- 0 level))
        (start 0)
!         var fetch-start fetch-end pre post)
  
      ;; FIXME: In the following we try to find the variables in expression
      ;; This is quite empirical - I don't know in what situations this will
      ;; break.  We will look for identifiers and exclude cases where we
      ;; know it is not a variable.  To distinguish array references from
      ;; function calls, we require that arrays use [] instead of ()
!     
      (while (string-match
            "\\(\\`\\|[^a-zA-Z0-9$_][ \t]*\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)\\([ 
\t]*[^a-zA-Z0-9$_]\\|\\'\\)" expr start)
        (setq var (match-string 2 expr)
!           start (match-end 2)
            pre (substring expr 0 (match-beginning 2))
            post (substring expr (match-end 2)))
!       (cond 
!        ((or
!       ;; Exclude identifiers which are not variables
!        (string-match ",[ \t$\n]*/\\'" pre)        ;; a `/' KEYWORD
!        (and (string-match "[,(][ \t\n]*\\'" pre)
!             (string-match "\\`[ \t]*=" post))  ;; a `=' KEYWORD
!        (string-match "\\`(" post)              ;; a function
!        (string-match "->[ \t]*\\'" pre)        ;; a method
!        (string-match "\\.\\'" pre)))             ;; structure member
! 
!        ;; Skip over strings
         ((and (string-match "\\([\"\']\\)[^\1]*$" pre)
!            (string-match (concat "^[^" (match-string 1 pre) "]*" 
!                                  (match-string 1 pre)) post))
!       (setq start (+ start (match-end 0))))
! 
!        
!        ;; seems to be a variable - delimit its name
!        (t 
!       (put-text-property start (- start (length var)) 'fetch t expr))))
! 
!     (setq start 0)
!     (while (setq fetch-start
!                (next-single-property-change start 'fetch expr))
!       (if (get-text-property start 'fetch expr) ; it's on in range
!         (setq fetch-end fetch-start ;it's off in range
!               fetch-start start)
!       (setq fetch-end (next-single-property-change fetch-start 'fetch expr)))
!       (unless fetch-end (setq fetch-end (length expr)))
!       (remove-text-properties fetch-start fetch-end '(fetch) expr)
!       (setq expr (concat (substring expr 0 fetch-start)
!                        (format "(routine_names('%s',fetch=%d))" 
!                                (substring expr fetch-start fetch-end)
!                                fetch)
!                        (substring expr fetch-end)))
!       (setq start fetch-end))
!     (if (get-text-property 0 'fetch expr) ; Full expression, left over
!       (setq expr (format "(routine_names('%s',fetch=%d))" expr fetch)))
      expr))
  
  
***************
*** 3113,3125 ****
  size(___,/DIMENSIONS)"
    (cond
     ((null help) (concat "print, " expr))
!    ((stringp help)
      (if (string-match "\\(^\\|[^_]\\)\\(___\\)\\([^_]\\|$\\)" help)
        (concat (substring help 0 (match-beginning 2))
                expr
                (substring help (match-end 2)))))
     (t (concat "help, " expr))))
! 
  
  (defun idlwave-shell-examine-highlight ()
    "Highlight the most recent IDL output."
--- 3125,3137 ----
  size(___,/DIMENSIONS)"
    (cond
     ((null help) (concat "print, " expr))
!    ((stringp help) 
      (if (string-match "\\(^\\|[^_]\\)\\(___\\)\\([^_]\\|$\\)" help)
        (concat (substring help 0 (match-beginning 2))
                expr
                (substring help (match-end 2)))))
     (t (concat "help, " expr))))
!    
  
  (defun idlwave-shell-examine-highlight ()
    "Highlight the most recent IDL output."
***************
*** 3127,3133 ****
         (process (get-buffer-process buffer))
         (process-mark (if process (process-mark process)))
         output-begin output-end)
!     (save-excursion
        (set-buffer buffer)
        (goto-char process-mark)
        (beginning-of-line)
--- 3139,3145 ----
         (process (get-buffer-process buffer))
         (process-mark (if process (process-mark process)))
         output-begin output-end)
!     (save-excursion 
        (set-buffer buffer)
        (goto-char process-mark)
        (beginning-of-line)
***************
*** 3135,3146 ****
        (re-search-backward idlwave-shell-prompt-pattern nil t)
        (beginning-of-line 2)
        (setq output-begin (point)))
! 
      ;; First make sure the shell window is visible
      (idlwave-display-buffer (idlwave-shell-buffer)
                            nil (idlwave-shell-shell-frame))
      (if (and idlwave-shell-output-overlay process-mark)
!       (move-overlay idlwave-shell-output-overlay
                      output-begin output-end buffer))))
  
  (defun idlwave-shell-delete-output-overlay ()
--- 3147,3158 ----
        (re-search-backward idlwave-shell-prompt-pattern nil t)
        (beginning-of-line 2)
        (setq output-begin (point)))
!           
      ;; First make sure the shell window is visible
      (idlwave-display-buffer (idlwave-shell-buffer)
                            nil (idlwave-shell-shell-frame))
      (if (and idlwave-shell-output-overlay process-mark)
!       (move-overlay idlwave-shell-output-overlay 
                      output-begin output-end buffer))))
  
  (defun idlwave-shell-delete-output-overlay ()
***************
*** 3151,3157 ****
            (delete-overlay idlwave-shell-output-overlay))
        (error nil))
      (remove-hook 'pre-command-hook 'idlwave-shell-delete-output-overlay)))
! 
  (defun idlwave-shell-delete-expression-overlay ()
    (unless (or (eq this-command 'idlwave-shell-mouse-nop)
              (eq this-command 'handle-switch-frame))
--- 3163,3169 ----
            (delete-overlay idlwave-shell-output-overlay))
        (error nil))
      (remove-hook 'pre-command-hook 'idlwave-shell-delete-output-overlay)))
!   
  (defun idlwave-shell-delete-expression-overlay ()
    (unless (or (eq this-command 'idlwave-shell-mouse-nop)
              (eq this-command 'handle-switch-frame))
***************
*** 3180,3186 ****
  count - number of times to execute breakpoint. When count reaches 0
    the breakpoint is cleared and removed from the alist.
  
! command - command to execute when breakpoint is reached, either a
    lisp function to be called with `funcall' with no arguments or a
    list to be evaluated with `eval'.
  
--- 3192,3198 ----
  count - number of times to execute breakpoint. When count reaches 0
    the breakpoint is cleared and removed from the alist.
  
! command - command to execute when breakpoint is reached, either a 
    lisp function to be called with `funcall' with no arguments or a
    list to be evaluated with `eval'.
  
***************
*** 3213,3223 ****
            (insert "\nend\n"))
        (save-buffer 0)))
    (idlwave-shell-send-command (concat ".run " idlwave-shell-temp-pro-file)
!                             nil
                              (if (idlwave-shell-hide-p 'run) 'mostly)
                              nil t)
    (if n
!       (idlwave-display-buffer (idlwave-shell-buffer)
                              nil (idlwave-shell-shell-frame))))
  
  (defun idlwave-shell-evaluate-region (beg end &optional n)
--- 3225,3235 ----
            (insert "\nend\n"))
        (save-buffer 0)))
    (idlwave-shell-send-command (concat ".run " idlwave-shell-temp-pro-file)
!                             nil 
                              (if (idlwave-shell-hide-p 'run) 'mostly)
                              nil t)
    (if n
!       (idlwave-display-buffer (idlwave-shell-buffer) 
                              nil (idlwave-shell-shell-frame))))
  
  (defun idlwave-shell-evaluate-region (beg end &optional n)
***************
*** 3228,3234 ****
    (interactive "r\nP")
    (idlwave-shell-send-command (buffer-substring beg end))
    (if n
!       (idlwave-display-buffer (idlwave-shell-buffer)
                              nil (idlwave-shell-shell-frame))))
  
  (defun idlwave-shell-delete-temp-files ()
--- 3240,3246 ----
    (interactive "r\nP")
    (idlwave-shell-send-command (buffer-substring beg end))
    (if n
!       (idlwave-display-buffer (idlwave-shell-buffer) 
                              nil (idlwave-shell-shell-frame))))
  
  (defun idlwave-shell-delete-temp-files ()
***************
*** 3283,3289 ****
                              'hide))
  
  (defun idlwave-shell-bp-get (bp &optional item)
!   "Get a value for a breakpoint.
  BP has the form of elements in idlwave-shell-bp-alist.  Optional
  second arg ITEM is the particular value to retrieve.  ITEM can be
  'file, 'line, 'index, 'module, 'count, 'cmd, 'condition, 'disabled or
--- 3295,3301 ----
                              'hide))
  
  (defun idlwave-shell-bp-get (bp &optional item)
!   "Get a value for a breakpoint.  
  BP has the form of elements in idlwave-shell-bp-alist.  Optional
  second arg ITEM is the particular value to retrieve.  ITEM can be
  'file, 'line, 'index, 'module, 'count, 'cmd, 'condition, 'disabled or
***************
*** 3318,3325 ****
          ;; Searching the breakpoints
          ;; In IDL 5.5, the breakpoint reporting format changed.
          (bp-re54 "^[ \t]*\\([0-9]+\\)[ \t]+\\(\\S-+\\)?[ \t]+\\([0-9]+\\)[ 
\t]+\\(\\S-+\\)")
!         (bp-re55
!          (concat
            "^\\s-*\\([0-9]+\\)"    ; 1 index
            "\\s-+\\([0-9]+\\)"     ; 2 line number
            "\\s-+\\(Uncompiled\\|" ; 3-6 either uncompiled or routine name
--- 3330,3337 ----
          ;; Searching the breakpoints
          ;; In IDL 5.5, the breakpoint reporting format changed.
          (bp-re54 "^[ \t]*\\([0-9]+\\)[ \t]+\\(\\S-+\\)?[ \t]+\\([0-9]+\\)[ 
\t]+\\(\\S-+\\)")
!         (bp-re55 
!          (concat 
            "^\\s-*\\([0-9]+\\)"    ; 1 index
            "\\s-+\\([0-9]+\\)"     ; 2 line number
            "\\s-+\\(Uncompiled\\|" ; 3-6 either uncompiled or routine name
***************
*** 3334,3344 ****
          bp-re indmap)
        (setq idlwave-shell-bp-alist (list nil))
        ;; Search for either header type, and set the correct regexp
!       (when (or
             (if (re-search-forward "^\\s-*Index.*\n\\s-*-" nil t)
!                (setq bp-re bp-re54    ; versions <= 5.4
                       indmap '(1 2 3 4))) ;index module line file
!            (if (re-search-forward
                  "^\\s-*Index\\s-*Line\\s-*Attributes\\s-*File" nil t)
                 (setq bp-re bp-re55    ; versions >= 5.5
                       indmap '(1 6 2 16)))) ; index module line file
--- 3346,3356 ----
          bp-re indmap)
        (setq idlwave-shell-bp-alist (list nil))
        ;; Search for either header type, and set the correct regexp
!       (when (or 
             (if (re-search-forward "^\\s-*Index.*\n\\s-*-" nil t)
!                (setq bp-re bp-re54    ; versions <= 5.4 
                       indmap '(1 2 3 4))) ;index module line file
!            (if (re-search-forward 
                  "^\\s-*Index\\s-*Line\\s-*Attributes\\s-*File" nil t)
                 (setq bp-re bp-re55    ; versions >= 5.5
                       indmap '(1 6 2 16)))) ; index module line file
***************
*** 3349,3360 ****
                line (string-to-number (match-string (nth 2 indmap)))
                file (idlwave-shell-file-name (match-string (nth 3 indmap))))
          (if (eq bp-re bp-re55)
!             (setq count (if (match-string 10) 1
                            (if (match-string 8)
                                (string-to-number (match-string 8))))
                    condition (match-string 13)
                    disabled (not (null (match-string 15)))))
! 
          ;; Add the breakpoint info to the list
          (nconc idlwave-shell-bp-alist
                 (list (cons (list file line)
--- 3361,3372 ----
                line (string-to-number (match-string (nth 2 indmap)))
                file (idlwave-shell-file-name (match-string (nth 3 indmap))))
          (if (eq bp-re bp-re55)
!             (setq count (if (match-string 10) 1 
                            (if (match-string 8)
                                (string-to-number (match-string 8))))
                    condition (match-string 13)
                    disabled (not (null (match-string 15)))))
!                   
          ;; Add the breakpoint info to the list
          (nconc idlwave-shell-bp-alist
                 (list (cons (list file line)
***************
*** 3364,3370 ****
                              count nil condition disabled))))))
        (setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist))
        ;; Update breakpoint data
!       (if (eq bp-re bp-re54)
          (mapcar 'idlwave-shell-update-bp old-bp-alist)
        (mapcar 'idlwave-shell-update-bp-command-only old-bp-alist))))
    ;; Update the breakpoint overlays
--- 3376,3382 ----
                              count nil condition disabled))))))
        (setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist))
        ;; Update breakpoint data
!       (if (eq bp-re bp-re54) 
          (mapcar 'idlwave-shell-update-bp old-bp-alist)
        (mapcar 'idlwave-shell-update-bp-command-only old-bp-alist))))
    ;; Update the breakpoint overlays
***************
*** 3379,3386 ****
    "Update BP data in breakpoint list.
  If BP frame is in `idlwave-shell-bp-alist' updates the breakpoint data."
    (let ((match (assoc (car bp) idlwave-shell-bp-alist)))
!     (if match
!       (if command-only
            (setf (nth 1 (cdr (cdr match))) (nth 1 (cdr (cdr match))))
          (setcdr (cdr match) (cdr (cdr bp)))))))
  
--- 3391,3398 ----
    "Update BP data in breakpoint list.
  If BP frame is in `idlwave-shell-bp-alist' updates the breakpoint data."
    (let ((match (assoc (car bp) idlwave-shell-bp-alist)))
!     (if match 
!       (if command-only 
            (setf (nth 1 (cdr (cdr match))) (nth 1 (cdr (cdr match))))
          (setcdr (cdr match) (cdr (cdr bp)))))))
  
***************
*** 3405,3446 ****
    (let*
        ((bp-file (idlwave-shell-bp-get bp 'file))
         (bp-module (idlwave-shell-bp-get bp 'module))
!        (internal-file-list
!       (cdr (assoc bp-module idlwave-shell-sources-alist))))
      (if (and internal-file-list
             (equal bp-file (nth 0 internal-file-list)))
          (nth 1 internal-file-list)
        bp-file)))
  
  (defun idlwave-shell-set-bp (bp &optional no-show)
!   "Try to set a breakpoint BP.
  The breakpoint will be placed at the beginning of the statement on the
  line specified by BP or at the next IDL statement if that line is not
  a statement.  Determines IDL's internal representation for the
  breakpoint, which may have occurred at a different line than
  specified.  If NO-SHOW is non-nil, don't do any updating."
    ;; Get and save the old breakpoints
!   (idlwave-shell-send-command
     idlwave-shell-bp-query
     `(progn
       (idlwave-shell-filter-bp (quote ,no-show))
       (setq idlwave-shell-old-bp idlwave-shell-bp-alist))
     'hide)
-   ;; Get sources for IDL compiled procedures followed by setting
-   ;; breakpoint.
-   (idlwave-shell-send-command
-    idlwave-shell-sources-query
-    `(progn
-      (idlwave-shell-sources-filter)
-      (idlwave-shell-set-bp2 (quote ,bp) (quote ,no-show)))
-    'hide))
  
! (defun idlwave-shell-set-bp2 (bp &optional no-show)
!   "Use results of breakpoint and sources query to set bp.
! Use the count argument with IDLs breakpoint command.
! We treat a count of 1 as a temporary breakpoint.
! Counts greater than 1 use the IDL AFTER=count keyword to break
! only after reaching the statement count times."
    (let*
        ((arg (idlwave-shell-bp-get bp 'count))
         (key (cond
--- 3417,3447 ----
    (let*
        ((bp-file (idlwave-shell-bp-get bp 'file))
         (bp-module (idlwave-shell-bp-get bp 'module))
!        (internal-file-list 
!       (if bp-module
!           (cdr (assoc bp-module idlwave-shell-sources-alist)))))
      (if (and internal-file-list
             (equal bp-file (nth 0 internal-file-list)))
          (nth 1 internal-file-list)
        bp-file)))
  
  (defun idlwave-shell-set-bp (bp &optional no-show)
!   "Try to set a breakpoint BP.  
  The breakpoint will be placed at the beginning of the statement on the
  line specified by BP or at the next IDL statement if that line is not
  a statement.  Determines IDL's internal representation for the
  breakpoint, which may have occurred at a different line than
  specified.  If NO-SHOW is non-nil, don't do any updating."
    ;; Get and save the old breakpoints
!   (idlwave-shell-send-command 
     idlwave-shell-bp-query
     `(progn
       (idlwave-shell-filter-bp (quote ,no-show))
       (setq idlwave-shell-old-bp idlwave-shell-bp-alist))
     'hide)
  
!   ;; Get sources for this routine in the sources list
!   (idlwave-shell-module-source-query (idlwave-shell-bp-get bp 'module))
    (let*
        ((arg (idlwave-shell-bp-get bp 'count))
         (key (cond
***************
*** 3450,3481 ****
                ((> arg 1)
                 (format ",after=%d" arg))))
         (condition (idlwave-shell-bp-get bp 'condition))
!        (key (concat key
                    (if condition (concat ",CONDITION=\"" condition "\""))))
         (line (idlwave-shell-bp-get bp 'line)))
      (idlwave-shell-send-command
!      (concat "breakpoint,'"
             (idlwave-shell-sources-bp bp) "',"
             (if (integerp line) (setq line (int-to-string line)))
             key)
!      ;; Check for failure and look for breakpoint in IDL's list
       `(progn
        (if (idlwave-shell-set-bp-check (quote ,bp))
!            (idlwave-shell-set-bp3 (quote ,bp) (quote ,no-show))))
       ;; hide output?
       (idlwave-shell-hide-p 'breakpoint)
       'preempt t)))
  
! (defun idlwave-shell-set-bp3 (bp &optional no-show)
    "Find the breakpoint in IDL's internal list of breakpoints."
!   (idlwave-shell-send-command idlwave-shell-bp-query
!                             `(progn
!                                (idlwave-shell-filter-bp (quote ,no-show))
!                                (idlwave-shell-new-bp (quote ,bp))
!                                (unless (quote ,no-show)
!                                  (idlwave-shell-update-bp-overlays)))
!                             'hide
!                             'preempt))
  
  (defun idlwave-shell-find-bp (frame)
    "Return breakpoint from `idlwave-shell-bp-alist' for frame.
--- 3451,3485 ----
                ((> arg 1)
                 (format ",after=%d" arg))))
         (condition (idlwave-shell-bp-get bp 'condition))
!        (disabled (idlwave-shell-bp-get bp 'disabled))
!        (key (concat key 
                    (if condition (concat ",CONDITION=\"" condition "\""))))
+        (key (concat key (if disabled ",/DISABLE")))
         (line (idlwave-shell-bp-get bp 'line)))
      (idlwave-shell-send-command
!      (concat "breakpoint,'" 
             (idlwave-shell-sources-bp bp) "',"
             (if (integerp line) (setq line (int-to-string line)))
             key)
!      ;; Check for failure and adjust breakpoint to match IDL's list
       `(progn
        (if (idlwave-shell-set-bp-check (quote ,bp))
!           (idlwave-shell-set-bp-adjust (quote ,bp) (quote ,no-show))))
       ;; hide output?
       (idlwave-shell-hide-p 'breakpoint)
       'preempt t)))
  
! (defun idlwave-shell-set-bp-adjust (bp &optional no-show)
    "Find the breakpoint in IDL's internal list of breakpoints."
!   (idlwave-shell-send-command 
!    idlwave-shell-bp-query
!    `(progn
!       (idlwave-shell-filter-bp 'no-show)
!       (idlwave-shell-new-bp (quote ,bp))
!       (unless (quote ,no-show)
!       (idlwave-shell-update-bp-overlays)))
!    'hide
!    'preempt))
  
  (defun idlwave-shell-find-bp (frame)
    "Return breakpoint from `idlwave-shell-bp-alist' for frame.
***************
*** 3526,3535 ****
    "Alist of overlays marking breakpoints")
  (defvar idlwave-shell-bp-glyph)
  
  (defun idlwave-shell-update-bp-overlays ()
    "Update the overlays which mark breakpoints in the source code.
  Existing overlays are recycled, in order to minimize consumption."
-   ;(message "Updating Overlays")
    (when idlwave-shell-mark-breakpoints
      (let ((ov-alist (copy-alist idlwave-shell-bp-overlays))
          (bp-list idlwave-shell-bp-alist)
--- 3530,3543 ----
    "Alist of overlays marking breakpoints")
  (defvar idlwave-shell-bp-glyph)
  
+ (defvar idlwave-shell-debug-line-map (make-sparse-keymap))
+ (define-key idlwave-shell-debug-line-map 
+   (if (featurep 'xemacs) [button3] [mouse-3])
+   'idlwave-shell-mouse-active-bp)
+ 
  (defun idlwave-shell-update-bp-overlays ()
    "Update the overlays which mark breakpoints in the source code.
  Existing overlays are recycled, in order to minimize consumption."
    (when idlwave-shell-mark-breakpoints
      (let ((ov-alist (copy-alist idlwave-shell-bp-overlays))
          (bp-list idlwave-shell-bp-alist)
***************
*** 3538,3551 ****
          ov ov-list bp buf old-buffers win)
  
        ;; Delete the old overlays from their buffers
!       (if ov-alist
          (while (setq ov-list (pop ov-alist))
            (while (setq ov (pop (cdr ov-list)))
              (add-to-list 'old-buffers (overlay-buffer ov))
              (delete-overlay ov))))
! 
        (setq ov-alist idlwave-shell-bp-overlays
!           idlwave-shell-bp-overlays
            (if idlwave-shell-bp-glyph
                (mapcar 'list (mapcar 'car idlwave-shell-bp-glyph))
              (list (list 'bp))))
--- 3546,3559 ----
          ov ov-list bp buf old-buffers win)
  
        ;; Delete the old overlays from their buffers
!       (if ov-alist 
          (while (setq ov-list (pop ov-alist))
            (while (setq ov (pop (cdr ov-list)))
              (add-to-list 'old-buffers (overlay-buffer ov))
              (delete-overlay ov))))
!       
        (setq ov-alist idlwave-shell-bp-overlays
!           idlwave-shell-bp-overlays 
            (if idlwave-shell-bp-glyph
                (mapcar 'list (mapcar 'car idlwave-shell-bp-glyph))
              (list (list 'bp))))
***************
*** 3569,3584 ****
                              (t 'bp-n)))
                            (t 'bp))
                         'bp))
!                (help-list
                  (delq nil
                        (list
                         (if count
!                            (concat "n=" (int-to-string count)))
                         (if condition
!                            (concat "condition: " condition))
                         (if disabled "disabled"))))
!                (help-text (if help-list
!                               (mapconcat 'identity help-list ",")))
                 (full-type (if disabled
                                (intern (concat (symbol-name type)
                                                "-disabled"))
--- 3577,3599 ----
                              (t 'bp-n)))
                            (t 'bp))
                         'bp))
!                (help-list 
                  (delq nil
                        (list
                         (if count
!                            (concat "after:" (int-to-string count)))
                         (if condition
!                            (concat "condition:" condition))
                         (if disabled "disabled"))))
!                (help-text (concat 
!                            "BP " 
!                            (int-to-string (idlwave-shell-bp-get bp))
!                            (if help-list 
!                                (concat 
!                                 " - " 
!                                 (mapconcat 'identity help-list ", ")))
!                            (if (and (not count) (not condition))
!                                " (use mouse-3 for breakpoint actions)")))
                 (full-type (if disabled
                                (intern (concat (symbol-name type)
                                                "-disabled"))
***************
*** 3586,3594 ****
                 (ov-existing (assq full-type ov-alist))
                 (ov (or (and (cdr ov-existing)
                              (pop (cdr ov-existing)))
!                        (idlwave-shell-make-new-bp-overlay
!                         type disabled help-text)))
                 match)
            (move-overlay ov beg end)
            (if (setq match (assq full-type idlwave-shell-bp-overlays))
                (push ov (cdr match))
--- 3601,3610 ----
                 (ov-existing (assq full-type ov-alist))
                 (ov (or (and (cdr ov-existing)
                              (pop (cdr ov-existing)))
!                        (idlwave-shell-make-new-bp-overlay type disabled)))
                 match)
+           (if idlwave-shell-breakpoint-popup-menu
+               (overlay-put ov 'help-echo help-text))
            (move-overlay ov beg end)
            (if (setq match (assq full-type idlwave-shell-bp-overlays))
                (push ov (cdr match))
***************
*** 3596,3602 ****
                     (list (list full-type ov)))))
          ;; Take care of margins if using a glyph
          (when use-glyph
!           (if old-buffers
                (setq old-buffers (delq (current-buffer) old-buffers)))
            (if (fboundp 'set-specifier) ;; XEmacs
                (set-specifier left-margin-width (cons (current-buffer) 2))
--- 3612,3618 ----
                     (list (list full-type ov)))))
          ;; Take care of margins if using a glyph
          (when use-glyph
!           (if old-buffers 
                (setq old-buffers (delq (current-buffer) old-buffers)))
            (if (fboundp 'set-specifier) ;; XEmacs
                (set-specifier left-margin-width (cons (current-buffer) 2))
***************
*** 3612,3640 ****
              (if (setq win (get-buffer-window buf t))
                  (set-window-buffer win buf))))))))
  
! 
! (defun idlwave-shell-make-new-bp-overlay (&optional type disabled help)
!   "Make a new overlay for highlighting breakpoints.
  
  This stuff is strongly dependant upon the version of Emacs.  If TYPE
  is passed, make an overlay of that type ('bp or 'bp-cond, currently
! only for glyphs).  If HELP is set, use it to make a tooltip with that
! text popup."
    (let ((ov (make-overlay 1 1))
        (use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph))
                        idlwave-shell-bp-glyph))
        (type (or type 'bp))
!       (face (if disabled
                  idlwave-shell-disabled-breakpoint-face
                idlwave-shell-breakpoint-face)))
      (if (featurep 'xemacs)
        ;; This is XEmacs
        (progn
!         (cond
           ;; tty's cannot display glyphs
           ((eq (console-type) 'tty)
            (set-extent-property ov 'face face))
! 
           ;; use the glyph
           (use-glyph
            (let ((glyph (cdr (assq type idlwave-shell-bp-glyph))))
--- 3628,3658 ----
              (if (setq win (get-buffer-window buf t))
                  (set-window-buffer win buf))))))))
  
! (defun idlwave-shell-make-new-bp-overlay (&optional type disabled)
!   "Make a new overlay for highlighting breakpoints.  
  
  This stuff is strongly dependant upon the version of Emacs.  If TYPE
  is passed, make an overlay of that type ('bp or 'bp-cond, currently
! only for glyphs)."
    (let ((ov (make-overlay 1 1))
        (use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph))
                        idlwave-shell-bp-glyph))
        (type (or type 'bp))
!       (face (if disabled 
                  idlwave-shell-disabled-breakpoint-face
                idlwave-shell-breakpoint-face)))
      (if (featurep 'xemacs)
        ;; This is XEmacs
        (progn
!         (when idlwave-shell-breakpoint-popup-menu
!           (set-extent-property ov 'mouse-face 'highlight)
!           (set-extent-property ov 'keymap idlwave-shell-debug-line-map))
! 
!         (cond 
           ;; tty's cannot display glyphs
           ((eq (console-type) 'tty)
            (set-extent-property ov 'face face))
!           
           ;; use the glyph
           (use-glyph
            (let ((glyph (cdr (assq type idlwave-shell-bp-glyph))))
***************
*** 3650,3671 ****
           (t nil))
          (set-extent-priority ov -1))  ; make stop line face prevail
        ;; This is Emacs
        (cond
         (window-system
        (if use-glyph
            (let ((image-props (cdr (assq type idlwave-shell-bp-glyph)))
                  string)
! 
              (if disabled (setq image-props
!                                (append image-props
                                         (list :conversion 'disabled))))
!             (setq string
!                  (propertize "@"
!                              'display
                               (list (list 'margin 'left-margin)
!                                    image-props)
!                              'mouse-face 'highlight
!                              'help-echo help))
              (overlay-put ov 'before-string string))
          ;; just the face
          (overlay-put ov 'face face)))
--- 3668,3690 ----
           (t nil))
          (set-extent-priority ov -1))  ; make stop line face prevail
        ;; This is Emacs
+       (when idlwave-shell-breakpoint-popup-menu
+       (overlay-put ov 'mouse-face 'highlight)
+       (overlay-put ov 'keymap idlwave-shell-debug-line-map))
        (cond
         (window-system
        (if use-glyph
            (let ((image-props (cdr (assq type idlwave-shell-bp-glyph)))
                  string)
!             
              (if disabled (setq image-props
!                                (append image-props 
                                         (list :conversion 'disabled))))
!             (setq string 
!                  (propertize "@" 
!                              'display 
                               (list (list 'margin 'left-margin)
!                                    image-props)))
              (overlay-put ov 'before-string string))
          ;; just the face
          (overlay-put ov 'face face)))
***************
*** 3678,3683 ****
--- 3697,3750 ----
         (t nil)))
      ov))
  
+ (defun idlwave-shell-mouse-active-bp (ev)
+   "Does right-click mouse action on breakpoint lines."
+   (interactive "e")
+   (if ev (mouse-set-point ev))
+   (let ((bp (idlwave-shell-find-bp (idlwave-shell-current-frame)))
+       index condition count select cmd disabled)
+     (unless bp
+       (error "Breakpoint not found"))
+     (setq index (int-to-string (idlwave-shell-bp-get bp))
+         condition (idlwave-shell-bp-get bp 'condition)
+         cmd (idlwave-shell-bp-get bp 'cmd)
+         count (idlwave-shell-bp-get bp 'count)
+         disabled (idlwave-shell-bp-get bp 'disabled))
+     (setq select (idlwave-popup-select 
+                 ev 
+                 (delq nil 
+                       (list (if disabled "Enable" "Disable")
+                             "Clear"
+                             "Clear All"
+                             (if condition "Remove Condition" "Add Condition")
+                             (if condition "Change Condition")
+                             (if count "Remove Repeat Count" 
+                               "Add Repeat Count")
+                             (if count "Change Repeat Count")))
+                 (concat "BreakPoint " index)))
+     (if select 
+       (cond 
+        ((string-equal select "Clear All")
+         (idlwave-shell-clear-all-bp))
+        ((string-equal select "Clear")
+         (idlwave-shell-clear-current-bp))
+        ((string-match "Condition" select)
+         (idlwave-shell-break-here count cmd 
+                                   (if (or (not condition)
+                                           (string-match "Change" select))
+                                     (read-string "Break Condition: "))
+                                   disabled))
+        ((string-match "Count" select)
+         (idlwave-shell-break-here (if (or (not count)
+                                           (string-match "Change" select))
+                                       (string-to-number
+                                        (read-string "Break After Count: ")))
+                                   cmd condition disabled))
+        ((string-match "able$" select)
+         (idlwave-shell-toggle-enable-current-bp))
+        (t 
+         (message "Unimplemented: %s" select))))))
+   
  (defun idlwave-shell-edit-default-command-line (arg)
    "Edit the current execute command."
    (interactive "P")
***************
*** 3689,3702 ****
  Also with prefix arg, ask for the command.  You can also use the command
  `idlwave-shell-edit-default-command-line' to edit the line."
    (interactive "P")
!   (cond
     ((equal arg '(16))
      (setq idlwave-shell-command-line-to-execute nil))
     ((equal arg '(4))
!     (setq idlwave-shell-command-line-to-execute
          (read-string "IDL> " idlwave-shell-command-line-to-execute))))
    (idlwave-shell-reset 'hidden)
!   (idlwave-shell-send-command
     (or idlwave-shell-command-line-to-execute
         (with-current-buffer (idlwave-shell-buffer)
         (ring-ref comint-input-ring 0)))
--- 3756,3769 ----
  Also with prefix arg, ask for the command.  You can also use the command
  `idlwave-shell-edit-default-command-line' to edit the line."
    (interactive "P")
!   (cond 
     ((equal arg '(16))
      (setq idlwave-shell-command-line-to-execute nil))
     ((equal arg '(4))
!     (setq idlwave-shell-command-line-to-execute 
          (read-string "IDL> " idlwave-shell-command-line-to-execute))))
    (idlwave-shell-reset 'hidden)
!   (idlwave-shell-send-command 
     (or idlwave-shell-command-line-to-execute
         (with-current-buffer (idlwave-shell-buffer)
         (ring-ref comint-input-ring 0)))
***************
*** 3706,3712 ****
    "Save file and run it in IDL.
  Runs `save-buffer' and sends a '.RUN' command for the associated file to IDL.
  When called from the shell buffer, re-run the file which was last handled by
! one of the save-and-.. commands."
    (interactive)
    (idlwave-shell-save-and-action 'run))
  
--- 3773,3779 ----
    "Save file and run it in IDL.
  Runs `save-buffer' and sends a '.RUN' command for the associated file to IDL.
  When called from the shell buffer, re-run the file which was last handled by
! one of the save-and-.. commands."  
    (interactive)
    (idlwave-shell-save-and-action 'run))
  
***************
*** 3722,3728 ****
    "Save file and batch it in IDL.
  Runs `save-buffer' and sends a '@file' command for the associated file to IDL.
  When called from the shell buffer, re-batch the file which was last handled by
! one of the save-and-.. commands."
    (interactive)
    (idlwave-shell-save-and-action 'batch))
  
--- 3789,3795 ----
    "Save file and batch it in IDL.
  Runs `save-buffer' and sends a '@file' command for the associated file to IDL.
  When called from the shell buffer, re-batch the file which was last handled by
! one of the save-and-.. commands."  
    (interactive)
    (idlwave-shell-save-and-action 'batch))
  
***************
*** 3762,3768 ****
         'idlwave-shell-maybe-update-routine-info
         (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
        (idlwave-shell-bp-query))
!     (let ((msg (format "No such file %s"
                       idlwave-shell-last-save-and-action-file)))
        (setq idlwave-shell-last-save-and-action-file nil)
        (error msg))))
--- 3829,3835 ----
         'idlwave-shell-maybe-update-routine-info
         (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
        (idlwave-shell-bp-query))
!     (let ((msg (format "No such file %s" 
                       idlwave-shell-last-save-and-action-file)))
        (setq idlwave-shell-last-save-and-action-file nil)
        (error msg))))
***************
*** 3785,3801 ****
  
    (module name . (source-file-truename idlwave-internal-filename)).")
  
  (defun idlwave-shell-sources-query ()
!   "Determine source files for IDL compiled procedures.
  Queries IDL using the string in `idlwave-shell-sources-query'."
! '  (interactive)
    (idlwave-shell-send-command idlwave-shell-sources-query
                              'idlwave-shell-sources-filter
                              'hide))
  
  (defun idlwave-shell-sources-filter ()
    "Get source files from `idlwave-shell-sources-query' output.
! Create `idlwave-shell-sources-alist' consisting of
  list elements of the form:
   (module name . (source-file-truename idlwave-internal-filename))."
    (save-excursion
--- 3852,3893 ----
  
    (module name . (source-file-truename idlwave-internal-filename)).")
  
+ (defun idlwave-shell-module-source-query (module)
+   "Determine the source file for a given module."
+   (if module
+       (idlwave-shell-send-command 
+        (format "print,(routine_info('%s',/SOURCE)).PATH" module)
+        `(idlwave-shell-module-source-filter ,module)
+        'hide)))
+ 
+ (defun idlwave-shell-module-source-filter (module)
+   "Get module source, and update idlwave-shell-sources-alist."
+   (let ((old (assoc (upcase module) idlwave-shell-sources-alist))
+       filename)
+     (if (string-match "\.PATH *[\n\r]\\([^\r\n]+\\)[\n\r]"
+                     idlwave-shell-command-output)
+       (setq filename (substring idlwave-shell-command-output 
+                                 (match-beginning 1) (match-end 1)))
+       (error "No file matching module found."))
+     (if old
+       (setcdr old (list (idlwave-shell-file-name filename) filename))
+       (setq idlwave-shell-sources-alist
+           (append idlwave-shell-sources-alist 
+                   (list (cons (upcase module)
+                               (list (idlwave-shell-file-name filename) 
+                                     filename))))))))
+   
  (defun idlwave-shell-sources-query ()
!   "Determine source files for all IDL compiled procedures.
  Queries IDL using the string in `idlwave-shell-sources-query'."
!   (interactive)
    (idlwave-shell-send-command idlwave-shell-sources-query
                              'idlwave-shell-sources-filter
                              'hide))
  
  (defun idlwave-shell-sources-filter ()
    "Get source files from `idlwave-shell-sources-query' output.
! Create `idlwave-shell-sources-alist' consisting of 
  list elements of the form:
   (module name . (source-file-truename idlwave-internal-filename))."
    (save-excursion
***************
*** 3880,3886 ****
                    (list
                     (save-match-data
                       (idlwave-shell-file-name
!                       (buffer-substring (match-beginning 1 )
                                        (match-end 1))))
                     (string-to-number
                      (buffer-substring (match-beginning 2)
--- 3972,3978 ----
                    (list
                     (save-match-data
                       (idlwave-shell-file-name
!                       (buffer-substring (match-beginning 1 ) 
                                        (match-end 1))))
                     (string-to-number
                      (buffer-substring (match-beginning 2)
***************
*** 3947,3959 ****
  
  ;; The mouse bindings for PRINT and HELP
  (idlwave-shell-define-key-both
!  (if (featurep 'xemacs)
!      [(shift button2)]
     [(shift down-mouse-2)])
   'idlwave-shell-mouse-print)
  (idlwave-shell-define-key-both
!  (if (featurep 'xemacs)
!      [(control meta button2)]
     [(control meta down-mouse-2)])
    'idlwave-shell-mouse-help)
  (idlwave-shell-define-key-both
--- 4039,4051 ----
  
  ;; The mouse bindings for PRINT and HELP
  (idlwave-shell-define-key-both
!  (if (featurep 'xemacs) 
!      [(shift button2)] 
     [(shift down-mouse-2)])
   'idlwave-shell-mouse-print)
  (idlwave-shell-define-key-both
!  (if (featurep 'xemacs) 
!      [(control meta button2)] 
     [(control meta down-mouse-2)])
    'idlwave-shell-mouse-help)
  (idlwave-shell-define-key-both
***************
*** 3962,3975 ****
     [(control shift down-mouse-2)])
   'idlwave-shell-examine-select)
  ;; Add this one from the idlwave-mode-map
! (define-key idlwave-shell-mode-map
    (if (featurep 'xemacs)
        [(shift button3)]
      [(shift mouse-3)])
    'idlwave-mouse-context-help)
  
  ;; For Emacs, we need to turn off the button release events.
! (defun idlwave-shell-mouse-nop (event)
    (interactive "e"))
  (unless (featurep 'xemacs)
    (idlwave-shell-define-key-both
--- 4054,4067 ----
     [(control shift down-mouse-2)])
   'idlwave-shell-examine-select)
  ;; Add this one from the idlwave-mode-map
! (define-key idlwave-shell-mode-map 
    (if (featurep 'xemacs)
        [(shift button3)]
      [(shift mouse-3)])
    'idlwave-mouse-context-help)
  
  ;; For Emacs, we need to turn off the button release events.
! (defun idlwave-shell-mouse-nop (event) 
    (interactive "e"))
  (unless (featurep 'xemacs)
    (idlwave-shell-define-key-both
***************
*** 3979,3985 ****
    (idlwave-shell-define-key-both
     [(control meta mouse-2)] 'idlwave-shell-mouse-nop))
  
! 
  ;; The following set of bindings is used to bind the debugging keys.
  ;; If `idlwave-shell-activate-prefix-keybindings' is non-nil, the
  ;; first key in the list gets bound the C-c C-d prefix map.  If
--- 4071,4077 ----
    (idlwave-shell-define-key-both
     [(control meta mouse-2)] 'idlwave-shell-mouse-nop))
  
!   
  ;; The following set of bindings is used to bind the debugging keys.
  ;; If `idlwave-shell-activate-prefix-keybindings' is non-nil, the
  ;; first key in the list gets bound the C-c C-d prefix map.  If
***************
*** 3988,3997 ****
  ;; `idlwave-mode-map' and `idlwave-shell-mode-map'.  The next list
  ;; item, if non-nil, means to bind this as a single key in the
  ;; electric-debug-mode-map.
! ;;
  ;; [C-c C-d]-binding   debug-modifier-key command bind-electric-debug buf-only
! ;; Used keys:   abcdef hijklmnopqrstuvwxyz
! ;; Unused keys:       g
  (let* ((specs
        '(([(control ?b)]   ?b   idlwave-shell-break-here t t)
          ([(control ?i)]   ?i   idlwave-shell-break-in t t)
--- 4080,4089 ----
  ;; `idlwave-mode-map' and `idlwave-shell-mode-map'.  The next list
  ;; item, if non-nil, means to bind this as a single key in the
  ;; electric-debug-mode-map.
! ;; 
  ;; [C-c C-d]-binding   debug-modifier-key command bind-electric-debug buf-only
! ;; Used keys:   abcdef hijklmnopqrstuvwxyz 
! ;; Unused keys:       g             
  (let* ((specs
        '(([(control ?b)]   ?b   idlwave-shell-break-here t t)
          ([(control ?i)]   ?i   idlwave-shell-break-in t t)
***************
*** 4041,4050 ****
          electric (nth 3 s)
          only-buffer (nth 4 s)
          cannotshift (and shift (char-valid-p c2) (eq c2 (upcase c2))))
! 
      ;; The regular prefix keymap.
      (when (and idlwave-shell-activate-prefix-keybindings k1)
!       (unless only-buffer
        (define-key idlwave-shell-mode-prefix-map k1 cmd))
        (define-key idlwave-mode-prefix-map k1 cmd))
      ;; The debug modifier map
--- 4133,4142 ----
          electric (nth 3 s)
          only-buffer (nth 4 s)
          cannotshift (and shift (char-valid-p c2) (eq c2 (upcase c2))))
!     
      ;; The regular prefix keymap.
      (when (and idlwave-shell-activate-prefix-keybindings k1)
!       (unless only-buffer 
        (define-key idlwave-shell-mode-prefix-map k1 cmd))
        (define-key idlwave-mode-prefix-map k1 cmd))
      ;; The debug modifier map
***************
*** 4058,4081 ****
        (unless only-buffer (define-key idlwave-shell-mode-map k2 cmd))))
      ;; The electric debug single-keystroke map
      (if (and electric (char-or-string-p c2))
!       (define-key idlwave-shell-electric-debug-mode-map (char-to-string c2)
          cmd))))
  
  ;; A few extras in the electric debug map
  (define-key idlwave-shell-electric-debug-mode-map " " 'idlwave-shell-step)
  (define-key idlwave-shell-electric-debug-mode-map "+" 'idlwave-shell-stack-up)
  (define-key idlwave-shell-electric-debug-mode-map "=" 'idlwave-shell-stack-up)
! (define-key idlwave-shell-electric-debug-mode-map "-"
    'idlwave-shell-stack-down)
! (define-key idlwave-shell-electric-debug-mode-map "_"
    'idlwave-shell-stack-down)
  (define-key idlwave-shell-electric-debug-mode-map "q" 'idlwave-shell-retall)
! (define-key idlwave-shell-electric-debug-mode-map "t"
    '(lambda () (interactive) (idlwave-shell-send-command "help,/TRACE")))
  (define-key idlwave-shell-electric-debug-mode-map [(control ??)]
    'idlwave-shell-electric-debug-help)
! (define-key idlwave-shell-electric-debug-mode-map "x"
!   '(lambda (arg) (interactive "P")
       (idlwave-shell-print arg nil nil t)))
  
  
--- 4150,4173 ----
        (unless only-buffer (define-key idlwave-shell-mode-map k2 cmd))))
      ;; The electric debug single-keystroke map
      (if (and electric (char-or-string-p c2))
!       (define-key idlwave-shell-electric-debug-mode-map (char-to-string c2) 
          cmd))))
  
  ;; A few extras in the electric debug map
  (define-key idlwave-shell-electric-debug-mode-map " " 'idlwave-shell-step)
  (define-key idlwave-shell-electric-debug-mode-map "+" 'idlwave-shell-stack-up)
  (define-key idlwave-shell-electric-debug-mode-map "=" 'idlwave-shell-stack-up)
! (define-key idlwave-shell-electric-debug-mode-map "-" 
    'idlwave-shell-stack-down)
! (define-key idlwave-shell-electric-debug-mode-map "_" 
    'idlwave-shell-stack-down)
  (define-key idlwave-shell-electric-debug-mode-map "q" 'idlwave-shell-retall)
! (define-key idlwave-shell-electric-debug-mode-map "t" 
    '(lambda () (interactive) (idlwave-shell-send-command "help,/TRACE")))
  (define-key idlwave-shell-electric-debug-mode-map [(control ??)]
    'idlwave-shell-electric-debug-help)
! (define-key idlwave-shell-electric-debug-mode-map "x" 
!   '(lambda (arg) (interactive "P") 
       (idlwave-shell-print arg nil nil t)))
  
  
***************
*** 4096,4107 ****
      (setq idlwave-shell-suppress-electric-debug nil))
    (idlwave-shell-electric-debug-mode))
  
! (defvar idlwave-shell-electric-debug-read-only)
  (defvar idlwave-shell-electric-debug-buffers nil)
  
  (easy-mmode-define-minor-mode idlwave-shell-electric-debug-mode
    "Toggle Electric Debug mode.
! With no argument, this command toggles the mode.
  Non-null prefix argument turns on the mode.
  Null prefix argument turns off the mode.
  
--- 4188,4199 ----
      (setq idlwave-shell-suppress-electric-debug nil))
    (idlwave-shell-electric-debug-mode))
  
! (defvar idlwave-shell-electric-debug-read-only) 
  (defvar idlwave-shell-electric-debug-buffers nil)
  
  (easy-mmode-define-minor-mode idlwave-shell-electric-debug-mode
    "Toggle Electric Debug mode.
! With no argument, this command toggles the mode. 
  Non-null prefix argument turns on the mode.
  Null prefix argument turns off the mode.
  
***************
*** 4111,4117 ****
  " *Debugging*"
  idlwave-shell-electric-debug-mode-map)
  
! (add-hook
   'idlwave-shell-electric-debug-mode-on-hook
   (lambda ()
     (set (make-local-variable 'idlwave-shell-electric-debug-read-only)
--- 4203,4209 ----
  " *Debugging*"
  idlwave-shell-electric-debug-mode-map)
  
! (add-hook 
   'idlwave-shell-electric-debug-mode-on-hook
   (lambda ()
     (set (make-local-variable 'idlwave-shell-electric-debug-read-only)
***************
*** 4119,4131 ****
     (setq buffer-read-only t)
     (add-to-list 'idlwave-shell-electric-debug-buffers (current-buffer))
     (if idlwave-shell-stop-line-overlay
!        (overlay-put idlwave-shell-stop-line-overlay 'face
                    idlwave-shell-electric-stop-line-face))
     (if (facep 'fringe)
         (set-face-foreground 'fringe idlwave-shell-electric-stop-color
                            (selected-frame)))))
  
! (add-hook
   'idlwave-shell-electric-debug-mode-off-hook
   (lambda ()
     ;; Return to previous read-only state
--- 4211,4223 ----
     (setq buffer-read-only t)
     (add-to-list 'idlwave-shell-electric-debug-buffers (current-buffer))
     (if idlwave-shell-stop-line-overlay
!        (overlay-put idlwave-shell-stop-line-overlay 'face 
                    idlwave-shell-electric-stop-line-face))
     (if (facep 'fringe)
         (set-face-foreground 'fringe idlwave-shell-electric-stop-color
                            (selected-frame)))))
  
! (add-hook 
   'idlwave-shell-electric-debug-mode-off-hook
   (lambda ()
     ;; Return to previous read-only state
***************
*** 4134,4140 ****
     (setq idlwave-shell-electric-debug-buffers
         (delq (current-buffer) idlwave-shell-electric-debug-buffers))
     (if idlwave-shell-stop-line-overlay
!        (overlay-put idlwave-shell-stop-line-overlay 'face
                    idlwave-shell-stop-line-face)
       (if (facep 'fringe)
         (set-face-foreground 'fringe (face-foreground 'default))))))
--- 4226,4232 ----
     (setq idlwave-shell-electric-debug-buffers
         (delq (current-buffer) idlwave-shell-electric-debug-buffers))
     (if idlwave-shell-stop-line-overlay
!        (overlay-put idlwave-shell-stop-line-overlay 'face 
                    idlwave-shell-stop-line-face)
       (if (facep 'fringe)
         (set-face-foreground 'fringe (face-foreground 'default))))))
***************
*** 4148,4153 ****
--- 4240,4246 ----
    (force-mode-line-update))
  
  ;; Turn it off in all relevant buffers
+ (defvar idlwave-shell-electric-debug-buffers nil)
  (defun idlwave-shell-electric-debug-all-off ()
    (setq idlwave-shell-suppress-electric-debug nil)
    (let ((buffers idlwave-shell-electric-debug-buffers)
***************
*** 4165,4171 ****
  ;; Show the help text
  (defun idlwave-shell-electric-debug-help ()
    (interactive)
!   (with-output-to-temp-buffer "*IDLWAVE Electric Debug Help*"
      (princ idlwave-shell-electric-debug-help))
    (let* ((current-window (selected-window))
         (window (get-buffer-window "*IDLWAVE Electric Debug Help*"))
--- 4258,4264 ----
  ;; Show the help text
  (defun idlwave-shell-electric-debug-help ()
    (interactive)
!   (with-output-to-temp-buffer "*IDLWAVE Electric Debug Help*" 
      (princ idlwave-shell-electric-debug-help))
    (let* ((current-window (selected-window))
         (window (get-buffer-window "*IDLWAVE Electric Debug Help*"))
***************
*** 4180,4186 ****
    `("Debug"
      ["Electric Debug Mode"
       idlwave-shell-electric-debug-mode
!      :style toggle :selected idlwave-shell-electric-debug-mode
       :included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"]
      "--"
      ("Compile & Run"
--- 4273,4279 ----
    `("Debug"
      ["Electric Debug Mode"
       idlwave-shell-electric-debug-mode
!      :style toggle :selected idlwave-shell-electric-debug-mode 
       :included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"]
      "--"
      ("Compile & Run"
***************
*** 4196,4210 ****
       "--"
       ["Goto Next Error" idlwave-shell-goto-next-error t]
       "--"
!      ["Compile and Run Region" idlwave-shell-run-region
        (eq major-mode 'idlwave-mode)]
!      ["Evaluate Region" idlwave-shell-evaluate-region
        (eq major-mode 'idlwave-mode)]
       "--"
       ["Execute Default Cmd" idlwave-shell-execute-default-command-line t]
       ["Edit Default Cmd" idlwave-shell-edit-default-command-line t])
      ("Breakpoints"
!      ["Set Breakpoint" idlwave-shell-break-here
        :keys "C-c C-d C-c" :active (eq major-mode 'idlwave-mode)]
       ("Set Special Breakpoint"
        ["Set After Count Breakpoint"
--- 4289,4303 ----
       "--"
       ["Goto Next Error" idlwave-shell-goto-next-error t]
       "--"
!      ["Compile and Run Region" idlwave-shell-run-region 
        (eq major-mode 'idlwave-mode)]
!      ["Evaluate Region" idlwave-shell-evaluate-region 
        (eq major-mode 'idlwave-mode)]
       "--"
       ["Execute Default Cmd" idlwave-shell-execute-default-command-line t]
       ["Edit Default Cmd" idlwave-shell-edit-default-command-line t])
      ("Breakpoints"
!      ["Set Breakpoint" idlwave-shell-break-here 
        :keys "C-c C-d C-c" :active (eq major-mode 'idlwave-mode)]
       ("Set Special Breakpoint"
        ["Set After Count Breakpoint"
***************
*** 4215,4230 ****
        ["Set Condition Breakpoint"
         (idlwave-shell-break-here '(4))
         :active (eq major-mode 'idlwave-mode)])
!      ["Break in Module" idlwave-shell-break-in
        :keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)]
       ["Break in this Module" idlwave-shell-break-this-module
        :keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)]
       ["Clear Breakpoint" idlwave-shell-clear-current-bp t]
       ["Clear All Breakpoints" idlwave-shell-clear-all-bp t]
       ["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t]
!      ["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp
        :keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)]
!      ["Goto Next Breakpoint" idlwave-shell-goto-next-bp
        :keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)]
       ["List All Breakpoints" idlwave-shell-list-all-bp t]
       ["Resync Breakpoints" idlwave-shell-bp-query t])
--- 4308,4323 ----
        ["Set Condition Breakpoint"
         (idlwave-shell-break-here '(4))
         :active (eq major-mode 'idlwave-mode)])
!      ["Break in Module" idlwave-shell-break-in 
        :keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)]
       ["Break in this Module" idlwave-shell-break-this-module
        :keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)]
       ["Clear Breakpoint" idlwave-shell-clear-current-bp t]
       ["Clear All Breakpoints" idlwave-shell-clear-all-bp t]
       ["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t]
!      ["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp 
        :keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)]
!      ["Goto Next Breakpoint" idlwave-shell-goto-next-bp 
        :keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)]
       ["List All Breakpoints" idlwave-shell-list-all-bp t]
       ["Resync Breakpoints" idlwave-shell-bp-query t])
***************
*** 4256,4293 ****
       ["Redisplay and Sync" idlwave-shell-redisplay t])
      ("Show Commands"
       ["Everything" (if (eq idlwave-shell-show-commands 'everything)
!                      (progn
                         (setq idlwave-shell-show-commands
                               (get 'idlwave-shell-show-commands 'last-val))
                         (put 'idlwave-shell-show-commands 'last-val nil))
!                    (put 'idlwave-shell-show-commands 'last-val
                          idlwave-shell-show-commands)
                     (setq idlwave-shell-show-commands 'everything))
        :style toggle :selected (and (not (listp idlwave-shell-show-commands))
!                                  (eq idlwave-shell-show-commands
                                       'everything))]
       "--"
       ["Compiling Commands" (idlwave-shell-add-or-remove-show 'run)
!       :style toggle
!       :selected (not (idlwave-shell-hide-p
                      'run
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))]
       ["Breakpoint Commands" (idlwave-shell-add-or-remove-show 'breakpoint)
!       :style toggle
!       :selected (not (idlwave-shell-hide-p
                      'breakpoint
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))]
       ["Debug Commands" (idlwave-shell-add-or-remove-show 'debug)
!       :style toggle
!       :selected (not (idlwave-shell-hide-p
                      'debug
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))]
       ["Miscellaneous Commands" (idlwave-shell-add-or-remove-show 'misc)
!       :style toggle
!       :selected (not (idlwave-shell-hide-p
                      'misc
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))])
--- 4349,4386 ----
       ["Redisplay and Sync" idlwave-shell-redisplay t])
      ("Show Commands"
       ["Everything" (if (eq idlwave-shell-show-commands 'everything)
!                      (progn 
                         (setq idlwave-shell-show-commands
                               (get 'idlwave-shell-show-commands 'last-val))
                         (put 'idlwave-shell-show-commands 'last-val nil))
!                    (put 'idlwave-shell-show-commands 'last-val 
                          idlwave-shell-show-commands)
                     (setq idlwave-shell-show-commands 'everything))
        :style toggle :selected (and (not (listp idlwave-shell-show-commands))
!                                  (eq idlwave-shell-show-commands 
                                       'everything))]
       "--"
       ["Compiling Commands" (idlwave-shell-add-or-remove-show 'run)
!       :style toggle 
!       :selected (not (idlwave-shell-hide-p 
                      'run
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))]
       ["Breakpoint Commands" (idlwave-shell-add-or-remove-show 'breakpoint)
!       :style toggle 
!       :selected (not (idlwave-shell-hide-p 
                      'breakpoint
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))]
       ["Debug Commands" (idlwave-shell-add-or-remove-show 'debug)
!       :style toggle 
!       :selected (not (idlwave-shell-hide-p 
                      'debug
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))]
       ["Miscellaneous Commands" (idlwave-shell-add-or-remove-show 'misc)
!       :style toggle 
!       :selected (not (idlwave-shell-hide-p 
                      'misc
                      (get 'idlwave-shell-show-commands 'last-val)))
        :active (not (eq idlwave-shell-show-commands 'everything))])
***************
*** 4301,4307 ****
        :style toggle :selected idlwave-shell-use-input-mode-magic])
      "--"
      ["Update Working Dir" idlwave-shell-resync-dirs t]
!     ["Save Path Info"
       (idlwave-shell-send-command idlwave-shell-path-query
                                 'idlwave-shell-get-path-info
                                 'hide)
--- 4394,4400 ----
        :style toggle :selected idlwave-shell-use-input-mode-magic])
      "--"
      ["Update Working Dir" idlwave-shell-resync-dirs t]
!     ["Save Path Info" 
       (idlwave-shell-send-command idlwave-shell-path-query
                                 'idlwave-shell-get-path-info
                                 'hide)
***************
*** 4313,4319 ****
  
  (if (or (featurep 'easymenu) (load "easymenu" t))
      (progn
!       (easy-menu-define
         idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus"
         idlwave-shell-menu-def)
        (easy-menu-define
--- 4406,4412 ----
  
  (if (or (featurep 'easymenu) (load "easymenu" t))
      (progn
!       (easy-menu-define 
         idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus"
         idlwave-shell-menu-def)
        (easy-menu-define
***************
*** 4333,4339 ****
  (defvar idlwave-shell-bp-glyph nil
    "The glyphs to mark breakpoint lines in the source code.")
  
! (let ((image-alist
         '((bp . "/* XPM */
  static char * file[] = {
  \"14 12 3 1\",
--- 4426,4432 ----
  (defvar idlwave-shell-bp-glyph nil
    "The glyphs to mark breakpoint lines in the source code.")
  
! (let ((image-alist 
         '((bp . "/* XPM */
  static char * file[] = {
  \"14 12 3 1\",
***************
*** 4466,4472 ****
  \"    .XXXX.    \",
  \"     ....     \",
  \"              \"};"))) im-cons im)
! 
    (while (setq im-cons (pop image-alist))
      (setq im (cond ((and (featurep 'xemacs)
                         (featurep 'xpm))
--- 4559,4565 ----
  \"    .XXXX.    \",
  \"     ....     \",
  \"              \"};"))) im-cons im)
!   
    (while (setq im-cons (pop image-alist))
      (setq im (cond ((and (featurep 'xemacs)
                         (featurep 'xpm))
***************
*** 4479,4485 ****
                   ((and (not (featurep 'xemacs))
                         (fboundp 'image-type-available-p)
                         (image-type-available-p 'xpm))
!                   (list 'image :type 'xpm :data (cdr im-cons)
                          :ascent 'center))
                   (t nil)))
      (if im (push (cons (car im-cons) im) idlwave-shell-bp-glyph))))
--- 4572,4578 ----
                   ((and (not (featurep 'xemacs))
                         (fboundp 'image-type-available-p)
                         (image-type-available-p 'xpm))
!                   (list 'image :type 'xpm :data (cdr im-cons) 
                          :ascent 'center))
                   (t nil)))
      (if im (push (cons (car im-cons) im) idlwave-shell-bp-glyph))))
***************
*** 4489,4495 ****
  
  ;;; Load the toolbar when wanted by the user.
  
! (autoload 'idlwave-toolbar-toggle "idlw-toolbar"
    "Toggle the IDLWAVE toolbar")
  (autoload 'idlwave-toolbar-add-everywhere "idlw-toolbar"
    "Add IDLWAVE toolbar")
--- 4582,4588 ----
  
  ;;; Load the toolbar when wanted by the user.
  
! (autoload 'idlwave-toolbar-toggle "idlw-toolbar" 
    "Toggle the IDLWAVE toolbar")
  (autoload 'idlwave-toolbar-add-everywhere "idlw-toolbar"
    "Add IDLWAVE toolbar")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]