=================================================================== RCS file: /home/cvs/OpenXM_contrib2/windows/post-msg-asirgui/asir-mode.el,v retrieving revision 1.10 retrieving revision 1.16 diff -u -p -r1.10 -r1.16 --- OpenXM_contrib2/windows/post-msg-asirgui/asir-mode.el 2013/11/27 04:40:25 1.10 +++ OpenXM_contrib2/windows/post-msg-asirgui/asir-mode.el 2021/03/14 23:21:21 1.16 @@ -2,12 +2,13 @@ ;; ;; asir-mode.el -- asir mode ;; +;; $OpenXM: OpenXM_contrib2/windows/post-msg-asirgui/asir-mode.el,v 1.15 2021/02/24 23:10:32 takayama Exp $ - ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. + ;; 1. Install ;; ;; **(for Windows) Write the following configuration to your .emacs file. @@ -30,11 +31,13 @@ ;; The following key binding can be used: ;; C-c s Asir starts up in another window. ;; C-c t Asir terminates. +;; C-c a Abort current calculation. ;; C-c l The current buffer is loaded to Asir as a file. ;; C-c r Selected region is loaded to Asir as a file. ;; C-c p Selected region is pasted to Asir. (require 'shell) +(require 'cl) ;;;; AsirGUI for Windows (defvar asir-exec-path '("~/Desktop/asir/bin" "c:/Program Files/asir/bin" "c:/Program Files (x64)/asir/bin" "c:/asir/bin") @@ -90,7 +93,7 @@ (shell (get-buffer-create asir-cmd-buffer-name))) (sleep-for 1) (goto-char (point-max)) - (insert "asir") + (insert "openxm asir") (comint-send-input) (select-frame current-frame)))))) @@ -149,6 +152,25 @@ (insert-buffer-substring buffer start end) (comint-send-input)))))) +(defun asir-abort () + "Abort calculation on asir" + (interactive) + (if (eq system-type 'windows-nt) + ;; for Windows + (let ((exec-path (asir-effective-exec-path))) + (start-process "asir-proc-cmdasir" nil "cmdasir" "--abort")) + ;; for UNIX + (save-excursion + (if (get-buffer asir-cmd-buffer-name) + (progn + (set-buffer asir-cmd-buffer-name) + (comint-kill-input) + (comint-interrupt-subjob) + (goto-char (point-max)) + (insert "t\ny") + (comint-send-input) + ))))) + ;;;; Extension for CC-mode. (require 'cc-mode) @@ -187,6 +209,7 @@ '("----" ["Start Asir" asir-start t] ["Terminate Asir" asir-terminate t] + ["Abort calcuration on Asir" asir-abort t] ["Execute Current Buffer on Asir" asir-execute-current-buffer (buffer-file-name)] ["Execute Region on Asir" asir-execute-region mark-active] ["Paste Region to Asir" asir-paste-region mark-active] @@ -225,6 +248,7 @@ Each list item should be a regexp matching a single id ;; Key binding for asir-mode (define-key asir-mode-map (kbd "C-c s") 'asir-start) (define-key asir-mode-map (kbd "C-c t") 'asir-terminate) +(define-key asir-mode-map (kbd "C-c a") 'asir-abort) (define-key asir-mode-map (kbd "C-c l") 'asir-execute-current-buffer) (define-key asir-mode-map (kbd "C-c r") 'asir-execute-region) (define-key asir-mode-map (kbd "C-c p") 'asir-paste-region) @@ -1229,7 +1253,7 @@ Key bindings: ((and (eq char-after-ip ?{) (progn (setq placeholder (c-inside-bracelist-p (point) - paren-state)) + paren-state nil)) (if placeholder (setq tmpsymbol '(brace-list-open . inexpr-class)) (setq tmpsymbol '(block-open . inexpr-statement) @@ -1352,7 +1376,7 @@ Key bindings: (save-excursion (goto-char containing-sexp) (c-looking-at-special-brace-list))) - (c-inside-bracelist-p containing-sexp paren-state)))) + (c-inside-bracelist-p containing-sexp paren-state t)))) (cond ;; CASE 9A: In the middle of a special brace list opener.