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

fieker-DuValspielwiese
Last change on this file since f0d41bc was f0d41bc, checked in by Olaf Bachmann <obachman@…>, 24 years ago
turn of lazy lock on mswindows git-svn-id: file:///usr/local/Singular/svn/trunk@4344 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 8.4 KB
RevLine 
[48d74cb]1;;; Emacs edit mode for this file is  -*- Emacs-Lisp -*-
[f0d41bc]2;;; $Id: .emacs-singular,v 1.13 2000-05-17 12:02:55 obachman Exp $
[48d74cb]3
[f7ffaa]4;;;
[48d74cb]5;;; .emacs-singular - Emacs initialization file to use for
6;;;                   Singular interactive mode.
[f7ffaa]7;;;
[48d74cb]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:
[f7ffaa]35;;;
[48d74cb]36;;; ;; extra key bindings
37;;; (add-hook 'singular-interactive-mode-hook
38;;;            <... code omitted, see below for details ...>)
[f7ffaa]39;;;
[48d74cb]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;;;
[26ceba]53;;; ;; add Singular toolbar for XEmacs
54;;; <... insert the code below if you are running XEmacs ...>
55;;;
[48d74cb]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
[f7ffaa]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
[48d74cb]82;; other, "non-customizable" settings
[f0d41bc]83
84;; lazy-lock seems to be broken under mswindows:
85;; causes delay of input (only reacts after mouse click), or even total
86;; hang
87(cond ((not (or (eq system-type 'cygwin32)
88             (eq system-type 'windows-nt)))
89            (add-hook 'font-lock-mode-hook 'lazy-lock-mode)
90            (setq font-lock-support-mode 'lazy-lock-mode)))
[c7a817]91
[f7ffaa]92(add-hook 'singular-interactive-mode-hook
93          (function (lambda () (font-lock-mode 1))))
94
[c04b94]95;; turn on c++-mode for files ending in ".sing" and ".lib"
[c7a817]96(setq auto-mode-alist (cons '("\\.sing\\'" . c++-mode) auto-mode-alist))
[841181]97(setq auto-mode-alist (cons '("\\.lib\\'" .  c++-mode) auto-mode-alist))
98(add-hook 'c++-mode-hook
99          (function (lambda () (font-lock-mode 1))))
[c7a817]100
[18daf9e]101;; somewhat nicer scrolling
[ef0124]102;; This causes a core dump with 21.1.9 under cygwin, when a file is opened
103;; with a button
104;; obachman: Fixed it with a simmple patch, by working around the assertion
105;; in file indent.c line 517 (or so)
[f0d41bc]106; (setq scroll-step 10)
[18daf9e]107
108
[f7ffaa]109;; this is a work-around for early version of Font Lock mode
110;; which do not use `defface' to define faces.  It forces
111;; `custom-set-faces' to define the faces immediately.
112(make-face 'font-lock-comment-face)
113(make-face 'font-lock-string-face)
114
[c04b94]115; a handy function for customizing face of point
116(defun customize-face-at-point ()
[338897c]117  "Customize face which point is at."
[c04b94]118  (interactive)
[338897c]119  (let ((face (get-text-property (point) 'face)))
120    (if face
121        (customize-face face)
122      (message "No face defined at point"))))
[c04b94]123
[48d74cb]124;; tricky stuff: these customization settings are not used any
125;; longer as soon as user saved her own to ~/.emacs-singular-cust
126(setq custom-file "~/.emacs-singular-cust")
127(if (file-exists-p custom-file)
128    (load-file custom-file)
129
130;; pre-customized settings
[f7ffaa]131(custom-set-variables
[aa7c34d]132 '(mouse-yank-at-point t)
[841181]133 '(font-lock-maximum-decoration t t)
[f7ffaa]134 '(next-line-add-newlines nil)
135 '(paren-mode (quote paren) nil (paren))
136 '(show-paren-mode t nil (paren))
[48d74cb]137 '(singular-help-same-window t)
[c7a817]138 '(singular-cursor-key-model (quote terminal))
139 '(transient-mark-mode t)
[ef0124]140 '(Info-button1-follows-hyperlink t)
[c7a817]141 '(singular-section-face-alist (quote ((input . singular-section-input-face) (output)))))
[841181]142
[f7ffaa]143(custom-set-faces
[841181]144 '(show-paren-match-face ((((class color)) (:foreground "Red"))))
[f7ffaa]145 '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
[841181]146 '(font-lock-variable-name-face ((t (:foreground "black"))) t)
[f7ffaa]147 '(paren-match ((t (:foreground "Red"))) t)
[841181]148 '(singular-section-input-face ((t (:bold t))))
149 '(font-lock-keyword-face ((t (:bold t :foreground "violet"))) t)
150 '(singular-section-output-face ((t (:bold nil))))
151 '(font-lock-type-face ((t (:bold t :foreground "violet"))) t)
152 '(font-lock-comment-face ((t (:bold nil :foreground "Red"))) t)
153 '(font-lock-function-name-face ((t (:bold t :foreground "blue3"))) t))
[ef0124]154 '(info-xref ((t (:foreground "blue" :bold t))))
155 '(info-node ((t (:foreground "blue" :bold t :italic nil))))
[841181]156;; obachman: played around a little bit, found this better
157;;  '(singular-section-input-face ((t (:bold t))))
158;;  '(singular-section-output-face ((t (:bold nil))))
159;;  '(font-lock-comment-face ((t (:bold nil :foreground "Grey30"))) t)
160;;  '(font-lock-string-face ((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "LightSkyBlue"))) t)
161;;  '(paren-match ((t (:foreground "Red"))) t)
162;;  '(show-paren-match-face ((((class color)) (:foreground "Red")))))
[f7ffaa]163
[48d74cb]164)
165
[26ceba]166;; update singular-emacs-home-directory
167(setq singular-emacs-home-directory 
168      (concat singular-emacs-home-directory
169              ;; we check for trailing slash and backslash
170              ;; but unconditionally insert a slash.
171              ;; Hopefully that works on NT, too.
172              (if (memq (aref singular-emacs-home-directory
173                              (1- (length singular-emacs-home-directory)))
174                        '(?/ ?\\))
175                  "" "/")))
176
[48d74cb]177;; add global menus for Singular, Emacs version
178(unless (fboundp 'add-submenu)
[c7a817]179  (setq singular-start-map (make-sparse-keymap))
180  (define-key singular-start-map [menu-bar singular]
181    (cons "Singular" (make-sparse-keymap "Singular")))
182  (define-key singular-start-map [menu-bar singular restart]
[48d74cb]183    '("Start..." . singular-other))
[c7a817]184  (define-key singular-start-map [menu-bar singular start-default]
[48d74cb]185    '("Start default" . singular))
[c7a817]186  (setq menu-bar-final-item (append '(singular) menu-bar-final-items))
187  (use-local-map singular-start-map))
[48d74cb]188
189;; add global menus for Singular, XEmacs version
[c2f709]190(when (fboundp 'add-submenu)
191  (add-submenu nil 
192               '("Singular"
193                 ["Start default" singular t]
194                 ["Start..." singular-other t]))
195  (setq-default current-menubar current-menubar))
[48d74cb]196
[26ceba]197;; add Singular button to toolbar for XEmacs
198(if (fboundp 'toolbar-add-item)
199    (toolbar-add-item 
200     (vector 
201      (toolbar-make-button-list (concat singular-emacs-home-directory 
202                                        "singular.xpm"))
203      'singular t "Start Singular")
204     (length (specifier-instance default-toolbar))))
205
[f7ffaa]206;;;
[48d74cb]207;;; - load singular.el.
[f7ffaa]208;;;
[48d74cb]209
[f0d41bc]210; get rid of superfluous "Load .emacs" menu entry on XEmacs
[48d74cb]211(when (fboundp 'delete-menu-item)
212  (delete-menu-item '("Load .emacs"))           ; that is for the current buffer
213  (let ((current-menubar (default-value 'current-menubar)))
214    (delete-menu-item '("Load .emacs"))         ; that is for all other buffers
215    (set-default 'current-menubar current-menubar)))
216
[f0d41bc]217; load singular.el from `singular-emacs-home-directory'
[26ceba]218(load-file (concat singular-emacs-home-directory "singular.el"))
Note: See TracBrowser for help on using the repository browser.