Changeset a0cde2 in git for emacs/singular.el


Ignore:
Timestamp:
Jul 22, 1998, 12:37:46 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
5fcd96638c9cc6007c245fd9dbd9b0818cebc986
Parents:
cf34a0fc5bbcdd46cd586ff09badd3261d953574
Message:
	* singular.el (singular-interactive-mode): adds
	  `comint-truncate-buffer' to `comint-output-filter-functions'.
	  `singular-buffer-maximum-size' unmade buffer local.

	* singular.el (singular-interactive-mode): does not run
	  `comint-mode'.  Mode name changed to `"Singular Interactive".

	* singular.el (singular-debug): doc fix
	  (singular-debug): recognition of mode `all' added
	  (singular-interactive-mode): `singular-debug' unmade buffer
	  local

	* singular.el (singular-exit-sentinel): debug messages added

	* singular.el (singular-start-file): doc fix
	  (singular-default-executable, singular-default-name,
	  singular-default-switches): doc fix
	  (singular, singular-interactive-mode): doc fix
	  (singular-delimiter-argument-list, singular-input-ignoredups,
	  singular-buffer-maximum-size, singular-input-ring-size): doc fix


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

Legend:

Unmodified
Added
Removed
  • emacs/singular.el

    rcf34a0 ra0cde2  
    1010
    1111;;{{{ Code Common to Both Modes
     12;;{{{ Debugging Stuff
    1213(defvar singular-debug nil
    13   "*List of states to debug.
    14 Currently, only the state `interactive' is supported.
    15 
    16 This variable is buffer local.")
    17 
    18 (defmacro singular-debug (state form)
     14  "*List of modes to debug or `all' to debug all modes.
     15Currently, only the mode `interactive' is supported.")
     16
     17(defmacro singular-debug (mode form)
    1918  "Major debugging hook for singular.el.
    20 Evaluates FORM if and only if STATE is an element of
    21 `singular-debug'."
    22   `(if (memq ,state singular-debug) ,form))
     19Evaluates FORM if and only if `singular-debug' equals `all' or if MODE
     20is an element of `singular-debug'."
     21  `(if (or (eq singular-debug 'all)
     22           (memq ,mode singular-debug))
     23       ,form))
     24;;}}}
    2325;;}}}
    2426
     
    3436;;}}}
    3537
     38;;{{{ Miscellaneous
     39
     40;; Note:
     41;;
     42;; We assume a one-to-one correspondance between Singular buffers
     43;; and Singular processes.  We always have
     44;; (equal buffer-name (concat "*" process-name "*")).
     45
     46(defun singular-buffer-name-to-process-name (buffer-name)
     47  "Create the process name for BUFFER-NAME.
     48The process name is the buffer name with surrounding `*' stripped
     49off."
     50  (substring buffer-name 1 -1))
     51
     52(defun singular-process-name-to-buffer-name (process-name)
     53  "Create the buffer name for PROCESS-NAME.
     54The buffer name is the process name with surrounding `*'."
     55  (concat "*" process-name "*"))
     56;;}}}
     57 
    3658;;{{{ Customization Variables of comint
    3759(defvar singular-prompt-regexp "^> "
     
    4264(defvar singular-delimiter-argument-list '(?= ?\( ?\) ?, ?;)
    4365  "List of characters to recognize as separate arguments.
    44 This variable is used to initialize `comint-delimiter-argument-list'.")
     66This variable is used to initialize `comint-delimiter-argument-list'
     67when Singular interactive mode starts up.")
    4568
    4669(defvar singular-input-ignoredups t
    4770  "*If non-nil, don't add input matching the last on the input ring.
    48 This variable is used to initialize `comint-input-ignoredups'.")
     71This variable is used to initialize `comint-input-ignoredups' when
     72Singular interactive mode starts up.")
    4973
    5074(defvar singular-buffer-maximum-size 2048
    5175  "*The maximum size in lines for Singular buffers.
    52 This variable is used to initialize `comint-buffer-maximum-size'.
    53 
    54 This variable is buffer-local.")
     76This variable is used to initialize `comint-buffer-maximum-size' when
     77Singular interactive mode starts up.")
    5578
    5679(defvar singular-input-ring-size 64
    5780  "Size of input history ring.
    58 This variable is used to initialize `comint-input-ring-size'.")
    59 ;;}}}
    60 
    61 ;;{{{ Miscellaneous
    62 
    63 ;; Note:
    64 ;;
    65 ;; We assume a one-to-one correspondance between Singular buffers
    66 ;; and Singular processes.  We always have
    67 ;; (equal buffer-name (concat "*" process-name "*")).
    68 
    69 (defun singular-buffer-name-to-process-name (buffer-name)
    70   "Create the process name for BUFFER-NAME.
    71 The process name is the buffer name with surrounding `*' stripped
    72 off."
    73   (substring buffer-name 1 -1))
    74 
    75 (defun singular-process-name-to-buffer-name (process-name)
    76   "Create the buffer name for PROCESS-NAME.
    77 The buffer name is the process name with surrounding `*'."
    78   (concat "*" process-name "*"))
    79 ;;}}}
    80  
     81This variable is used to initialize `comint-input-ring-size' when
     82Singular interactive mode starts up.")
     83;;}}}
     84
     85;;{{{ Singular Interactive Mode
    8186(defun singular-interactive-mode ()
    8287  "Major mode for interacting with Singular.
    8388
    84 \\[comint-send-input] after the end of Singular's output sends the text from the
    85     end of process to the end of the current line.
    86 
    87 \\[comint-send-input] before end of Singular's output copies the current line minus
    88     the prompt to the end of the buffer and sends it
    89     \(\\[comint-copy-old-input] just copies the current line).
     89NOT READY [how to send input]!
    9090
    9191NOT READY [multiple Singulars]!
    9292
    93 Singular buffers are automatically limited in length \(by default,
    94 to 2048 lines).  This limit may be adjusted by setting
    95 `singular-buffer-maximum-size'.
     93Singular buffers are automatically limited in length \(by default, to
     942048 lines).  This limit may be adjusted by setting
     95`singular-buffer-maximum-size' before Singular interactive mode starts
     96up or by setting `comint-buffer-maximum-size' while Singular
     97interactive mode is running.
    9698
    9799NOT READY [much more to come.  See shell.el.]!"
    98100  (interactive)
    99   (comint-mode)
     101  ;; we do not run `comint-mode' because `make-comint' should
     102  ;; have run it already
     103  ;; (comint-mode)
    100104
    101105  ;; miscellaneous
    102106  (setq major-mode 'singular-interactive-mode)
    103   (setq mode-name "Singular")
     107  (setq mode-name "Singular Interactive")
    104108  (use-local-map singular-interactive-mode-map)
    105   (make-local-variable 'singular-debug)
    106109
    107110  ;; customize comint for Singular
     
    110113  (setq comint-input-ignoredups singular-input-ignoredups)
    111114  (make-local-variable 'comint-buffer-maximum-size)
    112   (make-local-variable 'singular-buffer-maximum-size)
    113115  (setq comint-buffer-maximum-size singular-buffer-maximum-size)
    114116  (setq comint-input-ring-size singular-input-ring-size)
     117  (or (memq 'comint-truncate-buffer comint-output-filter-functions)
     118      (setq comint-output-filter-functions
     119            (cons 'comint-truncate-buffer comint-output-filter-functions)))
    115120
    116121  ;; get name of history file (if any)
     
    128133(defvar singular-start-file "~/.emacs_singularrc"
    129134  "Name of start-up file to pass to Singular.
    130 If the file named by this variable exists it is given as
    131 initial input to any Singular process being started \(Note that
    132 this may lose due to a timing error if Singular discards input
    133 when it starts up.)")
     135If the file named by this variable exists it is given as initial input
     136to any Singular process being started.  Note that this may lose due to
     137a timing error if Singular discards input when it starts up.")
    134138
    135139(defvar singular-default-executable "Singular"
    136   "Default name of Singular executable.")
     140  "Default name of Singular executable.
     141Used by `singular' when new Singular processes are started.")
    137142
    138143(defvar singular-default-name "singular"
    139   "Default process name for Singular process.")
     144  "Default process name for Singular process.
     145Used by `singular' when new Singular processes are started.")
    140146
    141147(defvar singular-default-switches '("-t")
    142   "List of switches to pass to Singular processes on startup.")
     148  "Default switches for Singular processes.
     149Used by `singular' when new Singular processes are started.")
    143150
    144151(defun singular-exit-sentinel (process message)
    145152 "Clean up after termination of Singular.
    146 Writes back input ring after regular termination of Singular
    147 if process buffer is still alive."
     153Writes back input ring after regular termination of Singular if
     154process buffer is still alive."
    148155  (save-excursion
    149156    (singular-debug 'interactive
    150                     (message "Sentinel: %s" (substring message 0 -1)))
     157                    (message "Sentinel message: %s" (substring message 0 -1)))
    151158    (if (string-match "finished\\|exited" message)
    152159        (let ((process-buffer (process-buffer process)))
    153           (and process-buffer
    154                (buffer-name process-buffer)
    155                (set-buffer process-buffer)
    156                (comint-write-input-ring))))))
     160          (if (and process-buffer
     161                   (buffer-name process-buffer)
     162                   (set-buffer process-buffer))
     163              (progn
     164                (singular-debug 'interactive (message "Writing input ring back"))
     165                (comint-write-input-ring)))))))
    157166
    158167(defun singular (&optional singular-executable singular-name singular-switches)
    159168  "Run an inferior Singular process, with I/O through an Emacs buffer.
    160169
    161 NOT READY [arguments and interactive use]!
     170NOT READY [arguments, default values, and interactive use]!
    162171
    163172If buffer exists but Singular is not running, start new Singular.
    164173If buffer exists and Singular is running, just switch to buffer.
    165 If a file `~/.emacs_singularrc' exists, it is given as initial
    166 input \(Note that this may lose due to a timing error if Singular
    167 discards input when it starts up.)
    168 The buffer is put in Singular interactive mode, giving commands
    169 for sending input and handling ouput of Singular.  See
     174If a file `~/.emacs_singularrc' exists, it is given as initial input.
     175Note that this may lose due to a timing error if Singular discards
     176input when it starts up.
     177
     178The buffer is put in Singular interactive mode, giving commands for
     179sending input and handling ouput of Singular.  See
    170180`singular-interactive-mode'.
    171181
    172 \(Type \\[describe-mode] in the Singular buffer for a list of commands.)"
     182Type \\[describe-mode] in the Singular buffer for a list of commands."
     183  ;; handle interactive calls
    173184  (interactive (list singular-default-executable
    174185                     singular-default-name
    175186                     singular-default-switches))
    176   ;; make buffer name canonical
     187
    177188  (let* (;; get default values for optional arguments
    178189         (singular-executable (or singular-executable
     
    201212(defalias 'Singular 'singular)
    202213;;}}}
     214;;}}}
    203215
    204216(provide 'singular)
Note: See TracChangeset for help on using the changeset viewer.