source: git/emacs/.emacs-singular @ 18daf9e

spielwiese
Last change on this file since 18daf9e was 18daf9e, checked in by Olaf Bachmann <obachman@…>, 24 years ago
* last touches befor alpha-release git-svn-id: file:///usr/local/Singular/svn/trunk@3981 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.8 KB
Line 
1;;; Emacs edit mode for this file is  -*- Emacs-Lisp -*-
2;;; $Id: .emacs-singular,v 1.9 1999-12-08 17:00:40 obachman 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 'font-lock-mode-hook 'lazy-lock-mode)
84(setq font-lock-support-mode 'lazy-lock-mode)
85
86(add-hook 'singular-interactive-mode-hook
87          (function (lambda () (font-lock-mode 1))))
88
89;; turn on c++-mode for files ending in ".sing" and ".lib"
90(setq auto-mode-alist (cons '("\\.sing\\'" . c++-mode) auto-mode-alist))
91(setq auto-mode-alist (cons '("\\.lib\\'" .  c++-mode) auto-mode-alist))
92(add-hook 'c++-mode-hook
93          (function (lambda () (font-lock-mode 1))))
94
95;; somewhat nicer scrolling
96(setq scroll-step 1)
97
98
99;; this is a work-around for early version of Font Lock mode
100;; which do not use `defface' to define faces.  It forces
101;; `custom-set-faces' to define the faces immediately.
102(make-face 'font-lock-comment-face)
103(make-face 'font-lock-string-face)
104
105; a handy function for customizing face of point
106(defun customize-face-at-point ()
107"Customize face which point is at"
108  (interactive)
109  (customize-face (get-text-property (point) 'face)))
110
111;; tricky stuff: these customization settings are not used any
112;; longer as soon as user saved her own to ~/.emacs-singular-cust
113(setq custom-file "~/.emacs-singular-cust")
114(if (file-exists-p custom-file)
115    (load-file custom-file)
116
117;; pre-customized settings
118(custom-set-variables
119 '(font-lock-maximum-decoration t t)
120 '(next-line-add-newlines nil)
121 '(paren-mode (quote paren) nil (paren))
122 '(show-paren-mode t nil (paren))
123 '(singular-help-same-window t)
124 '(singular-cursor-key-model (quote terminal))
125 '(transient-mark-mode t)
126 '(singular-section-face-alist (quote ((input . singular-section-input-face) (output)))))
127
128(custom-set-faces
129 '(show-paren-match-face ((((class color)) (:foreground "Red"))))
130 '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
131 '(font-lock-variable-name-face ((t (:foreground "black"))) t)
132 '(paren-match ((t (:foreground "Red"))) t)
133 '(singular-section-input-face ((t (:bold t))))
134 '(font-lock-keyword-face ((t (:bold t :foreground "violet"))) t)
135 '(singular-section-output-face ((t (:bold nil))))
136 '(font-lock-type-face ((t (:bold t :foreground "violet"))) t)
137 '(font-lock-comment-face ((t (:bold nil :foreground "Red"))) t)
138 '(font-lock-function-name-face ((t (:bold t :foreground "blue3"))) t))
139;; obachman: played around a little bit, found this better
140;;  '(singular-section-input-face ((t (:bold t))))
141;;  '(singular-section-output-face ((t (:bold nil))))
142;;  '(font-lock-comment-face ((t (:bold nil :foreground "Grey30"))) t)
143;;  '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
144;;  '(paren-match ((t (:foreground "Red"))) t)
145;;  '(show-paren-match-face ((((class color)) (:foreground "Red")))))
146
147)
148
149;; update singular-emacs-home-directory
150(setq singular-emacs-home-directory 
151      (concat singular-emacs-home-directory
152              ;; we check for trailing slash and backslash
153              ;; but unconditionally insert a slash.
154              ;; Hopefully that works on NT, too.
155              (if (memq (aref singular-emacs-home-directory
156                              (1- (length singular-emacs-home-directory)))
157                        '(?/ ?\\))
158                  "" "/")))
159
160;; add global menus for Singular, Emacs version
161(unless (fboundp 'add-submenu)
162  (setq singular-start-map (make-sparse-keymap))
163  (define-key singular-start-map [menu-bar singular]
164    (cons "Singular" (make-sparse-keymap "Singular")))
165  (define-key singular-start-map [menu-bar singular restart]
166    '("Start..." . singular-other))
167  (define-key singular-start-map [menu-bar singular start-default]
168    '("Start default" . singular))
169  (setq menu-bar-final-item (append '(singular) menu-bar-final-items))
170  (use-local-map singular-start-map))
171
172;; add global menus for Singular, XEmacs version
173(when (fboundp 'add-submenu)
174  (add-submenu nil 
175               '("Singular"
176                 ["Start default" singular t]
177                 ["Start..." singular-other t]))
178  (setq-default current-menubar current-menubar))
179
180;; add Singular button to toolbar for XEmacs
181(if (fboundp 'toolbar-add-item)
182    (toolbar-add-item 
183     (vector 
184      (toolbar-make-button-list (concat singular-emacs-home-directory 
185                                        "singular.xpm"))
186      'singular t "Start Singular")
187     (length (specifier-instance default-toolbar))))
188
189;;;
190;;; - load singular.el.
191;;;
192
193;; get rid of superfluous "Load .emacs" menu entry on XEmacs
194(when (fboundp 'delete-menu-item)
195  (delete-menu-item '("Load .emacs"))           ; that is for the current buffer
196  (let ((current-menubar (default-value 'current-menubar)))
197    (delete-menu-item '("Load .emacs"))         ; that is for all other buffers
198    (set-default 'current-menubar current-menubar)))
199
200;; load singular.el from `singular-emacs-home-directory'
201(load-file (concat singular-emacs-home-directory "singular.el"))
Note: See TracBrowser for help on using the repository browser.