source: git/emacs/.emacs-singular @ 57592b3

spielwiese
Last change on this file since 57592b3 was 341696, checked in by Hans Schönemann <hannes@…>, 15 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.1 KB
Line 
1;;; Emacs edit mode for this file is  -*- Emacs-Lisp -*-
2;;; $Id$
3
4;;;
5;;; .emacs-singular - Emacs initialization file to use for
6;;;                   Singular interactive mode.
7;;;
8;;; If you run ESingular, then this file is loaded instead of the
9;;; default ~/.emacs initialization file.
10;;;
11;;; How you use this file very much depends on your attitude
12;;; towards Emacs:
13;;;
14;;; 1) If you are going to use Emacs solely as frontend to
15;;;    Singular you do not have to worry at all about this file.
16;;; 2) If you are already an experienced Emacs user you may
17;;;    want to copy this file's contents to your .emacs file.
18;;; 3) If you are planning to become an experienced Emacs user
19;;;    you may use this file as starting point for your .emacs
20;;;    file, that is, for your Emacs initialization file.  Simply
21;;;    copy it to your home directory and rename it to ".emacs"
22;;;    (without the quotes, of course).  Then edit it as
23;;;    described below.
24;;;
25;;; In cases 2) and 3) you should be careful what exactly to copy
26;;; to your .emacs file.  In general, you need the following:
27;;;
28;;; o the hook-customizations with `add-hook';
29;;; o the pre-customized settings with `custom-set-variables' and
30;;;   `custom-set-faces';
31;;; o the code which creates menus for starting Singular;
32;;; o the code which loads singular.el (located at the end of
33;;;   this file) you have to replace by something else, for
34;;;   example, an `autoload'.
35;;; o the code which is in .emacs-general
36;;;
37;;; Here is how the Singular customization in your .emacs may
38;;; look like:
39;;;
40;;; ;; extra key bindings
41;;; (add-hook 'singular-interactive-mode-hook
42;;;            <... code omitted, see below for details ...>)
43;;;
44;;; ;; other, "non-customizable" settings
45;;; (add-hook 'singular-interactive-mode-hook
46;;;            <... code omitted, see below for details ...>)
47;;;
48;;; ;; pre-customized settings
49;;; (custom-set-variables
50;;;  <... code omitted, see below for details ...>)
51;;; (custom-set-faces
52;;;  <... code omitted, see below for details ...>)
53;;;
54;;; ;; add global menus for Singular
55;;; <... choose your version for either Emacs or XEmacs, see below ...>
56;;;
57;;; ;; add Singular toolbar for XEmacs
58;;; <... insert the code below if you are running XEmacs ...>
59;;;
60;;; ;; add Singular Emacs home directory to `load-path'
61;;; (setq load-path (cons "<your-singular-emacs-home-directory>" load-path))
62;;; (autoload 'singular "singular"
63;;;   "Start Singular using default values." t)
64;;; (autoload 'singular-other "singular"
65;;;   "Ask for arguments and start Singular." t)
66;;;
67
68;; extra key bindings
69(add-hook 'singular-interactive-mode-hook
70          (function (lambda ()
71                      ;; control cursor keys
72                      (cond
73                       ;; Emacs
74                       ((eq singular-emacs-flavor 'emacs)
75                        (local-set-key [C-prior] 'singular-scroll-right)
76                        (local-set-key [C-next] 'singular-scroll-left)
77                        (local-set-key [C-up] 'comint-previous-prompt)
78                        (local-set-key [C-down] 'comint-next-prompt))
79                       ;; XEmacs
80                       (t
81                        (local-set-key [(control prior)] 'singular-scroll-right)
82                        (local-set-key [(control next)] 'singular-scroll-left)
83                        (local-set-key [(control up)] 'comint-previous-prompt)
84                        (local-set-key [(control down)] 'comint-next-prompt))))))
85
86;; other, "non-customizable" settings
87
88;; put stuff here which should not be/only be executed under
89;; mswindows/unix
90(cond ((or (eq system-type 'cygwin32)
91           (eq system-type 'windows-nt))
92       ;; mswindows stuff
93       
94       )
95      (t
96       ;; unix stuff
97
98       ;; lazy-lock seems to be broken under mswindows:
99       ;; causes delay of input (only reacts after mouse click), or even total
100       ;; hang
101       ;(add-hook 'font-lock-mode-hook 'lazy-lock-mode)
102       ;(setq font-lock-support-mode 'lazy-lock-mode)
103       
104       ;; somewhat nicer scrolling This causes a core dump with 21.1.9
105       ;; under cygwin, when a file is opened with a button
106       ;; Fixed it with a simmple patch, by working around the
107       ;; assertion in file indent.c line 517 (or so). This was
108       ;; officially fixed in 21.1.10 -- still sometimes
109       ;; interactive windows disappeared. Hence, do not set it under
110       ;; Windows
111       (setq scroll-step 10)
112
113       )
114      )
115
116(add-hook 'singular-interactive-mode-hook
117          (function (lambda () (font-lock-mode 1))))
118
119;; turn on c++-mode for files ending in ".sing" and ".lib"
120(setq auto-mode-alist (cons '("\\.sing\\'" . c++-mode) auto-mode-alist))
121(setq auto-mode-alist (cons '("\\.lib\\'" .  c++-mode) auto-mode-alist))
122(add-hook 'c++-mode-hook
123          (function (lambda () (font-lock-mode 1))))
124
125
126
127;; this is a work-around for early version of Font Lock mode
128;; which do not use `defface' to define faces.  It forces
129;; `custom-set-faces' to define the faces immediately.
130(make-face 'font-lock-comment-face)
131(make-face 'font-lock-string-face)
132
133;; tricky stuff: these customization settings are not used any
134;; longer as soon as user saved her own to ~/.emacs-singular-cust
135(setq custom-file "~/.emacs-singular-cust")
136(if (file-exists-p custom-file)
137    (load-file custom-file)
138
139;; pre-customized settings
140(custom-set-variables
141 '(mouse-yank-at-point t)
142 '(font-lock-maximum-decoration t t)
143 '(next-line-add-newlines nil)
144 '(paren-mode (quote paren) nil (paren))
145 '(show-paren-mode t nil (paren))
146 '(singular-help-same-window t)
147 '(singular-cursor-key-model (quote terminal))
148 '(transient-mark-mode t)
149 '(Info-button1-follows-hyperlink t)
150 '(singular-section-face-alist (quote ((input . singular-section-input-face) (output)))))
151
152(custom-set-faces
153 '(info-xref ((t (:foreground "blue" :bold t))))
154 '(info-node ((t (:foreground "blue" :bold t :italic t))))
155 '(show-paren-match-face ((((class color)) (:foreground "Red"))))
156 '(font-lock-variable-name-face ((t (:foreground "black"))) t)
157 '(paren-match ((t (:foreground "Red"))) t)
158 '(singular-section-input-face ((t (:bold t))))
159 '(font-lock-string-face ((((class color) (background light)) (:foreground "green4"))))
160 '(font-lock-doc-string-face ((((class color) (background light)) (:foreground "green4"))))
161 '(font-lock-keyword-face ((t (:bold t :foreground "violet"))) t)
162 '(singular-section-output-face ((t (:bold nil))))
163 '(font-lock-type-face ((t (:bold t :foreground "violet"))) t)
164 '(font-lock-comment-face ((t (:bold nil :foreground "Red"))) t)
165 '(font-lock-function-name-face ((t (:bold t :foreground "blue3"))) t))
166 '(info-xref ((t (:foreground "blue" :bold t))))
167 '(info-node ((t (:foreground "blue" :bold t :italic nil))))
168;; obachman: played around a little bit, found this better
169;;  '(singular-section-input-face ((t (:bold t))))
170;;  '(singular-section-output-face ((t (:bold nil))))
171;;  '(font-lock-comment-face ((t (:bold nil :foreground "Grey30"))) t)
172;;  '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
173;;  '(paren-match ((t (:foreground "Red"))) t)
174;;  '(show-paren-match-face ((((class color)) (:foreground "Red")))))
175)
176
177;; update singular-emacs-home-directory
178(setq singular-emacs-home-directory 
179      (concat singular-emacs-home-directory
180              ;; we check for trailing slash and backslash
181              ;; but unconditionally insert a slash.
182              ;; Hopefully that works on NT, too.
183              (if (memq (aref singular-emacs-home-directory
184                              (1- (length singular-emacs-home-directory)))
185                        '(?/ ?\\))
186                  "" "/")))
187
188;; add global menus for Singular, Emacs version
189(unless (fboundp 'add-submenu)
190  (setq singular-start-map (make-sparse-keymap))
191  (define-key singular-start-map [menu-bar singular]
192    (cons "Singular" (make-sparse-keymap "Singular")))
193  (define-key singular-start-map [menu-bar singular restart]
194    '("Start..." . singular-other))
195  (define-key singular-start-map [menu-bar singular start-default]
196    '("Start default" . singular))
197  (setq menu-bar-final-item (append '(singular) menu-bar-final-items))
198  (use-local-map singular-start-map))
199
200;; add global menus for Singular, XEmacs version
201(when (fboundp 'add-submenu)
202  (add-submenu nil 
203               '("Singular"
204                 ["Start default" singular t]
205                 ["Start..." singular-other t]))
206  (setq-default current-menubar current-menubar))
207
208;; add Singular button to toolbar for XEmacs
209;(if (fboundp 'toolbar-add-item)
210;    (toolbar-add-item
211;     (vector
212;      (toolbar-make-button-list (concat singular-emacs-home-directory
213;                                       "singular.xpm"))
214;      'singular t "Start Singular")
215;     (length (specifier-instance default-toolbar))))
216;
217;;;
218;;; - load singular.el and .emacs-general
219;;;
220
221; get rid of superfluous "Load .emacs" menu entry on XEmacs
222(when (fboundp 'delete-menu-item)
223  (delete-menu-item '("Load .emacs"))           ; that is for the current buffer
224  (let ((current-menubar (default-value 'current-menubar)))
225    (delete-menu-item '("Load .emacs"))         ; that is for all other buffers
226    (set-default 'current-menubar current-menubar)))
227
228; load singular.el from `singular-emacs-home-directory'
229(load-file (concat singular-emacs-home-directory "singular.el"))
230
231; load .emacs-general from home or `singular-emacs-home-directory'
232(if (file-exists-p "~/.emacs-general")
233    (load-file "~/.emacs-general")
234  (if (file-exists-p (concat singular-emacs-home-directory ".emacs-general"))
235      (load-file (concat singular-emacs-home-directory ".emacs-general"))))
Note: See TracBrowser for help on using the repository browser.