Changeset fffd22 in git


Ignore:
Timestamp:
Sep 14, 1999, 10:18:15 PM (24 years ago)
Author:
Tim Wichmann <wichmann@…>
Branches:
(u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
Children:
f4d1acce2cd9b5408e6b0edc0aca9588c1c5c790
Parents:
7a09cd16bcd25864b7fb6ebc116fc8cd4e26a25d
Message:
1999-09-14  T. Wichmann  <wichmann@arboretum.itwm.uni-kl.de>

	* singular.el (singular-exit-singular): New strategy for the
	communication between `singular-exit-singular' and
	`singular-exit-sentinel'. Some new functions and variables
	introduced.
	(singular-restart): now deletes a running singular process
	(singular-exit-sentinel): On demand inserts a string indicating
	that the process was killed

1999-09-08  T. Wichmann  <wichmann@arboretum.itwm.uni-kl.de>

	* singular.el (singular-interactive-mode-menu-init): Also remove
	  "Singular"-start menu
	  (singular-interactive-mode-map): corrected key for
	  singular-exit-singular
	  (singular-help): added new version of Jens


git-svn-id: file:///usr/local/Singular/svn/trunk@3607 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • emacs/singular.el

    r7a09cd1 rfffd22  
    11;;; singular.el --- Emacs support for Computer Algebra System Singular
    22
    3 ;; $Id: singular.el,v 1.40 1999-09-03 10:52:12 wichmann Exp $
     3;; $Id: singular.el,v 1.41 1999-09-14 20:18:15 wichmann Exp $
    44
    55;;; Commentary:
     
    520520
    521521  (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))
    523523
    524524(defun singular-cursor-key-model-set (key-model)
     
    706706   ;;Xemacs
    707707   (t
     708    (easy-menu-remove '("Singular"))
    708709    (easy-menu-remove '("Comint1"))     ; XEmacs 20
    709710    (easy-menu-remove '("Comint2"))     ; XEmacs 20
     
    10151016
    10161017(defun singular-load-library (nonstdlib &optional file)
    1017   "Read a Singular library (via 'LIB \"FILE\";')."
     1018  "Read a Singular library (via 'LIB \"FILE\";').
     1019If called interactively asks for the name of a standard Singular
     1020library. If interactively called with a prefix argument asks for a file
     1021name of a Singular library."
    10181022  (interactive "P")
    10191023  (let ((string (or file
     
    10821086If `singular-history-explicit-file-name' is non-nil, uses that as file
    10831087name, otherwise tries environment variable `SINGULARHIST'.
    1084 This function is called from `singular-exit-sentinel' every time a Singular
    1085 process terminates regularly."
     1088This function is called either by `singular-exit-singular' or by
     1089`singular-exit-sentinel' every time a Singular process terminates
     1090regularly."
    10861091  (singular-debug 'interactive (message "Writing input ring back"))
    10871092  (let ((comint-input-ring-file-name (or singular-history-explicit-file-name
     
    25232528
    25242529  ;; 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
    25292531                            singular-help-file-name
    25302532                            (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
    25342545    (singular-pop-to-buffer singular-help-same-window "*info*")
    25352546
    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)
    25482556         ;; 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'
    25502559         (if (interactive-p)
    25512560             (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)))))))
    25532580
    25542581(defun singular-help-init ()
     
    37663793       singular-name-default)
    37673794  (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.
     3803If t, `singular-exit-sentinel' inserts a string at the process mark
     3804indicating that the Singular process was killed.
     3805
     3806This variable is buffer-local.")
     3807
     3808(defvar singular-exit-cleanup-done nil
     3809  "Switch indicating if cleanup after Singular exit is already done.
     3810Initial value is nil. Is set to t by `singular-exit-cleanup' and to nil by
     3811`singular-exit-sentinel'.
     3812
     3813This variable is buffer-local.")
     3814
     3815(defun singular-exit-cleanup ()
     3816  "Clean up after termination of Singular.
    37723817Writes back input ring after regular termination of Singular if process
    37733818buffer is still alive, deinstalls the library menu und calls several other
    3774 exit procedures."
     3819exit procedures.
     3820Assumes that the current buffer is a Singular buffer.
     3821Sets the variable `singular-exit-cleanup-done' to t.
     3822
     3823This 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.
     3835Calls `singular-exit-cleanup' if `singular-exit-cleanup-done' is nil.
     3836If `singular-exit-insert-killed-marker' is non-nil, inserts a string at the
     3837process mark indicating that the process was killed."
    37753838  (save-excursion
    37763839    (singular-debug 'interactive
    37773840                    (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)
    37823843        (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.
     3857Calls `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)))
    37903862
    37913863(defun singular-exec (buffer name executable start-file switches)
     
    39514023previously used arguments.
    39524024If called within a Singular buffer, uses the arguments of the most recent
    3953 Singular process started in this buffer.
     4025Singular process started in this buffer. If there is a Singular process
     4026running in this buffer, it is deleted without warning!
    39544027If called outside a Singular buffer, uses the arguments of the most recent
    3955 Singular process started in any Singular buffer.
     4028Singular process started in any Singular buffer (and does not delete any
     4029Singular process).
    39564030If no last values are available, uses the default values (see documentation
    39574031of `singular').
     
    39654039Type \\[describe-mode] in the Singular buffer for a list of commands."
    39664040  (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     
    39674049  (singular-internal singular-executable-last
    39684050                     singular-directory-last
     
    40454127  (singular-internal executable directory switches name))
    40464128
    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.
     4131Deletes the buffers Singular process without warning and writes back the input
     4132history to file.
     4133If 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))))
    40564141;;}}}
    40574142;;}}}
Note: See TracChangeset for help on using the changeset viewer.