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

spielwiese
Last change on this file since aa7c34d was aa7c34d, checked in by Tim Wichmann <wichmann@…>, 24 years ago
* Added (mouse-yank-at-point t) to custom-set-variables git-svn-id: file:///usr/local/Singular/svn/trunk@4062 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.9 KB
Line 
1;;; Emacs edit mode for this file is  -*- Emacs-Lisp -*-
2;;; $Id: .emacs-singular,v 1.11 1999-12-22 10:22:45 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 '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  (let ((face (get-text-property (point) 'face)))
110    (if face
111        (customize-face face)
112      (message "No face defined at point"))))
113
114;; tricky stuff: these customization settings are not used any
115;; longer as soon as user saved her own to ~/.emacs-singular-cust
116(setq custom-file "~/.emacs-singular-cust")
117(if (file-exists-p custom-file)
118    (load-file custom-file)
119
120;; pre-customized settings
121(custom-set-variables
122 '(mouse-yank-at-point t)
123 '(font-lock-maximum-decoration t t)
124 '(next-line-add-newlines nil)
125 '(paren-mode (quote paren) nil (paren))
126 '(show-paren-mode t nil (paren))
127 '(singular-help-same-window t)
128 '(singular-cursor-key-model (quote terminal))
129 '(transient-mark-mode t)
130 '(singular-section-face-alist (quote ((input . singular-section-input-face) (output)))))
131
132(custom-set-faces
133 '(show-paren-match-face ((((class color)) (:foreground "Red"))))
134 '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
135 '(font-lock-variable-name-face ((t (:foreground "black"))) t)
136 '(paren-match ((t (:foreground "Red"))) t)
137 '(singular-section-input-face ((t (:bold t))))
138 '(font-lock-keyword-face ((t (:bold t :foreground "violet"))) t)
139 '(singular-section-output-face ((t (:bold nil))))
140 '(font-lock-type-face ((t (:bold t :foreground "violet"))) t)
141 '(font-lock-comment-face ((t (:bold nil :foreground "Red"))) t)
142 '(font-lock-function-name-face ((t (:bold t :foreground "blue3"))) t))
143;; obachman: played around a little bit, found this better
144;;  '(singular-section-input-face ((t (:bold t))))
145;;  '(singular-section-output-face ((t (:bold nil))))
146;;  '(font-lock-comment-face ((t (:bold nil :foreground "Grey30"))) t)
147;;  '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
148;;  '(paren-match ((t (:foreground "Red"))) t)
149;;  '(show-paren-match-face ((((class color)) (:foreground "Red")))))
150
151)
152
153;; update singular-emacs-home-directory
154(setq singular-emacs-home-directory 
155      (concat singular-emacs-home-directory
156              ;; we check for trailing slash and backslash
157              ;; but unconditionally insert a slash.
158              ;; Hopefully that works on NT, too.
159              (if (memq (aref singular-emacs-home-directory
160                              (1- (length singular-emacs-home-directory)))
161                        '(?/ ?\\))
162                  "" "/")))
163
164;; add global menus for Singular, Emacs version
165(unless (fboundp 'add-submenu)
166  (setq singular-start-map (make-sparse-keymap))
167  (define-key singular-start-map [menu-bar singular]
168    (cons "Singular" (make-sparse-keymap "Singular")))
169  (define-key singular-start-map [menu-bar singular restart]
170    '("Start..." . singular-other))
171  (define-key singular-start-map [menu-bar singular start-default]
172    '("Start default" . singular))
173  (setq menu-bar-final-item (append '(singular) menu-bar-final-items))
174  (use-local-map singular-start-map))
175
176;; add global menus for Singular, XEmacs version
177(when (fboundp 'add-submenu)
178  (add-submenu nil 
179               '("Singular"
180                 ["Start default" singular t]
181                 ["Start..." singular-other t]))
182  (setq-default current-menubar current-menubar))
183
184;; add Singular button to toolbar for XEmacs
185(if (fboundp 'toolbar-add-item)
186    (toolbar-add-item 
187     (vector 
188      (toolbar-make-button-list (concat singular-emacs-home-directory 
189                                        "singular.xpm"))
190      'singular t "Start Singular")
191     (length (specifier-instance default-toolbar))))
192
193;;;
194;;; - load singular.el.
195;;;
196
197;; get rid of superfluous "Load .emacs" menu entry on XEmacs
198(when (fboundp 'delete-menu-item)
199  (delete-menu-item '("Load .emacs"))           ; that is for the current buffer
200  (let ((current-menubar (default-value 'current-menubar)))
201    (delete-menu-item '("Load .emacs"))         ; that is for all other buffers
202    (set-default 'current-menubar current-menubar)))
203
204;; load singular.el from `singular-emacs-home-directory'
205(load-file (concat singular-emacs-home-directory "singular.el"))
Note: See TracBrowser for help on using the repository browser.