Function: idlwave-shell-save-and-action

idlwave-shell-save-and-action is a byte-compiled function defined in idlw-shell.el.gz.

Signature

(idlwave-shell-save-and-action ACTION)

Documentation

Save file and compile it in IDL.

Runs save-buffer and sends a '.RUN' command for the associated file to IDL. When called from the shell buffer, re-compile the file which was last handled by this command.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/idlw-shell.el.gz
(defun idlwave-shell-save-and-action (action)
  "Save file and compile it in IDL.
Runs `save-buffer' and sends a '.RUN' command for the associated file to IDL.
When called from the shell buffer, re-compile the file which was last
handled by this command."
  ;; Remove the stop overlay.
  (if idlwave-shell-stop-line-overlay
      (delete-overlay idlwave-shell-stop-line-overlay))
  (if idlwave-shell-is-stopped
      (idlwave-shell-electric-debug-all-off))
  (setq idlwave-shell-is-stopped nil)
  (setq overlay-arrow-string nil)
  (let (buf)
    (cond
     ((derived-mode-p 'idlwave-mode)
      (save-buffer)
      (setq idlwave-shell-last-save-and-action-file (buffer-file-name)))
     (idlwave-shell-last-save-and-action-file
      (if (setq buf (find-buffer-visiting
		     idlwave-shell-last-save-and-action-file))
	  (with-current-buffer buf
	    (save-buffer))))
     (t (setq idlwave-shell-last-save-and-action-file
	      (read-file-name "File: ")))))
  (if (file-regular-p idlwave-shell-last-save-and-action-file)
      (progn
	(idlwave-shell-send-command
	 (concat (cond ((eq action 'run)     ".run ")
		       ((eq action 'compile) ".compile ")
		       ((eq action 'batch)   "@")
		       (t (error "Unknown action %s" action)))
		 "\""
		 idlwave-shell-last-save-and-action-file
		 "\"")
	 `(idlwave-shell-maybe-update-routine-info nil
	   ,idlwave-shell-last-save-and-action-file)
	 (if (idlwave-shell-hide-p 'run) 'mostly) nil t)
	(idlwave-shell-bp-query))
    (let ((msg (format "No such file %s"
		       idlwave-shell-last-save-and-action-file)))
      (setq idlwave-shell-last-save-and-action-file nil)
      (error msg))))