45 |
;; |
;; |
46 |
;; INSTALLATION: |
;; INSTALLATION: |
47 |
;; ============= |
;; ============= |
48 |
;; |
;; |
49 |
;; Follow the instructions in the INSTALL file of the distribution. |
;; Follow the instructions in the INSTALL file of the distribution. |
50 |
;; In short, put this file on your load path and add the following |
;; In short, put this file on your load path and add the following |
51 |
;; lines to your .emacs file: |
;; lines to your .emacs file: |
58 |
;; |
;; |
59 |
;; The newest version of this file can be found on the maintainers |
;; The newest version of this file can be found on the maintainers |
60 |
;; web site. |
;; web site. |
61 |
;; |
;; |
62 |
;; http://idlwave.org |
;; http://idlwave.org |
63 |
;; |
;; |
64 |
;; DOCUMENTATION |
;; DOCUMENTATION |
65 |
;; ============= |
;; ============= |
66 |
;; |
;; |
77 |
;; it is a bug in XEmacs. |
;; it is a bug in XEmacs. |
78 |
;; The Debug menu in source buffers *does* display the bindings correctly. |
;; The Debug menu in source buffers *does* display the bindings correctly. |
79 |
;; |
;; |
80 |
;; |
;; |
81 |
;; CUSTOMIZATION VARIABLES |
;; CUSTOMIZATION VARIABLES |
82 |
;; ======================= |
;; ======================= |
83 |
;; |
;; |
101 |
(condition-case () (require 'custom) (error nil)) |
(condition-case () (require 'custom) (error nil)) |
102 |
(if (and (featurep 'custom) |
(if (and (featurep 'custom) |
103 |
(fboundp 'custom-declare-variable) |
(fboundp 'custom-declare-variable) |
104 |
(fboundp 'defface)) |
(fboundp 'defface)) |
105 |
;; We've got what we needed |
;; We've got what we needed |
106 |
(setq idlwave-shell-have-new-custom t) |
(setq idlwave-shell-have-new-custom t) |
107 |
;; We have the old or no custom-library, hack around it! |
;; We have the old or no custom-library, hack around it! |
108 |
(defmacro defgroup (&rest args) nil) |
(defmacro defgroup (&rest args) nil) |
109 |
(defmacro defcustom (var value doc &rest args) |
(defmacro defcustom (var value doc &rest args) |
110 |
`(defvar ,var ,value ,doc)))) |
`(defvar ,var ,value ,doc)))) |
111 |
|
|
112 |
;;; Customizations: idlwave-shell group |
;;; Customizations: idlwave-shell group |
118 |
:group 'idlwave) |
:group 'idlwave) |
119 |
|
|
120 |
(defcustom idlwave-shell-prompt-pattern "^ ?IDL> " |
(defcustom idlwave-shell-prompt-pattern "^ ?IDL> " |
121 |
"*Regexp to match IDL prompt at beginning of a line. |
"*Regexp to match IDL prompt at beginning of a line. |
122 |
For example, \"^IDL> \" or \"^WAVE> \". |
For example, \"^IDL> \" or \"^WAVE> \". |
123 |
The \"^\" means beginning of line, and is required. |
The \"^\" means beginning of line, and is required. |
124 |
This variable is used to initialize `comint-prompt-regexp' in the |
This variable is used to initialize `comint-prompt-regexp' in the |
125 |
process buffer. |
process buffer. |
126 |
|
|
127 |
This is a fine thing to set in your `.emacs' file." |
This is a fine thing to set in your `.emacs' file." |
210 |
:type 'boolean) |
:type 'boolean) |
211 |
|
|
212 |
(defcustom idlwave-shell-automatic-electric-debug 'breakpoint |
(defcustom idlwave-shell-automatic-electric-debug 'breakpoint |
213 |
"Enter the electric-debug minor mode automatically. |
"Enter the electric-debug minor mode automatically. |
214 |
This occurs at a breakpoint or any other halt. The mode is exited |
This occurs at a breakpoint or any other halt. The mode is exited |
215 |
upon return to the main level. Can be set to 'breakpoint to enter |
upon return to the main level. Can be set to 'breakpoint to enter |
216 |
electric debug mode only when breakpoints are tripped." |
electric debug mode only when breakpoints are tripped." |
295 |
is non-nil." |
is non-nil." |
296 |
:group 'idlwave-shell-command-setup |
:group 'idlwave-shell-command-setup |
297 |
:type 'file) |
:type 'file) |
298 |
|
|
299 |
(defcustom idlwave-shell-show-commands |
(defcustom idlwave-shell-show-commands |
300 |
'(run misc breakpoint) |
'(run misc breakpoint) |
301 |
"*A list of command types to show output from in the shell. |
"*A list of command types to show output from in the shell. |
306 |
:type '(choice |
:type '(choice |
307 |
(const everything) |
(const everything) |
308 |
(set :tag "Checklist" :greedy t |
(set :tag "Checklist" :greedy t |
309 |
(const :tag "All .run and .compile commands" run) |
(const :tag "All .run and .compile commands" run) |
310 |
(const :tag "All breakpoint commands" breakpoint) |
(const :tag "All breakpoint commands" breakpoint) |
311 |
(const :tag "All debug and stepping commands" debug) |
(const :tag "All debug and stepping commands" debug) |
312 |
(const :tag "Close, window, retall, etc. commands" misc)))) |
(const :tag "Close, window, retall, etc. commands" misc)))) |
313 |
|
|
314 |
(defcustom idlwave-shell-examine-alist |
(defcustom idlwave-shell-examine-alist |
315 |
'(("Print" . "print,___") |
'(("Print" . "print,___") |
316 |
("Help" . "help,___") |
("Help" . "help,___") |
317 |
("Structure Help" . "help,___,/STRUCTURE") |
("Structure Help" . "help,___,/STRUCTURE") |
322 |
("Ptr Valid" . "print,ptr_valid(___)") |
("Ptr Valid" . "print,ptr_valid(___)") |
323 |
("Widget Valid" . "print,widget_info(___,/VALID)") |
("Widget Valid" . "print,widget_info(___,/VALID)") |
324 |
("Widget Geometry" . "help,widget_info(___,/GEOMETRY)")) |
("Widget Geometry" . "help,widget_info(___,/GEOMETRY)")) |
325 |
"Alist of special examine commands for popup selection. |
"Alist of special examine commands for popup selection. |
326 |
The keys are used in the selection popup created by |
The keys are used in the selection popup created by |
327 |
`idlwave-shell-examine-select', and the corresponding value is sent as |
`idlwave-shell-examine-select', and the corresponding value is sent as |
328 |
a command to the shell, with special sequence `___' replaced by the |
a command to the shell, with special sequence `___' replaced by the |
329 |
expression being examined." |
expression being examined." |
330 |
:group 'idlwave-shell-command-setup |
:group 'idlwave-shell-command-setup |
331 |
:type '(repeat |
:type '(repeat |
332 |
(cons |
(cons |
333 |
(string :tag "Label ") |
(string :tag "Label ") |
334 |
(string :tag "Command")))) |
(string :tag "Command")))) |
335 |
|
|
340 |
"*Non-nil mean, put output of examine commands in their own buffer." |
"*Non-nil mean, put output of examine commands in their own buffer." |
341 |
:group 'idlwave-shell-command-setup |
:group 'idlwave-shell-command-setup |
342 |
:type 'boolean) |
:type 'boolean) |
343 |
|
|
344 |
(defcustom idlwave-shell-comint-settings |
(defcustom idlwave-shell-comint-settings |
345 |
'((comint-scroll-to-bottom-on-input . t) |
'((comint-scroll-to-bottom-on-input . t) |
346 |
(comint-scroll-to-bottom-on-output . t) |
(comint-scroll-to-bottom-on-output . t) |
403 |
answer = GET_KBRD(1) |
answer = GET_KBRD(1) |
404 |
|
|
405 |
Since the IDLWAVE shell defines the system variable `!IDLWAVE_VERSION', |
Since the IDLWAVE shell defines the system variable `!IDLWAVE_VERSION', |
406 |
you could actually check if you are running under Emacs before printing |
you could actually check if you are running under Emacs before printing |
407 |
the magic strings. Here is a procedure which uses this. |
the magic strings. Here is a procedure which uses this. |
408 |
|
|
409 |
Usage: |
Usage: |
420 |
if keyword_set(on) then print,'<chars>' $ |
if keyword_set(on) then print,'<chars>' $ |
421 |
else if keyword_set(off) then print,'</chars>' $ |
else if keyword_set(off) then print,'</chars>' $ |
422 |
else print,'<onechar>' |
else print,'<onechar>' |
423 |
endif |
endif |
424 |
end" |
end" |
425 |
:group 'idlwave-shell-command-setup |
:group 'idlwave-shell-command-setup |
426 |
:type '(list |
:type '(list |
478 |
:group 'idlwave-shell-highlighting-and-faces |
:group 'idlwave-shell-highlighting-and-faces |
479 |
:type 'string) |
:type 'string) |
480 |
|
|
481 |
(defcustom idlwave-shell-electric-stop-line-face |
(defcustom idlwave-shell-electric-stop-line-face |
482 |
(prog1 |
(prog1 |
483 |
(copy-face 'modeline 'idlwave-shell-electric-stop-line-face) |
(copy-face 'modeline 'idlwave-shell-electric-stop-line-face) |
484 |
(set-face-background 'idlwave-shell-electric-stop-line-face |
(set-face-background 'idlwave-shell-electric-stop-line-face |
485 |
idlwave-shell-electric-stop-color) |
idlwave-shell-electric-stop-color) |
486 |
(condition-case nil |
(condition-case nil |
487 |
(set-face-foreground 'idlwave-shell-electric-stop-line-face nil) |
(set-face-foreground 'idlwave-shell-electric-stop-line-face nil) |
527 |
;; Just copy the underline face to be on the safe side. |
;; Just copy the underline face to be on the safe side. |
528 |
(copy-face 'underline 'idlwave-shell-bp-face)) |
(copy-face 'underline 'idlwave-shell-bp-face)) |
529 |
|
|
530 |
(defcustom idlwave-shell-disabled-breakpoint-face |
(defcustom idlwave-shell-disabled-breakpoint-face |
531 |
'idlwave-shell-disabled-bp-face |
'idlwave-shell-disabled-bp-face |
532 |
"*The face for disabled breakpoint lines in the source code. |
"*The face for disabled breakpoint lines in the source code. |
533 |
Allows you to choose the font, color and other properties for |
Allows you to choose the font, color and other properties for |
580 |
|
|
581 |
TYPE is either 'pro' or 'rinfo', and `idlwave-shell-temp-pro-file' or |
TYPE is either 'pro' or 'rinfo', and `idlwave-shell-temp-pro-file' or |
582 |
`idlwave-shell-temp-rinfo-save-file' is set (respectively)." |
`idlwave-shell-temp-rinfo-save-file' is set (respectively)." |
583 |
(cond |
(cond |
584 |
((eq type 'rinfo) |
((eq type 'rinfo) |
585 |
(or idlwave-shell-temp-rinfo-save-file |
(or idlwave-shell-temp-rinfo-save-file |
586 |
(setq idlwave-shell-temp-rinfo-save-file |
(setq idlwave-shell-temp-rinfo-save-file |
587 |
(idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix)))) |
(idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix)))) |
588 |
((eq type 'pro) |
((eq type 'pro) |
589 |
(or idlwave-shell-temp-pro-file |
(or idlwave-shell-temp-pro-file |
590 |
(setq idlwave-shell-temp-pro-file |
(setq idlwave-shell-temp-pro-file |
591 |
(idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix)))) |
(idlwave-shell-make-temp-file idlwave-shell-temp-pro-prefix)))) |
592 |
(t (error "Wrong argument (idlwave-shell-temp-file): %s" |
(t (error "Wrong argument (idlwave-shell-temp-file): %s" |
593 |
(symbol-name type))))) |
(symbol-name type))))) |
594 |
|
|
595 |
|
|
596 |
(defun idlwave-shell-make-temp-file (prefix) |
(defun idlwave-shell-make-temp-file (prefix) |
597 |
"Create a temporary file." |
"Create a temporary file." |
619 |
|
|
620 |
|
|
621 |
(defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur" |
(defvar idlwave-shell-dirstack-query "cd,current=___cur & print,___cur" |
622 |
"Command used by `idlwave-shell-resync-dirs' to query IDL for |
"Command used by `idlwave-shell-resync-dirs' to query IDL for |
623 |
the directory stack.") |
the directory stack.") |
624 |
|
|
625 |
(defvar idlwave-shell-path-query "print,'PATH:<'+transpose(expand_path(!PATH,/ARRAY))+'>' & print,'SYSDIR:<'+!dir+'>'" |
(defvar idlwave-shell-path-query "print,'PATH:<'+transpose(expand_path(!PATH,/ARRAY))+'>' & print,'SYSDIR:<'+!dir+'>'" |
627 |
"The command which gets !PATH and !DIR info from the shell.") |
"The command which gets !PATH and !DIR info from the shell.") |
628 |
|
|
629 |
(defvar idlwave-shell-mode-line-info nil |
(defvar idlwave-shell-mode-line-info nil |
630 |
"Additional info displayed in the mode line") |
"Additional info displayed in the mode line") |
631 |
|
|
632 |
(defvar idlwave-shell-default-directory nil |
(defvar idlwave-shell-default-directory nil |
633 |
"The default directory in the idlwave-shell buffer, of outside use.") |
"The default directory in the idlwave-shell buffer, of outside use.") |
678 |
window-system) ; Window systems always |
window-system) ; Window systems always |
679 |
(progn |
(progn |
680 |
(setq idlwave-shell-stop-line-overlay (make-overlay 1 1)) |
(setq idlwave-shell-stop-line-overlay (make-overlay 1 1)) |
681 |
(overlay-put idlwave-shell-stop-line-overlay |
(overlay-put idlwave-shell-stop-line-overlay |
682 |
'face idlwave-shell-stop-line-face)))) |
'face idlwave-shell-stop-line-face)))) |
683 |
|
|
684 |
(t |
(t |
686 |
(if window-system |
(if window-system |
687 |
(progn |
(progn |
688 |
(setq idlwave-shell-stop-line-overlay (make-overlay 1 1)) |
(setq idlwave-shell-stop-line-overlay (make-overlay 1 1)) |
689 |
(overlay-put idlwave-shell-stop-line-overlay |
(overlay-put idlwave-shell-stop-line-overlay |
690 |
'face idlwave-shell-stop-line-face))))) |
'face idlwave-shell-stop-line-face))))) |
691 |
|
|
692 |
;; Now the expression and output overlays |
;; Now the expression and output overlays |
747 |
|
|
748 |
;;; The following are the types of messages we attempt to catch to |
;;; The following are the types of messages we attempt to catch to |
749 |
;;; resync our idea of where IDL execution currently is. |
;;; resync our idea of where IDL execution currently is. |
750 |
;;; |
;;; |
751 |
|
|
752 |
(defvar idlwave-shell-halt-frame nil |
(defvar idlwave-shell-halt-frame nil |
753 |
"The frame associated with halt/breakpoint messages.") |
"The frame associated with halt/breakpoint messages.") |
791 |
|
|
792 |
(defconst idlwave-shell-electric-debug-help |
(defconst idlwave-shell-electric-debug-help |
793 |
" ==> IDLWAVE Electric Debug Mode Help <== |
" ==> IDLWAVE Electric Debug Mode Help <== |
794 |
|
|
795 |
Break Point Setting and Clearing: |
Break Point Setting and Clearing: |
796 |
b Set breakpoint ([C-u b] for conditional, [C-n b] nth hit, etc.). |
b Set breakpoint ([C-u b] for conditional, [C-n b] nth hit, etc.). |
797 |
d Clear nearby breakpoint. |
d Clear nearby breakpoint. |
817 |
Examining Expressions (with prefix for examining the region): |
Examining Expressions (with prefix for examining the region): |
818 |
p Print expression near point or in region ([C-u p]). |
p Print expression near point or in region ([C-u p]). |
819 |
? Help on expression near point or in region ([C-u ?]). |
? Help on expression near point or in region ([C-u ?]). |
820 |
x Examine expression near point or in region ([C-u x]) with |
x Examine expression near point or in region ([C-u x]) with |
821 |
letter completion of the examine type. |
letter completion of the examine type. |
822 |
|
|
823 |
Miscellaneous: |
Miscellaneous: |
871 |
`\\[idlwave-routine-info]' displays information about an IDL routine near point, |
`\\[idlwave-routine-info]' displays information about an IDL routine near point, |
872 |
just like in `idlwave-mode'. The module used is the one at point or |
just like in `idlwave-mode'. The module used is the one at point or |
873 |
the one whose argument list is being edited. |
the one whose argument list is being edited. |
874 |
To update IDLWAVE's knowledge about compiled or edited modules, use |
To update IDLWAVE's knowledge about compiled or edited modules, use |
875 |
\\[idlwave-update-routine-info]. |
\\[idlwave-update-routine-info]. |
876 |
\\[idlwave-find-module] find the source of a module. |
\\[idlwave-find-module] find the source of a module. |
877 |
\\[idlwave-resolve] tells IDL to compile an unresolved module. |
\\[idlwave-resolve] tells IDL to compile an unresolved module. |
878 |
\\[idlwave-context-help] shows the online help on the item at |
\\[idlwave-context-help] shows the online help on the item at |
879 |
point, if online help has been installed. |
point, if online help has been installed. |
880 |
|
|
881 |
|
|
882 |
4. Debugging |
4. Debugging |
883 |
--------- |
--------- |
884 |
A complete set of commands for compiling and debugging IDL programs |
A complete set of commands for compiling and debugging IDL programs |
885 |
is available from the menu. Also keybindings starting with a |
is available from the menu. Also keybindings starting with a |
886 |
`C-c C-d' prefix are available for most commands in the *idl* buffer |
`C-c C-d' prefix are available for most commands in the *idl* buffer |
887 |
and also in source buffers. The best place to learn about the |
and also in source buffers. The best place to learn about the |
888 |
keybindings is again the menu. |
keybindings is again the menu. |
974 |
(idlwave-shell-display-line nil) |
(idlwave-shell-display-line nil) |
975 |
(setq idlwave-shell-calling-stack-index 0) |
(setq idlwave-shell-calling-stack-index 0) |
976 |
(setq idlwave-shell-only-prompt-pattern |
(setq idlwave-shell-only-prompt-pattern |
977 |
(concat "\\`[ \t\n]*" |
(concat "\\`[ \t\n]*" |
978 |
(substring idlwave-shell-prompt-pattern 1) |
(substring idlwave-shell-prompt-pattern 1) |
979 |
"[ \t\n]*\\'")) |
"[ \t\n]*\\'")) |
980 |
|
|
981 |
(when idlwave-shell-query-for-class |
(when idlwave-shell-query-for-class |
1010 |
(while (setq entry (pop list)) |
(while (setq entry (pop list)) |
1011 |
(set (make-local-variable (car entry)) (cdr entry))))) |
(set (make-local-variable (car entry)) (cdr entry))))) |
1012 |
|
|
1013 |
|
|
1014 |
(unless (memq 'comint-carriage-motion |
(unless (memq 'comint-carriage-motion |
1015 |
(default-value 'comint-output-filter-functions)) |
(default-value 'comint-output-filter-functions)) |
1016 |
;; Strip those pesky ctrl-m's. |
;; Strip those pesky ctrl-m's. |
1017 |
(add-hook 'comint-output-filter-functions |
(add-hook 'comint-output-filter-functions |
1018 |
(lambda (string) |
(lambda (string) |
1019 |
(when (string-match "\r" string) |
(when (string-match "\r" string) |
1020 |
(let ((pmark (process-mark (get-buffer-process |
(let ((pmark (process-mark (get-buffer-process |
1021 |
(current-buffer))))) |
(current-buffer))))) |
1022 |
(save-excursion |
(save-excursion |
1023 |
;; bare CR -> delete preceding line |
;; bare CR -> delete preceding line |
1059 |
(idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide) |
(idlwave-shell-send-command idlwave-shell-initial-commands nil 'hide) |
1060 |
;; Turn off IDL's ^d interpreting, and define a system |
;; Turn off IDL's ^d interpreting, and define a system |
1061 |
;; variable which knows the version of IDLWAVE |
;; variable which knows the version of IDLWAVE |
1062 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
1063 |
(format "defsysv,'!idlwave_version','%s',1" |
(format "defsysv,'!idlwave_version','%s',1" |
1064 |
idlwave-mode-version) |
idlwave-mode-version) |
1065 |
nil 'hide) |
nil 'hide) |
1066 |
;; Get the paths if they weren't read in from file |
;; Get the paths if they weren't read in from file |
1081 |
(setq idlwave-system-directory sysdir) |
(setq idlwave-system-directory sysdir) |
1082 |
(put 'idlwave-system-directory 'from-shell t)) |
(put 'idlwave-system-directory 'from-shell t)) |
1083 |
;; Preserve any existing flags |
;; Preserve any existing flags |
1084 |
(setq idlwave-path-alist |
(setq idlwave-path-alist |
1085 |
(mapcar (lambda (x) |
(mapcar (lambda (x) |
1086 |
(let ((old-entry (assoc x old-path-alist))) |
(let ((old-entry (assoc x old-path-alist))) |
1087 |
(if old-entry |
(if old-entry |
1089 |
(list x)))) |
(list x)))) |
1090 |
dirs)) |
dirs)) |
1091 |
(put 'idlwave-path-alist 'from-shell t) |
(put 'idlwave-path-alist 'from-shell t) |
1092 |
(if idlwave-path-alist |
(if idlwave-path-alist |
1093 |
(if (and idlwave-auto-write-paths |
(if (and idlwave-auto-write-paths |
1094 |
(not idlwave-library-path) |
(not idlwave-library-path) |
1095 |
(not no-write) ) |
(not no-write) ) |
1125 |
(frame (selected-frame))) |
(frame (selected-frame))) |
1126 |
(catch 'exit |
(catch 'exit |
1127 |
(while flist |
(while flist |
1128 |
(if (not (eq (car flist) |
(if (not (eq (car flist) |
1129 |
idlwave-shell-idl-wframe)) |
idlwave-shell-idl-wframe)) |
1130 |
(throw 'exit (car flist)) |
(throw 'exit (car flist)) |
1131 |
(setq flist (cdr flist)))))) |
(setq flist (cdr flist)))))) |
1132 |
(make-frame)) |
(make-frame)) |
1144 |
;; We do not have a source frame, so we use this one. |
;; We do not have a source frame, so we use this one. |
1145 |
(setq idlwave-shell-display-wframe (selected-frame))) |
(setq idlwave-shell-display-wframe (selected-frame))) |
1146 |
;; Return a new frame |
;; Return a new frame |
1147 |
(setq idlwave-shell-idl-wframe |
(setq idlwave-shell-idl-wframe |
1148 |
(make-frame idlwave-shell-frame-parameters))))) |
(make-frame idlwave-shell-frame-parameters))))) |
1149 |
|
|
1150 |
;;;###autoload |
;;;###autoload |
1151 |
(defun idlwave-shell (&optional arg quick) |
(defun idlwave-shell (&optional arg quick) |
1152 |
"Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'. |
"Run an inferior IDL, with I/O through buffer `(idlwave-shell-buffer)'. |
1173 |
(delete-other-windows)) |
(delete-other-windows)) |
1174 |
(and idlwave-shell-use-dedicated-frame |
(and idlwave-shell-use-dedicated-frame |
1175 |
(setq idlwave-shell-idl-wframe (selected-frame))) |
(setq idlwave-shell-idl-wframe (selected-frame))) |
1176 |
(add-hook 'idlwave-shell-sentinel-hook |
(add-hook 'idlwave-shell-sentinel-hook |
1177 |
'save-buffers-kill-emacs t)) |
'save-buffers-kill-emacs t)) |
1178 |
|
|
1179 |
;; A non-nil arg means, we want a dedicated frame. This will last |
;; A non-nil arg means, we want a dedicated frame. This will last |
1180 |
;; for the current editing session. |
;; for the current editing session. |
1181 |
(if arg (setq idlwave-shell-use-dedicated-frame t)) |
(if arg (setq idlwave-shell-use-dedicated-frame t)) |
1182 |
(if (equal arg '(16)) (setq idlwave-shell-use-dedicated-frame nil)) |
(if (equal arg '(16)) (setq idlwave-shell-use-dedicated-frame nil)) |
1183 |
|
|
1184 |
;; Check if the process still exists. If not, create it. |
;; Check if the process still exists. If not, create it. |
1185 |
(unless (comint-check-proc (idlwave-shell-buffer)) |
(unless (comint-check-proc (idlwave-shell-buffer)) |
1186 |
(let* ((prg (or idlwave-shell-explicit-file-name "idl")) |
(let* ((prg (or idlwave-shell-explicit-file-name "idl")) |
1207 |
(if (eq (selected-frame) (window-frame window)) |
(if (eq (selected-frame) (window-frame window)) |
1208 |
(select-window window)))) |
(select-window window)))) |
1209 |
;; Save the paths at the end |
;; Save the paths at the end |
1210 |
(add-hook 'idlwave-shell-sentinel-hook |
(add-hook 'idlwave-shell-sentinel-hook |
1211 |
(lambda () |
(lambda () |
1212 |
(if (and |
(if (and |
1213 |
idlwave-auto-write-paths |
idlwave-auto-write-paths |
1214 |
idlwave-path-alist |
idlwave-path-alist |
1215 |
(not idlwave-library-path) |
(not idlwave-library-path) |
1240 |
(setq idlwave-shell-show-commands (list type)))) |
(setq idlwave-shell-show-commands (list type)))) |
1241 |
|
|
1242 |
|
|
1243 |
(defun idlwave-shell-send-command (&optional cmd pcmd hide preempt |
(defun idlwave-shell-send-command (&optional cmd pcmd hide preempt |
1244 |
show-if-error) |
show-if-error) |
1245 |
"Send a command to IDL process. |
"Send a command to IDL process. |
1246 |
|
|
1261 |
`idlwave-shell-pending-commands'. If PREEMPT is 'wait, wait for all |
`idlwave-shell-pending-commands'. If PREEMPT is 'wait, wait for all |
1262 |
output to complete and the next prompt to arrive before returning |
output to complete and the next prompt to arrive before returning |
1263 |
\(useful if you need an answer now\). IDL is considered ready if the |
\(useful if you need an answer now\). IDL is considered ready if the |
1264 |
prompt is present and if `idlwave-shell-ready' is non-nil. |
prompt is present and if `idlwave-shell-ready' is non-nil. |
1265 |
|
|
1266 |
If SHOW-IF-ERROR is non-nil, show the output it it contains an error |
If SHOW-IF-ERROR is non-nil, show the output it it contains an error |
1267 |
message, independent of what HIDE is set to." |
message, independent of what HIDE is set to." |
1268 |
|
|
1269 |
; (setq hide nil) ; FIXME: turn this on for debugging only |
; (setq hide nil) ; FIXME: turn this on for debugging only |
1270 |
; (if (null cmd) |
; (if (null cmd) |
1271 |
; (progn |
; (progn |
1272 |
; (message "SENDING Pending commands: %s" |
; (message "SENDING Pending commands: %s" |
1273 |
; (prin1-to-string idlwave-shell-pending-commands))) |
; (prin1-to-string idlwave-shell-pending-commands))) |
1274 |
; (message "SENDING %s|||%s" cmd pcmd)) |
; (message "SENDING %s|||%s" cmd pcmd)) |
1275 |
(if (and (symbolp idlwave-shell-show-commands) |
(if (and (symbolp idlwave-shell-show-commands) |
1276 |
(eq idlwave-shell-show-commands 'everything)) |
(eq idlwave-shell-show-commands 'everything)) |
1277 |
(setq hide nil)) |
(setq hide nil)) |
1278 |
(let ((save-buffer (current-buffer)) |
(let ((save-buffer (current-buffer)) |
1300 |
(append (list (list cmd pcmd hide show-if-error)) |
(append (list (list cmd pcmd hide show-if-error)) |
1301 |
idlwave-shell-pending-commands) |
idlwave-shell-pending-commands) |
1302 |
;; Put at end. |
;; Put at end. |
1303 |
(append idlwave-shell-pending-commands |
(append idlwave-shell-pending-commands |
1304 |
(list (list cmd pcmd hide show-if-error)))))) |
(list (list cmd pcmd hide show-if-error)))))) |
1305 |
;; Check if IDL ready |
;; Check if IDL ready |
1306 |
(let ((save-point (point-marker))) |
(let ((save-point (point-marker))) |
1349 |
(if (or (not (setq buf (get-buffer (idlwave-shell-buffer)))) |
(if (or (not (setq buf (get-buffer (idlwave-shell-buffer)))) |
1350 |
(not (setq proc (get-buffer-process buf)))) |
(not (setq proc (get-buffer-process buf)))) |
1351 |
(funcall errf "Shell is not running")) |
(funcall errf "Shell is not running")) |
1352 |
(if (equal c ?\C-g) |
(if (equal c ?\C-g) |
1353 |
(funcall errf "Abort") |
(funcall errf "Abort") |
1354 |
(comint-send-string proc (char-to-string c))))) |
(comint-send-string proc (char-to-string c))))) |
1355 |
|
|
1390 |
(if idlwave-shell-ready |
(if idlwave-shell-ready |
1391 |
(funcall errf "No IDL program seems to be waiting for input")) |
(funcall errf "No IDL program seems to be waiting for input")) |
1392 |
|
|
1393 |
;; OK, start the loop |
;; OK, start the loop |
1394 |
(message "Character mode on: Sending single chars (`C-g' to exit)") |
(message "Character mode on: Sending single chars (`C-g' to exit)") |
1395 |
(message |
(message |
1396 |
(catch 'exit |
(catch 'exit |
1470 |
(setq output (substring output (string-match "\n" output))) |
(setq output (substring output (string-match "\n" output))) |
1471 |
(while (string-match "\\(\n\\|\\`\\)%.*\\(\n .*\\)*" output) |
(while (string-match "\\(\n\\|\\`\\)%.*\\(\n .*\\)*" output) |
1472 |
(setq output (replace-match "" nil t output))) |
(setq output (replace-match "" nil t output))) |
1473 |
(unless |
(unless |
1474 |
(string-match idlwave-shell-only-prompt-pattern output) |
(string-match idlwave-shell-only-prompt-pattern output) |
1475 |
output)) |
output)) |
1476 |
|
|
1477 |
(defvar idlwave-shell-hidden-output-buffer " *idlwave-shell-hidden-output*" |
(defvar idlwave-shell-hidden-output-buffer " *idlwave-shell-hidden-output*" |
1478 |
"Buffer containing hidden output from IDL commands.") |
"Buffer containing hidden output from IDL commands.") |
1479 |
(defvar idlwave-shell-current-state nil) |
(defvar idlwave-shell-current-state nil) |
1480 |
|
|
1481 |
(defun idlwave-shell-filter (proc string) |
(defun idlwave-shell-filter (proc string) |
1482 |
"Watch for IDL prompt and filter incoming text. |
"Watch for IDL prompt and filter incoming text. |
1483 |
When the IDL prompt is received executes `idlwave-shell-post-command-hook' |
When the IDL prompt is received executes `idlwave-shell-post-command-hook' |
1509 |
(idlwave-shell-input-mode-magic |
(idlwave-shell-input-mode-magic |
1510 |
(concat idlwave-shell-accumulation string))) |
(concat idlwave-shell-accumulation string))) |
1511 |
(setq idlwave-shell-accumulation |
(setq idlwave-shell-accumulation |
1512 |
(substring string |
(substring string |
1513 |
(progn (string-match "\\(.*[\n\r]+\\)*" |
(progn (string-match "\\(.*[\n\r]+\\)*" |
1514 |
string) |
string) |
1515 |
(match-end 0))))) |
(match-end 0))))) |
1516 |
(setq idlwave-shell-accumulation |
(setq idlwave-shell-accumulation |
1517 |
(concat idlwave-shell-accumulation string))) |
(concat idlwave-shell-accumulation string))) |
1518 |
|
|
1519 |
|
|
1520 |
;;; Test/Debug code |
;;; Test/Debug code |
1521 |
; (save-excursion (set-buffer |
; (save-excursion (set-buffer |
1522 |
; (get-buffer-create "*idlwave-shell-output*")) |
; (get-buffer-create "*idlwave-shell-output*")) |
1523 |
; (goto-char (point-max)) |
; (goto-char (point-max)) |
1524 |
; (insert "\nSTRING===>\n" string "\n<====\n")) |
; (insert "\nSTRING===>\n" string "\n<====\n")) |
1525 |
|
|
1526 |
;; Check for prompt in current accumulating output |
;; Check for prompt in current accumulating output |
1527 |
(if (setq idlwave-shell-ready |
(if (setq idlwave-shell-ready |
1528 |
(string-match idlwave-shell-prompt-pattern |
(string-match idlwave-shell-prompt-pattern |
1558 |
(if (and idlwave-shell-show-if-error |
(if (and idlwave-shell-show-if-error |
1559 |
(eq idlwave-shell-current-state 'error)) |
(eq idlwave-shell-current-state 'error)) |
1560 |
(idlwave-shell-comint-filter proc full-output) |
(idlwave-shell-comint-filter proc full-output) |
1561 |
;; If it's only *mostly* hidden, filter % lines, |
;; If it's only *mostly* hidden, filter % lines, |
1562 |
;; and show anything that remains |
;; and show anything that remains |
1563 |
(if (eq idlwave-shell-hide-output 'mostly) |
(if (eq idlwave-shell-hide-output 'mostly) |
1564 |
(let ((filtered |
(let ((filtered |
1565 |
(idlwave-shell-filter-hidden-output |
(idlwave-shell-filter-hidden-output |
1566 |
full-output))) |
full-output))) |
1567 |
(if filtered |
(if filtered |
1568 |
(idlwave-shell-comint-filter |
(idlwave-shell-comint-filter |
1569 |
proc filtered)))))) |
proc filtered)))))) |
1570 |
|
|
1571 |
;; Call the post-command hook |
;; Call the post-command hook |
1572 |
(if (listp idlwave-shell-post-command-hook) |
(if (listp idlwave-shell-post-command-hook) |
1573 |
(progn |
(progn |
1612 |
(condition-case nil |
(condition-case nil |
1613 |
(comint-write-input-ring) |
(comint-write-input-ring) |
1614 |
(error nil))))) |
(error nil))))) |
1615 |
|
|
1616 |
(when (and (> (length (frame-list)) 1) |
(when (and (> (length (frame-list)) 1) |
1617 |
(frame-live-p idlwave-shell-idl-wframe)) |
(frame-live-p idlwave-shell-idl-wframe)) |
1618 |
(delete-frame idlwave-shell-idl-wframe) |
(delete-frame idlwave-shell-idl-wframe) |
1636 |
;; in module and file names. I am not sure if it will be necessary to |
;; in module and file names. I am not sure if it will be necessary to |
1637 |
;; change this. Currently it seems to work the way it is. |
;; change this. Currently it seems to work the way it is. |
1638 |
(defvar idlwave-shell-syntax-error |
(defvar idlwave-shell-syntax-error |
1639 |
"^% Syntax error.\\s-*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)" |
"^% Syntax error.\\s-*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)" |
1640 |
"A regular expression to match an IDL syntax error. |
"A regular expression to match an IDL syntax error. |
1641 |
The 1st pair matches the file name, the second pair matches the line |
The 1st pair matches the file name, the second pair matches the line |
1642 |
number.") |
number.") |
1643 |
|
|
1645 |
"^% .*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)" |
"^% .*\n\\s-*At:\\s-*\\(.*\\),\\s-*Line\\s-*\\(.*\\)" |
1646 |
"A regular expression to match any IDL error.") |
"A regular expression to match any IDL error.") |
1647 |
|
|
1648 |
(defvar idlwave-shell-halting-error |
(defvar idlwave-shell-halting-error |
1649 |
"^% .*\n\\([^%].*\n\\)*% Execution halted at:\\(\\s-*\\S-+\\s-*[0-9]+\\s-*.*\\)\n" |
"^% .*\n\\([^%].*\n\\)*% Execution halted at:\\(\\s-*\\S-+\\s-*[0-9]+\\s-*.*\\)\n" |
1650 |
"A regular expression to match errors which halt execution.") |
"A regular expression to match errors which halt execution.") |
1651 |
|
|
1652 |
(defvar idlwave-shell-cant-continue-error |
(defvar idlwave-shell-cant-continue-error |
1653 |
"^% Can't continue from this point.\n" |
"^% Can't continue from this point.\n" |
1654 |
"A regular expression to match errors stepping errors.") |
"A regular expression to match errors stepping errors.") |
1655 |
|
|
1656 |
(defvar idlwave-shell-file-line-message |
(defvar idlwave-shell-file-line-message |
1657 |
(concat |
(concat |
1658 |
"\\(" ; program name group (1) |
"\\(" ; program name group (1) |
1659 |
"\\$MAIN\\$\\|" ; main level routine |
"\\$MAIN\\$\\|" ; main level routine |
1660 |
"\\<[a-zA-Z][a-zA-Z0-9_$:]*" ; start with a letter followed by [..] |
"\\<[a-zA-Z][a-zA-Z0-9_$:]*" ; start with a letter followed by [..] |
1672 |
"\\)" ; end line number group (5) |
"\\)" ; end line number group (5) |
1673 |
) |
) |
1674 |
"*A regular expression to parse out the file name and line number. |
"*A regular expression to parse out the file name and line number. |
1675 |
The 1st group should match the subroutine name. |
The 1st group should match the subroutine name. |
1676 |
The 3rd group is the line number. |
The 3rd group is the line number. |
1677 |
The 5th group is the file name. |
The 5th group is the file name. |
1678 |
All parts may contain linebreaks surrounded by spaces. This is important |
All parts may contain linebreaks surrounded by spaces. This is important |
1691 |
(cond |
(cond |
1692 |
;; Make sure we have output |
;; Make sure we have output |
1693 |
((not idlwave-shell-command-output)) |
((not idlwave-shell-command-output)) |
1694 |
|
|
1695 |
;; First Priority: Syntax and other errors |
;; First Priority: Syntax and other errors |
1696 |
((or |
((or |
1697 |
(string-match idlwave-shell-syntax-error |
(string-match idlwave-shell-syntax-error |
1698 |
idlwave-shell-command-output) |
idlwave-shell-command-output) |
1699 |
(string-match idlwave-shell-other-error |
(string-match idlwave-shell-other-error |
1707 |
(setq idlwave-shell-error-last (point))) |
(setq idlwave-shell-error-last (point))) |
1708 |
(setq idlwave-shell-current-state 'error) |
(setq idlwave-shell-current-state 'error) |
1709 |
(idlwave-shell-goto-next-error)) |
(idlwave-shell-goto-next-error)) |
1710 |
|
|
1711 |
;; Second Priority: Halting errors |
;; Second Priority: Halting errors |
1712 |
((string-match idlwave-shell-halting-error |
((string-match idlwave-shell-halting-error |
1713 |
idlwave-shell-command-output) |
idlwave-shell-command-output) |
1714 |
;; Grab the file and line state info. |
;; Grab the file and line state info. |
1715 |
(setq idlwave-shell-calling-stack-index 0) |
(setq idlwave-shell-calling-stack-index 0) |
1716 |
(setq idlwave-shell-halt-frame |
(setq idlwave-shell-halt-frame |
1717 |
(idlwave-shell-parse-line |
(idlwave-shell-parse-line |
1718 |
(substring idlwave-shell-command-output |
(substring idlwave-shell-command-output |
1719 |
(match-beginning 2))) |
(match-beginning 2))) |
1720 |
idlwave-shell-current-state 'error) |
idlwave-shell-current-state 'error) |
1721 |
(idlwave-shell-display-line (idlwave-shell-pc-frame))) |
(idlwave-shell-display-line (idlwave-shell-pc-frame))) |
1722 |
|
|
1723 |
;; Third Priority: Various types of innocuous HALT and |
;; Third Priority: Various types of innocuous HALT and |
1724 |
;; TRACEBACK messages. |
;; TRACEBACK messages. |
1725 |
((or (setq trace (string-match idlwave-shell-trace-message-re |
((or (setq trace (string-match idlwave-shell-trace-message-re |
1729 |
;; Grab the file and line state info. |
;; Grab the file and line state info. |
1730 |
(setq idlwave-shell-calling-stack-index 0) |
(setq idlwave-shell-calling-stack-index 0) |
1731 |
(setq idlwave-shell-halt-frame |
(setq idlwave-shell-halt-frame |
1732 |
(idlwave-shell-parse-line |
(idlwave-shell-parse-line |
1733 |
(substring idlwave-shell-command-output (match-end 0)))) |
(substring idlwave-shell-command-output (match-end 0)))) |
1734 |
(setq idlwave-shell-current-state 'halt) |
(setq idlwave-shell-current-state 'halt) |
1735 |
;; Don't debug trace messages |
;; Don't debug trace messages |
1736 |
(idlwave-shell-display-line (idlwave-shell-pc-frame) nil |
(idlwave-shell-display-line (idlwave-shell-pc-frame) nil |
1737 |
(if trace 'no-debug))) |
(if trace 'no-debug))) |
1738 |
|
|
1739 |
;; Fourth Priority: Breakpoints |
;; Fourth Priority: Breakpoints |
1740 |
((string-match idlwave-shell-break-message |
((string-match idlwave-shell-break-message |
1741 |
idlwave-shell-command-output) |
idlwave-shell-command-output) |
1742 |
(setq idlwave-shell-calling-stack-index 0) |
(setq idlwave-shell-calling-stack-index 0) |
1743 |
(setq idlwave-shell-halt-frame |
(setq idlwave-shell-halt-frame |
1744 |
(idlwave-shell-parse-line |
(idlwave-shell-parse-line |
1745 |
(substring idlwave-shell-command-output (match-end 0)))) |
(substring idlwave-shell-command-output (match-end 0)))) |
1746 |
;; We used to count hits on breakpoints |
;; We used to count hits on breakpoints |
1747 |
;; this is no longer supported since IDL breakpoints |
;; this is no longer supported since IDL breakpoints |
1748 |
;; have learned counting. |
;; have learned counting. |
1749 |
;; Do breakpoint command processing |
;; Do breakpoint command processing |
1750 |
(let ((bp (assoc |
(let ((bp (assoc |
1751 |
(list |
(list |
1752 |
(nth 0 idlwave-shell-halt-frame) |
(nth 0 idlwave-shell-halt-frame) |
1753 |
(nth 1 idlwave-shell-halt-frame)) |
(nth 1 idlwave-shell-halt-frame)) |
1760 |
;; A breakpoint that we did not know about - perhaps it was |
;; A breakpoint that we did not know about - perhaps it was |
1761 |
;; set by the user... Let's update our list. |
;; set by the user... Let's update our list. |
1762 |
(idlwave-shell-bp-query))) |
(idlwave-shell-bp-query))) |
1763 |
(setq idlwave-shell-current-state 'breakpoint) |
(setq idlwave-shell-current-state 'breakpoint) |
1764 |
(idlwave-shell-display-line (idlwave-shell-pc-frame))) |
(idlwave-shell-display-line (idlwave-shell-pc-frame))) |
1765 |
|
|
1766 |
;; Last Priority: Can't Step errors |
;; Last Priority: Can't Step errors |
1767 |
((string-match idlwave-shell-cant-continue-error |
((string-match idlwave-shell-cant-continue-error |
1768 |
idlwave-shell-command-output) |
idlwave-shell-command-output) |
1777 |
IDL5. These line breaks can be right in the middle of procedure |
IDL5. These line breaks can be right in the middle of procedure |
1778 |
or file names. |
or file names. |
1779 |
It is very difficult to come up with a robust solution. This one seems |
It is very difficult to come up with a robust solution. This one seems |
1780 |
to be pretty good though. |
to be pretty good though. |
1781 |
|
|
1782 |
Here is in what ways it improves over the previous solution: |
Here is in what ways it improves over the previous solution: |
1783 |
|
|
1802 |
(setq procedure (match-string 1 string) |
(setq procedure (match-string 1 string) |
1803 |
number (match-string 3 string) |
number (match-string 3 string) |
1804 |
file (match-string 5 string)) |
file (match-string 5 string)) |
1805 |
|
|
1806 |
;; Repair the strings |
;; Repair the strings |
1807 |
(setq procedure (idlwave-shell-repair-string procedure)) |
(setq procedure (idlwave-shell-repair-string procedure)) |
1808 |
(setq number (idlwave-shell-repair-string number)) |
(setq number (idlwave-shell-repair-string number)) |
1811 |
;; If we have a file, return the frame list |
;; If we have a file, return the frame list |
1812 |
(if file |
(if file |
1813 |
(list (idlwave-shell-file-name file) |
(list (idlwave-shell-file-name file) |
1814 |
(string-to-int number) |
(string-to-number number) |
1815 |
procedure) |
procedure) |
1816 |
;; No success finding a file |
;; No success finding a file |
1817 |
nil)))) |
nil)))) |
1828 |
file name." |
file name." |
1829 |
(let ((file1 "") (file2 "") (start 0)) |
(let ((file1 "") (file2 "") (start 0)) |
1830 |
;; We scan no further than to the next "^%" line |
;; We scan no further than to the next "^%" line |
1831 |
(if (string-match "^%" file) |
(if (string-match "^%" file) |
1832 |
(setq file (substring file 0 (match-beginning 0)))) |
(setq file (substring file 0 (match-beginning 0)))) |
1833 |
;; Take out the line breaks |
;; Take out the line breaks |
1834 |
(while (string-match "[ \t]*\n[ \t]*" file start) |
(while (string-match "[ \t]*\n[ \t]*" file start) |
1883 |
The size is given by `idlwave-shell-graphics-window-size'." |
The size is given by `idlwave-shell-graphics-window-size'." |
1884 |
(interactive "P") |
(interactive "P") |
1885 |
(let ((n (if n (prefix-numeric-value n) 0))) |
(let ((n (if n (prefix-numeric-value n) 0))) |
1886 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
1887 |
(apply 'format "window,%d,xs=%d,ys=%d" |
(apply 'format "window,%d,xs=%d,ys=%d" |
1888 |
n idlwave-shell-graphics-window-size) |
n idlwave-shell-graphics-window-size) |
1889 |
nil (idlwave-shell-hide-p 'misc) nil t))) |
nil (idlwave-shell-hide-p 'misc) nil t))) |
1903 |
Also get rid of widget events in the queue." |
Also get rid of widget events in the queue." |
1904 |
(interactive "P") |
(interactive "P") |
1905 |
(save-selected-window |
(save-selected-window |
1906 |
;;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 & |
;;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 & |
1907 |
(idlwave-shell-send-command "retall" nil |
(idlwave-shell-send-command "retall" nil |
1908 |
(if (idlwave-shell-hide-p 'misc) 'mostly) |
(if (idlwave-shell-hide-p 'misc) 'mostly) |
1909 |
nil t) |
nil t) |
1910 |
(idlwave-shell-display-line nil))) |
(idlwave-shell-display-line nil))) |
1911 |
|
|
1912 |
(defun idlwave-shell-closeall (&optional arg) |
(defun idlwave-shell-closeall (&optional arg) |
1913 |
"Close all open files." |
"Close all open files." |
1914 |
(interactive "P") |
(interactive "P") |
1915 |
(idlwave-shell-send-command "close,/all" nil |
(idlwave-shell-send-command "close,/all" nil |
1916 |
(idlwave-shell-hide-p 'misc) nil t)) |
(idlwave-shell-hide-p 'misc) nil t)) |
1917 |
|
|
1918 |
(defun idlwave-shell-quit (&optional arg) |
(defun idlwave-shell-quit (&optional arg) |
1928 |
|
|
1929 |
(defun idlwave-shell-reset (&optional hidden) |
(defun idlwave-shell-reset (&optional hidden) |
1930 |
"Reset IDL. Return to main level and destroy the leftover variables. |
"Reset IDL. Return to main level and destroy the leftover variables. |
1931 |
This issues the following commands: |
This issues the following commands: |
1932 |
RETALL |
RETALL |
1933 |
WIDGET_CONTROL,/RESET |
WIDGET_CONTROL,/RESET |
1934 |
CLOSE, /ALL |
CLOSE, /ALL |
1978 |
;; Set dummy values and kill the text |
;; Set dummy values and kill the text |
1979 |
(setq sep "@" sep-re "@ *" text "") |
(setq sep "@" sep-re "@ *" text "") |
1980 |
(if idlwave-idlwave_routine_info-compiled |
(if idlwave-idlwave_routine_info-compiled |
1981 |
(message |
(message |
1982 |
"Routine Info warning: No match for BEGIN line in \n>>>\n%s\n<<<\n" |
"Routine Info warning: No match for BEGIN line in \n>>>\n%s\n<<<\n" |
1983 |
idlwave-shell-command-output))) |
idlwave-shell-command-output))) |
1984 |
(if (string-match "^>>>END OF IDLWAVE ROUTINE INFO.*" text) |
(if (string-match "^>>>END OF IDLWAVE ROUTINE INFO.*" text) |
1985 |
(setq text (substring text 0 (match-beginning 0))) |
(setq text (substring text 0 (match-beginning 0))) |
1986 |
(if idlwave-idlwave_routine_info-compiled |
(if idlwave-idlwave_routine_info-compiled |
1987 |
(message |
(message |
1988 |
"Routine Info warning: No match for END line in \n>>>\n%s\n<<<\n" |
"Routine Info warning: No match for END line in \n>>>\n%s\n<<<\n" |
1989 |
idlwave-shell-command-output))) |
idlwave-shell-command-output))) |
1990 |
(if (string-match "\\S-" text) |
(if (string-match "\\S-" text) |
1991 |
;; Obviously, the pro worked. Make a note that we have it now. |
;; Obviously, the pro worked. Make a note that we have it now. |
2003 |
key (nth 4 specs) |
key (nth 4 specs) |
2004 |
keys (if (and (stringp key) |
keys (if (and (stringp key) |
2005 |
(not (string-match "\\` *\\'" key))) |
(not (string-match "\\` *\\'" key))) |
2006 |
(mapcar 'list |
(mapcar 'list |
2007 |
(delete "" (idlwave-split-string key " +"))))) |
(delete "" (idlwave-split-string key " +"))))) |
2008 |
(setq name (idlwave-sintern-routine-or-method name class t) |
(setq name (idlwave-sintern-routine-or-method name class t) |
2009 |
class (idlwave-sintern-class class t) |
class (idlwave-sintern-class class t) |
2010 |
file (if (equal file "") nil file) |
file (if (equal file "") nil file) |
2011 |
keys (mapcar (lambda (x) |
keys (mapcar (lambda (x) |
2012 |
(list (idlwave-sintern-keyword (car x) t))) keys)) |
(list (idlwave-sintern-keyword (car x) t))) keys)) |
2013 |
|
|
2014 |
;; In the following ignore routines already defined in buffers, |
;; In the following ignore routines already defined in buffers, |
2015 |
;; assuming that if the buffer stuff differs, it is a "new" |
;; assuming that if the buffer stuff differs, it is a "new" |
2016 |
;; version, not yet compiled, and should take precedence. |
;; version, not yet compiled, and should take precedence. |
2017 |
;; We could do the same for the library to avoid duplicates - |
;; We could do the same for the library to avoid duplicates - |
2018 |
;; but I think frequently a user might have several versions of |
;; but I think frequently a user might have several versions of |
2019 |
;; the same function in different programs, and in this case the |
;; the same function in different programs, and in this case the |
2020 |
;; compiled one will be the best guess of all versions. |
;; compiled one will be the best guess of all versions. |
2021 |
;; Therefore, we leave duplicates of library routines in. |
;; Therefore, we leave duplicates of library routines in. |
2022 |
(cond ((string= name "$MAIN$")) ; ignore this one |
(cond ((string= name "$MAIN$")) ; ignore this one |
2023 |
((and (string= type "PRO") |
((and (string= type "PRO") |
2024 |
;; FIXME: is it OK to make the buffer routines dominate? |
;; FIXME: is it OK to make the buffer routines dominate? |
2025 |
(or t (null file) |
(or t (null file) |
2026 |
(not (idlwave-rinfo-assq name 'pro class |
(not (idlwave-rinfo-assq name 'pro class |
2027 |
idlwave-buffer-routines))) |
idlwave-buffer-routines))) |
2028 |
;; FIXME: is it OK to make the library routines dominate? |
;; FIXME: is it OK to make the library routines dominate? |
2029 |
;;(not (idlwave-rinfo-assq name 'pro class |
;;(not (idlwave-rinfo-assq name 'pro class |
2030 |
;; idlwave-library-routines)) |
;; idlwave-library-routines)) |
2031 |
) |
) |
2032 |
(setq entry (list name 'pro class |
(setq entry (list name 'pro class |
2033 |
(cons 'compiled |
(cons 'compiled |
2034 |
(if file |
(if file |
2035 |
(list |
(list |
2036 |
(file-name-nondirectory file) |
(file-name-nondirectory file) |
2037 |
(idlwave-sintern-dir |
(idlwave-sintern-dir |
2038 |
(file-name-directory file))))) |
(file-name-directory file))))) |
2039 |
cs (cons nil keys))) |
cs (cons nil keys))) |
2040 |
(if file |
(if file |
2041 |
(push entry idlwave-compiled-routines) |
(push entry idlwave-compiled-routines) |
2042 |
(push entry idlwave-unresolved-routines))) |
(push entry idlwave-unresolved-routines))) |
2043 |
|
|
2044 |
((and (string= type "FUN") |
((and (string= type "FUN") |
2045 |
;; FIXME: is it OK to make the buffer routines dominate? |
;; FIXME: is it OK to make the buffer routines dominate? |
2046 |
(or t (not file) |
(or t (not file) |
2047 |
(not (idlwave-rinfo-assq name 'fun class |
(not (idlwave-rinfo-assq name 'fun class |
2048 |
idlwave-buffer-routines))) |
idlwave-buffer-routines))) |
2049 |
;; FIXME: is it OK to make the library routines dominate? |
;; FIXME: is it OK to make the library routines dominate? |
2050 |
;; (not (idlwave-rinfo-assq name 'fun class |
;; (not (idlwave-rinfo-assq name 'fun class |
2051 |
;; idlwave-library-routines)) |
;; idlwave-library-routines)) |
2052 |
) |
) |
2053 |
(setq entry (list name 'fun class |
(setq entry (list name 'fun class |
2054 |
(cons 'compiled |
(cons 'compiled |
2055 |
(if file |
(if file |
2056 |
(list |
(list |
2057 |
(file-name-nondirectory file) |
(file-name-nondirectory file) |
2058 |
(idlwave-sintern-dir |
(idlwave-sintern-dir |
2059 |
(file-name-directory file))))) |
(file-name-directory file))))) |
2060 |
cs (cons nil keys))) |
cs (cons nil keys))) |
2061 |
(if file |
(if file |
2072 |
(set-buffer (idlwave-shell-buffer)) |
(set-buffer (idlwave-shell-buffer)) |
2073 |
(if (string-match ",___cur[\n\r]\\(\\S-*\\) *[\n\r]" |
(if (string-match ",___cur[\n\r]\\(\\S-*\\) *[\n\r]" |
2074 |
idlwave-shell-command-output) |
idlwave-shell-command-output) |
2075 |
(let ((dir (substring idlwave-shell-command-output |
(let ((dir (substring idlwave-shell-command-output |
2076 |
(match-beginning 1) (match-end 1)))) |
(match-beginning 1) (match-end 1)))) |
2077 |
; (message "Setting Emacs working dir to %s" dir) |
; (message "Setting Emacs working dir to %s" dir) |
2078 |
(setq idlwave-shell-default-directory dir) |
(setq idlwave-shell-default-directory dir) |
2086 |
expression) |
expression) |
2087 |
(save-excursion |
(save-excursion |
2088 |
(goto-char apos) |
(goto-char apos) |
2089 |
(setq expression (buffer-substring |
(setq expression (buffer-substring |
2090 |
(catch 'exit |
(catch 'exit |
2091 |
(while t |
(while t |
2092 |
(if (not (re-search-backward |
(if (not (re-search-backward |
2093 |
"[^][.A-Za-z0-9_() ]" bos t)) |
"[^][.A-Za-z0-9_() ]" bos t)) |
2094 |
(throw 'exit bos)) ;ran into bos |
(throw 'exit bos)) ;ran into bos |
2095 |
(if (not (idlwave-is-pointer-dereference bol)) |
(if (not (idlwave-is-pointer-dereference bol)) |
2117 |
idlwave-shell-command-output)) |
idlwave-shell-command-output)) |
2118 |
(string-match (concat match "\\([A-Za-z_0-9]+\\)") |
(string-match (concat match "\\([A-Za-z_0-9]+\\)") |
2119 |
idlwave-shell-command-output)) |
idlwave-shell-command-output)) |
2120 |
(setq idlwave-shell-get-object-class |
(setq idlwave-shell-get-object-class |
2121 |
(match-string 1 idlwave-shell-command-output))))) |
(match-string 1 idlwave-shell-command-output))))) |
2122 |
|
|
2123 |
(defvar idlwave-sint-sysvars nil) |
(defvar idlwave-sint-sysvars nil) |
2131 |
(interactive "P") |
(interactive "P") |
2132 |
(let (exec-cmd) |
(let (exec-cmd) |
2133 |
(cond |
(cond |
2134 |
((and |
((and |
2135 |
(setq exec-cmd (idlwave-shell-executive-command)) |
(setq exec-cmd (idlwave-shell-executive-command)) |
2136 |
(cdr exec-cmd) |
(cdr exec-cmd) |
2137 |
(member (upcase (cdr exec-cmd)) |
(member (upcase (cdr exec-cmd)) |
2141 |
(idlwave-shell-complete-filename)) |
(idlwave-shell-complete-filename)) |
2142 |
|
|
2143 |
((car-safe exec-cmd) |
((car-safe exec-cmd) |
2144 |
(setq idlwave-completion-help-info |
(setq idlwave-completion-help-info |
2145 |
'(idlwave-shell-complete-execcomm-help)) |
'(idlwave-shell-complete-execcomm-help)) |
2146 |
(idlwave-complete-in-buffer 'execcomm 'execcomm |
(idlwave-complete-in-buffer 'execcomm 'execcomm |
2147 |
idlwave-executive-commands-alist nil |
idlwave-executive-commands-alist nil |
2160 |
(let ((case-fold-search t)) |
(let ((case-fold-search t)) |
2161 |
(not (looking-at ".*obj_new"))))) |
(not (looking-at ".*obj_new"))))) |
2162 |
(idlwave-shell-complete-filename)) |
(idlwave-shell-complete-filename)) |
2163 |
|
|
2164 |
(t |
(t |
2165 |
;; Default completion of modules and keywords |
;; Default completion of modules and keywords |
2166 |
(idlwave-complete arg))))) |
(idlwave-complete arg))))) |
2182 |
We assume that we are after a file name when completing one of the |
We assume that we are after a file name when completing one of the |
2183 |
args of an executive .run, .rnew or .compile." |
args of an executive .run, .rnew or .compile." |
2184 |
;; CWD might have changed, resync, to set default directory |
;; CWD might have changed, resync, to set default directory |
2185 |
(idlwave-shell-resync-dirs) |
(idlwave-shell-resync-dirs) |
2186 |
(let ((comint-file-name-chars idlwave-shell-file-name-chars)) |
(let ((comint-file-name-chars idlwave-shell-file-name-chars)) |
2187 |
(comint-dynamic-complete-as-filename))) |
(comint-dynamic-complete-as-filename))) |
2188 |
|
|
2223 |
|
|
2224 |
(defun idlwave-shell-redisplay (&optional hide) |
(defun idlwave-shell-redisplay (&optional hide) |
2225 |
"Tries to resync the display with where execution has stopped. |
"Tries to resync the display with where execution has stopped. |
2226 |
Issues a \"help,/trace\" command followed by a call to |
Issues a \"help,/trace\" command followed by a call to |
2227 |
`idlwave-shell-display-line'. Also updates the breakpoint |
`idlwave-shell-display-line'. Also updates the breakpoint |
2228 |
overlays." |
overlays." |
2229 |
(interactive) |
(interactive) |
2236 |
(idlwave-shell-bp-query)) |
(idlwave-shell-bp-query)) |
2237 |
|
|
2238 |
(defun idlwave-shell-display-level-in-calling-stack (&optional hide) |
(defun idlwave-shell-display-level-in-calling-stack (&optional hide) |
2239 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
2240 |
"help,/trace" |
"help,/trace" |
2241 |
`(progn |
`(progn |
2242 |
;; scanning for the state will reset the stack level - restore it |
;; scanning for the state will reset the stack level - restore it |
2267 |
(setq idlwave-shell-calling-stack-index nmin |
(setq idlwave-shell-calling-stack-index nmin |
2268 |
message (format "%d is the current calling stack level - can't go further down" |
message (format "%d is the current calling stack level - can't go further down" |
2269 |
(- nmin))))) |
(- nmin))))) |
2270 |
(setq idlwave-shell-calling-stack-routine |
(setq idlwave-shell-calling-stack-routine |
2271 |
(nth 2 (nth idlwave-shell-calling-stack-index stack))) |
(nth 2 (nth idlwave-shell-calling-stack-index stack))) |
2272 |
|
|
2273 |
;; only edebug if in that mode already |
;; only edebug if in that mode already |
2274 |
(idlwave-shell-display-line |
(idlwave-shell-display-line |
2275 |
(nth idlwave-shell-calling-stack-index stack) nil |
(nth idlwave-shell-calling-stack-index stack) nil |
2276 |
(unless idlwave-shell-electric-debug-mode 'no-debug)) |
(unless idlwave-shell-electric-debug-mode 'no-debug)) |
2277 |
(message (or message |
(message (or message |
2278 |
(format "In routine %s (stack level %d)" |
(format "In routine %s (stack level %d)" |
2279 |
idlwave-shell-calling-stack-routine |
idlwave-shell-calling-stack-routine |
2280 |
(- idlwave-shell-calling-stack-index)))))) |
(- idlwave-shell-calling-stack-index)))))) |
2305 |
(defun idlwave-shell-pc-frame () |
(defun idlwave-shell-pc-frame () |
2306 |
"Returns the frame for IDL execution." |
"Returns the frame for IDL execution." |
2307 |
(and idlwave-shell-halt-frame |
(and idlwave-shell-halt-frame |
2308 |
(list (nth 0 idlwave-shell-halt-frame) |
(list (nth 0 idlwave-shell-halt-frame) |
2309 |
(nth 1 idlwave-shell-halt-frame) |
(nth 1 idlwave-shell-halt-frame) |
2310 |
(nth 2 idlwave-shell-halt-frame)))) |
(nth 2 idlwave-shell-halt-frame)))) |
2311 |
|
|
2323 |
debug mode." |
debug mode." |
2324 |
(if (not frame) |
(if (not frame) |
2325 |
;; Remove stop-line overlay from old position |
;; Remove stop-line overlay from old position |
2326 |
(progn |
(progn |
2327 |
(setq overlay-arrow-string nil) |
(setq overlay-arrow-string nil) |
2328 |
(setq idlwave-shell-mode-line-info nil) |
(setq idlwave-shell-mode-line-info nil) |
2329 |
(setq idlwave-shell-is-stopped nil) |
(setq idlwave-shell-is-stopped nil) |
2340 |
;;; |
;;; |
2341 |
;;; buffer : the buffer to display a line in. |
;;; buffer : the buffer to display a line in. |
2342 |
;;; select-shell: current buffer is the shell. |
;;; select-shell: current buffer is the shell. |
2343 |
;;; |
;;; |
2344 |
(setq idlwave-shell-mode-line-info |
(setq idlwave-shell-mode-line-info |
2345 |
(if (nth 2 frame) |
(if (nth 2 frame) |
2346 |
(format "[%d:%s]" |
(format "[%d:%s]" |
2347 |
(- idlwave-shell-calling-stack-index) |
(- idlwave-shell-calling-stack-index) |
2348 |
(nth 2 frame)))) |
(nth 2 frame)))) |
2349 |
(let* ((buffer (idlwave-find-file-noselect (car frame) 'shell)) |
(let* ((buffer (idlwave-find-file-noselect (car frame) 'shell)) |
2367 |
(forward-line 0) |
(forward-line 0) |
2368 |
(setq pos (point)) |
(setq pos (point)) |
2369 |
(setq idlwave-shell-is-stopped t) |
(setq idlwave-shell-is-stopped t) |
2370 |
|
|
2371 |
(if idlwave-shell-stop-line-overlay |
(if idlwave-shell-stop-line-overlay |
2372 |
;; Move overlay |
;; Move overlay |
2373 |
(move-overlay idlwave-shell-stop-line-overlay |
(move-overlay idlwave-shell-stop-line-overlay |
2389 |
;; If we have the column of the error, move the cursor there. |
;; If we have the column of the error, move the cursor there. |
2390 |
(if col (move-to-column col)) |
(if col (move-to-column col)) |
2391 |
(setq pos (point)) |
(setq pos (point)) |
2392 |
|
|
2393 |
;; Enter electric debug mode, if not prohibited and not in |
;; Enter electric debug mode, if not prohibited and not in |
2394 |
;; it already |
;; it already |
2395 |
(when (and (or |
(when (and (or |
2396 |
(eq idlwave-shell-automatic-electric-debug t) |
(eq idlwave-shell-automatic-electric-debug t) |
2397 |
(and |
(and |
2398 |
(eq idlwave-shell-automatic-electric-debug 'breakpoint) |
(eq idlwave-shell-automatic-electric-debug 'breakpoint) |
2399 |
(not (eq idlwave-shell-current-state 'error)))) |
(not (eq idlwave-shell-current-state 'error)))) |
2400 |
(not no-debug) |
(not no-debug) |
2402 |
(not idlwave-shell-electric-debug-mode)) |
(not idlwave-shell-electric-debug-mode)) |
2403 |
(idlwave-shell-electric-debug-mode) |
(idlwave-shell-electric-debug-mode) |
2404 |
(setq electric t))) |
(setq electric t))) |
2405 |
|
|
2406 |
;; Make sure pos is really displayed in the window. |
;; Make sure pos is really displayed in the window. |
2407 |
(set-window-point window pos) |
(set-window-point window pos) |
2408 |
|
|
2409 |
;; If we came from the shell, go back there. Otherwise select |
;; If we came from the shell, go back there. Otherwise select |
2410 |
;; the window where the error is displayed. |
;; the window where the error is displayed. |
2411 |
(if (or (and idlwave-shell-electric-zap-to-file electric) |
(if (or (and idlwave-shell-electric-zap-to-file electric) |
2412 |
(and (equal (buffer-name) (idlwave-shell-buffer)) |
(and (equal (buffer-name) (idlwave-shell-buffer)) |
2413 |
(not select-shell))) |
(not select-shell))) |
2414 |
(select-window window)))))) |
(select-window window)))))) |
2415 |
|
|
2419 |
(interactive "p") |
(interactive "p") |
2420 |
(or (not arg) (< arg 1) |
(or (not arg) (< arg 1) |
2421 |
(setq arg 1)) |
(setq arg 1)) |
2422 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
2423 |
(concat ".s " (if (integerp arg) (int-to-string arg) arg)) |
(concat ".s " (if (integerp arg) (int-to-string arg) arg)) |
2424 |
nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t)) |
nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t)) |
2425 |
|
|
2426 |
(defun idlwave-shell-stepover (arg) |
(defun idlwave-shell-stepover (arg) |
2427 |
"Stepover one source line. |
"Stepover one source line. |
2428 |
If given prefix argument ARG, step ARG source lines. |
If given prefix argument ARG, step ARG source lines. |
2429 |
Uses IDL's stepover executive command which does not enter called functions." |
Uses IDL's stepover executive command which does not enter called functions." |
2430 |
(interactive "p") |
(interactive "p") |
2431 |
(or (not arg) (< arg 1) |
(or (not arg) (< arg 1) |
2432 |
(setq arg 1)) |
(setq arg 1)) |
2433 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
2434 |
(concat ".so " (if (integerp arg) (int-to-string arg) arg)) |
(concat ".so " (if (integerp arg) (int-to-string arg) arg)) |
2435 |
nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t)) |
nil (if (idlwave-shell-hide-p 'debug) 'mostly) nil t)) |
2436 |
|
|
2437 |
(defun idlwave-shell-break-here (&optional count cmd condition no-show) |
(defun idlwave-shell-break-here (&optional count cmd condition no-show) |
2438 |
"Set breakpoint at current line. |
"Set breakpoint at current line. |
2439 |
|
|
2440 |
If Count is nil then an ordinary breakpoint is set. We treat a count |
If Count is nil then an ordinary breakpoint is set. We treat a count |
2441 |
of 1 as a temporary breakpoint using the ONCE keyword. Counts greater |
of 1 as a temporary breakpoint using the ONCE keyword. Counts greater |
2442 |
than 1 use the IDL AFTER=count keyword to break only after reaching |
than 1 use the IDL AFTER=count keyword to break only after reaching |
2443 |
the statement count times. |
the statement count times. |
2444 |
|
|
2445 |
Optional argument CMD is a list or function to evaluate upon reaching |
Optional argument CMD is a list or function to evaluate upon reaching |
2446 |
the breakpoint." |
the breakpoint." |
2447 |
|
|
2448 |
(interactive "P") |
(interactive "P") |
2449 |
(when (listp count) |
(when (listp count) |
2450 |
(if (equal (car count) 4) |
(if (equal (car count) 4) |
2451 |
(setq condition (read-string "Break Condition: "))) |
(setq condition (read-string "Break Condition: "))) |
2452 |
(setq count nil)) |
(setq count nil)) |
2453 |
(idlwave-shell-set-bp |
(idlwave-shell-set-bp |
2470 |
(progn |
(progn |
2471 |
(if (progn |
(if (progn |
2472 |
(beep) |
(beep) |
2473 |
(y-or-n-p |
(y-or-n-p |
2474 |
(concat "Okay to recompile file " |
(concat "Okay to recompile file " |
2475 |
(idlwave-shell-bp-get bp 'file) " "))) |
(idlwave-shell-bp-get bp 'file) " "))) |
2476 |
;; Recompile |
;; Recompile |
2478 |
;; Clean up before retrying |
;; Clean up before retrying |
2479 |
(idlwave-shell-command-failure) |
(idlwave-shell-command-failure) |
2480 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
2481 |
(concat ".run " (idlwave-shell-bp-get bp 'file)) nil |
(concat ".run " (idlwave-shell-bp-get bp 'file)) nil |
2482 |
(if (idlwave-shell-hide-p 'run) 'mostly) nil t) |
(if (idlwave-shell-hide-p 'run) 'mostly) nil t) |
2483 |
;; Try setting breakpoint again |
;; Try setting breakpoint again |
2484 |
(idlwave-shell-set-bp bp)) |
(idlwave-shell-set-bp bp)) |
2502 |
(defun idlwave-shell-cont (&optional no-show) |
(defun idlwave-shell-cont (&optional no-show) |
2503 |
"Continue executing." |
"Continue executing." |
2504 |
(interactive) |
(interactive) |
2505 |
(idlwave-shell-send-command ".c" (unless no-show |
(idlwave-shell-send-command ".c" (unless no-show |
2506 |
'(idlwave-shell-redisplay 'hide)) |
'(idlwave-shell-redisplay 'hide)) |
2507 |
(if (idlwave-shell-hide-p 'debug) 'mostly) |
(if (idlwave-shell-hide-p 'debug) 'mostly) |
2508 |
nil t)) |
nil t)) |
2509 |
|
|
2510 |
(defun idlwave-shell-go () |
(defun idlwave-shell-go () |
2585 |
((eq force 'enable) (setq disabled t))) |
((eq force 'enable) (setq disabled t))) |
2586 |
(when bp |
(when bp |
2587 |
(setf (nth 3 (cdr (cdr bp))) (not disabled)) |
(setf (nth 3 (cdr (cdr bp))) (not disabled)) |
2588 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
2589 |
(concat "breakpoint," |
(concat "breakpoint," |
2590 |
(if disabled "/enable," "/disable,") |
(if disabled "/enable," "/disable,") |
2591 |
(int-to-string (idlwave-shell-bp-get bp))) |
(int-to-string (idlwave-shell-bp-get bp))) |
2599 |
(while bpl |
(while bpl |
2600 |
(setq disabled (idlwave-shell-bp-get (car bpl) 'disabled)) |
(setq disabled (idlwave-shell-bp-get (car bpl) 'disabled)) |
2601 |
(when (idlwave-xor (not disabled) (eq enable 'enable)) |
(when (idlwave-xor (not disabled) (eq enable 'enable)) |
2602 |
(idlwave-shell-toggle-enable-current-bp |
(idlwave-shell-toggle-enable-current-bp |
2603 |
(car bpl) (if (eq enable 'enable) 'enable 'disable) no-update) |
(car bpl) (if (eq enable 'enable) 'enable 'disable) no-update) |
2604 |
(push (car bpl) modified)) |
(push (car bpl) modified)) |
2605 |
(setq bpl (cdr bpl))) |
(setq bpl (cdr bpl))) |
2606 |
(unless no-update (idlwave-shell-bp-query)) |
(unless no-update (idlwave-shell-bp-query)) |
2607 |
modified)) |
modified)) |
2608 |
|
|
2609 |
(defun idlwave-shell-to-here () |
(defun idlwave-shell-to-here () |
2610 |
"Set a breakpoint with count 1 then continue." |
"Set a breakpoint with count 1 then continue." |
2611 |
(interactive) |
(interactive) |
2643 |
(defun idlwave-shell-set-bp-in-module (module) |
(defun idlwave-shell-set-bp-in-module (module) |
2644 |
"Set breakpoint in module. Assumes that `idlwave-shell-sources-alist' |
"Set breakpoint in module. Assumes that `idlwave-shell-sources-alist' |
2645 |
contains an entry for that module." |
contains an entry for that module." |
2646 |
(let ((source-file (car-safe |
(let ((source-file (car-safe |
2647 |
(cdr-safe |
(cdr-safe |
2648 |
(assoc (upcase module) |
(assoc (upcase module) |
2649 |
idlwave-shell-sources-alist)))) |
idlwave-shell-sources-alist)))) |
2662 |
(save-excursion |
(save-excursion |
2663 |
(goto-char (point-min)) |
(goto-char (point-min)) |
2664 |
(let ((case-fold-search t)) |
(let ((case-fold-search t)) |
2665 |
(if (re-search-forward |
(if (re-search-forward |
2666 |
(concat "^[ \t]*\\(pro\\|function\\)[ \t]+" |
(concat "^[ \t]*\\(pro\\|function\\)[ \t]+" |
2667 |
(downcase module) |
(downcase module) |
2668 |
"[ \t\n,]") nil t) |
"[ \t\n,]") nil t) |
2704 |
"Attempt to run until this procedure exits. |
"Attempt to run until this procedure exits. |
2705 |
Runs to the last statement and then steps 1 statement. Use the .out command." |
Runs to the last statement and then steps 1 statement. Use the .out command." |
2706 |
(interactive) |
(interactive) |
2707 |
(idlwave-shell-send-command ".o" nil |
(idlwave-shell-send-command ".o" nil |
2708 |
(if (idlwave-shell-hide-p 'debug) 'mostly) |
(if (idlwave-shell-hide-p 'debug) 'mostly) |
2709 |
nil t)) |
nil t)) |
2710 |
|
|
2751 |
(interactive "e") |
(interactive "e") |
2752 |
(let ((transient-mark-mode t) |
(let ((transient-mark-mode t) |
2753 |
(zmacs-regions t) |
(zmacs-regions t) |
2754 |
(tracker (if (featurep 'xemacs) |
(tracker (if (featurep 'xemacs) |
2755 |
(if (fboundp 'default-mouse-track-event-is-with-button) |
(if (fboundp 'default-mouse-track-event-is-with-button) |
2756 |
'idlwave-xemacs-hack-mouse-track |
'idlwave-xemacs-hack-mouse-track |
2757 |
'mouse-track) |
'mouse-track) |
2769 |
(let ((oldfunc (symbol-function 'default-mouse-track-event-is-with-button))) |
(let ((oldfunc (symbol-function 'default-mouse-track-event-is-with-button))) |
2770 |
(unwind-protect |
(unwind-protect |
2771 |
(progn |
(progn |
2772 |
(fset 'default-mouse-track-event-is-with-button |
(fset 'default-mouse-track-event-is-with-button |
2773 |
'idlwave-default-mouse-track-event-is-with-button) |
'idlwave-default-mouse-track-event-is-with-button) |
2774 |
(mouse-track event)) |
(mouse-track event)) |
2775 |
(fset 'default-mouse-track-event-is-with-button oldfunc)))) |
(fset 'default-mouse-track-event-is-with-button oldfunc)))) |
2801 |
(defvar idlwave-shell-examine-completion-list nil) |
(defvar idlwave-shell-examine-completion-list nil) |
2802 |
|
|
2803 |
(defun idlwave-shell-print (arg &optional help ev complete-help-type) |
(defun idlwave-shell-print (arg &optional help ev complete-help-type) |
2804 |
"Print current expression. |
"Print current expression. |
2805 |
|
|
2806 |
With HELP non-nil, show help on expression. If HELP is a string, |
With HELP non-nil, show help on expression. If HELP is a string, |
2807 |
the expression will be put in place of ___, e.g.: |
the expression will be put in place of ___, e.g.: |
2834 |
(save-excursion |
(save-excursion |
2835 |
(let* ((process (get-buffer-process (current-buffer))) |
(let* ((process (get-buffer-process (current-buffer))) |
2836 |
(process-mark (if process (process-mark process))) |
(process-mark (if process (process-mark process))) |
2837 |
(stack-label |
(stack-label |
2838 |
(if (and (integerp idlwave-shell-calling-stack-index) |
(if (and (integerp idlwave-shell-calling-stack-index) |
2839 |
(> idlwave-shell-calling-stack-index 0)) |
(> idlwave-shell-calling-stack-index 0)) |
2840 |
(format " [-%d:%s]" |
(format " [-%d:%s]" |
2841 |
idlwave-shell-calling-stack-index |
idlwave-shell-calling-stack-index |
2842 |
idlwave-shell-calling-stack-routine))) |
idlwave-shell-calling-stack-routine))) |
2843 |
expr beg end cmd examine-hook) |
expr beg end cmd examine-hook) |
2844 |
(cond |
(cond |
2868 |
;; an array |
;; an array |
2869 |
(forward-sexp)) |
(forward-sexp)) |
2870 |
(setq end (point))))) |
(setq end (point))))) |
2871 |
|
|
2872 |
;; Get expression, but first move the begin mark if a |
;; Get expression, but first move the begin mark if a |
2873 |
;; process-mark is inside the region, to keep the overlay from |
;; process-mark is inside the region, to keep the overlay from |
2874 |
;; wandering in the Shell. |
;; wandering in the Shell. |
2879 |
|
|
2880 |
;; Show the overlay(s) and attach any necessary hooks and filters |
;; Show the overlay(s) and attach any necessary hooks and filters |
2881 |
(when (and beg end idlwave-shell-expression-overlay) |
(when (and beg end idlwave-shell-expression-overlay) |
2882 |
(move-overlay idlwave-shell-expression-overlay beg end |
(move-overlay idlwave-shell-expression-overlay beg end |
2883 |
(current-buffer)) |
(current-buffer)) |
2884 |
(add-hook 'pre-command-hook |
(add-hook 'pre-command-hook |
2885 |
'idlwave-shell-delete-expression-overlay)) |
'idlwave-shell-delete-expression-overlay)) |
2886 |
(setq examine-hook |
(setq examine-hook |
2887 |
(if idlwave-shell-separate-examine-output |
(if idlwave-shell-separate-examine-output |
2888 |
'idlwave-shell-examine-display |
'idlwave-shell-examine-display |
2889 |
'idlwave-shell-examine-highlight)) |
'idlwave-shell-examine-highlight)) |
2890 |
(add-hook 'pre-command-hook |
(add-hook 'pre-command-hook |
2891 |
'idlwave-shell-delete-output-overlay) |
'idlwave-shell-delete-output-overlay) |
2892 |
|
|
2893 |
;; Remove empty or comment-only lines |
;; Remove empty or comment-only lines |
2894 |
(while (string-match "\n[ \t]*\\(;.*\\)?\r*\n" expr) |
(while (string-match "\n[ \t]*\\(;.*\\)?\r*\n" expr) |
2895 |
(setq expr (replace-match "\n" t t expr))) |
(setq expr (replace-match "\n" t t expr))) |
2899 |
;; Remove final newline |
;; Remove final newline |
2900 |
(if (string-match "\n[ \t\r]*\\'" expr) |
(if (string-match "\n[ \t\r]*\\'" expr) |
2901 |
(setq expr (replace-match "" t t expr))) |
(setq expr (replace-match "" t t expr))) |
2902 |
|
|
2903 |
(catch 'exit |
(catch 'exit |
2904 |
;; Pop-up or complete on the examine selection list, if appropriate |
;; Pop-up or complete on the examine selection list, if appropriate |
2905 |
(if (or |
(if (or |
2906 |
complete-help-type |
complete-help-type |
2907 |
(and ev idlwave-shell-examine-alist) |
(and ev idlwave-shell-examine-alist) |
2908 |
(consp help)) |
(consp help)) |
2909 |
(let ((help-cons |
(let ((help-cons |
2910 |
(if (consp help) help |
(if (consp help) help |
2911 |
(assoc |
(assoc |
2912 |
;; A cons from either a pop-up or mini-buffer completion |
;; A cons from either a pop-up or mini-buffer completion |
2913 |
(if complete-help-type |
(if complete-help-type |
2914 |
(idlwave-one-key-select 'idlwave-shell-examine-alist |
(idlwave-one-key-select 'idlwave-shell-examine-alist |
2915 |
"Examine with: " 1.5) |
"Examine with: " 1.5) |
2916 |
;; (idlwave-completing-read |
;; (idlwave-completing-read |
2917 |
;; "Examine with: " |
;; "Examine with: " |
2918 |
;; idlwave-shell-examine-alist nil nil nil |
;; idlwave-shell-examine-alist nil nil nil |
2919 |
;; 'idlwave-shell-examine-completion-list |
;; 'idlwave-shell-examine-completion-list |
2920 |
;; "Print") |
;; "Print") |
2921 |
(idlwave-popup-select |
(idlwave-popup-select |
2922 |
ev |
ev |
2923 |
(mapcar 'car idlwave-shell-examine-alist) |
(mapcar 'car idlwave-shell-examine-alist) |
2924 |
"Examine with")) |
"Examine with")) |
2925 |
idlwave-shell-examine-alist)))) |
idlwave-shell-examine-alist)))) |
2926 |
(setq help (cdr help-cons)) |
(setq help (cdr help-cons)) |
2927 |
(if (null help) (throw 'exit nil)) |
(if (null help) (throw 'exit nil)) |
2928 |
(if idlwave-shell-separate-examine-output |
(if idlwave-shell-separate-examine-output |
2929 |
(setq idlwave-shell-examine-label |
(setq idlwave-shell-examine-label |
2930 |
(concat |
(concat |
2931 |
(format "==>%s<==\n%s:" expr (car help-cons)) |
(format "==>%s<==\n%s:" expr (car help-cons)) |
2932 |
stack-label "\n")))) |
stack-label "\n")))) |
2933 |
;; The regular help label (no popups, cons cells, etc.) |
;; The regular help label (no popups, cons cells, etc.) |
2934 |
(setq idlwave-shell-examine-label |
(setq idlwave-shell-examine-label |
2935 |
(concat |
(concat |
2936 |
(format "==>%s<==\n%s:" expr |
(format "==>%s<==\n%s:" expr |
2937 |
(cond ((null help) "print") |
(cond ((null help) "print") |
2938 |
((stringp help) help) |
((stringp help) help) |
2939 |
(t (symbol-name help)))) |
(t (symbol-name help)))) |
2946 |
idlwave-shell-calling-stack-index))) |
idlwave-shell-calling-stack-index))) |
2947 |
(setq cmd (idlwave-shell-help-statement help expr)) |
(setq cmd (idlwave-shell-help-statement help expr)) |
2948 |
;;(idlwave-shell-recenter-shell-window) |
;;(idlwave-shell-recenter-shell-window) |
2949 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
2950 |
cmd |
cmd |
2951 |
examine-hook |
examine-hook |
2952 |
(if idlwave-shell-separate-examine-output 'hide)))))) |
(if idlwave-shell-separate-examine-output 'hide)))))) |
2953 |
|
|
2954 |
(defvar idlwave-shell-examine-window-alist nil |
(defvar idlwave-shell-examine-window-alist nil |
2975 |
(let* ((end (or |
(let* ((end (or |
2976 |
(re-search-backward idlwave-shell-prompt-pattern nil t) |
(re-search-backward idlwave-shell-prompt-pattern nil t) |
2977 |
(point-max))) |
(point-max))) |
2978 |
(beg (progn |
(beg (progn |
2979 |
(goto-char |
(goto-char |
2980 |
(or (progn (if (re-search-backward |
(or (progn (if (re-search-backward |
2981 |
idlwave-shell-prompt-pattern nil t) |
idlwave-shell-prompt-pattern nil t) |
2982 |
(match-end 0))) |
(match-end 0))) |
2983 |
(point-min))) |
(point-min))) |
2994 |
(setq buffer-read-only t) |
(setq buffer-read-only t) |
2995 |
(move-overlay idlwave-shell-output-overlay cur-beg cur-end |
(move-overlay idlwave-shell-output-overlay cur-beg cur-end |
2996 |
(current-buffer)) |
(current-buffer)) |
2997 |
|
|
2998 |
;; Look for the examine buffer in all windows. If one is |
;; Look for the examine buffer in all windows. If one is |
2999 |
;; found in a frame all by itself, use that, otherwise, switch |
;; found in a frame all by itself, use that, otherwise, switch |
3000 |
;; to or create an examine window in this frame, and resize if |
;; to or create an examine window in this frame, and resize if |
3001 |
;; it's a newly created window |
;; it's a newly created window |
3002 |
(let* ((winlist (get-buffer-window-list "*Examine*" nil 'visible))) |
(let* ((winlist (get-buffer-window-list "*Examine*" nil 'visible))) |
3003 |
(setq win (idlwave-display-buffer |
(setq win (idlwave-display-buffer |
3004 |
"*Examine*" |
"*Examine*" |
3005 |
nil |
nil |
3006 |
(let ((list winlist) thiswin) |
(let ((list winlist) thiswin) |
3007 |
(catch 'exit |
(catch 'exit |
3008 |
(save-selected-window |
(save-selected-window |
3009 |
(while (setq thiswin (pop list)) |
(while (setq thiswin (pop list)) |
3010 |
(select-window thiswin) |
(select-window thiswin) |
3011 |
(if (one-window-p) |
(if (one-window-p) |
3012 |
(throw 'exit (window-frame thiswin))))))))) |
(throw 'exit (window-frame thiswin))))))))) |
3013 |
(set-window-start win (point-min)) ; Ensure the point is visible. |
(set-window-start win (point-min)) ; Ensure the point is visible. |
3014 |
(save-selected-window |
(save-selected-window |
3029 |
;; And add the new value. |
;; And add the new value. |
3030 |
(if (setq elt (assoc win idlwave-shell-examine-window-alist)) |
(if (setq elt (assoc win idlwave-shell-examine-window-alist)) |
3031 |
(setcdr elt (window-height)) |
(setcdr elt (window-height)) |
3032 |
(add-to-list 'idlwave-shell-examine-window-alist |
(add-to-list 'idlwave-shell-examine-window-alist |
3033 |
(cons win (window-height))))))))) |
(cons win (window-height))))))))) |
3034 |
;; Recenter for maximum output, after widened |
;; Recenter for maximum output, after widened |
3035 |
(save-selected-window |
(save-selected-window |
3047 |
|
|
3048 |
(defun idlwave-shell-examine-display-clear () |
(defun idlwave-shell-examine-display-clear () |
3049 |
(interactive) |
(interactive) |
3050 |
(save-excursion |
(save-excursion |
3051 |
(let ((buf (get-buffer "*Examine*"))) |
(let ((buf (get-buffer "*Examine*"))) |
3052 |
(when (bufferp buf) |
(when (bufferp buf) |
3053 |
(set-buffer buf) |
(set-buffer buf) |
3075 |
;; break. We will look for identifiers and exclude cases where we |
;; break. We will look for identifiers and exclude cases where we |
3076 |
;; know it is not a variable. To distinguish array references from |
;; know it is not a variable. To distinguish array references from |
3077 |
;; function calls, we require that arrays use [] instead of () |
;; function calls, we require that arrays use [] instead of () |
3078 |
|
|
3079 |
(while (string-match |
(while (string-match |
3080 |
"\\(\\`\\|[^a-zA-Z0-9$_][ \t]*\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)\\([ \t]*[^a-zA-Z0-9$_]\\|\\'\\)" expr start) |
"\\(\\`\\|[^a-zA-Z0-9$_][ \t]*\\)\\([a-zA-Z][a-zA-Z0-9$_]*\\)\\([ \t]*[^a-zA-Z0-9$_]\\|\\'\\)" expr start) |
3081 |
(setq var (match-string 2 expr) |
(setq var (match-string 2 expr) |
3091 |
((string-match "->[ \t]*\\'" pre)) ;; a method |
((string-match "->[ \t]*\\'" pre)) ;; a method |
3092 |
((string-match "\\.\\'" pre)) ;; structure member |
((string-match "\\.\\'" pre)) ;; structure member |
3093 |
((and (string-match "\\([\"\']\\)[^\1]*$" pre) |
((and (string-match "\\([\"\']\\)[^\1]*$" pre) |
3094 |
(string-match (concat "^[^" (match-string 1 pre) "]*" |
(string-match (concat "^[^" (match-string 1 pre) "]*" |
3095 |
(match-string 1 pre)) post))) |
(match-string 1 pre)) post))) |
3096 |
(t ;; seems to be a variable - replace its name in the |
(t ;; seems to be a variable - replace its name in the |
3097 |
;; expression with the fetch. |
;; expression with the fetch. |
3109 |
size(___,/DIMENSIONS)" |
size(___,/DIMENSIONS)" |
3110 |
(cond |
(cond |
3111 |
((null help) (concat "print, " expr)) |
((null help) (concat "print, " expr)) |
3112 |
((stringp help) |
((stringp help) |
3113 |
(if (string-match "\\(^\\|[^_]\\)\\(___\\)\\([^_]\\|$\\)" help) |
(if (string-match "\\(^\\|[^_]\\)\\(___\\)\\([^_]\\|$\\)" help) |
3114 |
(concat (substring help 0 (match-beginning 2)) |
(concat (substring help 0 (match-beginning 2)) |
3115 |
expr |
expr |
3116 |
(substring help (match-end 2))))) |
(substring help (match-end 2))))) |
3117 |
(t (concat "help, " expr)))) |
(t (concat "help, " expr)))) |
3118 |
|
|
3119 |
|
|
3120 |
(defun idlwave-shell-examine-highlight () |
(defun idlwave-shell-examine-highlight () |
3121 |
"Highlight the most recent IDL output." |
"Highlight the most recent IDL output." |
3123 |
(process (get-buffer-process buffer)) |
(process (get-buffer-process buffer)) |
3124 |
(process-mark (if process (process-mark process))) |
(process-mark (if process (process-mark process))) |
3125 |
output-begin output-end) |
output-begin output-end) |
3126 |
(save-excursion |
(save-excursion |
3127 |
(set-buffer buffer) |
(set-buffer buffer) |
3128 |
(goto-char process-mark) |
(goto-char process-mark) |
3129 |
(beginning-of-line) |
(beginning-of-line) |
3131 |
(re-search-backward idlwave-shell-prompt-pattern nil t) |
(re-search-backward idlwave-shell-prompt-pattern nil t) |
3132 |
(beginning-of-line 2) |
(beginning-of-line 2) |
3133 |
(setq output-begin (point))) |
(setq output-begin (point))) |
3134 |
|
|
3135 |
;; First make sure the shell window is visible |
;; First make sure the shell window is visible |
3136 |
(idlwave-display-buffer (idlwave-shell-buffer) |
(idlwave-display-buffer (idlwave-shell-buffer) |
3137 |
nil (idlwave-shell-shell-frame)) |
nil (idlwave-shell-shell-frame)) |
3138 |
(if (and idlwave-shell-output-overlay process-mark) |
(if (and idlwave-shell-output-overlay process-mark) |
3139 |
(move-overlay idlwave-shell-output-overlay |
(move-overlay idlwave-shell-output-overlay |
3140 |
output-begin output-end buffer)))) |
output-begin output-end buffer)))) |
3141 |
|
|
3142 |
(defun idlwave-shell-delete-output-overlay () |
(defun idlwave-shell-delete-output-overlay () |
3147 |
(delete-overlay idlwave-shell-output-overlay)) |
(delete-overlay idlwave-shell-output-overlay)) |
3148 |
(error nil)) |
(error nil)) |
3149 |
(remove-hook 'pre-command-hook 'idlwave-shell-delete-output-overlay))) |
(remove-hook 'pre-command-hook 'idlwave-shell-delete-output-overlay))) |
3150 |
|
|
3151 |
(defun idlwave-shell-delete-expression-overlay () |
(defun idlwave-shell-delete-expression-overlay () |
3152 |
(unless (or (eq this-command 'idlwave-shell-mouse-nop) |
(unless (or (eq this-command 'idlwave-shell-mouse-nop) |
3153 |
(eq this-command 'handle-switch-frame)) |
(eq this-command 'handle-switch-frame)) |
3176 |
count - number of times to execute breakpoint. When count reaches 0 |
count - number of times to execute breakpoint. When count reaches 0 |
3177 |
the breakpoint is cleared and removed from the alist. |
the breakpoint is cleared and removed from the alist. |
3178 |
|
|
3179 |
command - command to execute when breakpoint is reached, either a |
command - command to execute when breakpoint is reached, either a |
3180 |
lisp function to be called with `funcall' with no arguments or a |
lisp function to be called with `funcall' with no arguments or a |
3181 |
list to be evaluated with `eval'. |
list to be evaluated with `eval'. |
3182 |
|
|
3209 |
(insert "\nend\n")) |
(insert "\nend\n")) |
3210 |
(save-buffer 0))) |
(save-buffer 0))) |
3211 |
(idlwave-shell-send-command (concat ".run " idlwave-shell-temp-pro-file) |
(idlwave-shell-send-command (concat ".run " idlwave-shell-temp-pro-file) |
3212 |
nil |
nil |
3213 |
(if (idlwave-shell-hide-p 'run) 'mostly) |
(if (idlwave-shell-hide-p 'run) 'mostly) |
3214 |
nil t) |
nil t) |
3215 |
(if n |
(if n |
3216 |
(idlwave-display-buffer (idlwave-shell-buffer) |
(idlwave-display-buffer (idlwave-shell-buffer) |
3217 |
nil (idlwave-shell-shell-frame)))) |
nil (idlwave-shell-shell-frame)))) |
3218 |
|
|
3219 |
(defun idlwave-shell-evaluate-region (beg end &optional n) |
(defun idlwave-shell-evaluate-region (beg end &optional n) |
3224 |
(interactive "r\nP") |
(interactive "r\nP") |
3225 |
(idlwave-shell-send-command (buffer-substring beg end)) |
(idlwave-shell-send-command (buffer-substring beg end)) |
3226 |
(if n |
(if n |
3227 |
(idlwave-display-buffer (idlwave-shell-buffer) |
(idlwave-display-buffer (idlwave-shell-buffer) |
3228 |
nil (idlwave-shell-shell-frame)))) |
nil (idlwave-shell-shell-frame)))) |
3229 |
|
|
3230 |
(defun idlwave-shell-delete-temp-files () |
(defun idlwave-shell-delete-temp-files () |
3279 |
'hide)) |
'hide)) |
3280 |
|
|
3281 |
(defun idlwave-shell-bp-get (bp &optional item) |
(defun idlwave-shell-bp-get (bp &optional item) |
3282 |
"Get a value for a breakpoint. |
"Get a value for a breakpoint. |
3283 |
BP has the form of elements in idlwave-shell-bp-alist. Optional |
BP has the form of elements in idlwave-shell-bp-alist. Optional |
3284 |
second arg ITEM is the particular value to retrieve. ITEM can be |
second arg ITEM is the particular value to retrieve. ITEM can be |
3285 |
'file, 'line, 'index, 'module, 'count, 'cmd, 'condition, 'disabled or |
'file, 'line, 'index, 'module, 'count, 'cmd, 'condition, 'disabled or |
3314 |
;; Searching the breakpoints |
;; Searching the breakpoints |
3315 |
;; In IDL 5.5, the breakpoint reporting format changed. |
;; In IDL 5.5, the breakpoint reporting format changed. |
3316 |
(bp-re54 "^[ \t]*\\([0-9]+\\)[ \t]+\\(\\S-+\\)?[ \t]+\\([0-9]+\\)[ \t]+\\(\\S-+\\)") |
(bp-re54 "^[ \t]*\\([0-9]+\\)[ \t]+\\(\\S-+\\)?[ \t]+\\([0-9]+\\)[ \t]+\\(\\S-+\\)") |
3317 |
(bp-re55 |
(bp-re55 |
3318 |
(concat |
(concat |
3319 |
"^\\s-*\\([0-9]+\\)" ; 1 index |
"^\\s-*\\([0-9]+\\)" ; 1 index |
3320 |
"\\s-+\\([0-9]+\\)" ; 2 line number |
"\\s-+\\([0-9]+\\)" ; 2 line number |
3321 |
"\\s-+\\(Uncompiled\\|" ; 3-6 either uncompiled or routine name |
"\\s-+\\(Uncompiled\\|" ; 3-6 either uncompiled or routine name |
3330 |
bp-re indmap) |
bp-re indmap) |
3331 |
(setq idlwave-shell-bp-alist (list nil)) |
(setq idlwave-shell-bp-alist (list nil)) |
3332 |
;; Search for either header type, and set the correct regexp |
;; Search for either header type, and set the correct regexp |
3333 |
(when (or |
(when (or |
3334 |
(if (re-search-forward "^\\s-*Index.*\n\\s-*-" nil t) |
(if (re-search-forward "^\\s-*Index.*\n\\s-*-" nil t) |
3335 |
(setq bp-re bp-re54 ; versions <= 5.4 |
(setq bp-re bp-re54 ; versions <= 5.4 |
3336 |
indmap '(1 2 3 4))) ;index module line file |
indmap '(1 2 3 4))) ;index module line file |
3337 |
(if (re-search-forward |
(if (re-search-forward |
3338 |
"^\\s-*Index\\s-*Line\\s-*Attributes\\s-*File" nil t) |
"^\\s-*Index\\s-*Line\\s-*Attributes\\s-*File" nil t) |
3339 |
(setq bp-re bp-re55 ; versions >= 5.5 |
(setq bp-re bp-re55 ; versions >= 5.5 |
3340 |
indmap '(1 6 2 16)))) ; index module line file |
indmap '(1 6 2 16)))) ; index module line file |
3341 |
;; There seems to be a breakpoint listing here, parse breakpoint lines. |
;; There seems to be a breakpoint listing here, parse breakpoint lines. |
3342 |
(while (re-search-forward bp-re nil t) |
(while (re-search-forward bp-re nil t) |
3343 |
(setq index (string-to-int (match-string (nth 0 indmap))) |
(setq index (string-to-number (match-string (nth 0 indmap))) |
3344 |
module (match-string (nth 1 indmap)) |
module (match-string (nth 1 indmap)) |
3345 |
line (string-to-int (match-string (nth 2 indmap))) |
line (string-to-number (match-string (nth 2 indmap))) |
3346 |
file (idlwave-shell-file-name (match-string (nth 3 indmap)))) |
file (idlwave-shell-file-name (match-string (nth 3 indmap)))) |
3347 |
(if (eq bp-re bp-re55) |
(if (eq bp-re bp-re55) |
3348 |
(setq count (if (match-string 10) 1 |
(setq count (if (match-string 10) 1 |
3349 |
(if (match-string 8) |
(if (match-string 8) |
3350 |
(string-to-int (match-string 8)))) |
(string-to-number (match-string 8)))) |
3351 |
condition (match-string 13) |
condition (match-string 13) |
3352 |
disabled (not (null (match-string 15))))) |
disabled (not (null (match-string 15))))) |
3353 |
|
|
3354 |
;; Add the breakpoint info to the list |
;; Add the breakpoint info to the list |
3355 |
(nconc idlwave-shell-bp-alist |
(nconc idlwave-shell-bp-alist |
3356 |
(list (cons (list file line) |
(list (cons (list file line) |
3360 |
count nil condition disabled)))))) |
count nil condition disabled)))))) |
3361 |
(setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist)) |
(setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist)) |
3362 |
;; Update breakpoint data |
;; Update breakpoint data |
3363 |
(if (eq bp-re bp-re54) |
(if (eq bp-re bp-re54) |
3364 |
(mapcar 'idlwave-shell-update-bp old-bp-alist) |
(mapcar 'idlwave-shell-update-bp old-bp-alist) |
3365 |
(mapcar 'idlwave-shell-update-bp-command-only old-bp-alist)))) |
(mapcar 'idlwave-shell-update-bp-command-only old-bp-alist)))) |
3366 |
;; Update the breakpoint overlays |
;; Update the breakpoint overlays |
3375 |
"Update BP data in breakpoint list. |
"Update BP data in breakpoint list. |
3376 |
If BP frame is in `idlwave-shell-bp-alist' updates the breakpoint data." |
If BP frame is in `idlwave-shell-bp-alist' updates the breakpoint data." |
3377 |
(let ((match (assoc (car bp) idlwave-shell-bp-alist))) |
(let ((match (assoc (car bp) idlwave-shell-bp-alist))) |
3378 |
(if match |
(if match |
3379 |
(if command-only |
(if command-only |
3380 |
(setf (nth 1 (cdr (cdr match))) (nth 1 (cdr (cdr match)))) |
(setf (nth 1 (cdr (cdr match))) (nth 1 (cdr (cdr match)))) |
3381 |
(setcdr (cdr match) (cdr (cdr bp))))))) |
(setcdr (cdr match) (cdr (cdr bp))))))) |
3382 |
|
|
3401 |
(let* |
(let* |
3402 |
((bp-file (idlwave-shell-bp-get bp 'file)) |
((bp-file (idlwave-shell-bp-get bp 'file)) |
3403 |
(bp-module (idlwave-shell-bp-get bp 'module)) |
(bp-module (idlwave-shell-bp-get bp 'module)) |
3404 |
(internal-file-list |
(internal-file-list |
3405 |
(cdr (assoc bp-module idlwave-shell-sources-alist)))) |
(cdr (assoc bp-module idlwave-shell-sources-alist)))) |
3406 |
(if (and internal-file-list |
(if (and internal-file-list |
3407 |
(equal bp-file (nth 0 internal-file-list))) |
(equal bp-file (nth 0 internal-file-list))) |
3409 |
bp-file))) |
bp-file))) |
3410 |
|
|
3411 |
(defun idlwave-shell-set-bp (bp &optional no-show) |
(defun idlwave-shell-set-bp (bp &optional no-show) |
3412 |
"Try to set a breakpoint BP. |
"Try to set a breakpoint BP. |
3413 |
The breakpoint will be placed at the beginning of the statement on the |
The breakpoint will be placed at the beginning of the statement on the |
3414 |
line specified by BP or at the next IDL statement if that line is not |
line specified by BP or at the next IDL statement if that line is not |
3415 |
a statement. Determines IDL's internal representation for the |
a statement. Determines IDL's internal representation for the |
3416 |
breakpoint, which may have occurred at a different line than |
breakpoint, which may have occurred at a different line than |
3417 |
specified. If NO-SHOW is non-nil, don't do any updating." |
specified. If NO-SHOW is non-nil, don't do any updating." |
3418 |
;; Get and save the old breakpoints |
;; Get and save the old breakpoints |
3419 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
3420 |
idlwave-shell-bp-query |
idlwave-shell-bp-query |
3421 |
`(progn |
`(progn |
3422 |
(idlwave-shell-filter-bp (quote ,no-show)) |
(idlwave-shell-filter-bp (quote ,no-show)) |
3434 |
(defun idlwave-shell-set-bp2 (bp &optional no-show) |
(defun idlwave-shell-set-bp2 (bp &optional no-show) |
3435 |
"Use results of breakpoint and sources query to set bp. |
"Use results of breakpoint and sources query to set bp. |
3436 |
Use the count argument with IDLs breakpoint command. |
Use the count argument with IDLs breakpoint command. |
3437 |
We treat a count of 1 as a temporary breakpoint. |
We treat a count of 1 as a temporary breakpoint. |
3438 |
Counts greater than 1 use the IDL AFTER=count keyword to break |
Counts greater than 1 use the IDL AFTER=count keyword to break |
3439 |
only after reaching the statement count times." |
only after reaching the statement count times." |
3440 |
(let* |
(let* |
3446 |
((> arg 1) |
((> arg 1) |
3447 |
(format ",after=%d" arg)))) |
(format ",after=%d" arg)))) |
3448 |
(condition (idlwave-shell-bp-get bp 'condition)) |
(condition (idlwave-shell-bp-get bp 'condition)) |
3449 |
(key (concat key |
(key (concat key |
3450 |
(if condition (concat ",CONDITION=\"" condition "\"")))) |
(if condition (concat ",CONDITION=\"" condition "\"")))) |
3451 |
(line (idlwave-shell-bp-get bp 'line))) |
(line (idlwave-shell-bp-get bp 'line))) |
3452 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
3453 |
(concat "breakpoint,'" |
(concat "breakpoint,'" |
3454 |
(idlwave-shell-sources-bp bp) "'," |
(idlwave-shell-sources-bp bp) "'," |
3455 |
(if (integerp line) (setq line (int-to-string line))) |
(if (integerp line) (setq line (int-to-string line))) |
3456 |
key) |
key) |
3534 |
ov ov-list bp buf old-buffers win) |
ov ov-list bp buf old-buffers win) |
3535 |
|
|
3536 |
;; Delete the old overlays from their buffers |
;; Delete the old overlays from their buffers |
3537 |
(if ov-alist |
(if ov-alist |
3538 |
(while (setq ov-list (pop ov-alist)) |
(while (setq ov-list (pop ov-alist)) |
3539 |
(while (setq ov (pop (cdr ov-list))) |
(while (setq ov (pop (cdr ov-list))) |
3540 |
(add-to-list 'old-buffers (overlay-buffer ov)) |
(add-to-list 'old-buffers (overlay-buffer ov)) |
3541 |
(delete-overlay ov)))) |
(delete-overlay ov)))) |
3542 |
|
|
3543 |
(setq ov-alist idlwave-shell-bp-overlays |
(setq ov-alist idlwave-shell-bp-overlays |
3544 |
idlwave-shell-bp-overlays |
idlwave-shell-bp-overlays |
3545 |
(if idlwave-shell-bp-glyph |
(if idlwave-shell-bp-glyph |
3546 |
(mapcar 'list (mapcar 'car idlwave-shell-bp-glyph)) |
(mapcar 'list (mapcar 'car idlwave-shell-bp-glyph)) |
3547 |
(list (list 'bp)))) |
(list (list 'bp)))) |
3565 |
(t 'bp-n))) |
(t 'bp-n))) |
3566 |
(t 'bp)) |
(t 'bp)) |
3567 |
'bp)) |
'bp)) |
3568 |
(help-list |
(help-list |
3569 |
(delq nil |
(delq nil |
3570 |
(list |
(list |
3571 |
(if count |
(if count |
3573 |
(if condition |
(if condition |
3574 |
(concat "condition: " condition)) |
(concat "condition: " condition)) |
3575 |
(if disabled "disabled")))) |
(if disabled "disabled")))) |
3576 |
(help-text (if help-list |
(help-text (if help-list |
3577 |
(mapconcat 'identity help-list ","))) |
(mapconcat 'identity help-list ","))) |
3578 |
(full-type (if disabled |
(full-type (if disabled |
3579 |
(intern (concat (symbol-name type) |
(intern (concat (symbol-name type) |
3582 |
(ov-existing (assq full-type ov-alist)) |
(ov-existing (assq full-type ov-alist)) |
3583 |
(ov (or (and (cdr ov-existing) |
(ov (or (and (cdr ov-existing) |
3584 |
(pop (cdr ov-existing))) |
(pop (cdr ov-existing))) |
3585 |
(idlwave-shell-make-new-bp-overlay |
(idlwave-shell-make-new-bp-overlay |
3586 |
type disabled help-text))) |
type disabled help-text))) |
3587 |
match) |
match) |
3588 |
(move-overlay ov beg end) |
(move-overlay ov beg end) |
3592 |
(list (list full-type ov))))) |
(list (list full-type ov))))) |
3593 |
;; Take care of margins if using a glyph |
;; Take care of margins if using a glyph |
3594 |
(when use-glyph |
(when use-glyph |
3595 |
(if old-buffers |
(if old-buffers |
3596 |
(setq old-buffers (delq (current-buffer) old-buffers))) |
(setq old-buffers (delq (current-buffer) old-buffers))) |
3597 |
(if (fboundp 'set-specifier) ;; XEmacs |
(if (fboundp 'set-specifier) ;; XEmacs |
3598 |
(set-specifier left-margin-width (cons (current-buffer) 2)) |
(set-specifier left-margin-width (cons (current-buffer) 2)) |
3610 |
|
|
3611 |
|
|
3612 |
(defun idlwave-shell-make-new-bp-overlay (&optional type disabled help) |
(defun idlwave-shell-make-new-bp-overlay (&optional type disabled help) |
3613 |
"Make a new overlay for highlighting breakpoints. |
"Make a new overlay for highlighting breakpoints. |
3614 |
|
|
3615 |
This stuff is strongly dependant upon the version of Emacs. If TYPE |
This stuff is strongly dependant upon the version of Emacs. If TYPE |
3616 |
is passed, make an overlay of that type ('bp or 'bp-cond, currently |
is passed, make an overlay of that type ('bp or 'bp-cond, currently |
3620 |
(use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph)) |
(use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph)) |
3621 |
idlwave-shell-bp-glyph)) |
idlwave-shell-bp-glyph)) |
3622 |
(type (or type 'bp)) |
(type (or type 'bp)) |
3623 |
(face (if disabled |
(face (if disabled |
3624 |
idlwave-shell-disabled-breakpoint-face |
idlwave-shell-disabled-breakpoint-face |
3625 |
idlwave-shell-breakpoint-face))) |
idlwave-shell-breakpoint-face))) |
3626 |
(if (featurep 'xemacs) |
(if (featurep 'xemacs) |
3627 |
;; This is XEmacs |
;; This is XEmacs |
3628 |
(progn |
(progn |
3629 |
(cond |
(cond |
3630 |
;; tty's cannot display glyphs |
;; tty's cannot display glyphs |
3631 |
((eq (console-type) 'tty) |
((eq (console-type) 'tty) |
3632 |
(set-extent-property ov 'face face)) |
(set-extent-property ov 'face face)) |
3633 |
|
|
3634 |
;; use the glyph |
;; use the glyph |
3635 |
(use-glyph |
(use-glyph |
3636 |
(let ((glyph (cdr (assq type idlwave-shell-bp-glyph)))) |
(let ((glyph (cdr (assq type idlwave-shell-bp-glyph)))) |
3651 |
(if use-glyph |
(if use-glyph |
3652 |
(let ((image-props (cdr (assq type idlwave-shell-bp-glyph))) |
(let ((image-props (cdr (assq type idlwave-shell-bp-glyph))) |
3653 |
string) |
string) |
3654 |
|
|
3655 |
(if disabled (setq image-props |
(if disabled (setq image-props |
3656 |
(append image-props |
(append image-props |
3657 |
(list :conversion 'disabled)))) |
(list :conversion 'disabled)))) |
3658 |
(setq string |
(setq string |
3659 |
(propertize "@" |
(propertize "@" |
3660 |
'display |
'display |
3661 |
(list (list 'margin 'left-margin) |
(list (list 'margin 'left-margin) |
3662 |
image-props) |
image-props) |
3663 |
'mouse-face 'highlight |
'mouse-face 'highlight |
3685 |
Also with prefix arg, ask for the command. You can also use the command |
Also with prefix arg, ask for the command. You can also use the command |
3686 |
`idlwave-shell-edit-default-command-line' to edit the line." |
`idlwave-shell-edit-default-command-line' to edit the line." |
3687 |
(interactive "P") |
(interactive "P") |
3688 |
(cond |
(cond |
3689 |
((equal arg '(16)) |
((equal arg '(16)) |
3690 |
(setq idlwave-shell-command-line-to-execute nil)) |
(setq idlwave-shell-command-line-to-execute nil)) |
3691 |
((equal arg '(4)) |
((equal arg '(4)) |
3692 |
(setq idlwave-shell-command-line-to-execute |
(setq idlwave-shell-command-line-to-execute |
3693 |
(read-string "IDL> " idlwave-shell-command-line-to-execute)))) |
(read-string "IDL> " idlwave-shell-command-line-to-execute)))) |
3694 |
(idlwave-shell-reset 'hidden) |
(idlwave-shell-reset 'hidden) |
3695 |
(idlwave-shell-send-command |
(idlwave-shell-send-command |
3696 |
(or idlwave-shell-command-line-to-execute |
(or idlwave-shell-command-line-to-execute |
3697 |
(with-current-buffer (idlwave-shell-buffer) |
(with-current-buffer (idlwave-shell-buffer) |
3698 |
(ring-ref comint-input-ring 0))) |
(ring-ref comint-input-ring 0))) |
3702 |
"Save file and run it in IDL. |
"Save file and run it in IDL. |
3703 |
Runs `save-buffer' and sends a '.RUN' command for the associated file to IDL. |
Runs `save-buffer' and sends a '.RUN' command for the associated file to IDL. |
3704 |
When called from the shell buffer, re-run the file which was last handled by |
When called from the shell buffer, re-run the file which was last handled by |
3705 |
one of the save-and-.. commands." |
one of the save-and-.. commands." |
3706 |
(interactive) |
(interactive) |
3707 |
(idlwave-shell-save-and-action 'run)) |
(idlwave-shell-save-and-action 'run)) |
3708 |
|
|
3718 |
"Save file and batch it in IDL. |
"Save file and batch it in IDL. |
3719 |
Runs `save-buffer' and sends a '@file' command for the associated file to IDL. |
Runs `save-buffer' and sends a '@file' command for the associated file to IDL. |
3720 |
When called from the shell buffer, re-batch the file which was last handled by |
When called from the shell buffer, re-batch the file which was last handled by |
3721 |
one of the save-and-.. commands." |
one of the save-and-.. commands." |
3722 |
(interactive) |
(interactive) |
3723 |
(idlwave-shell-save-and-action 'batch)) |
(idlwave-shell-save-and-action 'batch)) |
3724 |
|
|
3758 |
'idlwave-shell-maybe-update-routine-info |
'idlwave-shell-maybe-update-routine-info |
3759 |
(if (idlwave-shell-hide-p 'run) 'mostly) nil t) |
(if (idlwave-shell-hide-p 'run) 'mostly) nil t) |
3760 |
(idlwave-shell-bp-query)) |
(idlwave-shell-bp-query)) |
3761 |
(let ((msg (format "No such file %s" |
(let ((msg (format "No such file %s" |
3762 |
idlwave-shell-last-save-and-action-file))) |
idlwave-shell-last-save-and-action-file))) |
3763 |
(setq idlwave-shell-last-save-and-action-file nil) |
(setq idlwave-shell-last-save-and-action-file nil) |
3764 |
(error msg)))) |
(error msg)))) |
3791 |
|
|
3792 |
(defun idlwave-shell-sources-filter () |
(defun idlwave-shell-sources-filter () |
3793 |
"Get source files from `idlwave-shell-sources-query' output. |
"Get source files from `idlwave-shell-sources-query' output. |
3794 |
Create `idlwave-shell-sources-alist' consisting of |
Create `idlwave-shell-sources-alist' consisting of |
3795 |
list elements of the form: |
list elements of the form: |
3796 |
(module name . (source-file-truename idlwave-internal-filename))." |
(module name . (source-file-truename idlwave-internal-filename))." |
3797 |
(save-excursion |
(save-excursion |
3876 |
(list |
(list |
3877 |
(save-match-data |
(save-match-data |
3878 |
(idlwave-shell-file-name |
(idlwave-shell-file-name |
3879 |
(buffer-substring (match-beginning 1 ) |
(buffer-substring (match-beginning 1 ) |
3880 |
(match-end 1)))) |
(match-end 1)))) |
3881 |
(string-to-int |
(string-to-number |
3882 |
(buffer-substring (match-beginning 2) |
(buffer-substring (match-beginning 2) |
3883 |
(match-end 2))))) |
(match-end 2))))) |
3884 |
;; Try to find the column of the error |
;; Try to find the column of the error |
3943 |
|
|
3944 |
;; The mouse bindings for PRINT and HELP |
;; The mouse bindings for PRINT and HELP |
3945 |
(idlwave-shell-define-key-both |
(idlwave-shell-define-key-both |
3946 |
(if (featurep 'xemacs) |
(if (featurep 'xemacs) |
3947 |
[(shift button2)] |
[(shift button2)] |
3948 |
[(shift down-mouse-2)]) |
[(shift down-mouse-2)]) |
3949 |
'idlwave-shell-mouse-print) |
'idlwave-shell-mouse-print) |
3950 |
(idlwave-shell-define-key-both |
(idlwave-shell-define-key-both |
3951 |
(if (featurep 'xemacs) |
(if (featurep 'xemacs) |
3952 |
[(control meta button2)] |
[(control meta button2)] |
3953 |
[(control meta down-mouse-2)]) |
[(control meta down-mouse-2)]) |
3954 |
'idlwave-shell-mouse-help) |
'idlwave-shell-mouse-help) |
3955 |
(idlwave-shell-define-key-both |
(idlwave-shell-define-key-both |
3958 |
[(control shift down-mouse-2)]) |
[(control shift down-mouse-2)]) |
3959 |
'idlwave-shell-examine-select) |
'idlwave-shell-examine-select) |
3960 |
;; Add this one from the idlwave-mode-map |
;; Add this one from the idlwave-mode-map |
3961 |
(define-key idlwave-shell-mode-map |
(define-key idlwave-shell-mode-map |
3962 |
(if (featurep 'xemacs) |
(if (featurep 'xemacs) |
3963 |
[(shift button3)] |
[(shift button3)] |
3964 |
[(shift mouse-3)]) |
[(shift mouse-3)]) |
3965 |
'idlwave-mouse-context-help) |
'idlwave-mouse-context-help) |
3966 |
|
|
3967 |
;; For Emacs, we need to turn off the button release events. |
;; For Emacs, we need to turn off the button release events. |
3968 |
(defun idlwave-shell-mouse-nop (event) |
(defun idlwave-shell-mouse-nop (event) |
3969 |
(interactive "e")) |
(interactive "e")) |
3970 |
(unless (featurep 'xemacs) |
(unless (featurep 'xemacs) |
3971 |
(idlwave-shell-define-key-both |
(idlwave-shell-define-key-both |
3975 |
(idlwave-shell-define-key-both |
(idlwave-shell-define-key-both |
3976 |
[(control meta mouse-2)] 'idlwave-shell-mouse-nop)) |
[(control meta mouse-2)] 'idlwave-shell-mouse-nop)) |
3977 |
|
|
3978 |
|
|
3979 |
;; The following set of bindings is used to bind the debugging keys. |
;; The following set of bindings is used to bind the debugging keys. |
3980 |
;; If `idlwave-shell-activate-prefix-keybindings' is non-nil, the |
;; If `idlwave-shell-activate-prefix-keybindings' is non-nil, the |
3981 |
;; first key in the list gets bound the C-c C-d prefix map. If |
;; first key in the list gets bound the C-c C-d prefix map. If |
3984 |
;; `idlwave-mode-map' and `idlwave-shell-mode-map'. The next list |
;; `idlwave-mode-map' and `idlwave-shell-mode-map'. The next list |
3985 |
;; item, if non-nil, means to bind this as a single key in the |
;; item, if non-nil, means to bind this as a single key in the |
3986 |
;; electric-debug-mode-map. |
;; electric-debug-mode-map. |
3987 |
;; |
;; |
3988 |
;; [C-c C-d]-binding debug-modifier-key command bind-electric-debug buf-only |
;; [C-c C-d]-binding debug-modifier-key command bind-electric-debug buf-only |
3989 |
;; Used keys: abcdef hijklmnopqrstuvwxyz |
;; Used keys: abcdef hijklmnopqrstuvwxyz |
3990 |
;; Unused keys: g |
;; Unused keys: g |
3991 |
(let* ((specs |
(let* ((specs |
3992 |
'(([(control ?b)] ?b idlwave-shell-break-here t t) |
'(([(control ?b)] ?b idlwave-shell-break-here t t) |
3993 |
([(control ?i)] ?i idlwave-shell-break-in t t) |
([(control ?i)] ?i idlwave-shell-break-in t t) |
4037 |
electric (nth 3 s) |
electric (nth 3 s) |
4038 |
only-buffer (nth 4 s) |
only-buffer (nth 4 s) |
4039 |
cannotshift (and shift (char-valid-p c2) (eq c2 (upcase c2)))) |
cannotshift (and shift (char-valid-p c2) (eq c2 (upcase c2)))) |
4040 |
|
|
4041 |
;; The regular prefix keymap. |
;; The regular prefix keymap. |
4042 |
(when (and idlwave-shell-activate-prefix-keybindings k1) |
(when (and idlwave-shell-activate-prefix-keybindings k1) |
4043 |
(unless only-buffer |
(unless only-buffer |
4044 |
(define-key idlwave-shell-mode-prefix-map k1 cmd)) |
(define-key idlwave-shell-mode-prefix-map k1 cmd)) |
4045 |
(define-key idlwave-mode-prefix-map k1 cmd)) |
(define-key idlwave-mode-prefix-map k1 cmd)) |
4046 |
;; The debug modifier map |
;; The debug modifier map |
4054 |
(unless only-buffer (define-key idlwave-shell-mode-map k2 cmd)))) |
(unless only-buffer (define-key idlwave-shell-mode-map k2 cmd)))) |
4055 |
;; The electric debug single-keystroke map |
;; The electric debug single-keystroke map |
4056 |
(if (and electric (char-or-string-p c2)) |
(if (and electric (char-or-string-p c2)) |
4057 |
(define-key idlwave-shell-electric-debug-mode-map (char-to-string c2) |
(define-key idlwave-shell-electric-debug-mode-map (char-to-string c2) |
4058 |
cmd)))) |
cmd)))) |
4059 |
|
|
4060 |
;; A few extras in the electric debug map |
;; A few extras in the electric debug map |
4061 |
(define-key idlwave-shell-electric-debug-mode-map " " 'idlwave-shell-step) |
(define-key idlwave-shell-electric-debug-mode-map " " 'idlwave-shell-step) |
4062 |
(define-key idlwave-shell-electric-debug-mode-map "+" 'idlwave-shell-stack-up) |
(define-key idlwave-shell-electric-debug-mode-map "+" 'idlwave-shell-stack-up) |
4063 |
(define-key idlwave-shell-electric-debug-mode-map "=" 'idlwave-shell-stack-up) |
(define-key idlwave-shell-electric-debug-mode-map "=" 'idlwave-shell-stack-up) |
4064 |
(define-key idlwave-shell-electric-debug-mode-map "-" |
(define-key idlwave-shell-electric-debug-mode-map "-" |
4065 |
'idlwave-shell-stack-down) |
'idlwave-shell-stack-down) |
4066 |
(define-key idlwave-shell-electric-debug-mode-map "_" |
(define-key idlwave-shell-electric-debug-mode-map "_" |
4067 |
'idlwave-shell-stack-down) |
'idlwave-shell-stack-down) |
4068 |
(define-key idlwave-shell-electric-debug-mode-map "q" 'idlwave-shell-retall) |
(define-key idlwave-shell-electric-debug-mode-map "q" 'idlwave-shell-retall) |
4069 |
(define-key idlwave-shell-electric-debug-mode-map "t" |
(define-key idlwave-shell-electric-debug-mode-map "t" |
4070 |
'(lambda () (interactive) (idlwave-shell-send-command "help,/TRACE"))) |
'(lambda () (interactive) (idlwave-shell-send-command "help,/TRACE"))) |
4071 |
(define-key idlwave-shell-electric-debug-mode-map [(control ??)] |
(define-key idlwave-shell-electric-debug-mode-map [(control ??)] |
4072 |
'idlwave-shell-electric-debug-help) |
'idlwave-shell-electric-debug-help) |
4073 |
(define-key idlwave-shell-electric-debug-mode-map "x" |
(define-key idlwave-shell-electric-debug-mode-map "x" |
4074 |
'(lambda (arg) (interactive "P") |
'(lambda (arg) (interactive "P") |
4075 |
(idlwave-shell-print arg nil nil t))) |
(idlwave-shell-print arg nil nil t))) |
4076 |
|
|
4077 |
|
|
4092 |
(setq idlwave-shell-suppress-electric-debug nil)) |
(setq idlwave-shell-suppress-electric-debug nil)) |
4093 |
(idlwave-shell-electric-debug-mode)) |
(idlwave-shell-electric-debug-mode)) |
4094 |
|
|
4095 |
(defvar idlwave-shell-electric-debug-read-only) |
(defvar idlwave-shell-electric-debug-read-only) |
4096 |
(defvar idlwave-shell-electric-debug-buffers nil) |
(defvar idlwave-shell-electric-debug-buffers nil) |
4097 |
|
|
4098 |
(easy-mmode-define-minor-mode idlwave-shell-electric-debug-mode |
(easy-mmode-define-minor-mode idlwave-shell-electric-debug-mode |
4099 |
"Toggle Electric Debug mode. |
"Toggle Electric Debug mode. |
4100 |
With no argument, this command toggles the mode. |
With no argument, this command toggles the mode. |
4101 |
Non-null prefix argument turns on the mode. |
Non-null prefix argument turns on the mode. |
4102 |
Null prefix argument turns off the mode. |
Null prefix argument turns off the mode. |
4103 |
|
|
4107 |
" *Debugging*" |
" *Debugging*" |
4108 |
idlwave-shell-electric-debug-mode-map) |
idlwave-shell-electric-debug-mode-map) |
4109 |
|
|
4110 |
(add-hook |
(add-hook |
4111 |
'idlwave-shell-electric-debug-mode-on-hook |
'idlwave-shell-electric-debug-mode-on-hook |
4112 |
(lambda () |
(lambda () |
4113 |
(set (make-local-variable 'idlwave-shell-electric-debug-read-only) |
(set (make-local-variable 'idlwave-shell-electric-debug-read-only) |
4115 |
(setq buffer-read-only t) |
(setq buffer-read-only t) |
4116 |
(add-to-list 'idlwave-shell-electric-debug-buffers (current-buffer)) |
(add-to-list 'idlwave-shell-electric-debug-buffers (current-buffer)) |
4117 |
(if idlwave-shell-stop-line-overlay |
(if idlwave-shell-stop-line-overlay |
4118 |
(overlay-put idlwave-shell-stop-line-overlay 'face |
(overlay-put idlwave-shell-stop-line-overlay 'face |
4119 |
idlwave-shell-electric-stop-line-face)) |
idlwave-shell-electric-stop-line-face)) |
4120 |
(if (facep 'fringe) |
(if (facep 'fringe) |
4121 |
(set-face-foreground 'fringe idlwave-shell-electric-stop-color |
(set-face-foreground 'fringe idlwave-shell-electric-stop-color |
4122 |
(selected-frame))))) |
(selected-frame))))) |
4123 |
|
|
4124 |
(add-hook |
(add-hook |
4125 |
'idlwave-shell-electric-debug-mode-off-hook |
'idlwave-shell-electric-debug-mode-off-hook |
4126 |
(lambda () |
(lambda () |
4127 |
;; Return to previous read-only state |
;; Return to previous read-only state |
4130 |
(setq idlwave-shell-electric-debug-buffers |
(setq idlwave-shell-electric-debug-buffers |
4131 |
(delq (current-buffer) idlwave-shell-electric-debug-buffers)) |
(delq (current-buffer) idlwave-shell-electric-debug-buffers)) |
4132 |
(if idlwave-shell-stop-line-overlay |
(if idlwave-shell-stop-line-overlay |
4133 |
(overlay-put idlwave-shell-stop-line-overlay 'face |
(overlay-put idlwave-shell-stop-line-overlay 'face |
4134 |
idlwave-shell-stop-line-face) |
idlwave-shell-stop-line-face) |
4135 |
(if (facep 'fringe) |
(if (facep 'fringe) |
4136 |
(set-face-foreground 'fringe (face-foreground 'default)))))) |
(set-face-foreground 'fringe (face-foreground 'default)))))) |
4161 |
;; Show the help text |
;; Show the help text |
4162 |
(defun idlwave-shell-electric-debug-help () |
(defun idlwave-shell-electric-debug-help () |
4163 |
(interactive) |
(interactive) |
4164 |
(with-output-to-temp-buffer "*IDLWAVE Electric Debug Help*" |
(with-output-to-temp-buffer "*IDLWAVE Electric Debug Help*" |
4165 |
(princ idlwave-shell-electric-debug-help)) |
(princ idlwave-shell-electric-debug-help)) |
4166 |
(let* ((current-window (selected-window)) |
(let* ((current-window (selected-window)) |
4167 |
(window (get-buffer-window "*IDLWAVE Electric Debug Help*")) |
(window (get-buffer-window "*IDLWAVE Electric Debug Help*")) |
4176 |
`("Debug" |
`("Debug" |
4177 |
["Electric Debug Mode" |
["Electric Debug Mode" |
4178 |
idlwave-shell-electric-debug-mode |
idlwave-shell-electric-debug-mode |
4179 |
:style toggle :selected idlwave-shell-electric-debug-mode |
:style toggle :selected idlwave-shell-electric-debug-mode |
4180 |
:included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"] |
:included (eq major-mode 'idlwave-mode) :keys "C-c C-d C-v"] |
4181 |
"--" |
"--" |
4182 |
("Compile & Run" |
("Compile & Run" |
4192 |
"--" |
"--" |
4193 |
["Goto Next Error" idlwave-shell-goto-next-error t] |
["Goto Next Error" idlwave-shell-goto-next-error t] |
4194 |
"--" |
"--" |
4195 |
["Compile and Run Region" idlwave-shell-run-region |
["Compile and Run Region" idlwave-shell-run-region |
4196 |
(eq major-mode 'idlwave-mode)] |
(eq major-mode 'idlwave-mode)] |
4197 |
["Evaluate Region" idlwave-shell-evaluate-region |
["Evaluate Region" idlwave-shell-evaluate-region |
4198 |
(eq major-mode 'idlwave-mode)] |
(eq major-mode 'idlwave-mode)] |
4199 |
"--" |
"--" |
4200 |
["Execute Default Cmd" idlwave-shell-execute-default-command-line t] |
["Execute Default Cmd" idlwave-shell-execute-default-command-line t] |
4201 |
["Edit Default Cmd" idlwave-shell-edit-default-command-line t]) |
["Edit Default Cmd" idlwave-shell-edit-default-command-line t]) |
4202 |
("Breakpoints" |
("Breakpoints" |
4203 |
["Set Breakpoint" idlwave-shell-break-here |
["Set Breakpoint" idlwave-shell-break-here |
4204 |
:keys "C-c C-d C-c" :active (eq major-mode 'idlwave-mode)] |
:keys "C-c C-d C-c" :active (eq major-mode 'idlwave-mode)] |
4205 |
("Set Special Breakpoint" |
("Set Special Breakpoint" |
4206 |
["Set After Count Breakpoint" |
["Set After Count Breakpoint" |
4207 |
(progn |
(progn |
4208 |
(let ((count (string-to-int (read-string "Break after count: ")))) |
(let ((count (string-to-number (read-string "Break after count: ")))) |
4209 |
(if (integerp count) (idlwave-shell-break-here count)))) |
(if (integerp count) (idlwave-shell-break-here count)))) |
4210 |
:active (eq major-mode 'idlwave-mode)] |
:active (eq major-mode 'idlwave-mode)] |
4211 |
["Set Condition Breakpoint" |
["Set Condition Breakpoint" |
4212 |
(idlwave-shell-break-here '(4)) |
(idlwave-shell-break-here '(4)) |
4213 |
:active (eq major-mode 'idlwave-mode)]) |
:active (eq major-mode 'idlwave-mode)]) |
4214 |
["Break in Module" idlwave-shell-break-in |
["Break in Module" idlwave-shell-break-in |
4215 |
:keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)] |
:keys "C-c C-d C-i" :active (eq major-mode 'idlwave-mode)] |
4216 |
["Break in this Module" idlwave-shell-break-this-module |
["Break in this Module" idlwave-shell-break-this-module |
4217 |
:keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)] |
:keys "C-c C-d C-j" :active (eq major-mode 'idlwave-mode)] |
4218 |
["Clear Breakpoint" idlwave-shell-clear-current-bp t] |
["Clear Breakpoint" idlwave-shell-clear-current-bp t] |
4219 |
["Clear All Breakpoints" idlwave-shell-clear-all-bp t] |
["Clear All Breakpoints" idlwave-shell-clear-all-bp t] |
4220 |
["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t] |
["Disable/Enable Breakpoint" idlwave-shell-toggle-enable-current-bp t] |
4221 |
["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp |
["Goto Previous Breakpoint" idlwave-shell-goto-previous-bp |
4222 |
:keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)] |
:keys "C-c C-d [" :active (eq major-mode 'idlwave-mode)] |
4223 |
["Goto Next Breakpoint" idlwave-shell-goto-next-bp |
["Goto Next Breakpoint" idlwave-shell-goto-next-bp |
4224 |
:keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)] |
:keys "C-c C-d ]" :active (eq major-mode 'idlwave-mode)] |
4225 |
["List All Breakpoints" idlwave-shell-list-all-bp t] |
["List All Breakpoints" idlwave-shell-list-all-bp t] |
4226 |
["Resync Breakpoints" idlwave-shell-bp-query t]) |
["Resync Breakpoints" idlwave-shell-bp-query t]) |
4252 |
["Redisplay and Sync" idlwave-shell-redisplay t]) |
["Redisplay and Sync" idlwave-shell-redisplay t]) |
4253 |
("Show Commands" |
("Show Commands" |
4254 |
["Everything" (if (eq idlwave-shell-show-commands 'everything) |
["Everything" (if (eq idlwave-shell-show-commands 'everything) |
4255 |
(progn |
(progn |
4256 |
(setq idlwave-shell-show-commands |
(setq idlwave-shell-show-commands |
4257 |
(get 'idlwave-shell-show-commands 'last-val)) |
(get 'idlwave-shell-show-commands 'last-val)) |
4258 |
(put 'idlwave-shell-show-commands 'last-val nil)) |
(put 'idlwave-shell-show-commands 'last-val nil)) |
4259 |
(put 'idlwave-shell-show-commands 'last-val |
(put 'idlwave-shell-show-commands 'last-val |
4260 |
idlwave-shell-show-commands) |
idlwave-shell-show-commands) |
4261 |
(setq idlwave-shell-show-commands 'everything)) |
(setq idlwave-shell-show-commands 'everything)) |
4262 |
:style toggle :selected (and (not (listp idlwave-shell-show-commands)) |
:style toggle :selected (and (not (listp idlwave-shell-show-commands)) |
4263 |
(eq idlwave-shell-show-commands |
(eq idlwave-shell-show-commands |
4264 |
'everything))] |
'everything))] |
4265 |
"--" |
"--" |
4266 |
["Compiling Commands" (idlwave-shell-add-or-remove-show 'run) |
["Compiling Commands" (idlwave-shell-add-or-remove-show 'run) |
4267 |
:style toggle |
:style toggle |
4268 |
:selected (not (idlwave-shell-hide-p |
:selected (not (idlwave-shell-hide-p |
4269 |
'run |
'run |
4270 |
(get 'idlwave-shell-show-commands 'last-val))) |
(get 'idlwave-shell-show-commands 'last-val))) |
4271 |
:active (not (eq idlwave-shell-show-commands 'everything))] |
:active (not (eq idlwave-shell-show-commands 'everything))] |
4272 |
["Breakpoint Commands" (idlwave-shell-add-or-remove-show 'breakpoint) |
["Breakpoint Commands" (idlwave-shell-add-or-remove-show 'breakpoint) |
4273 |
:style toggle |
:style toggle |
4274 |
:selected (not (idlwave-shell-hide-p |
:selected (not (idlwave-shell-hide-p |
4275 |
'breakpoint |
'breakpoint |
4276 |
(get 'idlwave-shell-show-commands 'last-val))) |
(get 'idlwave-shell-show-commands 'last-val))) |
4277 |
:active (not (eq idlwave-shell-show-commands 'everything))] |
:active (not (eq idlwave-shell-show-commands 'everything))] |
4278 |
["Debug Commands" (idlwave-shell-add-or-remove-show 'debug) |
["Debug Commands" (idlwave-shell-add-or-remove-show 'debug) |
4279 |
:style toggle |
:style toggle |
4280 |
:selected (not (idlwave-shell-hide-p |
:selected (not (idlwave-shell-hide-p |
4281 |
'debug |
'debug |
4282 |
(get 'idlwave-shell-show-commands 'last-val))) |
(get 'idlwave-shell-show-commands 'last-val))) |
4283 |
:active (not (eq idlwave-shell-show-commands 'everything))] |
:active (not (eq idlwave-shell-show-commands 'everything))] |
4284 |
["Miscellaneous Commands" (idlwave-shell-add-or-remove-show 'misc) |
["Miscellaneous Commands" (idlwave-shell-add-or-remove-show 'misc) |
4285 |
:style toggle |
:style toggle |
4286 |
:selected (not (idlwave-shell-hide-p |
:selected (not (idlwave-shell-hide-p |
4287 |
'misc |
'misc |
4288 |
(get 'idlwave-shell-show-commands 'last-val))) |
(get 'idlwave-shell-show-commands 'last-val))) |
4289 |
:active (not (eq idlwave-shell-show-commands 'everything))]) |
:active (not (eq idlwave-shell-show-commands 'everything))]) |
4297 |
:style toggle :selected idlwave-shell-use-input-mode-magic]) |
:style toggle :selected idlwave-shell-use-input-mode-magic]) |
4298 |
"--" |
"--" |
4299 |
["Update Working Dir" idlwave-shell-resync-dirs t] |
["Update Working Dir" idlwave-shell-resync-dirs t] |
4300 |
["Save Path Info" |
["Save Path Info" |
4301 |
(idlwave-shell-send-command idlwave-shell-path-query |
(idlwave-shell-send-command idlwave-shell-path-query |
4302 |
'idlwave-shell-get-path-info |
'idlwave-shell-get-path-info |
4303 |
'hide) |
'hide) |
4309 |
|
|
4310 |
(if (or (featurep 'easymenu) (load "easymenu" t)) |
(if (or (featurep 'easymenu) (load "easymenu" t)) |
4311 |
(progn |
(progn |
4312 |
(easy-menu-define |
(easy-menu-define |
4313 |
idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus" |
idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus" |
4314 |
idlwave-shell-menu-def) |
idlwave-shell-menu-def) |
4315 |
(easy-menu-define |
(easy-menu-define |
4329 |
(defvar idlwave-shell-bp-glyph nil |
(defvar idlwave-shell-bp-glyph nil |
4330 |
"The glyphs to mark breakpoint lines in the source code.") |
"The glyphs to mark breakpoint lines in the source code.") |
4331 |
|
|
4332 |
(let ((image-alist |
(let ((image-alist |
4333 |
'((bp . "/* XPM */ |
'((bp . "/* XPM */ |
4334 |
static char * file[] = { |
static char * file[] = { |
4335 |
\"14 12 3 1\", |
\"14 12 3 1\", |
4462 |
\" .XXXX. \", |
\" .XXXX. \", |
4463 |
\" .... \", |
\" .... \", |
4464 |
\" \"};"))) im-cons im) |
\" \"};"))) im-cons im) |
4465 |
|
|
4466 |
(while (setq im-cons (pop image-alist)) |
(while (setq im-cons (pop image-alist)) |
4467 |
(setq im (cond ((and (featurep 'xemacs) |
(setq im (cond ((and (featurep 'xemacs) |
4468 |
(featurep 'xpm)) |
(featurep 'xpm)) |
4475 |
((and (not (featurep 'xemacs)) |
((and (not (featurep 'xemacs)) |
4476 |
(fboundp 'image-type-available-p) |
(fboundp 'image-type-available-p) |
4477 |
(image-type-available-p 'xpm)) |
(image-type-available-p 'xpm)) |
4478 |
(list 'image :type 'xpm :data (cdr im-cons) |
(list 'image :type 'xpm :data (cdr im-cons) |
4479 |
:ascent 'center)) |
:ascent 'center)) |
4480 |
(t nil))) |
(t nil))) |
4481 |
(if im (push (cons (car im-cons) im) idlwave-shell-bp-glyph)))) |
(if im (push (cons (car im-cons) im) idlwave-shell-bp-glyph)))) |
4485 |
|
|
4486 |
;;; Load the toolbar when wanted by the user. |
;;; Load the toolbar when wanted by the user. |
4487 |
|
|
4488 |
(autoload 'idlwave-toolbar-toggle "idlw-toolbar" |
(autoload 'idlwave-toolbar-toggle "idlw-toolbar" |
4489 |
"Toggle the IDLWAVE toolbar") |
"Toggle the IDLWAVE toolbar") |
4490 |
(autoload 'idlwave-toolbar-add-everywhere "idlw-toolbar" |
(autoload 'idlwave-toolbar-add-everywhere "idlw-toolbar" |
4491 |
"Add IDLWAVE toolbar") |
"Add IDLWAVE toolbar") |