source: git/emacs/.emacs-singular @ 08a955

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