Changeset fffd22 in git
- Timestamp:
- Sep 14, 1999, 10:18:15 PM (24 years ago)
- Branches:
- (u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
- Children:
- f4d1acce2cd9b5408e6b0edc0aca9588c1c5c790
- Parents:
- 7a09cd16bcd25864b7fb6ebc116fc8cd4e26a25d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emacs/singular.el
r7a09cd1 rfffd22 1 1 ;;; singular.el --- Emacs support for Computer Algebra System Singular 2 2 3 ;; $Id: singular.el,v 1.4 0 1999-09-03 10:52:12wichmann Exp $3 ;; $Id: singular.el,v 1.41 1999-09-14 20:18:15 wichmann Exp $ 4 4 5 5 ;;; Commentary: … … 520 520 521 521 (define-key singular-interactive-mode-map [?\C-c ?\C-r] 'singular-restart) 522 (define-key singular-interactive-mode-map [ (control c) ($)] 'singular-exit-singular))522 (define-key singular-interactive-mode-map [?\C-c ?\$] 'singular-exit-singular)) 523 523 524 524 (defun singular-cursor-key-model-set (key-model) … … 706 706 ;;Xemacs 707 707 (t 708 (easy-menu-remove '("Singular")) 708 709 (easy-menu-remove '("Comint1")) ; XEmacs 20 709 710 (easy-menu-remove '("Comint2")) ; XEmacs 20 … … 1015 1016 1016 1017 (defun singular-load-library (nonstdlib &optional file) 1017 "Read a Singular library (via 'LIB \"FILE\";')." 1018 "Read a Singular library (via 'LIB \"FILE\";'). 1019 If called interactively asks for the name of a standard Singular 1020 library. If interactively called with a prefix argument asks for a file 1021 name of a Singular library." 1018 1022 (interactive "P") 1019 1023 (let ((string (or file … … 1082 1086 If `singular-history-explicit-file-name' is non-nil, uses that as file 1083 1087 name, otherwise tries environment variable `SINGULARHIST'. 1084 This function is called from `singular-exit-sentinel' every time a Singular 1085 process terminates regularly." 1088 This function is called either by `singular-exit-singular' or by 1089 `singular-exit-sentinel' every time a Singular process terminates 1090 regularly." 1086 1091 (singular-debug 'interactive (message "Writing input ring back")) 1087 1092 (let ((comint-input-ring-file-name (or singular-history-explicit-file-name … … 2523 2528 2524 2529 ;; get help file and topic 2525 (let ((help-topic (if (or (null help-topic) (string= help-topic "")) 2526 "Top" 2527 help-topic)) 2528 (help-file-name (or singular-help-explicit-file-name 2530 (let ((help-file-name (or singular-help-explicit-file-name 2529 2531 singular-help-file-name 2530 2532 (getenv "SINGULAR_INFO_FILE") 2531 singular-help-fall-back-file-name))) 2532 2533 ;; last not least, pop to Info buffer and jump to desired node 2533 singular-help-fall-back-file-name)) 2534 (help-topic (cond ((or (null help-topic) 2535 (string= help-topic "")) 2536 "Top") 2537 ;; try to get the real topic from the alist. 2538 ;; It's OK if the alist is empty. 2539 ((cdr (assoc help-topic 2540 singular-help-topics-alist))) 2541 (t help-topic))) 2542 (continue t)) 2543 2544 ;; pop to Info buffer 2534 2545 (singular-pop-to-buffer singular-help-same-window "*info*") 2535 2546 2536 ;; catch errors when jumping to node 2537 (condition-case signal 2538 (Info-find-node help-file-name help-topic) 2539 (error 2540 (let ((error-message (cadr signal))) 2541 (cond ((and (stringp error-message) 2542 (string-match "Info file .* does not exist" error-message)) 2543 (Info-directory)) 2544 ;; assume that node has not been found but file has 2545 (t 2546 (Info-find-node help-file-name "Top"))) 2547 2547 ;; test whether we are already in Singular's online manual 2548 (unless (and (boundp 'Info-current-file) 2549 (equal Info-current-file help-file-name)) 2550 ;; jump to Singular's top node 2551 (condition-case signal 2552 (Info-find-node help-file-name "Top") 2553 ;; in case of an error jump to info directory 2554 (error 2555 (Info-directory) 2548 2556 ;; if we have been called interactively we pass the error down, 2549 ;; otherwise we only print a message 2557 ;; otherwise we assumes that we have been called from a hook and 2558 ;; call `singular-error' 2550 2559 (if (interactive-p) 2551 2560 (signal (car signal) (cdr signal)) 2552 (singular-error "Error: %s" error-message))))))) 2561 (singular-error "Singular online manual %s not found" 2562 help-file-name)) 2563 ;; do not continue 2564 (setq continue nil)))) 2565 2566 (when continue 2567 ;; jump to desired node 2568 (condition-case signal 2569 (Info-goto-node help-topic) 2570 ;; in case of an error jump to Singular's top node 2571 (error 2572 (Info-goto-node "Top") 2573 ;; if we have been called interactively we pass the error down, 2574 ;; otherwise we assumes that we have been called from a hook and 2575 ;; call `singular-error' 2576 (if (interactive-p) 2577 (signal (car signal) (cdr signal)) 2578 (singular-error "Singular help topic %s not found" 2579 help-topic))))))) 2553 2580 2554 2581 (defun singular-help-init () … … 3766 3793 singular-name-default) 3767 3794 (set (make-local-variable 'singular-switches-last) 3768 singular-switches-default)) 3769 3770 (defun singular-exit-sentinel (process message) 3771 "Clean up after termination of Singular. 3795 singular-switches-default) 3796 (set (make-local-variable 'singular-exit-insert-killed-marker) 3797 nil) 3798 (set (make-local-variable 'singular-exit-cleanup-done) 3799 nil)) 3800 3801 (defvar singular-exit-insert-killed-marker nil 3802 "Switch indicating if text should be inserted on process finishing. 3803 If t, `singular-exit-sentinel' inserts a string at the process mark 3804 indicating that the Singular process was killed. 3805 3806 This variable is buffer-local.") 3807 3808 (defvar singular-exit-cleanup-done nil 3809 "Switch indicating if cleanup after Singular exit is already done. 3810 Initial value is nil. Is set to t by `singular-exit-cleanup' and to nil by 3811 `singular-exit-sentinel'. 3812 3813 This variable is buffer-local.") 3814 3815 (defun singular-exit-cleanup () 3816 "Clean up after termination of Singular. 3772 3817 Writes back input ring after regular termination of Singular if process 3773 3818 buffer is still alive, deinstalls the library menu und calls several other 3774 exit procedures." 3819 exit procedures. 3820 Assumes that the current buffer is a Singular buffer. 3821 Sets the variable `singular-exit-cleanup-done' to t. 3822 3823 This function is called by `singular-interrupt-singular' or by 3824 `singular-exit-sentinel'." 3825 (singular-debug 'interactive 3826 (message "exit-cleanup called")) 3827 (singular-demo-exit) 3828 (singular-scan-header-exit) 3829 (singular-menu-deinstall-libraries) 3830 (singular-history-write) 3831 (setq singular-exit-cleanup-done t)) 3832 3833 (defun singular-exit-sentinel (process message) 3834 "Clean up after termination of Singular. 3835 Calls `singular-exit-cleanup' if `singular-exit-cleanup-done' is nil. 3836 If `singular-exit-insert-killed-marker' is non-nil, inserts a string at the 3837 process mark indicating that the process was killed." 3775 3838 (save-excursion 3776 3839 (singular-debug 'interactive 3777 3840 (message "Sentinel: %s" (substring message 0 -1))) 3778 ;; exit demo mode if necessary 3779 (singular-demo-exit) 3780 (singular-scan-header-exit) 3781 (if (string-match "finished\\|exited" message) 3841 3842 (if (string-match "finished\\|exited\\|killed" message) 3782 3843 (let ((process-buffer (process-buffer process))) 3783 (if (and process-buffer 3784 (buffer-name process-buffer) 3785 (set-buffer process-buffer)) 3786 ;; write back history 3787 (progn 3788 (singular-menu-deinstall-libraries) 3789 (singular-history-write))))))) 3844 (when (and process-buffer 3845 (buffer-name process-buffer) 3846 (set-buffer process-buffer)) 3847 (when singular-exit-insert-killed-marker 3848 (goto-char (process-mark process)) 3849 (insert "// ** Singular process killed **\n") 3850 (setq singular-exit-insert-killed-marker nil)) 3851 (unless singular-exit-cleanup-done 3852 (singular-exit-cleanup))))) 3853 (setq singular-exit-cleanup-done nil))) 3854 3855 (defun singular-interrupt-singular () 3856 "Delete the Singular process running in the current buffer. 3857 Calls `singular-exit-cleanup' and deletes the Singular process." 3858 (let ((process (singular-process))) 3859 (singular-exit-cleanup) 3860 (setq singular-exit-insert-killed-marker t) 3861 (delete-process process))) 3790 3862 3791 3863 (defun singular-exec (buffer name executable start-file switches) … … 3951 4023 previously used arguments. 3952 4024 If called within a Singular buffer, uses the arguments of the most recent 3953 Singular process started in this buffer. 4025 Singular process started in this buffer. If there is a Singular process 4026 running in this buffer, it is deleted without warning! 3954 4027 If called outside a Singular buffer, uses the arguments of the most recent 3955 Singular process started in any Singular buffer. 4028 Singular process started in any Singular buffer (and does not delete any 4029 Singular process). 3956 4030 If no last values are available, uses the default values (see documentation 3957 4031 of `singular'). … … 3965 4039 Type \\[describe-mode] in the Singular buffer for a list of commands." 3966 4040 (interactive) 4041 4042 (let ((process (singular-process t))) 4043 (and (eq (get-buffer (singular-process-name-to-buffer-name 4044 singular-name-default)) 4045 (current-buffer)) 4046 process 4047 (singular-interrupt-singular))) 4048 3967 4049 (singular-internal singular-executable-last 3968 4050 singular-directory-last … … 4045 4127 (singular-internal executable directory switches name)) 4046 4128 4047 (defun singular-exit-singular () 4048 "Exit Singular and kill Singular buffer. 4049 Sends string \"quit;\" to Singular process." 4050 (interactive) 4051 (let ((string "quit;") 4052 (process (singular-process))) 4053 (singular-input-filter process string) 4054 (singular-send-string process string)) 4055 (kill-buffer (current-buffer))) 4129 (defun singular-exit-singular (&optional kill-singular-buffer) 4130 "Delete Singular process and kill Singular buffer. 4131 Deletes the buffers Singular process without warning and writes back the input 4132 history to file. 4133 If called with prefix argument, kills the Singular buffer." 4134 (interactive "P") 4135 (singular-debug 'interactive 4136 (message "exit singular called")) 4137 4138 (singular-interrupt-singular) 4139 (if kill-singular-buffer 4140 (kill-buffer (current-buffer)))) 4056 4141 ;;}}} 4057 4142 ;;}}}
Note: See TracChangeset
for help on using the changeset viewer.