source: git/emacs/.emacs-singular @ ab733d

fieker-DuValspielwiese
Last change on this file since ab733d was c2f709, checked in by Tim Wichmann <wichmann@…>, 25 years ago
1999-09-08 T. Wichmann <wichmann@arboretum.itwm.uni-kl.de> * .emacs-singular Singular start menu for XEmacs appears now in every buffer git-svn-id: file:///usr/local/Singular/svn/trunk@3597 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 6.2 KB
Line 
1;;; Emacs edit mode for this file is  -*- Emacs-Lisp -*-
2;;; $Id: .emacs-singular,v 1.4 1999-09-08 18:21:58 wichmann Exp $
3
4;;;
5;;; .emacs-singular - Emacs initialization file to use for
6;;;                   Singular interactive mode.
7;;;
8;;; How you use this file very much depends on your attitude
9;;; towards Emacs:
10;;;
11;;; 1) If you are going to use Emacs solely as frontend to
12;;;    Singular you do not have to worry at all about this file.
13;;; 2) If you are already an experienced Emacs user you may
14;;;    want to copy this file's contents to your .emacs file.
15;;; 3) If you are planning to become an experienced Emacs user
16;;;    you may use this file as starting point for your .emacs
17;;;    file, that is, for your Emacs initialization file.  Simply
18;;;    copy it to your home directory and rename it to ".emacs"
19;;;    (without the quotes, of course).  Then edit it as
20;;;    described below.
21;;;
22;;; In cases 2) and 3) you should be careful what exactly to copy
23;;; to your .emacs file.  In general, you need the following:
24;;;
25;;; o the hook-customizations with `add-hook';
26;;; o the pre-customized settings with `custom-set-variables' and
27;;;   `custom-set-faces';
28;;; o the code which creates menus for starting Singular;
29;;; o the code which loads singular.el (located at the end of
30;;;   this file) you have to replace by something else, for
31;;;   example, an `autoload'.
32;;;
33;;; Here is how the Singular customization in your .emacs may
34;;; look like:
35;;;
36;;; ;; extra key bindings
37;;; (add-hook 'singular-interactive-mode-hook
38;;;            <... code omitted, see below for details ...>)
39;;;
40;;; ;; other, "non-customizable" settings
41;;; (add-hook 'singular-interactive-mode-hook
42;;;            <... code omitted, see below for details ...>)
43;;;
44;;; ;; pre-customized settings
45;;; (custom-set-variables
46;;;  <... code omitted, see below for details ...>)
47;;; (custom-set-faces
48;;;  <... code omitted, see below for details ...>)
49;;;
50;;; ;; add global menus for Singular
51;;; <... choose your version for either Emacs or XEmacs, see below ...>
52;;;
53;;; ;; add Singular toolbar for XEmacs
54;;; <... insert the code below if you are running XEmacs ...>
55;;;
56;;; ;; add Singular Emacs home directory to `load-path'
57;;; (setq load-path (cons "<your-singular-emacs-home-directory>" load-path))
58;;; (autoload 'singular "singular"
59;;;   "Start Singular using default values." t)
60;;; (autoload 'singular-other "singular"
61;;;   "Ask for arguments and start Singular." t)
62;;;
63
64;; extra key bindings
65(add-hook 'singular-interactive-mode-hook
66          (function (lambda ()
67                      ;; control cursor keys
68                      (cond
69                       ;; Emacs
70                       ((eq singular-emacs-flavor 'emacs)
71                        (local-set-key [C-prior] 'singular-scroll-right)
72                        (local-set-key [C-next] 'singular-scroll-left)
73                        (local-set-key [C-up] 'comint-previous-prompt)
74                        (local-set-key [C-down] 'comint-next-prompt))
75                       ;; XEmacs
76                       (t
77                        (local-set-key [(control prior)] 'singular-scroll-right)
78                        (local-set-key [(control next)] 'singular-scroll-left)
79                        (local-set-key [(control up)] 'comint-previous-prompt)
80                        (local-set-key [(control down)] 'comint-next-prompt))))))
81
82;; other, "non-customizable" settings
83(add-hook 'singular-interactive-mode-hook
84          (function (lambda () (font-lock-mode 1))))
85
86;; this is a work-around for early version of Font Lock mode
87;; which do not use `defface' to define faces.  It forces
88;; `custom-set-faces' to define the faces immediately.
89(make-face 'font-lock-comment-face)
90(make-face 'font-lock-string-face)
91
92;; tricky stuff: these customization settings are not used any
93;; longer as soon as user saved her own to ~/.emacs-singular-cust
94(setq custom-file "~/.emacs-singular-cust")
95(if (file-exists-p custom-file)
96    (load-file custom-file)
97
98;; pre-customized settings
99(custom-set-variables
100 '(font-lock-maximum-decoration nil t)
101 '(next-line-add-newlines nil)
102 '(paren-mode (quote paren) nil (paren))
103 '(show-paren-mode t nil (paren))
104 '(singular-help-same-window t)
105 '(transient-mark-mode t))
106(custom-set-faces
107 '(font-lock-comment-face ((t (:bold nil :foreground "Grey50"))) t)
108 '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
109 '(paren-match ((t (:foreground "Red"))) t)
110 '(show-paren-match-face ((((class color)) (:foreground "Red")))))
111
112)
113
114;; update singular-emacs-home-directory
115(setq singular-emacs-home-directory 
116      (concat singular-emacs-home-directory
117              ;; we check for trailing slash and backslash
118              ;; but unconditionally insert a slash.
119              ;; Hopefully that works on NT, too.
120              (if (memq (aref singular-emacs-home-directory
121                              (1- (length singular-emacs-home-directory)))
122                        '(?/ ?\\))
123                  "" "/")))
124
125;; add global menus for Singular, Emacs version
126(unless (fboundp 'add-submenu)
127  (setq singular-start-map (make-sparse-keymap))
128  (define-key singular-start-map [menu-bar singular]
129    (cons "Singular" (make-sparse-keymap "Singular")))
130  (define-key singular-start-map [menu-bar singular restart]
131    '("Start..." . singular-other))
132  (define-key singular-start-map [menu-bar singular start-default]
133    '("Start default" . singular))
134  (setq menu-bar-final-item (append '(singular) menu-bar-final-items))
135  (use-local-map singular-start-map))
136
137;; add global menus for Singular, XEmacs version
138(when (fboundp 'add-submenu)
139  (add-submenu nil 
140               '("Singular"
141                 ["Start default" singular t]
142                 ["Start..." singular-other t]))
143  (setq-default current-menubar current-menubar))
144
145;; add Singular button to toolbar for XEmacs
146(if (fboundp 'toolbar-add-item)
147    (toolbar-add-item 
148     (vector 
149      (toolbar-make-button-list (concat singular-emacs-home-directory 
150                                        "singular.xpm"))
151      'singular t "Start Singular")
152     (length (specifier-instance default-toolbar))))
153
154;;;
155;;; - load singular.el.
156;;;
157
158;; get rid of superfluous "Load .emacs" menu entry on XEmacs
159(when (fboundp 'delete-menu-item)
160  (delete-menu-item '("Load .emacs"))           ; that is for the current buffer
161  (let ((current-menubar (default-value 'current-menubar)))
162    (delete-menu-item '("Load .emacs"))         ; that is for all other buffers
163    (set-default 'current-menubar current-menubar)))
164
165;; load singular.el from `singular-emacs-home-directory'
166(load-file (concat singular-emacs-home-directory "singular.el"))
Note: See TracBrowser for help on using the repository browser.