Variable: idlwave-shell-input-mode-spells

idlwave-shell-input-mode-spells is a customizable variable defined in idlw-shell.el.gz.

Value

("^<onechar>$" "^<chars>$" "^</chars>$")

Documentation

The three regular expressions which match the magic spells for input modes.

When the first regexp matches in the output stream of IDL, IDLWAVE prompts for a single character and sends it immediately to IDL, similar to the command M-x idlwave-shell-send-char (idlwave-shell-send-char).

When the second regexp matches, IDLWAVE switches to a blocking single-character input mode. This is the same mode which can be entered manually with M-x idlwave-shell-char-mode-loop (idlwave-shell-char-mode-loop). This input mode exits when the third regexp matches in the output, or when the IDL prompt is encountered.

The variable idlwave-shell-use-input-mode-magic must be non-nil to enable scanning for these expressions. If the IDL program produces lots of output, shell operation may be slowed down.

This mechanism is useful for correct interaction with the IDL function GET_KBRD, because in normal operation IDLWAVE only sends \n terminated strings. Here is some example code which makes use of the default spells.

  print,'<chars>' ; Make IDLWAVE switch to character mode
  REPEAT BEGIN
      A = GET_KBRD(1)
      PRINT, BYTE(A)
  ENDREP UNTIL A EQ 'q'
  print,'</chars>' ; Make IDLWAVE switch back to line mode

  print,'Quit the program, y or n?'
  print,'<onechar>' ; Ask IDLWAVE to send one character
  answer = GET_KBRD(1)

Since the IDLWAVE shell defines the system variable !IDLWAVE_VERSION, you could actually check if you are running under Emacs before printing the magic strings. Here is a procedure which uses this.

Usage:
======
idlwave_char_input ; Make IDLWAVE send one character
idlwave_char_input,/on ; Start the loop to send characters
idlwave_char_input,/off ; End the loop to send characters


pro idlwave_char_input,on=on,off=off
  ;; Test if we are running under Emacs
  defsysv,'!idlwave_version',exists=running_emacs
  if running_emacs then begin
      if keyword_set(on) then print,'<chars>' $
        else if keyword_set(off) then print,'</chars>' $
        else print,'<onechar>'
  endif
end

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/idlw-shell.el.gz
(defcustom idlwave-shell-input-mode-spells
  '("^<onechar>$" "^<chars>$" "^</chars>$")
  "The three regular expressions which match the magic spells for input modes.

When the first regexp matches in the output stream of IDL, IDLWAVE
prompts for a single character and sends it immediately to IDL, similar
to the command \\[idlwave-shell-send-char].

When the second regexp matches, IDLWAVE switches to a blocking
single-character input mode.  This is the same mode which can be entered
manually with \\[idlwave-shell-char-mode-loop].
This input mode exits when the third regexp matches in the output,
or when the IDL prompt is encountered.

The variable `idlwave-shell-use-input-mode-magic' must be non-nil to enable
scanning for these expressions.  If the IDL program produces lots of
output, shell operation may be slowed down.

This mechanism is useful for correct interaction with the IDL function
GET_KBRD, because in normal operation IDLWAVE only sends \\n terminated
strings.  Here is some example code which makes use of the default spells.

  print,\\='<chars>\\='               ; Make IDLWAVE switch to character mode
  REPEAT BEGIN
      A = GET_KBRD(1)
      PRINT, BYTE(A)
  ENDREP UNTIL A EQ \\='q\\='
  print,\\='</chars>\\='              ; Make IDLWAVE switch back to line mode

  print,\\='Quit the program, y or n?\\='
  print,\\='<onechar>\\='             ; Ask IDLWAVE to send one character
  answer = GET_KBRD(1)

Since the IDLWAVE shell defines the system variable `!IDLWAVE_VERSION',
you could actually check if you are running under Emacs before printing
the magic strings.  Here is a procedure which uses this.

Usage:
======
idlwave_char_input               ; Make IDLWAVE send one character
idlwave_char_input,/on           ; Start the loop to send characters
idlwave_char_input,/off          ; End the loop to send characters


pro idlwave_char_input,on=on,off=off
  ;; Test if we are running under Emacs
  defsysv,\\='!idlwave_version\\=',exists=running_emacs
  if running_emacs then begin
      if keyword_set(on) then         print,\\='<chars>\\=' $
        else if keyword_set(off) then print,\\='</chars>\\=' $
        else                          print,\\='<onechar>\\='
  endif
end"
  :group 'idlwave-shell-command-setup
  :type '(list
	  (regexp :tag "One-char  regexp")
	  (regexp :tag "Char-mode regexp")
	  (regexp :tag "Line-mode regexp")))