Changeset 2690cd in git
- Timestamp:
- Aug 30, 1999, 10:05:14 PM (24 years ago)
- Branches:
- (u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
- Children:
- 81cc121c271bb464cdd71be4803ebdf5f91ccd03
- Parents:
- 3752f87abf8b5c7e453cc308ed8dbed9235a6d8a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
emacs/singular.el
r3752f8 r2690cd 1 1 ;;; singular.el --- Emacs support for Computer Algebra System Singular 2 2 3 ;; $Id: singular.el,v 1.3 7 1999-08-30 19:08:18wichmann Exp $3 ;; $Id: singular.el,v 1.38 1999-08-30 20:05:14 wichmann Exp $ 4 4 5 5 ;;; Commentary: … … 3706 3706 "History list of Singular switches.") 3707 3707 3708 (defvar singular-switches-magic '("- -emacs")3708 (defvar singular-switches-magic '("-t" "--emacs") 3709 3709 "Additional magic switches for Singular process. 3710 3710 List of switch-strings which are automagically added when new Singular 3711 processes are started. 3712 This list should at least contain the option \"--emacs\". If you are 3713 running an older version of Singular, remove this option from the list.") 3711 processes are started, one string for each command line argument. 3712 This list should at least contain the options \"--emacs\" and \"-t\". If 3713 you are running an older version of Singular, remove option \"--emacs\" 3714 from the list.") 3714 3715 3715 3716 (defcustom singular-name-default "singular" … … 3902 3903 3903 3904 (defun singular () 3904 "Start Singular using default values. 3905 Starts Singular using the values of `singular-executable-default', 3906 `singular-directory-default', `singular-switches-default', and 3907 `singular-name-default'." 3905 "Run an inferior Singular process using default arguments. 3906 Starts a Singular process, with I/O through an Emacs buffer, using the 3907 values of `singular-executable-default', `singular-directory-default', 3908 `singular-switches-default', and `singular-name-default'. 3909 3910 For more information on starting a Singular process and on the arguments 3911 see the documentation of `singular-other'. To restart a previously started 3912 Singular process use `singular-restart'. 3913 3914 Every time `singular' starts a new Singular process it runs the hooks 3915 on `singular-exec-hook'. 3916 3917 Type \\[describe-mode] in the Singular buffer for a list of commands." 3908 3918 (interactive) 3909 3919 (singular-internal singular-executable-default … … 3913 3923 3914 3924 (defun singular-restart () 3915 "Start Singular using the last values used. 3916 If called within a Singular buffer, uses the buffer local values last used 3917 in this buffer. 3918 If called outside a Singular buffer, uses the last values used by any 3919 Singular buffer. 3920 If no last values are available, uses the default values." 3925 "Run an inferior Singular process using the last arguments used. 3926 Starts a Singular process, with I/O through an Emacs buffer, using the 3927 previously used arguments. 3928 If called within a Singular buffer, uses the arguments of the most recent 3929 Singular process started in this buffer. 3930 If called outside a Singular buffer, uses the arguments of the most recent 3931 Singular process started in any Singular buffer. 3932 If no last values are available, uses the default values (see documentation 3933 of `singular'). 3934 3935 For more information on starting a Singular process and on the arguments 3936 see the documentation of `singular-other'. 3937 3938 Every time `singular-restarts' starts a new Singular process it runs the 3939 hooks on `singular-exec-hook'. 3940 3941 Type \\[describe-mode] in the Singular buffer for a list of commands." 3921 3942 (interactive) 3922 3943 (singular-internal singular-executable-last … … 3926 3947 3927 3948 (defun singular-other () 3928 "Ask for arguments and start Singular. 3929 Interactively asks values for the executable, the default directory, the 3930 buffer name and the command line switches, and starts Singular." 3931 (interactive) 3932 (let* ((executable (read-file-name "Singular executable: ")) 3949 "Run an inferior Singular process. 3950 Starts a Singular process, with I/O through an Emacs buffer. 3951 3952 If called interactively, the user is asked in the minibuffer area for an 3953 existing executable (with or without path), an exisiting directory or nil 3954 (if non-nil, sets the buffers default directory to this directory), the 3955 complete command line arguments to be passed to Singular (as a single 3956 string) and the buffer name of the singular buffer, which is surrounded by 3957 \"*\", if not already. (The process name of the singular process is then 3958 given by the buffer name with the surrounding stars stripped.) 3959 3960 If called non-interactiveley, EXECUTABLE is the name of an existing 3961 Singular executable (with or without path), DIRECTORY is the name of an 3962 existing directory or nil. If non-nil, sets the buffers default directory 3963 to DIRECTORY. SWITCHES is a list of strings where each string contains one 3964 command line argument which is passed to Singular, and NAME is the process 3965 name of the Singular process (that is, the singular buffer name is given by 3966 NAME surrounded by \"*\"). 3967 3968 If buffer exists but Singular is not running, starts new Singular. 3969 If buffer exists and Singular is running, just switches to buffer. 3970 If a file `~/.emacs_singularrc' exists, it is given as initial input. 3971 Note that this may lose due to a timing error if Singular discards 3972 input when it starts up. 3973 3974 If a new buffer is created it is put in Singular interactive mode, 3975 giving commands for sending input and handling output of Singular. See 3976 `singular-interactive-mode'. 3977 3978 Every time `singular-other' starts a new Singular process it runs the hooks 3979 on `singular-exec-hook'. 3980 3981 Type \\[describe-mode] in the Singular buffer for a list of commands." 3982 (interactive 3983 (let* ((exec (read-file-name "Singular executable: ")) 3933 3984 ;; Remark: Do NOT call `expand-file-name' after the 3934 3985 ;; above read-file-name! It has to be possible to enter a command … … 3936 3987 ;; `start-process' is intelligent enough to start commands with 3937 3988 ;; not-expanded name. 3938 (directory (file-name-directory (read-file-name "Default directory: " 3939 nil 3940 (or singular-directory-default 3941 default-directory) 3942 t))) 3943 (switches "") 3944 (name (singular-generate-new-buffer-name 3945 (downcase (file-name-nondirectory executable))))) 3946 3947 ;; Get command line arguments and append magic switches 3948 ;; TODO: Think about default value: Up to now: 3949 ;; Use singular-switches-default as init value for read-from-minibuffer 3950 (let ((switches-default singular-switches-default)) 3951 (while switches-default 3952 (setq switches (concat switches (car switches-default) " ")) 3953 (setq switches-default (cdr switches-default)))) 3954 ;; note: magic switches are appended by `singular-internal' 3955 (setq switches (split-string (read-from-minibuffer "Singular options: " 3956 switches nil nil 3957 singular-switches-history) 3958 " ")) 3959 3960 ;; Generate new buffer name 3961 (let (done) 3962 (while (not done) 3963 (setq name (read-from-minibuffer "Singular buffer name: " name)) 3964 (setq done (or (not (get-buffer name)) 3965 (y-or-n-p "Buffer exists. Switch to that buffer? "))))) 3966 (if (string-match "^\\*\\(.*\\)\\*$" name) 3967 (setq name (substring name (match-beginning 1) (match-end 1)))) 3968 3969 (singular-internal executable directory switches name))) 3989 (dir (file-name-directory (read-file-name "Default directory: " 3990 nil 3991 (or singular-directory-default 3992 default-directory) 3993 t))) 3994 (switch "") 3995 (bufname (singular-generate-new-buffer-name 3996 (downcase (file-name-nondirectory exec))))) 3997 3998 ;; Get command line arguments and append magic switches 3999 ;; TODO: Think about default value: Up to now: 4000 ;; Use singular-switches-default as init value for read-from-minibuffer 4001 (let ((switches-default singular-switches-default)) 4002 (while switches-default 4003 (setq switch (concat switch (car switches-default) " ")) 4004 (setq switches-default (cdr switches-default)))) 4005 ;; note: magic switches are appended by `singular-internal' 4006 (setq switch (split-string (read-from-minibuffer "Singular options: " 4007 switch nil nil 4008 singular-switches-history) 4009 " ")) 4010 4011 ;; Generate new buffer name 4012 (let (done) 4013 (while (not done) 4014 (setq bufname (read-from-minibuffer "Singular buffer name: " bufname)) 4015 (setq done (or (not (get-buffer bufname)) 4016 (y-or-n-p "Buffer exists. Switch to that buffer? "))))) 4017 (if (string-match "^\\*\\(.*\\)\\*$" bufname) 4018 (setq bufname (substring bufname (match-beginning 1) (match-end 1)))) 4019 (list exec dir switch bufname))) 4020 4021 (singular-internal executable directory switches name)) 3970 4022 3971 4023 (defun singular-exit-singular ()
Note: See TracChangeset
for help on using the changeset viewer.