Changeset 99e62ad in git


Ignore:
Timestamp:
Aug 14, 1998, 8:57:23 AM (26 years ago)
Author:
Tim Wichmann <wichmann@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
c43e7bd9453af42df855704f07c6fe2ef772df1a
Parents:
39bc68d5d5208b0f0db79bc07072fed1944fad02
Message:
	* singular.el : commented code for singular-logo on startup in
	XEmacs. This code needs some rethinking...

	* singular.el (singular-toggle-truncate-lines): Added (recenter)
	according to function definition in XEmacs.
	(singular-other): Added check on unique buffer name.
	Added comments to functions and variables.


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

Legend:

Unmodified
Added
Removed
  • emacs/singular.el

    r39bc68d r99e62ad  
    11;;; singular.el --- Emacs support for Computer Algebra System Singular
    22
    3 ;; $Id: singular.el,v 1.25 1998-08-07 14:56:27 wichmann Exp $
     3;; $Id: singular.el,v 1.26 1998-08-14 06:57:23 wichmann Exp $
    44
    55;;; Commentary:
     
    174174;; Additional faces for font locking
    175175(make-face 'font-lock-singular-error-face)
     176
     177(defvar font-lock-singular-error-face 'font-lock-singular-error-face
     178  "Additional font-lock face for singular errors.")
     179
    176180(cond
    177181 ;; XEmacs
    178182 ((eq singular-emacs-flavor 'xemacs)
     183  ;; That 'append avoids to overwrite the face if it is already set
    179184  (set-face-foreground 'font-lock-singular-error-face "Red"
    180185                       'global nil 'append)))
    181 (defvar font-lock-singular-error-face 'font-lock-singular-error-face
    182   "NOT READY [docu]")
    183186
    184187(make-face 'font-lock-singular-warn-face)
     188
     189(defvar font-lock-singular-warn-face 'font-lock-singular-warn-face
     190  "Additional font-lock face for singular warnings.")
     191
    185192(cond
    186193 ;; XEmacs
    187194 ((eq singular-emacs-flavor 'xemacs)
     195  ;; That 'append avoids to overwrite the face if it is already set
    188196  (set-face-foreground 'font-lock-singular-warn-face "Orange"
    189197                       'global nil 'append)))
    190 (defvar font-lock-singular-warn-face 'font-lock-singular-warn-face
    191   "NOT READY [docu]")
    192198
    193199(make-face 'font-lock-singular-prompt-face)
     200
     201(defvar font-lock-singular-warn-face 'font-lock-singular-prompt-face
     202  "Addition font-lock face for the singular prompt.")
     203
    194204(cond
    195205 ;; XEmacs
    196206 ((eq singular-emacs-flavor 'xemacs)
     207  ;; That 'append avoids to overwrite the face if it is already set
    197208  (set-face-foreground 'font-lock-singular-prompt-face "Gray50"
    198209                       'global nil 'append)))
    199 (defvar font-lock-singular-warn-face 'font-lock-singular-prompt-face
    200   "NOT READY [docu]")
    201210;;}}}
    202211
     
    436445
    437446(defun singular-load-file (file &optional noexpand)
    438   "docu NOT READY"
     447  "Read a file in Singular (via '< \"FILE\";').
     448If optional argument NOEXPAND is nil, FILE is expanded using
     449`expand-file-name'."
    439450  (interactive "fLoad file: ")
    440451  (let* ((filename (if noexpand file (expand-file-name file)))
     
    445456
    446457(defun singular-load-library (file &optional noexpand)
    447   "docu NOT READY"
     458  "Read a Singular library (via 'LIB \"FILE\";').
     459If optional argument NOEXPAND is nil, FILE is expanded using
     460`expand-file-name'."
    448461  (interactive "fLoad Library: ")
    449462  (let* ((filename (if noexpand file (expand-file-name file)))
     
    454467
    455468(defun singular-exit-singular ()
    456   "NOT READY [docu]"
     469  "Exit Singular and kill Singular buffer.
     470Sends string \"quit;\" to Singular process."
    457471  (interactive)
    458472  (let ((string "quit;")
     
    462476  (kill-buffer (current-buffer)))
    463477
     478;; The function `singular-toggle-truncate-lines' is obsolete in XEmacs
     479;; but not in Emacs. So define it anyway.
    464480(defun singular-toggle-truncate-lines ()
    465481  "Toggle truncate-lines."
    466482  (interactive)
    467   (setq truncate-lines (not truncate-lines)))
     483  (setq truncate-lines (not truncate-lines))
     484  (recenter))
    468485;;}}}
    469486
     
    11971214
    11981215(defun singular-do-folding (where &optional unfold)
    1199   "NOT READY [docu]
    1200 WHERE= 'last or 'all --> just output sections
    1201 WHERE= 'at-point --> whatever is at point"
     1216  "Fold or unfold certain sections.
     1217WHERE may be 'last, 'all, or 'at-point. If WHERE equals 'last or
     1218'all, only output sections are affected. If WHERE equals 'at-point,
     1219the section at point is affected (input or output).
     1220If optional argument UNFOLD is non-nil, then unfold section instead
     1221of folding it."
    12021222  (let (which)
    12031223    (cond
    12041224     ((eq where 'last)
    12051225      (setq which (list (singular-latest-output-section t))))
     1226
    12061227     ((eq where 'at-point)
    12071228      (setq which (list (singular-section-at (point)))))
     1229
    12081230     ((eq where 'all)
    12091231      (setq which (singular-section-in (point-min) (point-max)))
     
    18661888  (setq major-mode 'singular-interactive-mode)
    18671889  (setq mode-name "Singular Interaction")
     1890
     1891  ;; key bindings, syntax tables and menus
    18681892  (use-local-map singular-interactive-mode-map)
    18691893  (set-syntax-table singular-interactive-mode-syntax-table)
     
    18731897    (easy-menu-add singular-interactive-mode-menu-1)
    18741898    (easy-menu-add singular-interactive-mode-menu-2)))
     1899
    18751900  (setq comment-start "// ")
    18761901  (setq comment-start-skip "// *")
     
    20182043            (singular-simple-sec-init (point))
    20192044
     2045            ;; NOT READY: SINGULAR-LOGO
     2046;           (cond
     2047;            ((eq singular-emacs-flavor 'xemacs)
     2048;             (set-extent-begin-glyph (make-extent (point-min) (point-min))
     2049;                                     singular-logo)
     2050;             (insert "\n")))
     2051
    20202052            ;; feed process with start file and read input ring.  Take
    20212053            ;; care about the undo information.
     
    20392071      (set-buffer old-buffer))))
    20402072
     2073;; NOT READY: SINGULAR-LOGO
     2074;(cond
     2075; ((eq singular-emacs-flavor 'xemacs)
     2076;  (defvar singular-logo (make-glyph))
     2077;  (set-glyph-image singular-logo
     2078;                  (concat "~/" "singlogo.xpm")
     2079;                  'global 'x)))
     2080
    20412081;; Note:
    20422082;;
     
    20852125          (setq buffer (get-buffer-create buffer-name))
    20862126          (set-buffer buffer)
     2127
    20872128          (singular-debug 'interactive (message "Calling `singular-interactive-mode'"))
    20882129          (singular-interactive-mode)))
     
    21032144
    21042145(defun singular-generate-new-buffer-name (name)
    2105   "NOT READY [docu]
    2106 name: should be without stars.
    2107 Try to create a buffer named *name*.
    2108 If fails, try to create buffer named *name<number>*
    2109 Return buffer name with stars at start/end"
    2110   (let ((new-name (singular-process-name-to-buffer-name name))
     2146  "Generate a unique buffer name for a singular interactive buffer.
     2147The string NAME is the desired name for the singular interactive
     2148buffer, without surrounding stars.
     2149The string returned is surrounded by stars.
     2150
     2151If no buffer with name \"*NAME*\" exists, return \"*NAME*\".
     2152Otherwise check for buffer called \"*NAME<n>*\" where n is a
     2153increasing number and return \"*NAME<n>*\" if no such buffer
     2154exists."
     2155  (let ((new-name (singular-process-name-to-buffer-name name))
    21112156        (count 2))
    21122157    (while (get-buffer new-name)
     
    21172162 
    21182163(defun singular-other (file)
    2119   "NOT READY [docu]"
     2164  "Start a new Singular, different to the default Singular.
     2165FILE is a Singular executable.
     2166
     2167Asks in the minibuffer for a buffer-name and for Singular options.
     2168Calls `singular' with the appropriate arguments."
    21202169  (interactive "fSingular executable: ")
    21212170  ;; NOT READY [code]
     
    21262175
    21272176    ;; Read buffer name from minibuffer at strip surrounding stars
    2128     (setq name (read-from-minibuffer "Singular buffer name: " name))
     2177    ;; NOT READY: This code is not very beautyful.
     2178    (let ((buffer-exists t)
     2179          (new-name name))
     2180      (while buffer-exists
     2181        (setq new-name (read-from-minibuffer "Singular buffer name: " name))
     2182        (if (get-buffer new-name)
     2183            (progn
     2184              (message "This buffer already exists.")
     2185              (sleep-for 1))
     2186          (setq buffer-exists nil)
     2187          (setq name new-name))))
     2188       
     2189   
    21292190    (if (string-match "^\\*\\(.*\\)\\*$" name)
    21302191        (setq name (substring name (match-beginning 1) (match-end 1))))
Note: See TracChangeset for help on using the changeset viewer.