• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/progmodes/

Lines Matching defs:idlwave

42 ;; Documentation should be available online with `M-x idlwave-info'.
46 ;; http://idlwave.org
55 ;; (autoload 'idlwave-shell "idlw-shell" "IDLWAVE Shell" t)
64 ;; http://idlwave.org
88 ;; `M-x idlwave-customize'.
97 (require 'idlwave)
101 (defvar idlwave-shell-have-new-custom nil)
109 (setq idlwave-shell-have-new-custom t)
115 ;;; Customizations: idlwave-shell group
118 (defgroup idlwave-shell-general-setup nil
120 :prefix "idlwave-shell"
121 :group 'idlwave)
123 (defcustom idlwave-shell-prompt-pattern "^\r? ?IDL> "
132 :group 'idlwave-shell-general-setup
135 (defcustom idlwave-shell-process-name "idl"
138 :group 'idlwave-shell-general-setup
141 ;; (defcustom idlwave-shell-automatic-start...) See idlwave.el
143 (defcustom idlwave-shell-use-dedicated-window nil
145 :group 'idlwave-shell-general-setup
148 (defcustom idlwave-shell-use-dedicated-frame nil
150 :group 'idlwave-shell-general-setup
153 (defcustom idlwave-shell-frame-parameters
155 "The frame parameters for a dedicated idlwave-shell frame.
156 See also `idlwave-shell-use-dedicated-frame'.
158 :group 'idlwave-shell-general-setup
162 (defcustom idlwave-shell-raise-frame t
163 "*Non-nil means, `idlwave-shell' raises the frame showing the shell window."
164 :group 'idlwave-shell-general-setup
167 (defcustom idlwave-shell-arrows-do-history t
175 :group 'idlwave-shell-general-setup
183 (defcustom idlwave-shell-use-toolbar t
185 Starting the shell will then add the toolbar to all idlwave-mode buffers.
189 `C-c C-d C-t' (`idlwave-shell-toggle-toolbar')."
190 :group 'idlwave-shell-general-setup
193 (defcustom idlwave-shell-temp-pro-prefix "/tmp/idltemp"
198 :group 'idlwave-shell-general-setup
201 (defvar idlwave-shell-fix-inserted-breaks nil
205 If non-nil then run `idlwave-shell-remove-breaks' to clean up IDL messages.")
207 (defcustom idlwave-shell-prefix-key "\C-c\C-d"
208 "*The prefix key for the debugging map `idlwave-shell-mode-prefix-map'.
209 This variable must already be set when idlwave-shell.el is loaded.
211 :group 'idlwave-shell-general-setup
214 (defcustom idlwave-shell-activate-prefix-keybindings t
216 The prefix key itself is given in the option `idlwave-shell-prefix-key'.
218 :group 'idlwave-shell-general-setup
221 (defcustom idlwave-shell-automatic-electric-debug 'breakpoint
226 :group 'idlwave-shell-general-setup
232 (defcustom idlwave-shell-electric-zap-to-file t
236 :group 'idlwave-shell-general-setup
239 ;; (defcustom idlwave-shell-debug-modifiers... See idlwave.el
241 (defvar idlwave-shell-activate-alt-keybindings nil
242 "Obsolete variable. See `idlwave-shell-debug-modifiers'.")
244 (defcustom idlwave-shell-use-truename nil
254 :group 'idlwave-shell-general-setup
257 (defcustom idlwave-shell-file-name-chars "~/A-Za-z0-9+:_.$#%={}\\- "
261 :group 'idlwave-shell-general-setup
264 (defcustom idlwave-shell-mode-hook '()
265 "*Hook for customising `idlwave-shell-mode'."
266 :group 'idlwave-shell-general-setup
269 (defcustom idlwave-shell-graphics-window-size '(500 400)
273 :group 'idlwave-shell-general-setup
280 (defgroup idlwave-shell-command-setup nil
282 :prefix "idlwave-shell"
283 :group 'idlwave)
285 (defcustom idlwave-shell-initial-commands "!more=0 & defsysv,'!ERROR_STATE',EXISTS=__e & if __e then begin & !ERROR_STATE.MSG_PREFIX=\"% \" & delvar,__e & endif"
287 This string is sent to the IDL process by `idlwave-shell-mode' which is
288 invoked by `idlwave-shell'."
289 :group 'idlwave-shell-command-setup
292 (defcustom idlwave-shell-save-command-history t
294 The file `idlwave-shell-command-history-file' is used to save and restore
296 :group 'idlwave-shell-command-setup
299 (defcustom idlwave-shell-command-history-file "idlwhist"
300 "The file in which the command history of the idlwave shell is saved.
303 The history is only saved if the variable `idlwave-shell-save-command-history'
305 :group 'idlwave-shell-command-setup
308 (defcustom idlwave-shell-show-commands
314 :group 'idlwave-shell-command-setup
323 (defcustom idlwave-shell-max-print-length 200
325 :group 'idlwave-shell-command-setup
328 (defcustom idlwave-shell-examine-alist
331 idlwave-shell-max-print-length)))
344 `idlwave-shell-examine-select', and the corresponding value is sent as
347 :group 'idlwave-shell-command-setup
353 (defvar idlwave-shell-print-expression-function nil
356 (defcustom idlwave-shell-separate-examine-output t
358 :group 'idlwave-shell-command-setup
361 (defcustom idlwave-shell-comint-settings
369 The function `idlwave-shell-mode' will make local variables out of each entry.
372 :group 'idlwave-shell-command-setup
376 (defcustom idlwave-shell-query-for-class t
378 :group 'idlwave-shell-command-setup
381 (defcustom idlwave-shell-use-input-mode-magic nil
384 by the regular expressions in `idlwave-shell-input-mode-spells'.
386 back, respectively. See `idlwave-shell-input-mode-spells' for details."
387 :group 'idlwave-shell-command-setup
390 (defcustom idlwave-shell-input-mode-spells
396 to the command \\[idlwave-shell-send-char].
400 manually with \\[idlwave-shell-char-mode-loop].
404 The variable `idlwave-shell-use-input-mode-magic' must be non-nil to enable
443 :group 'idlwave-shell-command-setup
449 (defcustom idlwave-shell-breakpoint-popup-menu t
452 :group 'idlwave-shell-command-setup
455 (defcustom idlwave-shell-reset-no-prompt nil
457 :group 'idlwave-shell-command-setup
461 (defgroup idlwave-shell-highlighting-and-faces nil
463 :prefix "idlwave-shell"
464 :group 'idlwave)
466 (defcustom idlwave-shell-mark-stop-line t
473 'face Use `idlwave-shell-stop-line-face' to highlight the line.
481 :group 'idlwave-shell-highlighting-and-faces
488 (defcustom idlwave-shell-overlay-arrow ">"
493 See also `idlwave-shell-use-overlay-arrow'."
494 :group 'idlwave-shell-highlighting-and-faces
497 (defcustom idlwave-shell-stop-line-face 'highlight
498 "*The face for `idlwave-shell-stop-line-overlay'.
500 line where IDL is stopped. See also `idlwave-shell-mark-stop-line'."
501 :group 'idlwave-shell-highlighting-and-faces
504 (defcustom idlwave-shell-electric-stop-color "Violet"
506 :group 'idlwave-shell-highlighting-and-faces
509 (defcustom idlwave-shell-electric-stop-line-face
511 (copy-face 'modeline 'idlwave-shell-electric-stop-line)
512 (set-face-background 'idlwave-shell-electric-stop-line
513 idlwave-shell-electric-stop-color)
515 (set-face-foreground 'idlwave-shell-electric-stop-line nil)
517 "*The face for `idlwave-shell-stop-line-overlay' when in electric debug mode.
520 :group 'idlwave-shell-highlighting-and-faces
523 (defcustom idlwave-shell-mark-breakpoints t
527 'face Highlight line with `idlwave-shell-breakpoint-face'.
531 :group 'idlwave-shell-highlighting-and-faces
538 (defvar idlwave-shell-use-breakpoint-glyph t
539 "Obsolete variable. See `idlwave-shell-mark-breakpoints.")
541 (defcustom idlwave-shell-breakpoint-face 'idlwave-shell-bp
544 lines which have a breakpoint. See also `idlwave-shell-mark-breakpoints'."
545 :group 'idlwave-shell-highlighting-and-faces
548 (if (not idlwave-shell-have-new-custom)
550 (copy-face 'underline 'idlwave-shell-bp)
552 (defface idlwave-shell-bp
556 :group 'idlwave-shell-highlighting-and-faces))
558 (defcustom idlwave-shell-disabled-breakpoint-face
559 'idlwave-shell-disabled-bp
562 lines which have a breakpoint. See also `idlwave-shell-mark-breakpoints'."
563 :group 'idlwave-shell-highlighting-and-faces
566 (if (not idlwave-shell-have-new-custom)
568 (copy-face 'underline 'idlwave-shell-disabled-bp)
570 (defface idlwave-shell-disabled-bp
574 :group 'idlwave-shell-highlighting-and-faces))
577 (defcustom idlwave-shell-expression-face 'secondary-selection
578 "*The face for `idlwave-shell-expression-overlay'.
581 :group 'idlwave-shell-highlighting-and-faces
584 (defcustom idlwave-shell-output-face 'secondary-selection
585 "*The face for `idlwave-shell-output-overlay'.
588 :group 'idlwave-shell-highlighting-and-faces
598 (defvar idlwave-shell-temp-pro-file nil
601 (defvar idlwave-shell-temp-rinfo-save-file nil
606 (defun idlwave-shell-temp-file (type)
609 TYPE is either 'pro' or 'rinfo', and `idlwave-shell-temp-pro-file' or
610 `idlwave-shell-temp-rinfo-save-file' is set (respectively)."
613 (or idlwave-shell-temp-rinfo-save-file
614 (setq idlwave-shell-temp-rinfo-save-file
615 (idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix))))
617 (or idlwave-shell-temp-pro-file
618 (setq idlwave-shell-temp-pro-file
619 (idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix))))
620 (t (error "Wrong argument (idlwave-shell-temp-file): %s"
624 (defun idlwave-shell-make-temp-file (prefix)
649 (defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur"
650 "Command used by `idlwave-shell-resync-dirs' to query IDL for
653 (defvar idlwave-shell-path-query "print,'PATH:<'+transpose(expand_path(!PATH,/ARRAY))+'>' & print,'SYSDIR:<'+!dir+'>'"
657 (defvar idlwave-shell-mode-line-info nil
660 (defvar idlwave-shell-default-directory nil
661 "The default directory in the idlwave-shell buffer, of outside use.")
663 (defvar idlwave-shell-last-save-and-action-file nil
664 "The last file which was compiled with `idlwave-shell-save-and-...'.")
672 (defvar idlwave-shell-stop-line-overlay nil
674 (defvar idlwave-shell-is-stopped nil)
675 (defvar idlwave-shell-expression-overlay nil
677 (defvar idlwave-shell-output-overlay nil
682 (if (overlayp idlwave-shell-stop-line-overlay)
683 (delete-overlay idlwave-shell-stop-line-overlay))
684 (if (overlayp idlwave-shell-expression-overlay)
685 (delete-overlay idlwave-shell-expression-overlay))
686 (if (overlayp idlwave-shell-output-overlay)
687 (delete-overlay idlwave-shell-output-overlay))
690 (setq idlwave-shell-stop-line-overlay nil
691 idlwave-shell-expression-overlay nil
692 idlwave-shell-output-overlay nil)
696 ((or (null idlwave-shell-mark-stop-line)
697 (eq idlwave-shell-mark-stop-line 'arrow))
701 ((eq idlwave-shell-mark-stop-line 'face)
708 (setq idlwave-shell-stop-line-overlay (make-overlay 1 1))
709 (overlay-put idlwave-shell-stop-line-overlay
710 'face idlwave-shell-stop-line-face))))
716 (setq idlwave-shell-stop-line-overlay (make-overlay 1 1))
717 (overlay-put idlwave-shell-stop-line-overlay
718 'face idlwave-shell-stop-line-face)))))
721 (setq idlwave-shell-expression-overlay (make-overlay 1 1))
722 (overlay-put idlwave-shell-expression-overlay
723 'face idlwave-shell-expression-face)
724 (overlay-put idlwave-shell-expression-overlay
726 (setq idlwave-shell-output-overlay (make-overlay 1 1))
727 (overlay-put idlwave-shell-output-overlay
728 'face idlwave-shell-output-face)
730 (copy-face idlwave-shell-stop-line-face
731 'idlwave-shell-pending-stop)
732 (copy-face idlwave-shell-electric-stop-line-face
733 'idlwave-shell-pending-electric-stop)
734 (set-face-background 'idlwave-shell-pending-stop "gray70")
735 (set-face-background 'idlwave-shell-pending-electric-stop "gray70")
739 (defvar idlwave-shell-bp-query "help,/breakpoints"
742 (defvar idlwave-shell-command-output nil
745 (defvar idlwave-shell-post-command-hook nil
750 (defvar idlwave-shell-sentinel-hook nil
753 (defvar idlwave-shell-hide-output nil
757 (defvar idlwave-shell-show-if-error nil
761 (defvar idlwave-shell-accumulation nil
764 (defvar idlwave-shell-command-line-to-execute nil)
765 (defvar idlwave-shell-cleanup-hook nil
768 (defvar idlwave-shell-pending-commands nil
772 `idlwave-shell-post-command-hook'. If HIDE is non-nil, hide the output
775 (defun idlwave-shell-buffer ()
777 The name of the buffer is made by surrounding `idlwave-shell-process-name
779 (concat "*" idlwave-shell-process-name "*"))
781 (defvar idlwave-shell-ready nil
788 (defvar idlwave-shell-halt-frame nil
791 (defvar idlwave-shell-step-frame nil
794 (defvar idlwave-shell-trace-frame nil
797 (defconst idlwave-shell-halt-messages
808 (defconst idlwave-shell-halt-messages-re
809 (mapconcat 'identity idlwave-shell-halt-messages "\\|")
810 "The regular expression computed from idlwave-shell-halt-messages")
812 (defconst idlwave-shell-trace-message-re
818 (defconst idlwave-shell-step-messages
825 (defvar idlwave-shell-break-message "^% Breakpoint at:"
828 (defconst idlwave-shell-electric-debug-help
867 (defvar idlwave-shell-bp-alist)
868 ;(defvar idlwave-shell-post-command-output)
869 (defvar idlwave-shell-sources-alist)
870 (defvar idlwave-shell-menu-def)
871 (defvar idlwave-shell-mode-menu)
872 (defvar idlwave-shell-initial-commands)
873 (defvar idlwave-shell-syntax-error)
874 (defvar idlwave-shell-other-error)
875 (defvar idlwave-shell-error-buffer)
876 (defvar idlwave-shell-error-last)
877 (defvar idlwave-shell-bp-buffer)
878 (defvar idlwave-shell-sources-query)
879 (defvar idlwave-shell-mode-map)
880 (defvar idlwave-shell-calling-stack-index)
881 (defvar idlwave-shell-only-prompt-pattern nil)
884 (defun idlwave-shell-mode ()
902 similar to M-TAB in `idlwave-mode'. In executive commands and
904 like in `idlwave-mode'.
908 `\\[idlwave-routine-info]' displays information about an IDL routine near point,
909 just like in `idlwave-mode'. The module used is the one at point or
912 \\[idlwave-update-routine-info].
913 \\[idlwave-find-module] find the source of a module.
914 \\[idlwave-resolve] tells IDL to compile an unresolved module.
915 \\[idlwave-context-help] shows the online help on the item at
934 \\[idlwave-shell-resync-dirs] queries IDL in order to change Emacs current directory
941 \\[idlwave-shell-print] or \\[idlwave-shell-mouse-print] with the
942 mouse, help, \\[idlwave-shell-help-expression] or
943 \\[idlwave-shell-mouse-help] with the mouse, or with a
945 \\[idlwave-shell-examine-select]. The mouse examine commands can
951 Turning on `idlwave-shell-mode' runs `comint-mode-hook' and
952 `idlwave-shell-mode-hook' (in that order).
956 Info documentation for this package is available. Use \\[idlwave-info]
959 homepage at `http://idlwave.org'.
960 IDLWAVE has customize support - see the group `idlwave'.
964 \\{idlwave-shell-mode-map}"
967 (idlwave-setup) ; Make sure config files and paths, etc. are available.
968 (unless (file-name-absolute-p idlwave-shell-command-history-file)
969 (setq idlwave-shell-command-history-file
970 (expand-file-name idlwave-shell-command-history-file
971 idlwave-config-directory)))
975 (setq comint-prompt-regexp idlwave-shell-prompt-pattern)
985 (setq major-mode 'idlwave-shell-mode)
987 (setq idlwave-shell-mode-line-info nil)
1000 idlwave-shell-mode-line-info
1006 ;; (make-local-variable 'idlwave-shell-bp-alist)
1007 (setq idlwave-shell-halt-frame nil
1008 idlwave-shell-trace-frame nil
1009 idlwave-shell-command-output nil
1010 idlwave-shell-step-frame nil)
1011 (idlwave-shell-display-line nil)
1012 (setq idlwave-shell-calling-stack-index 0)
1013 (setq idlwave-shell-only-prompt-pattern
1015 (substring idlwave-shell-prompt-pattern 1)
1018 (when idlwave-shell-query-for-class
1019 (add-to-list (make-local-variable 'idlwave-determine-class-special)
1020 'idlwave-shell-get-object-class)
1021 (setq idlwave-store-inquired-class t))
1026 (setq idlwave-idlwave_routine_info-compiled nil)
1027 (setq idlwave-shell-ready nil)
1028 (setq idlwave-shell-bp-alist nil)
1029 (idlwave-shell-update-bp-overlays) ; Throw away old overlays
1030 (setq idlwave-shell-post-command-hook nil ;clean up any old stuff
1031 idlwave-shell-sources-alist nil)
1032 (setq idlwave-shell-default-directory default-directory)
1033 (setq idlwave-shell-hide-output nil)
1037 (add-hook 'kill-buffer-hook 'idlwave-shell-kill-shell-buffer-confirm
1039 (add-hook 'kill-buffer-hook 'idlwave-shell-delete-temp-files nil 'local)
1040 (add-hook 'kill-emacs-hook 'idlwave-shell-delete-temp-files)
1041 (use-local-map idlwave-shell-mode-map)
1042 (easy-menu-add idlwave-shell-mode-menu idlwave-shell-mode-map)
1045 (when idlwave-shell-comint-settings
1046 (let ((list idlwave-shell-comint-settings) entry)
1074 (setq local-abbrev-table idlwave-mode-abbrev-table)
1075 (set-syntax-table idlwave-mode-syntax-table)
1081 (add-hook 'post-command-hook 'idlwave-command-hook nil t)
1084 (when (and idlwave-shell-save-command-history
1085 (stringp idlwave-shell-command-history-file))
1087 idlwave-shell-command-history-file)
1088 (if (file-regular-p idlwave-shell-command-history-file)
1095 (run-mode-hooks 'idlwave-shell-mode-hook)
1096 (idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide)
1099 (idlwave-shell-send-command
1100 (format "defsysv,'!idlwave_version','%s',1" idlwave-mode-version)
1103 (idlwave-shell-send-command idlwave-shell-path-query
1104 'idlwave-shell-get-path-info
1107 (defvar idlwave-system-directory)
1108 (defun idlwave-shell-get-path-info (&optional no-write)
1110 (let* ((rpl (idlwave-shell-path-filter))
1113 (old-path-alist idlwave-path-alist)
1114 (old-sys-dir idlwave-system-directory)
1117 (setq idlwave-system-directory sysdir)
1119 (not (string= idlwave-system-directory old-sys-dir)))
1120 (put 'idlwave-system-directory 'from-shell t)))
1122 (setq idlwave-path-alist
1129 (if (setq path-changed (not (equal idlwave-path-alist old-path-alist)))
1130 (put 'idlwave-path-alist 'from-shell t))
1131 (if idlwave-path-alist
1133 idlwave-auto-write-paths
1135 (not idlwave-library-path))
1136 (idlwave-write-paths))
1138 (setq idlwave-path-alist old-path-alist))))
1141 (fset 'idl-shell 'idlwave-shell))
1143 (defvar idlwave-shell-idl-wframe nil
1145 (defvar idlwave-shell-display-wframe nil
1148 (defvar idlwave-shell-calling-stack-index 0)
1149 (defvar idlwave-shell-calling-stack-routine nil)
1151 (defun idlwave-shell-source-frame ()
1153 (if idlwave-shell-use-dedicated-frame
1155 (if (frame-live-p idlwave-shell-display-wframe)
1157 idlwave-shell-display-wframe
1161 (setq idlwave-shell-display-wframe
1162 (if (eq (selected-frame) idlwave-shell-idl-wframe)
1169 idlwave-shell-idl-wframe))
1175 (defun idlwave-shell-shell-frame ()
1177 (if idlwave-shell-use-dedicated-frame
1179 (if (frame-live-p idlwave-shell-idl-wframe)
1181 idlwave-shell-idl-wframe
1183 (if (not (frame-live-p idlwave-shell-display-wframe))
1185 (setq idlwave-shell-display-wframe (selected-frame)))
1187 (setq idlwave-shell-idl-wframe
1188 (make-frame idlwave-shell-frame-parameters)))))
1191 (defun idlwave-shell (&optional arg quick)
1192 "Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'.
1196 When called with a prefix ARG, or when `idlwave-shell-use-dedicated-frame'
1200 The command to run comes from variable `idlwave-shell-explicit-file-name',
1201 with options taken from `idlwave-shell-command-line-options'.
1203 The buffer is put in `idlwave-shell-mode', providing commands for sending
1204 input and controlling the IDL job. See help on `idlwave-shell-mode'.
1205 See also the variable `idlwave-shell-prompt-pattern'.
1211 (let ((idlwave-shell-use-dedicated-frame nil))
1212 (idlwave-shell nil)
1214 (and idlwave-shell-use-dedicated-frame
1215 (setq idlwave-shell-idl-wframe (selected-frame)))
1216 (add-hook 'idlwave-shell-sentinel-hook
1221 (if arg (setq idlwave-shell-use-dedicated-frame t))
1222 (if (equal arg '(16)) (setq idlwave-shell-use-dedicated-frame nil))
1225 (unless (comint-check-proc (idlwave-shell-buffer))
1226 (let* ((prg (or idlwave-shell-explicit-file-name "idl"))
1228 idlwave-shell-process-name prg nil
1229 (if (stringp idlwave-shell-command-line-options)
1230 (idlwave-split-string
1231 idlwave-shell-command-line-options)
1232 idlwave-shell-command-line-options)))
1234 (setq idlwave-idlwave_routine_info-compiled nil)
1235 (set-process-filter process 'idlwave-shell-filter)
1236 (set-process-sentinel process 'idlwave-shell-sentinel)
1238 (idlwave-shell-mode)))
1239 (let ((window (idlwave-display-buffer (idlwave-shell-buffer) nil
1240 (idlwave-shell-shell-frame)))
1244 (if idlwave-shell-use-dedicated-window
1247 (if idlwave-shell-ready
1252 (add-hook 'idlwave-shell-sentinel-hook
1255 idlwave-auto-write-paths
1256 idlwave-path-alist
1257 (not idlwave-library-path)
1258 (get 'idlwave-path-alist 'from-shell))
1259 (idlwave-write-paths)))))
1261 (defun idlwave-shell-recenter-shell-window (&optional arg)
1262 "Run `idlwave-shell', but make sure the current window stays selected."
1265 (idlwave-shell arg)
1268 (defun idlwave-shell-hide-p (type &optional list)
1271 (let ((list (or list idlwave-shell-show-commands)))
1275 (defun idlwave-shell-add-or-remove-show (type)
1277 (if (listp idlwave-shell-show-commands)
1278 (setq idlwave-shell-show-commands
1279 (if (memq type idlwave-shell-show-commands)
1280 (delq type idlwave-shell-show-commands)
1281 (add-to-list'idlwave-shell-show-commands type)))
1282 (setq idlwave-shell-show-commands (list type))))
1285 (defun idlwave-shell-send-command (&optional cmd pcmd hide preempt
1290 idlwave-shell-pending-commands'. If IDL is ready the first command,
1291 CMD, in `idlwave-shell-pending-commands' is sent to the IDL process.
1294 `idlwave-shell-post-command-hook' when CMD is executed.
1303 `idlwave-shell-pending-commands'. If PREEMPT is 'wait, wait for all
1306 prompt is present and if `idlwave-shell-ready' is non-nil.
1315 ; (prin1-to-string idlwave-shell-pending-commands)))
1317 (if (and (symbolp idlwave-shell-show-commands)
1318 (eq idlwave-shell-show-commands 'everything))
1323 (if (or (not (setq buf (get-buffer (idlwave-shell-buffer))))
1325 (if (not idlwave-shell-automatic-start)
1328 "You need to first start an IDL shell with \\[idlwave-shell]"))
1329 (idlwave-shell-recenter-shell-window)
1330 (setq buf (get-buffer (idlwave-shell-buffer)))
1331 (if (or (not (setq buf (get-buffer (idlwave-shell-buffer))))
1335 (when (or cmd idlwave-shell-pending-commands)
1339 (setq idlwave-shell-pending-commands
1343 idlwave-shell-pending-commands)
1345 (append idlwave-shell-pending-commands
1350 (if (and idlwave-shell-ready
1355 (looking-at idlwave-shell-prompt-pattern)
1358 (let* ((lcmd (car idlwave-shell-pending-commands))
1365 (setq idlwave-shell-calling-stack-index 0))
1367 (setq idlwave-shell-post-command-hook pcmd)
1369 (setq idlwave-shell-hide-output hide)
1371 (setq idlwave-shell-show-if-error show-if-error)
1373 (setq idlwave-shell-pending-commands
1374 (cdr idlwave-shell-pending-commands))
1379 (setq idlwave-shell-ready nil)
1381 (while (not idlwave-shell-ready)
1383 (setq idlwave-shell-pending-commands nil)
1388 (defun idlwave-shell-send-char (c &optional error)
1393 (if (or (not (setq buf (get-buffer (idlwave-shell-buffer))))
1400 (defvar idlwave-shell-char-mode-active)
1401 (defun idlwave-shell-input-mode-magic (string)
1403 See also the variable `idlwave-shell-input-mode-spells'."
1405 ((string-match (car idlwave-shell-input-mode-spells) string)
1406 (call-interactively 'idlwave-shell-send-char))
1407 ((and (boundp 'idlwave-shell-char-mode-active)
1408 (string-match (nth 2 idlwave-shell-input-mode-spells) string))
1409 (setq idlwave-shell-char-mode-active 'exit))
1410 ((string-match (nth 1 idlwave-shell-input-mode-spells) string)
1413 (start-itimer "IDLWAVE Char Mode" 'idlwave-shell-char-mode-loop 0.5
1415 (run-at-time 0.5 nil 'idlwave-shell-char-mode-loop 'no-error)))))
1418 (defun idlwave-shell-char-mode-loop (&optional no-error)
1428 (let ((idlwave-shell-char-mode-active t)
1431 (if (or (not (setq buf (get-buffer (idlwave-shell-buffer))))
1434 (if idlwave-shell-ready
1447 (and idlwave-shell-ready
1449 (and (eq idlwave-shell-char-mode-active 'exit)
1464 (and (eq idlwave-shell-char-mode-active 'exit)
1467 (defun idlwave-shell-move-or-history (up &optional arg)
1474 (if (eq t idlwave-shell-arrows-do-history) (goto-char proc-pos))
1475 (if (and idlwave-shell-arrows-do-history
1480 (defun idlwave-shell-up-or-history (&optional arg)
1484 (idlwave-shell-move-or-history t arg))
1486 (defun idlwave-shell-down-or-history (&optional arg)
1490 (idlwave-shell-move-or-history nil arg))
1494 (defun idlwave-shell-comint-filter (process string) nil)
1496 (fset 'idlwave-shell-comint-filter (symbol-function 'comint-output-filter))
1497 (fset 'idlwave-shell-comint-filter (symbol-function 'comint-filter)))
1499 (defun idlwave-shell-is-running ()
1501 (eq (process-status idlwave-shell-process-name) 'run))
1503 (defun idlwave-shell-filter-hidden-output (output)
1514 (string-match idlwave-shell-only-prompt-pattern output)
1517 (defvar idlwave-shell-hidden-output-buffer " *idlwave-shell-hidden-output*"
1519 (defvar idlwave-shell-current-state nil)
1521 (defun idlwave-shell-filter (proc string)
1523 When the IDL prompt is received executes `idlwave-shell-post-command-hook'
1524 and then calls `idlwave-shell-send-command' for any pending commands."
1526 (if (eq (process-status idlwave-shell-process-name) 'run)
1535 (if idlwave-shell-hide-output
1540 (get-buffer-create idlwave-shell-hidden-output-buffer))
1543 (idlwave-shell-comint-filter proc string))
1548 (if idlwave-shell-use-input-mode-magic
1549 (idlwave-shell-input-mode-magic
1550 (concat idlwave-shell-accumulation string)))
1551 (setq idlwave-shell-accumulation
1556 (setq idlwave-shell-accumulation
1557 (concat idlwave-shell-accumulation string)))
1562 ; (get-buffer-create "*idlwave-shell-output*")
1567 (when (setq idlwave-shell-ready
1568 (string-match idlwave-shell-prompt-pattern
1569 idlwave-shell-accumulation))
1571 (if idlwave-shell-hide-output
1573 (set-buffer idlwave-shell-hidden-output-buffer)
1576 (re-search-backward idlwave-shell-prompt-pattern nil t)
1578 (setq idlwave-shell-command-output
1582 (setq idlwave-shell-command-output
1592 ;; them with idlwave-shell-ready=nil since they may
1593 ;; call idlwave-shell-send-command themselves.
1594 (let ((idlwave-shell-ready nil))
1595 (idlwave-shell-scan-for-state)
1597 (if idlwave-shell-hide-output
1598 (if (and idlwave-shell-show-if-error
1599 (eq idlwave-shell-current-state 'error))
1600 (idlwave-shell-comint-filter proc full-output)
1603 (if (eq idlwave-shell-hide-output 'mostly)
1605 (idlwave-shell-filter-hidden-output
1608 (idlwave-shell-comint-filter
1612 (if (listp idlwave-shell-post-command-hook)
1615 ;;(prin1 idlwave-shell-post-command-hook)
1616 (eval idlwave-shell-post-command-hook))
1618 (funcall idlwave-shell-post-command-hook))
1622 (setq idlwave-shell-accumulation nil
1623 idlwave-shell-command-output nil
1624 idlwave-shell-post-command-hook nil
1625 idlwave-shell-hide-output nil
1626 idlwave-shell-show-if-error nil))
1629 (idlwave-shell-send-command)))
1632 (defun idlwave-shell-sentinel (process event)
1634 (let* ((buf (idlwave-shell-buffer))
1638 (set-buffer (idlwave-shell-buffer))
1641 (if (and idlwave-shell-save-command-history
1642 (stringp idlwave-shell-command-history-file))
1648 (frame-live-p idlwave-shell-idl-wframe))
1649 (delete-frame idlwave-shell-idl-wframe)
1650 (setq idlwave-shell-idl-wframe nil
1651 idlwave-shell-display-wframe nil))
1655 (idlwave-shell-cleanup)
1660 (run-hooks 'idlwave-shell-sentinel-hook))
1661 (run-hooks 'idlwave-shell-sentinel-hook))))
1663 (defvar idlwave-shell-error-buffer " *idlwave-shell-errors*"
1669 (defvar idlwave-shell-syntax-error
1675 (defvar idlwave-shell-other-error
1679 (defvar idlwave-shell-halting-error
1683 (defvar idlwave-shell-cant-continue-error
1687 (defvar idlwave-shell-file-line-message
1712 (defvar idlwave-shell-electric-debug-mode) ; defined by easy-mmode
1714 (defun idlwave-shell-scan-for-state ()
1720 found. The variable `idlwave-shell-current-state' is set to 'error,
1726 ((not idlwave-shell-command-output))
1730 (string-match idlwave-shell-syntax-error
1731 idlwave-shell-command-output)
1732 (string-match idlwave-shell-other-error
1733 idlwave-shell-command-output))
1735 (get-buffer-create idlwave-shell-error-buffer)
1737 (insert idlwave-shell-command-output)
1739 (setq idlwave-shell-error-last (point)))
1740 (setq idlwave-shell-current-state 'error)
1741 (idlwave-shell-goto-next-error))
1744 ((string-match idlwave-shell-halting-error
1745 idlwave-shell-command-output)
1747 (setq idlwave-shell-calling-stack-index 0)
1748 (setq idlwave-shell-halt-frame
1749 (idlwave-shell-parse-line
1750 (substring idlwave-shell-command-output
1752 idlwave-shell-current-state 'error)
1753 (idlwave-shell-display-line (idlwave-shell-pc-frame)))
1757 ((or (setq trace (string-match idlwave-shell-trace-message-re
1758 idlwave-shell-command-output))
1759 (string-match idlwave-shell-halt-messages-re
1760 idlwave-shell-command-output))
1762 (setq idlwave-shell-calling-stack-index 0)
1763 (setq idlwave-shell-halt-frame
1764 (idlwave-shell-parse-line
1765 (substring idlwave-shell-command-output (match-end 0))))
1766 (setq idlwave-shell-current-state 'halt)
1768 (idlwave-shell-display-line
1769 (idlwave-shell-pc-frame) nil
1771 (if idlwave-shell-electric-debug-mode 'force))))
1774 ((string-match idlwave-shell-break-message
1775 idlwave-shell-command-output)
1776 (setq idlwave-shell-calling-stack-index 0)
1777 (setq idlwave-shell-halt-frame
1778 (idlwave-shell-parse-line
1779 (substring idlwave-shell-command-output (match-end 0))))
1786 (nth 0 idlwave-shell-halt-frame)
1787 (nth 1 idlwave-shell-halt-frame))
1788 idlwave-shell-bp-alist)))
1791 (let ((cmd (idlwave-shell-bp-get bp 'cmd)))
1796 (idlwave-shell-bp-query)))
1797 (setq idlwave-shell-current-state 'breakpoint)
1798 (idlwave-shell-display-line (idlwave-shell-pc-frame)))
1801 ((string-match idlwave-shell-cant-continue-error
1802 idlwave-shell-command-output)
1803 (setq idlwave-shell-current-state 'breakpoint))
1806 (t (setq idlwave-shell-current-state nil)))))
1809 (defun idlwave-shell-parse-line (string &optional skip-main)
1836 (string-match idlwave-shell-file-line-message string))
1842 (setq procedure (idlwave-shell-repair-string procedure))
1843 (setq number (idlwave-shell-repair-string number))
1844 (setq file (idlwave-shell-repair-file-name file))
1848 (list (idlwave-shell-file-name file)
1854 (defun idlwave-shell-repair-string (string)
1860 (defun idlwave-shell-repair-file-name (file)
1884 (defun idlwave-shell-cleanup ()
1886 (setq idlwave-shell-step-frame nil
1887 idlwave-shell-halt-frame nil
1888 idlwave-shell-pending-commands nil
1889 idlwave-shell-command-line-to-execute nil
1890 idlwave-shell-bp-alist nil
1891 idlwave-shell-calling-stack-index 0
1892 idlwave-idlwave_routine_info-compiled nil)
1893 (idlwave-shell-delete-temp-files)
1894 (idlwave-shell-display-line nil)
1895 (idlwave-shell-update-bp-overlays) ; kill old overlays
1896 (idlwave-shell-kill-buffer idlwave-shell-hidden-output-buffer)
1897 (idlwave-shell-kill-buffer idlwave-shell-bp-buffer)
1898 (idlwave-shell-kill-buffer idlwave-shell-error-buffer)
1899 ;; (idlwave-shell-kill-buffer (idlwave-shell-buffer))
1900 (and (get-buffer (idlwave-shell-buffer))
1901 (bury-buffer (get-buffer (idlwave-shell-buffer))))
1902 (run-hooks 'idlwave-shell-cleanup-hook))
1904 (defun idlwave-shell-kill-buffer (buf)
1909 (defun idlwave-shell-kill-shell-buffer-confirm ()
1910 (when (idlwave-shell-is-running)
1916 (defun idlwave-shell-window (n)
1918 The size is given by `idlwave-shell-graphics-window-size'."
1921 (idlwave-shell-send-command
1923 n idlwave-shell-graphics-window-size)
1924 nil (idlwave-shell-hide-p 'misc) nil t)))
1926 (defun idlwave-shell-resync-dirs ()
1929 `idlwave-shell-dirstack-query', reads the output for the new
1932 (idlwave-shell-send-command idlwave-shell-dirstack-query
1933 'idlwave-shell-filter-directory
1936 (defun idlwave-shell-retall (&optional arg)
1942 (idlwave-shell-send-command "retall" nil
1943 (if (idlwave-shell-hide-p 'misc) 'mostly)
1945 (idlwave-shell-display-line nil)))
1947 (defun idlwave-shell-closeall (&optional arg)
1950 (idlwave-shell-send-command "close,/all" nil
1951 (idlwave-shell-hide-p 'misc) nil t))
1953 (defun idlwave-shell-quit (&optional arg)
1957 (if (not (idlwave-shell-is-running))
1961 (idlwave-shell-send-command "exit")
1964 (defun idlwave-shell-reset (&optional hidden)
1973 (when (or idlwave-shell-reset-no-prompt
1976 (setq idlwave-shell-calling-stack-index 0)
1978 (idlwave-shell-send-command "retall" nil hidden)
1979 (idlwave-shell-send-command "widget_control,/reset" nil hidden)
1980 (idlwave-shell-send-command "close,/all" nil hidden)
1981 ;; (idlwave-shell-send-command "obj_destroy, obj_valid()" nil hidden)
1982 (idlwave-shell-send-command "heap_gc,/verbose" nil hidden)
1983 (idlwave-shell-display-line nil)))
1985 (defun idlwave-shell-path-filter ()
1987 (let ((path-string idlwave-shell-command-output)
2000 (defun idlwave-shell-routine-info-filter ()
2002 (let ((text idlwave-shell-command-output)
2007 (setq idlwave-compiled-routines nil
2008 idlwave-unresolved-routines nil)
2018 (if idlwave-idlwave_routine_info-compiled
2021 idlwave-shell-command-output)))
2024 (if idlwave-idlwave_routine_info-compiled
2027 idlwave-shell-command-output)))
2033 specs (idlwave-split-string spec sep-re)
2042 (delete "" (idlwave-split-string key " +")))))
2043 (setq name (idlwave-sintern-routine-or-method name class t)
2044 class (idlwave-sintern-class class t)
2047 (list (idlwave-sintern-keyword (car x) t))) keys))
2061 (not (idlwave-rinfo-assq name 'pro class
2062 idlwave-buffer-routines)))
2064 ;;(not (idlwave-rinfo-assq name 'pro class
2065 ;; idlwave-library-routines))
2072 (idlwave-sintern-dir
2076 (push entry idlwave-compiled-routines)
2077 (push entry idlwave-unresolved-routines)))
2082 (not (idlwave-rinfo-assq name 'fun class
2083 idlwave-buffer-routines)))
2085 ;; (not (idlwave-rinfo-assq name 'fun class
2086 ;; idlwave-library-routines))
2093 (idlwave-sintern-dir
2097 (push entry idlwave-compiled-routines)
2098 (push entry idlwave-unresolved-routines))))))
2100 (setq idlwave-compiled-routines (nreverse idlwave-compiled-routines)
2101 idlwave-unresolved-routines (nreverse idlwave-unresolved-routines)))
2103 (defun idlwave-shell-filter-directory ()
2104 "Get the current directory from `idlwave-shell-command-output'.
2107 (set-buffer (idlwave-shell-buffer))
2109 idlwave-shell-command-output)
2110 (let ((dir (substring idlwave-shell-command-output
2113 (setq idlwave-shell-default-directory dir)
2116 (defvar idlwave-shell-get-object-class nil)
2117 (defun idlwave-shell-get-object-class (apos)
2119 (let ((bos (save-excursion (idlwave-start-of-substatement 'pre) (point)))
2130 (if (not (idlwave-is-pointer-dereference bol))
2134 (setq idlwave-shell-get-object-class nil)
2135 (idlwave-shell-send-command
2138 'idlwave-shell-parse-object-class
2141 (if (and idlwave-shell-get-object-class
2142 (not (assoc-string idlwave-shell-get-object-class
2143 (idlwave-class-alist) t)))
2144 (idlwave-shell-maybe-update-routine-info))
2145 idlwave-shell-get-object-class)))
2147 (defun idlwave-shell-parse-object-class ()
2151 idlwave-shell-prompt-pattern "\\)")
2152 idlwave-shell-command-output)
2153 (setq idlwave-shell-get-object-class
2154 (match-string 1 idlwave-shell-command-output)))))
2156 (defvar idlwave-sint-sysvars nil)
2157 (idlwave-new-sintern-type 'execcomm)
2159 (defun idlwave-shell-complete (&optional arg)
2160 "Do completion in the idlwave-shell buffer.
2161 Calls `idlwave-shell-complete-filename' after some executive commands or
2162 in strings. Otherwise, calls `idlwave-complete' to complete modules and
2168 (setq exec-cmd (idlwave-shell-executive-command))
2174 (idlwave-shell-complete-filename))
2177 (setq idlwave-completion-help-info
2178 '(idlwave-shell-complete-execcomm-help))
2179 (idlwave-complete-in-buffer 'execcomm 'execcomm
2180 idlwave-executive-commands-alist nil
2184 ((idlwave-shell-batch-command)
2185 (idlwave-shell-complete-filename))
2187 ((idlwave-shell-shell-command)
2188 (idlwave-shell-complete-filename))
2190 ((and (idlwave-shell-filename-string)
2195 (idlwave-shell-complete-filename))
2199 (idlwave-complete arg)))))
2203 (defun idlwave-shell-complete-execcomm-help (mode word)
2204 (let ((word (or (nth 1 idlwave-completion-help-info) word))
2205 (entry (assoc-string word idlwave-executive-commands-alist t)))
2213 (defun idlwave-shell-complete-filename (&optional arg)
2218 (idlwave-shell-resync-dirs)
2219 (let ((comint-file-name-chars idlwave-shell-file-name-chars))
2222 (defun idlwave-shell-executive-command ()
2225 (idlwave-beginning-of-statement)
2230 (defun idlwave-shell-filename-string ()
2235 (skip-chars-backward idlwave-shell-file-name-chars limit)
2239 (defun idlwave-shell-batch-command ()
2244 (skip-chars-backward idlwave-shell-file-name-chars limit)
2246 (and (eq (preceding-char) ?@) (not (idlwave-in-quote))))))
2248 (defun idlwave-shell-shell-command ()
2251 (idlwave-beginning-of-statement)
2256 (defun idlwave-shell-redisplay (&optional hide)
2259 `idlwave-shell-display-line'. Also updates the breakpoint
2262 (setq idlwave-shell-calling-stack-index 0)
2263 (idlwave-shell-send-command
2265 '(idlwave-shell-display-line
2266 (idlwave-shell-pc-frame))
2268 (idlwave-shell-bp-query))
2270 (defun idlwave-shell-display-level-in-calling-stack (&optional hide)
2271 (idlwave-shell-send-command
2275 (setq idlwave-shell-calling-stack-index
2276 ,idlwave-shell-calling-stack-index)
2278 (idlwave-shell-parse-stack-and-display))
2281 (defun idlwave-shell-parse-stack-and-display ()
2282 (let* ((lines (delete "" (idlwave-split-string
2283 idlwave-shell-command-output "^%")))
2284 (stack (delq nil (mapcar 'idlwave-shell-parse-line lines)))
2289 (setq idlwave-shell-calling-stack-index 0)
2292 ((> idlwave-shell-calling-stack-index nmax)
2294 (setq idlwave-shell-calling-stack-index nmax
2297 ((< idlwave-shell-calling-stack-index nmin)
2299 (setq idlwave-shell-calling-stack-index nmin
2302 (setq idlwave-shell-calling-stack-routine
2303 (nth 2 (nth idlwave-shell-calling-stack-index stack)))
2306 (idlwave-shell-display-line
2307 (nth idlwave-shell-calling-stack-index stack) nil
2308 (if idlwave-shell-electric-debug-mode 'force))
2311 idlwave-shell-calling-stack-routine
2312 (- idlwave-shell-calling-stack-index))))))
2314 (defun idlwave-shell-stack-up ()
2317 (incf idlwave-shell-calling-stack-index)
2318 (idlwave-shell-display-level-in-calling-stack 'hide))
2319 (defun idlwave-shell-stack-down ()
2322 (decf idlwave-shell-calling-stack-index)
2323 (idlwave-shell-display-level-in-calling-stack 'hide))
2325 (defun idlwave-shell-goto-frame (&optional frame)
2327 If the optional argument FRAME is nil then idlwave-shell-pc-frame is
2330 (setq frame (idlwave-shell-pc-frame)))
2333 (set-buffer (idlwave-find-file-noselect (car frame) 'shell))
2337 (defun idlwave-shell-pc-frame ()
2339 (and idlwave-shell-halt-frame
2340 (list (nth 0 idlwave-shell-halt-frame)
2341 (nth 1 idlwave-shell-halt-frame)
2342 (nth 2 idlwave-shell-halt-frame))))
2344 (defun idlwave-shell-valid-frame (frame)
2348 (defun idlwave-shell-stop-line-pending ()
2350 (if idlwave-shell-stop-line-overlay
2351 (overlay-put idlwave-shell-stop-line-overlay 'face
2352 (if idlwave-shell-electric-debug-mode
2353 'idlwave-shell-pending-electric-stop
2354 'idlwave-shell-pending-stop))))
2356 (defvar idlwave-shell-suppress-electric-debug nil)
2357 (defun idlwave-shell-display-line (frame &optional col debug)
2364 'idlwave-shell-automatic-electric-debug'. if it is 'force, enable no
2370 (setq idlwave-shell-mode-line-info nil)
2371 (setq idlwave-shell-is-stopped nil)
2372 (if idlwave-shell-stop-line-overlay
2373 (delete-overlay idlwave-shell-stop-line-overlay))
2375 (idlwave-shell-electric-debug-all-off))
2376 (if (not (idlwave-shell-valid-frame frame))
2384 (setq idlwave-shell-mode-line-info
2387 (- idlwave-shell-calling-stack-index)
2389 (let* ((buffer (idlwave-find-file-noselect (car frame) 'shell))
2390 (select-shell (equal (buffer-name) (idlwave-shell-buffer)))
2394 (idlwave-display-buffer (idlwave-shell-buffer)
2395 nil (idlwave-shell-shell-frame))
2398 (setq window (idlwave-display-buffer buffer
2399 nil (idlwave-shell-source-frame)))
2409 (setq idlwave-shell-is-stopped t)
2411 (if idlwave-shell-stop-line-overlay
2414 (overlay-put idlwave-shell-stop-line-overlay 'face
2415 (if idlwave-shell-electric-debug-mode
2416 idlwave-shell-electric-stop-line-face
2417 idlwave-shell-stop-line-face))
2418 (move-overlay idlwave-shell-stop-line-overlay
2422 (if idlwave-shell-mark-stop-line
2423 (setq overlay-arrow-string idlwave-shell-overlay-arrow))
2440 (when (and (not idlwave-shell-electric-debug-mode)
2445 (eq idlwave-shell-automatic-electric-debug t)
2447 (eq idlwave-shell-automatic-electric-debug
2449 (not (eq idlwave-shell-current-state 'error))))
2450 (not idlwave-shell-suppress-electric-debug))))
2451 (idlwave-shell-electric-debug-mode t))
2452 (setq electric idlwave-shell-electric-debug-mode))
2459 (if (or (and idlwave-shell-electric-zap-to-file electric)
2460 (and (equal (buffer-name) (idlwave-shell-buffer))
2465 (defun idlwave-shell-step (arg)
2470 (idlwave-shell-stop-line-pending)
2471 (idlwave-shell-send-command
2473 nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t))
2475 (defun idlwave-shell-stepover (arg)
2482 (idlwave-shell-stop-line-pending)
2483 (idlwave-shell-send-command
2485 nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t))
2487 (defun idlwave-shell-break-here (&optional count cmd condition disabled
2504 (idlwave-shell-set-bp
2506 (idlwave-shell-bp (idlwave-shell-current-frame)
2508 (idlwave-shell-current-module))
2511 (defun idlwave-shell-set-bp-check (bp)
2513 This is run on `idlwave-shell-post-command-hook'.
2517 (if idlwave-shell-command-output
2520 idlwave-shell-command-output)
2526 (idlwave-shell-bp-get bp 'file) "?")))
2530 (idlwave-shell-command-failure)
2531 (idlwave-shell-send-command
2532 (concat ".run \"" (idlwave-shell-bp-get bp 'file) "\"") nil
2533 (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
2535 (idlwave-shell-set-bp bp))
2538 (idlwave-shell-command-failure))
2541 ((string-match "% Syntax error" idlwave-shell-command-output)
2543 (idlwave-shell-command-failure)
2548 (defun idlwave-shell-command-failure ()
2550 Call this from a function attached to `idlwave-shell-post-command-hook'
2552 For example, this is called from `idlwave-shell-set-bp-check' when a
2555 (setq idlwave-shell-pending-commands nil))
2557 (defun idlwave-shell-cont (&optional no-show)
2560 (idlwave-shell-stop-line-pending)
2561 (idlwave-shell-send-command ".c" (unless no-show
2562 '(idlwave-shell-redisplay 'hide))
2563 (if (idlwave-shell-hide-p 'debug) 'mostly)
2566 (defun idlwave-shell-go ()
2569 (idlwave-shell-stop-line-pending)
2570 (idlwave-shell-send-command ".go" '(idlwave-shell-redisplay 'hide)
2571 (if (idlwave-shell-hide-p 'debug) 'mostly)
2574 (defun idlwave-shell-return ()
2577 (idlwave-shell-stop-line-pending)
2578 (idlwave-shell-send-command ".return" '(idlwave-shell-redisplay 'hide)
2579 (if (idlwave-shell-hide-p 'debug) 'mostly)
2582 (defun idlwave-shell-skip ()
2585 (idlwave-shell-stop-line-pending)
2586 (idlwave-shell-send-command ".skip" '(idlwave-shell-redisplay 'hide)
2587 (if (idlwave-shell-hide-p 'debug) 'mostly)
2590 (defun idlwave-shell-clear-bp (bp &optional no-query)
2592 Clears in IDL and in `idlwave-shell-bp-alist'."
2593 (let ((index (idlwave-shell-bp-get bp)))
2596 (idlwave-shell-send-command
2598 nil (idlwave-shell-hide-p 'breakpoint) nil t)
2599 (unless no-query (idlwave-shell-bp-query))))))
2601 (defun idlwave-shell-current-frame ()
2603 If in the IDL shell buffer, returns `idlwave-shell-pc-frame'."
2604 (if (eq (current-buffer) (get-buffer (idlwave-shell-buffer)))
2606 (idlwave-shell-pc-frame)
2608 (list (idlwave-shell-file-name (buffer-file-name))
2615 (defun idlwave-shell-current-module ()
2618 (if (eq (current-buffer) (get-buffer (idlwave-shell-buffer)))
2620 (nth 2 idlwave-shell-halt-frame)
2625 (if (idlwave-prev-index-position)
2626 (let* ((module (idlwave-what-module))
2627 (name (idlwave-make-full-name (nth 2 module) (car module)))
2631 (defun idlwave-shell-clear-current-bp ()
2636 (let ((bp (idlwave-shell-find-current-bp)))
2637 (if bp (idlwave-shell-clear-bp bp))))
2640 (defun idlwave-shell-toggle-enable-current-bp (&optional bp force
2647 (let* ((bp (or bp (idlwave-shell-find-current-bp)))
2648 (disabled (idlwave-shell-bp-get bp 'disabled)))
2653 (idlwave-shell-send-command
2656 (int-to-string (idlwave-shell-bp-get bp)))
2657 nil (idlwave-shell-hide-p 'breakpoint) nil t)
2658 (unless no-update (idlwave-shell-bp-query)))))
2660 (defun idlwave-shell-enable-all-bp (&optional enable no-update bpl)
2663 (let ((bpl (or bpl idlwave-shell-bp-alist)) disabled modified)
2665 (setq disabled (idlwave-shell-bp-get (car bpl) 'disabled))
2666 (when (idlwave-xor (not disabled) (eq enable 'enable))
2667 (idlwave-shell-toggle-enable-current-bp
2671 (unless no-update (idlwave-shell-bp-query))
2674 (defun idlwave-shell-to-here ()
2678 (let ((disabled (idlwave-shell-enable-all-bp 'disable 'no-update)))
2679 (idlwave-shell-break-here 1 nil nil nil 'no-show)
2680 (idlwave-shell-cont 'no-show)
2681 (idlwave-shell-enable-all-bp 'enable 'no-update disabled))
2682 (idlwave-shell-redisplay)) ; sync up everything at the end
2684 (defun idlwave-shell-break-this-module (&optional arg)
2687 (idlwave-beginning-of-subprogram)
2688 (idlwave-shell-break-here arg)))
2690 (defun idlwave-shell-break-in ()
2696 (let* ((module (idlwave-fix-module-if-obj_new (idlwave-what-module)))
2702 (setq module (idlwave-make-full-name class name))
2703 (idlwave-shell-module-source-query module type)
2704 (idlwave-shell-set-bp-in-module name type class))
2708 (defun idlwave-shell-set-bp-in-module (name type class)
2709 "Set breakpoint in module. Assumes that `idlwave-shell-sources-alist'
2711 (let* ((module (idlwave-make-full-name class name))
2716 idlwave-shell-sources-alist)
2717 (nth 3 (idlwave-best-rinfo-assoc name type class
2718 (idlwave-routines)))))))
2723 (or (idlwave-get-buffer-visiting source-file)
2741 (idlwave-shell-break-here))
2745 (defun idlwave-shell-up ()
2749 (if (idlwave-shell-pc-frame)
2751 (idlwave-shell-goto-frame)
2754 (idlwave-beginning-of-subprogram)
2755 (idlwave-forward-block)
2757 (idlwave-backward-up-block -1)
2761 (idlwave-next-statement)
2762 (idlwave-end-of-statement)
2769 (idlwave-previous-statement))
2770 (idlwave-shell-to-here)))))
2772 (defun idlwave-shell-out ()
2776 (idlwave-shell-send-command ".o" nil
2777 (if (idlwave-shell-hide-p 'debug) 'mostly)
2780 (defun idlwave-shell-goto-previous-bp ()
2783 (idlwave-shell-move-to-bp -1))
2784 (defun idlwave-shell-goto-next-bp ()
2787 (idlwave-shell-move-to-bp 1))
2789 (defun idlwave-shell-move-to-bp (dir)
2791 (let* ((frame (idlwave-shell-current-frame))
2794 (bp-alist idlwave-shell-bp-alist)
2811 (defun idlwave-shell-help-expression (arg)
2812 "Print help on current expression. See `idlwave-shell-print'."
2814 (idlwave-shell-print arg 'help))
2816 (defmacro idlwave-shell-mouse-examine (help &optional ev)
2827 'idlwave-xemacs-hack-mouse-track
2834 (idlwave-shell-print (if (idlwave-region-active-p) '(4) nil)
2839 (defun idlwave-default-mouse-track-event-is-with-button (event n)
2842 (defun idlwave-xemacs-hack-mouse-track (event)
2849 'idlwave-default-mouse-track-event-is-with-button)
2854 (defun idlwave-shell-mouse-print (event)
2857 (funcall (idlwave-shell-mouse-examine nil) event))
2859 (defun idlwave-shell-mouse-help (event)
2862 (funcall (idlwave-shell-mouse-examine 'help) event))
2864 (defun idlwave-shell-examine-select (event)
2867 (funcall (idlwave-shell-mouse-examine nil event) event))
2869 (defmacro idlwave-shell-examine (help)
2873 (idlwave-shell-print nil ,help)))
2875 (defvar idlwave-shell-examine-label nil
2877 (defvar idlwave-shell-examine-completion-list nil)
2879 (defun idlwave-shell-print (arg &optional help ev complete-help-type)
2913 (unless idlwave-idlwave_routine_info-compiled
2914 (idlwave-shell-compile-helper-routines))
2919 (if (and (integerp idlwave-shell-calling-stack-index)
2920 (> idlwave-shell-calling-stack-index 0))
2922 idlwave-shell-calling-stack-index
2923 idlwave-shell-calling-stack-routine)))
2928 ((and (or arg (idlwave-region-active-p))
2933 (idlwave-with-special-syntax
2962 (when (and beg end idlwave-shell-expression-overlay)
2963 (move-overlay idlwave-shell-expression-overlay beg end
2966 'idlwave-shell-delete-expression-overlay))
2968 'idlwave-shell-delete-output-overlay)
2984 (and ev idlwave-shell-examine-alist)
2991 (idlwave-one-key-select 'idlwave-shell-examine-alist
2993 ;; (idlwave-completing-read
2995 ;; idlwave-shell-examine-alist nil nil nil
2996 ;; 'idlwave-shell-examine-completion-list
2998 (idlwave-popup-select
3000 (mapcar 'car idlwave-shell-examine-alist)
3002 idlwave-shell-examine-alist))))
3005 (if idlwave-shell-separate-examine-output
3006 (setq idlwave-shell-examine-label
3011 (setq idlwave-shell-examine-label
3021 (setq expr (idlwave-retrieve-expression-from-level
3023 idlwave-shell-calling-stack-index)))
3024 (setq cmd (idlwave-shell-help-statement help expr))
3025 ;;(idlwave-shell-recenter-shell-window)
3026 (idlwave-shell-send-command
3028 'idlwave-shell-check-compiled-and-display
3029 (if idlwave-shell-separate-examine-output 'hide))))))
3031 (defvar idlwave-shell-examine-window-alist nil
3034 (defvar idlwave-shell-examine-map (make-sparse-keymap))
3035 (define-key idlwave-shell-examine-map "q" 'idlwave-shell-examine-display-quit)
3036 (define-key idlwave-shell-examine-map "c" 'idlwave-shell-examine-display-clear)
3039 (defun idlwave-shell-check-compiled-and-display ()
3041 (if (string-match "% Attempt to call undefined" idlwave-shell-command-output)
3042 (idlwave-shell-compile-helper-routines))
3043 (if idlwave-shell-separate-examine-output
3044 (idlwave-shell-examine-display)
3045 (idlwave-shell-examine-highlight)))
3047 (defun idlwave-shell-examine-display ()
3052 (use-local-map idlwave-shell-examine-map)
3057 (if (string-match "^% Syntax error." idlwave-shell-command-output)
3059 (insert idlwave-shell-command-output)
3062 (re-search-backward idlwave-shell-prompt-pattern nil t)
3067 idlwave-shell-prompt-pattern nil t)
3074 (if idlwave-shell-examine-label
3076 (insert idlwave-shell-examine-label)
3077 (setq idlwave-shell-examine-label nil)))))
3081 (move-overlay idlwave-shell-output-overlay cur-beg cur-end
3089 (setq win (idlwave-display-buffer
3102 (let ((elt (assoc win idlwave-shell-examine-window-alist)))
3111 (setq idlwave-shell-examine-window-alist
3114 idlwave-shell-examine-window-alist)))
3116 (if (setq elt (assoc win idlwave-shell-examine-window-alist))
3118 (add-to-list 'idlwave-shell-examine-window-alist
3127 (defun idlwave-shell-examine-display-quit ()
3134 (defun idlwave-shell-examine-display-clear ()
3144 (defun idlwave-retrieve-expression-from-level (expr level)
3212 (defun idlwave-shell-help-statement (help expr)
3221 (number-to-string idlwave-shell-max-print-length)))
3231 (defun idlwave-shell-examine-highlight ()
3233 (let* ((buffer (get-buffer (idlwave-shell-buffer)))
3242 (re-search-backward idlwave-shell-prompt-pattern nil t)
3247 (idlwave-display-buffer (idlwave-shell-buffer)
3248 nil (idlwave-shell-shell-frame))
3249 (if (and idlwave-shell-output-overlay process-mark)
3250 (move-overlay idlwave-shell-output-overlay
3253 (defun idlwave-shell-delete-output-overlay ()
3254 (unless (or (eq this-command 'idlwave-shell-mouse-nop)
3257 (if idlwave-shell-output-overlay
3258 (delete-overlay idlwave-shell-output-overlay))
3260 (remove-hook 'pre-command-hook 'idlwave-shell-delete-output-overlay)))
3262 (defun idlwave-shell-delete-expression-overlay ()
3263 (unless (or (eq this-command 'idlwave-shell-mouse-nop)
3266 (if idlwave-shell-expression-overlay
3267 (delete-overlay idlwave-shell-expression-overlay))
3269 (remove-hook 'pre-command-hook 'idlwave-shell-delete-expression-overlay)))
3271 (defvar idlwave-shell-bp-alist nil
3284 data - Data associated with the breakpoint by idlwave-shell currently
3298 (defun idlwave-shell-run-region (beg end &optional n)
3300 Copies the region to a temporary file `idlwave-shell-temp-pro-file'
3304 lines - which would be a problem if `idlwave-shell-evaluate-region'
3311 (set-buffer (idlwave-find-file-noselect
3312 (idlwave-shell-temp-file 'pro) 'tmp))
3318 (idlwave-previous-statement)
3319 (idlwave-look-at "\\<end\\>")))
3322 (idlwave-shell-send-command (concat ".run \""
3323 idlwave-shell-temp-pro-file "\"")
3325 (if (idlwave-shell-hide-p 'run) 'mostly)
3328 (idlwave-display-buffer (idlwave-shell-buffer)
3329 nil (idlwave-shell-shell-frame))))
3331 (defun idlwave-shell-evaluate-region (beg end &optional n)
3335 `idlwave-shell-run-region' for this."
3337 (idlwave-shell-send-command (buffer-substring beg end))
3339 (idlwave-display-buffer (idlwave-shell-buffer)
3340 nil (idlwave-shell-shell-frame))))
3342 (defun idlwave-shell-delete-temp-files ()
3344 (if (stringp idlwave-shell-temp-pro-file)
3346 (let ((buf (idlwave-get-buffer-visiting
3347 idlwave-shell-temp-pro-file)))
3350 (delete-file idlwave-shell-temp-pro-file))
3352 (if (stringp idlwave-shell-temp-rinfo-save-file)
3354 (delete-file idlwave-shell-temp-rinfo-save-file)
3357 (defun idlwave-display-buffer (buf not-this-window-p &optional frame)
3381 (defvar idlwave-shell-bp-buffer " *idlwave-shell-bp*"
3384 (defun idlwave-shell-bp-query (&optional no-show)
3385 "Reconcile idlwave-shell's breakpoint list with IDL's.
3386 Queries IDL using the string in `idlwave-shell-bp-query'."
3388 (idlwave-shell-send-command idlwave-shell-bp-query
3390 (idlwave-shell-filter-bp (quote ,no-show)))
3393 (defun idlwave-shell-bp-get (bp &optional item)
3395 idlwave-shell-bp-alist. Optional second arg ITEM is the
3404 ;; idlwave-shell breakpoint data
3420 (defun idlwave-shell-filter-bp (&optional no-show)
3421 "Get the breakpoints from `idlwave-shell-command-output'. Create
3422 `idlwave-shell-bp-alist' updating breakpoint count and command data
3426 (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
3428 (insert idlwave-shell-command-output)
3430 (let ((old-bp-alist idlwave-shell-bp-alist)
3448 (setq idlwave-shell-bp-alist (list nil))
3463 file (idlwave-shell-file-name (match-string (nth 3 indmap))))
3472 (nconc idlwave-shell-bp-alist
3478 (setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist))
3481 (mapcar 'idlwave-shell-update-bp old-bp-alist)
3482 (mapcar 'idlwave-shell-update-bp-command-only old-bp-alist))))
3484 (unless no-show (idlwave-shell-update-bp-overlays))
3486 idlwave-shell-bp-alist)
3488 (defun idlwave-shell-update-bp-command-only (bp)
3489 (idlwave-shell-update-bp bp t))
3491 (defun idlwave-shell-update-bp (bp &optional command-only)
3493 If BP frame is in `idlwave-shell-bp-alist' updates the breakpoint data."
3494 (let ((match (assoc (car bp) idlwave-shell-bp-alist)))
3500 (defun idlwave-shell-set-bp-data (bp data)
3504 (defun idlwave-shell-bp (frame &optional data module)
3507 of the format used in `idlwave-shell-bp-alist'. Can be used in commands
3508 attempting match a breakpoint in `idlwave-shell-bp-alist'."
3513 (defvar idlwave-shell-old-bp nil
3516 (defun idlwave-shell-sources-bp (bp)
3517 "Check `idlwave-shell-sources-alist' for source of breakpoint using BP.
3521 ((bp-file (idlwave-shell-bp-get bp 'file))
3522 (bp-module (idlwave-shell-bp-get bp 'module))
3525 (cdr (assoc bp-module idlwave-shell-sources-alist)))))
3531 (defun idlwave-shell-set-bp (bp &optional no-show)
3539 (idlwave-shell-send-command
3540 idlwave-shell-bp-query
3542 (idlwave-shell-filter-bp (quote ,no-show))
3543 (setq idlwave-shell-old-bp idlwave-shell-bp-alist))
3547 (idlwave-shell-module-source-query (idlwave-shell-bp-get bp 'module)
3548 (idlwave-shell-bp-get bp 'type))
3550 ((count (idlwave-shell-bp-get bp 'count))
3551 (condition (idlwave-shell-bp-get bp 'condition))
3552 (disabled (idlwave-shell-bp-get bp 'disabled))
3565 (line (idlwave-shell-bp-get bp 'line)))
3566 (idlwave-shell-send-command
3568 (idlwave-shell-sources-bp bp) "',"
3573 (if (idlwave-shell-set-bp-check (quote ,bp))
3574 (idlwave-shell-set-bp-adjust (quote ,bp) (quote ,no-show))))
3576 (idlwave-shell-hide-p 'breakpoint)
3579 (defun idlwave-shell-set-bp-adjust (bp &optional no-show)
3581 (idlwave-shell-send-command
3582 idlwave-shell-bp-query
3584 (idlwave-shell-filter-bp 'no-show)
3585 (idlwave-shell-new-bp (quote ,bp))
3587 (idlwave-shell-update-bp-overlays)))
3591 (defun idlwave-shell-find-bp (frame)
3592 "Return breakpoint from `idlwave-shell-bp-alist' for frame.
3594 (assoc frame idlwave-shell-bp-alist))
3596 (defun idlwave-shell-find-current-bp ()
3598 (let ((bp (idlwave-shell-find-bp (idlwave-shell-current-frame))))
3602 (idlwave-shell-goto-frame)
3603 (idlwave-beginning-of-statement)
3604 (setq bp (idlwave-shell-find-bp (idlwave-shell-current-frame))))
3610 (defun idlwave-shell-new-bp (bp)
3616 (let ((obp-index (mapcar 'idlwave-shell-bp-get idlwave-shell-old-bp))
3617 (bpl idlwave-shell-bp-alist))
3618 (while (and (member (idlwave-shell-bp-get (car bpl)) obp-index)
3624 (setq bpl (assoc (car bp) idlwave-shell-bp-alist)))
3627 (equal (idlwave-shell-bp-get (setq bpl (car bpl)) 'file)
3628 (idlwave-shell-bp-get bp 'file)))
3630 ;; This updates `idlwave-shell-bp-alist' because a deep copy was
3632 (idlwave-shell-set-bp-data bpl (idlwave-shell-bp-get bp 'data))
3636 (defvar idlwave-shell-bp-overlays nil
3638 (defvar idlwave-shell-bp-glyph)
3640 (defvar idlwave-shell-debug-line-map (make-sparse-keymap))
3641 (define-key idlwave-shell-debug-line-map
3643 'idlwave-shell-mouse-active-bp)
3645 (defun idlwave-shell-update-bp-overlays ()
3648 (when idlwave-shell-mark-breakpoints
3649 (let ((ov-alist (copy-alist idlwave-shell-bp-overlays))
3650 (bp-list idlwave-shell-bp-alist)
3651 (use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph))
3652 idlwave-shell-bp-glyph))
3662 (setq ov-alist idlwave-shell-bp-overlays
3663 idlwave-shell-bp-overlays
3664 (if idlwave-shell-bp-glyph
3665 (mapcar 'list (mapcar 'car idlwave-shell-bp-glyph))
3669 (idlwave-shell-goto-frame (car bp))
3672 (condition (idlwave-shell-bp-get bp 'condition))
3673 (count (idlwave-shell-bp-get bp 'count))
3674 (disabled (idlwave-shell-bp-get bp 'disabled))
3675 (type (if idlwave-shell-bp-glyph
3697 (int-to-string (idlwave-shell-bp-get bp))
3711 (idlwave-shell-make-new-bp-overlay type disabled)))
3713 (if idlwave-shell-breakpoint-popup-menu
3716 (if (setq match (assq full-type idlwave-shell-bp-overlays))
3718 (nconc idlwave-shell-bp-overlays
3743 (defun idlwave-shell-make-new-bp-overlay (&optional type disabled)
3750 (use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph))
3751 idlwave-shell-bp-glyph))
3754 idlwave-shell-disabled-breakpoint-face
3755 idlwave-shell-breakpoint-face)))
3759 (when idlwave-shell-breakpoint-popup-menu
3761 (set-extent-property ov 'keymap idlwave-shell-debug-line-map))
3770 (let ((glyph (cdr (assq type idlwave-shell-bp-glyph))))
3776 (idlwave-shell-mark-breakpoints
3783 (when idlwave-shell-breakpoint-popup-menu
3785 (overlay-put ov 'keymap idlwave-shell-debug-line-map))
3789 (let ((image-props (cdr (assq type idlwave-shell-bp-glyph)))
3805 (idlwave-shell-mark-breakpoints
3812 (defun idlwave-shell-mouse-active-bp (ev)
3816 (let ((bp (idlwave-shell-find-bp (idlwave-shell-current-frame)))
3820 (setq index (int-to-string (idlwave-shell-bp-get bp))
3821 condition (idlwave-shell-bp-get bp 'condition)
3822 cmd (idlwave-shell-bp-get bp 'cmd)
3823 count (idlwave-shell-bp-get bp 'count)
3824 disabled (idlwave-shell-bp-get bp 'disabled))
3825 (setq select (idlwave-popup-select
3840 (idlwave-shell-clear-all-bp))
3842 (idlwave-shell-clear-current-bp))
3844 (idlwave-shell-break-here count cmd
3850 (idlwave-shell-break-here (if (or (not count)
3856 (idlwave-shell-toggle-enable-current-bp))
3860 (defun idlwave-shell-edit-default-command-line (arg)
3863 (setq idlwave-shell-command-line-to-execute
3864 (read-string "IDL> " idlwave-shell-command-line-to-execute)))
3866 (defun idlwave-shell-execute-default-command-line (arg)
3869 `idlwave-shell-edit-default-command-line' to edit the line."
3873 (setq idlwave-shell-command-line-to-execute nil))
3875 (setq idlwave-shell-command-line-to-execute
3876 (read-string "IDL> " idlwave-shell-command-line-to-execute))))
3877 (idlwave-shell-reset 'hidden)
3878 (idlwave-shell-send-command
3879 (or idlwave-shell-command-line-to-execute
3880 (with-current-buffer (idlwave-shell-buffer)
3882 '(idlwave-shell-redisplay 'hide)))
3884 (defun idlwave-shell-save-and-run ()
3890 (idlwave-shell-save-and-action 'run))
3892 (defun idlwave-shell-save-and-compile ()
3898 (idlwave-shell-save-and-action 'compile))
3900 (defun idlwave-shell-save-and-batch ()
3906 (idlwave-shell-save-and-action 'batch))
3908 (defun idlwave-shell-save-and-action (action)
3914 (if idlwave-shell-stop-line-overlay
3915 (delete-overlay idlwave-shell-stop-line-overlay))
3916 (if idlwave-shell-is-stopped
3917 (idlwave-shell-electric-debug-all-off))
3918 (setq idlwave-shell-is-stopped nil)
3922 ((eq major-mode 'idlwave-mode)
3924 (setq idlwave-shell-last-save-and-action-file (buffer-file-name)))
3925 (idlwave-shell-last-save-and-action-file
3926 (if (setq buf (idlwave-get-buffer-visiting
3927 idlwave-shell-last-save-and-action-file))
3931 (t (setq idlwave-shell-last-save-and-action-file
3933 (if (file-regular-p idlwave-shell-last-save-and-action-file)
3935 (idlwave-shell-send-command
3941 idlwave-shell-last-save-and-action-file
3943 `(idlwave-shell-maybe-update-routine-info nil
3944 ,idlwave-shell-last-save-and-action-file)
3945 (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
3946 (idlwave-shell-bp-query))
3948 idlwave-shell-last-save-and-action-file)))
3949 (setq idlwave-shell-last-save-and-action-file nil)
3952 (defun idlwave-shell-maybe-update-routine-info (&optional wait file)
3954 (if (and (not idlwave-shell-is-stopped)
3955 (or (eq t idlwave-auto-routine-info-updates)
3956 (memq 'compile-buffer idlwave-auto-routine-info-updates))
3957 idlwave-query-shell-for-routine-info
3958 idlwave-routines)
3959 (idlwave-shell-update-routine-info t nil wait file)))
3961 (defvar idlwave-shell-sources-query "help,/source,/full"
3964 (defvar idlwave-shell-sources-alist nil
3968 (module name . (source-file-truename idlwave-internal-filename)).")
3970 (defun idlwave-shell-module-source-query (module &optional type)
3974 (idlwave-shell-send-command
3977 `(idlwave-shell-module-source-filter ,module)
3980 (defun idlwave-shell-module-source-filter (module)
3981 "Get module source, and update idlwave-shell-sources-alist."
3982 (let ((old (assoc (upcase module) idlwave-shell-sources-alist))
3985 idlwave-shell-command-output)
3986 (setq filename (substring idlwave-shell-command-output
3989 (setcdr old (list (idlwave-shell-file-name filename) filename))
3990 (setq idlwave-shell-sources-alist
3991 (append idlwave-shell-sources-alist
3993 (list (idlwave-shell-file-name filename)
3996 (defun idlwave-shell-sources-query ()
3998 Queries IDL using the string in `idlwave-shell-sources-query'."
4000 (idlwave-shell-send-command idlwave-shell-sources-query
4001 'idlwave-shell-sources-filter
4004 (defun idlwave-shell-sources-filter ()
4005 "Get source files from `idlwave-shell-sources-query' output.
4006 Create `idlwave-shell-sources-alist' consisting of
4008 (module name . (source-file-truename idlwave-internal-filename))."
4010 (set-buffer (get-buffer-create idlwave-shell-bp-buffer))
4012 (insert idlwave-shell-command-output)
4022 (setq idlwave-shell-sources-alist
4029 (idlwave-shell-sources-grep))
4034 (idlwave-shell-sources-grep)))))))))
4036 (defun idlwave-shell-sources-grep ()
4052 (idlwave-shell-file-name internal-filename)
4057 (defun idlwave-shell-clear-all-bp ()
4060 (idlwave-shell-send-command
4061 idlwave-shell-bp-query
4063 (idlwave-shell-filter-bp)
4064 (mapcar (lambda (x) (idlwave-shell-clear-bp x 'no-query))
4065 idlwave-shell-bp-alist)
4066 (idlwave-shell-bp-query))
4069 (defun idlwave-shell-list-all-bp ()
4072 (idlwave-shell-send-command
4073 idlwave-shell-bp-query))
4075 (defvar idlwave-shell-error-last 0
4076 "Position of last syntax error in `idlwave-shell-error-buffer'.")
4078 (defun idlwave-shell-goto-next-error ()
4083 (set-buffer idlwave-shell-error-buffer)
4084 (goto-char idlwave-shell-error-last)
4086 (re-search-forward idlwave-shell-syntax-error nil t)
4087 (re-search-forward idlwave-shell-other-error nil t))
4092 (idlwave-shell-file-name
4104 (setq idlwave-shell-error-last (point)))
4107 (idlwave-shell-display-line frame col 'disable))
4111 (defun idlwave-shell-file-name (name)
4112 "If `idlwave-shell-use-truename' is non-nil, convert file name to true name.
4114 (let ((def-dir (if (eq major-mode 'idlwave-shell-mode)
4116 idlwave-shell-default-directory)))
4117 (if idlwave-shell-use-truename
4123 (defvar idlwave-shell-mode-map (copy-keymap comint-mode-map)
4124 "Keymap for idlwave-mode.")
4125 (defvar idlwave-shell-electric-debug-mode-map (make-sparse-keymap))
4126 (defvar idlwave-shell-mode-prefix-map (make-sparse-keymap))
4127 (fset 'idlwave-shell-mode-prefix-map idlwave-shell-mode-prefix-map)
4128 (defvar idlwave-mode-prefix-map (make-sparse-keymap))
4129 (fset 'idlwave-mode-prefix-map idlwave-mode-prefix-map)
4131 (defun idlwave-shell-define-key-both (key hook)
4133 (define-key idlwave-mode-map key hook)
4134 (define-key idlwave-shell-mode-map key hook))
4136 ;(define-key idlwave-shell-mode-map "\M-?" 'comint-dynamic-list-completions)
4137 ;(define-key idlwave-shell-mode-map "\t" 'comint-dynamic-complete)
4139 (define-key idlwave-shell-mode-map "\C-w" 'comint-kill-region)
4140 (define-key idlwave-shell-mode-map "\t" 'idlwave-shell-complete)
4141 (define-key idlwave-shell-mode-map "\M-\t" 'idlwave-shell-complete)
4142 (define-key idlwave-shell-mode-map "\C-c\C-s" 'idlwave-shell)
4143 (define-key idlwave-shell-mode-map "\C-c?" 'idlwave-routine-info)
4144 (define-key idlwave-shell-mode-map "\C-g" 'idlwave-keyboard-quit)
4145 (define-key idlwave-shell-mode-map "\M-?" 'idlwave-context-help)
4146 (define-key idlwave-shell-mode-map [(control meta ?\?)]
4147 'idlwave-help-assistant-help-with-topic)
4148 (define-key idlwave-shell-mode-map "\C-c\C-i" 'idlwave-update-routine-info)
4149 (define-key idlwave-shell-mode-map "\C-c\C-y" 'idlwave-shell-char-mode-loop)
4150 (define-key idlwave-shell-mode-map "\C-c\C-x" 'idlwave-shell-send-char)
4151 (define-key idlwave-shell-mode-map "\C-c=" 'idlwave-resolve)
4152 (define-key idlwave-shell-mode-map "\C-c\C-v" 'idlwave-find-module)
4153 (define-key idlwave-shell-mode-map "\C-c\C-k" 'idlwave-kill-autoloaded-buffers)
4154 (define-key idlwave-shell-mode-map idlwave-shell-prefix-key
4155 'idlwave-shell-debug-map)
4156 (define-key idlwave-shell-mode-map [(up)] 'idlwave-shell-up-or-history)
4157 (define-key idlwave-shell-mode-map [(down)] 'idlwave-shell-down-or-history)
4158 (define-key idlwave-mode-map "\C-c\C-y" 'idlwave-shell-char-mode-loop)
4159 (define-key idlwave-mode-map "\C-c\C-x" 'idlwave-shell-send-char)
4162 (idlwave-shell-define-key-both
4166 'idlwave-shell-mouse-print)
4167 (idlwave-shell-define-key-both
4171 'idlwave-shell-mouse-help)
4172 (idlwave-shell-define-key-both
4176 'idlwave-shell-examine-select)
4177 ;; Add this one from the idlwave-mode-map
4178 (define-key idlwave-shell-mode-map
4182 'idlwave-mouse-context-help)
4185 (defun idlwave-shell-mouse-nop (event)
4188 (idlwave-shell-define-key-both
4189 [(shift mouse-2)] 'idlwave-shell-mouse-nop)
4190 (idlwave-shell-define-key-both
4191 [(shift control mouse-2)] 'idlwave-shell-mouse-nop)
4192 (idlwave-shell-define-key-both
4193 [(control meta mouse-2)] 'idlwave-shell-mouse-nop))
4197 ;; If `idlwave-shell-activate-prefix-keybindings' is non-nil, the
4199 ;; `idlwave-shell-debug-modifiers' is non-nil, the second key in the
4201 ;; `idlwave-mode-map' and `idlwave-shell-mode-map'. The next list
4209 '(([(control ?b)] ?b idlwave-shell-break-here t t)
4210 ([(control ?i)] ?i idlwave-shell-break-in t t)
4211 ([(control ?j)] ?j idlwave-shell-break-this-module t t)
4212 ([(control ?d)] ?d idlwave-shell-clear-current-bp t)
4213 ([(control ?a)] ?a idlwave-shell-clear-all-bp t)
4214 ([(control ?\\)] ?\\ idlwave-shell-toggle-enable-current-bp t)
4215 ([(control ?s)] ?s idlwave-shell-step t)
4216 ([(control ?n)] ?n idlwave-shell-stepover t)
4217 ([(control ?k)] ?k idlwave-shell-skip t)
4218 ([(control ?u)] ?u idlwave-shell-up t)
4219 ([(control ?o)] ?o idlwave-shell-out t)
4220 ([(control ?m)] ?m idlwave-shell-return t)
4221 ([(control ?h)] ?h idlwave-shell-to-here t t)
4222 ([(control ?r)] ?r idlwave-shell-cont t)
4223 ([(control ?y)] ?y idlwave-shell-execute-default-command-line)
4224 ([(control ?z)] ?z idlwave-shell-reset t)
4225 ([(control ?q)] ?q idlwave-shell-quit)
4226 ([(control ?p)] ?p idlwave-shell-print t)
4227 ([( ??)] ?? idlwave-shell-help-expression t)
4228 ([(control ?v)] ?v idlwave-shell-toggle-electric-debug-mode t t)
4229 ([(control ?x)] ?x idlwave-shell-goto-next-error)
4230 ([(control ?c)] ?c idlwave-shell-save-and-run t)
4231 ([( ?@)] ?@ idlwave-shell-save-and-batch)
4232 ([(control ?e)] ?e idlwave-shell-run-region)
4233 ([(control ?w)] ?w idlwave-shell-resync-dirs)
4234 ([(control ?l)] ?l idlwave-shell-redisplay t)
4235 ([(control ?t)] ?t idlwave-shell-toggle-toolbar)
4236 ([(control up)] up idlwave-shell-stack-up)
4237 ([(control down)] down idlwave-shell-stack-down)
4238 ([( ?[)] ?[ idlwave-shell-goto-previous-bp t t)
4239 ([( ?])] ?] idlwave-shell-goto-next-bp t t)
4240 ([(control ?f)] ?f idlwave-shell-window)))
4241 (mod (cond ((and idlwave-shell-debug-modifiers
4242 (listp idlwave-shell-debug-modifiers)
4243 (not (equal '() idlwave-shell-debug-modifiers)))
4244 idlwave-shell-debug-modifiers)
4245 (idlwave-shell-activate-alt-keybindings
4259 (when (and idlwave-shell-activate-prefix-keybindings k1)
4261 (define-key idlwave-shell-mode-prefix-map k1 cmd))
4262 (define-key idlwave-mode-prefix-map k1 cmd))
4270 (define-key idlwave-mode-map k2 cmd)
4271 (unless only-buffer (define-key idlwave-shell-mode-map k2 cmd))))
4274 (define-key idlwave-shell-electric-debug-mode-map (char-to-string c2)
4278 (define-key idlwave-shell-electric-debug-mode-map " " 'idlwave-shell-step)
4279 (define-key idlwave-shell-electric-debug-mode-map "+" 'idlwave-shell-stack-up)
4280 (define-key idlwave-shell-electric-debug-mode-map "=" 'idlwave-shell-stack-up)
4281 (define-key idlwave-shell-electric-debug-mode-map "-"
4282 'idlwave-shell-stack-down)
4283 (define-key idlwave-shell-electric-debug-mode-map "_"
4284 'idlwave-shell-stack-down)
4285 (define-key idlwave-shell-electric-debug-mode-map "e"
4286 '(lambda () (interactive) (idlwave-shell-print '(16))))
4287 (define-key idlwave-shell-electric-debug-mode-map "q" 'idlwave-shell-retall)
4288 (define-key idlwave-shell-electric-debug-mode-map "t"
4289 '(lambda () (interactive) (idlwave-shell-send-command "help,/TRACE")))
4290 (define-key idlwave-shell-electric-debug-mode-map [(control ??)]
4291 'idlwave-shell-electric-debug-help)
4292 (define-key idlwave-shell-electric-debug-mode-map "x"
4294 (idlwave-shell-print arg nil nil t)))
4298 (fset 'idlwave-debug-map idlwave-mode-prefix-map)
4299 (fset 'idlwave-shell-debug-map idlwave-shell-mode-prefix-map)
4303 (defun idlwave-shell-toggle-electric-debug-mode ()
4309 (if idlwave-shell-electric-debug-mode
4311 (setq idlwave-shell-suppress-electric-debug t)
4312 (idlwave-shell-electric-debug-mode 0))
4313 (setq idlwave-shell-suppress-electric-debug nil)
4314 (idlwave-shell-electric-debug-mode t)))
4316 (defvar idlwave-shell-electric-debug-read-only)
4317 (defvar idlwave-shell-electric-debug-buffers nil)
4319 (define-minor-mode idlwave-shell-electric-debug-mode
4329 idlwave-shell-electric-debug-mode-map)
4332 'idlwave-shell-electric-debug-mode-on-hook
4334 (set (make-local-variable 'idlwave-shell-electric-debug-read-only)
4337 (add-to-list 'idlwave-shell-electric-debug-buffers (current-buffer))
4338 (if idlwave-shell-stop-line-overlay
4339 (overlay-put idlwave-shell-stop-line-overlay 'face
4340 idlwave-shell-electric-stop-line-face))
4342 (set-face-foreground 'fringe idlwave-shell-electric-stop-color
4346 'idlwave-shell-electric-debug-mode-off-hook
4349 (setq buffer-read-only (if (boundp 'idlwave-shell-electric-debug-read-only)
4350 idlwave-shell-electric-debug-read-only))
4351 (setq idlwave-shell-electric-debug-buffers
4352 (delq (current-buffer) idlwave-shell-electric-debug-buffers))
4353 (if idlwave-shell-stop-line-overlay
4354 (overlay-put idlwave-shell-stop-line-overlay 'face
4355 idlwave-shell-stop-line-face)
4360 (defadvice idlwave-shell-electric-debug-mode (after print-enter activate)
4362 (when idlwave-shell-electric-debug-mode
4368 (defvar idlwave-shell-electric-debug-buffers nil)
4369 (defun idlwave-shell-electric-debug-all-off ()
4370 (setq idlwave-shell-suppress-electric-debug nil)
4371 (let ((buffers idlwave-shell-electric-debug-buffers)
4377 (when (and (eq major-mode 'idlwave-mode)
4379 idlwave-shell-electric-debug-mode)
4380 (idlwave-shell-electric-debug-mode 0))))))
4381 (setq idlwave-shell-electric-debug-buffers nil))
4384 (defun idlwave-shell-electric-debug-help ()
4387 (princ idlwave-shell-electric-debug-help))
4397 (defvar idlwave-shell-menu-def
4400 idlwave-shell-electric-debug-mode
4401 :style toggle :selected idlwave-shell-electric-debug-mode
4402 :included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"]
4405 ["Save and .RUN" idlwave-shell-save-and-run
4406 (or (eq major-mode 'idlwave-mode)
4407 idlwave-shell-last-save-and-action-file)]
4408 ["Save and .COMPILE" idlwave-shell-save-and-compile
4409 (or (eq major-mode 'idlwave-mode)
4410 idlwave-shell-last-save-and-action-file)]
4411 ["Save and @Batch" idlwave-shell-save-and-batch
4412 (or (eq major-mode 'idlwave-mode)
4413 idlwave-shell-last-save-and-action-file)]
4415 ["Goto Next Error" idlwave-shell-goto-next-error t]
4417 ["Compile and Run Region" idlwave-shell-run-region
4418 (eq major-mode 'idlwave-mode)]
4419 ["Evaluate Region" idlwave-shell-evaluate-region
4420 (eq major-mode 'idlwave-mode)]
4422 ["Execute Default Cmd" idlwave-shell-execute-default-command-line t]
4423 ["Edit Default Cmd" idlwave-shell-edit-default-command-line t])
4425 ["Set Breakpoint" idlwave-shell-break-here
4426 :keys "C-c C-d C-b" :active (eq major-mode 'idlwave-mode)]
4431 (if (integerp count) (idlwave-shell-break-here count))))
4432 :active (eq major-mode 'idlwave-mode)]
4434 (idlwave-shell-break-here '(4))
4435 :active (eq major-mode 'idlwave-mode)])
4436 ["Break in Module" idlwave-shell-break-in
4437 :keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)]
4438 ["Break in this Module" idlwave-shell-break-this-module
4439 :keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)]
4440 ["Clear Breakpoint" idlwave-shell-clear-current-bp t]
4441 ["Clear All Breakpoints" idlwave-shell-clear-all-bp t]
4442 ["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t]
4443 ["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp
4444 :keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)]
4445 ["Goto Next Breakpoint" idlwave-shell-goto-next-bp
4446 :keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)]
4447 ["List All Breakpoints" idlwave-shell-list-all-bp t]
4448 ["Resync Breakpoints" idlwave-shell-bp-query t])
4450 ["Step (into)" idlwave-shell-step t]
4451 ["Step (over)" idlwave-shell-stepover t]
4452 ["Skip One Statement" idlwave-shell-skip t]
4453 ["Continue" idlwave-shell-cont t]
4454 ["... to End of Block" idlwave-shell-up t]
4455 ["... to End of Subprog" idlwave-shell-return t]
4456 ["... to End of Subprog+1" idlwave-shell-out t]
4457 ["... to Here (Cursor Line)" idlwave-shell-to-here
4458 :keys "C-c C-d C-h" :active (eq major-mode 'idlwave-mode)])
4460 ["Print expression" idlwave-shell-print t]
4461 ["Help on expression" idlwave-shell-help-expression t]
4464 `[ ,(car x) (idlwave-shell-print nil ',x) t ])
4465 idlwave-shell-examine-alist))
4468 `[ ,(car x) (idlwave-shell-print '(4) ',x) t ])
4469 idlwave-shell-examine-alist)))
4471 ["Stack Up" idlwave-shell-stack-up t]
4472 ["Stack Down" idlwave-shell-stack-down t]
4474 ["Redisplay and Sync" idlwave-shell-redisplay t])
4476 ["Everything" (if (eq idlwave-shell-show-commands 'everything)
4478 (setq idlwave-shell-show-commands
4479 (get 'idlwave-shell-show-commands 'last-val))
4480 (put 'idlwave-shell-show-commands 'last-val nil))
4481 (put 'idlwave-shell-show-commands 'last-val
4482 idlwave-shell-show-commands)
4483 (setq idlwave-shell-show-commands 'everything))
4484 :style toggle :selected (and (not (listp idlwave-shell-show-commands))
4485 (eq idlwave-shell-show-commands
4488 ["Compiling Commands" (idlwave-shell-add-or-remove-show 'run)
4490 :selected (not (idlwave-shell-hide-p
4492 (get 'idlwave-shell-show-commands 'last-val)))
4493 :active (not (eq idlwave-shell-show-commands 'everything))]
4494 ["Breakpoint Commands" (idlwave-shell-add-or-remove-show 'breakpoint)
4496 :selected (not (idlwave-shell-hide-p
4498 (get 'idlwave-shell-show-commands 'last-val)))
4499 :active (not (eq idlwave-shell-show-commands 'everything))]
4500 ["Debug Commands" (idlwave-shell-add-or-remove-show 'debug)
4502 :selected (not (idlwave-shell-hide-p
4504 (get 'idlwave-shell-show-commands 'last-val)))
4505 :active (not (eq idlwave-shell-show-commands 'everything))]
4506 ["Miscellaneous Commands" (idlwave-shell-add-or-remove-show 'misc)
4508 :selected (not (idlwave-shell-hide-p
4510 (get 'idlwave-shell-show-commands 'last-val)))
4511 :active (not (eq idlwave-shell-show-commands 'everything))])
4513 ["Send one char" idlwave-shell-send-char t]
4514 ["Temporary Character Mode" idlwave-shell-char-mode-loop t]
4517 (setq idlwave-shell-use-input-mode-magic
4518 (not idlwave-shell-use-input-mode-magic))
4519 :style toggle :selected idlwave-shell-use-input-mode-magic])
4521 ["Update Working Dir" idlwave-shell-resync-dirs t]
4523 (idlwave-shell-send-command idlwave-shell-path-query
4524 'idlwave-shell-get-path-info
4527 ["Reset IDL" idlwave-shell-reset t]
4529 ["Toggle Toolbar" idlwave-shell-toggle-toolbar t]
4530 ["Exit IDL" idlwave-shell-quit t]))
4535 idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus"
4536 idlwave-shell-menu-def)
4538 idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus"
4539 idlwave-shell-menu-def)
4543 (if (eq major-mode 'idlwave-mode)
4545 (easy-menu-remove idlwave-mode-debug-menu)
4546 (easy-menu-add idlwave-mode-debug-menu))))
4551 (defvar idlwave-shell-bp-glyph nil
4703 (if im (push (cons (car im-cons) im) idlwave-shell-bp-glyph))))
4706 (provide 'idlwave-shell)
4710 (autoload 'idlwave-toolbar-toggle "idlw-toolbar"
4712 (autoload 'idlwave-toolbar-add-everywhere "idlw-toolbar"
4714 (defun idlwave-shell-toggle-toolbar ()
4717 (idlwave-toolbar-toggle))
4719 (if idlwave-shell-use-toolbar
4720 (add-hook 'idlwave-shell-mode-hook 'idlwave-toolbar-add-everywhere))