Skip to content

Commit

Permalink
Added ability to execute and plot avl file
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudchamber committed Dec 30, 2010
1 parent a894da7 commit c959eea
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions drela-mode.el
Expand Up @@ -25,13 +25,20 @@
:type 'integer
:group 'avl)

(defcustom avl-executable-location "C:\\Progra~1\\Aero\\Avl\\bin\\avl.exe"
"Location of the avl executable"
:type 'string
:group 'avl)


(defvar avl-mode-map ()
"Keymap used in AVL mode.")
(if (null avl-mode-map)
(progn
(setq avl-mode-map (make-sparse-keymap))
(set-keymap-name avl-mode-map 'avl-mode-map)
(define-key avl-mode-map [(control p)] 'avl-plot-geometry)
(define-key avl-mode-map [(control e)] 'avl-execute)
(define-key avl-mode-map "\t" 'avl-indent-command)
(define-key avl-mode-map [(control return)] 'avl-insert-standard-comment)
(define-key avl-mode-map [(control shift return)] 'avl-uninsert-comment)
Expand Down Expand Up @@ -144,6 +151,48 @@
)


(defun avl-execute ()
(interactive)
(write-file (file-name-nondirectory (buffer-file-name)))
(if (get-buffer "AVL-RUN")
(kill-buffer "AVL-RUN"))
(shell-command (concat avl-executable-location
" "
(file-name-nondirectory (buffer-file-name))
" &")
"AVL-RUN")
(switch-to-buffer "AVL-RUN")
(delete-other-windows))


(defun avl-plot-geometry ()
(interactive)
(write-file (file-name-nondirectory (buffer-file-name)))
(if (get-buffer "AVL-RUN")
(kill-buffer "AVL-RUN"))
(shell-command (concat avl-executable-location
" "
(file-name-nondirectory (buffer-file-name))
" &")
"AVL-RUN")
(let ((old-buffer (current-buffer)))
(set-buffer "AVL-RUN")
(insert-string "oper")
(comint-send-input)
(insert-string "g")
(comint-send-input)
(insert-string "k")
(comint-send-input)
(insert-string " ")
(comint-send-input)
(insert-string " ")
(comint-send-input)
(insert-string "quit")
(comint-send-input)
(set-buffer old-buffer)
(delete-other-windows)))


(defun avl-uninsert-comment ()
"Removes the preceding full line comment"
(interactive)
Expand Down

0 comments on commit c959eea

Please sign in to comment.