comparison lib/emacs/pers-init.el @ 96:a7e72a254790

(none)
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Fri, 16 Apr 2021 09:01:16 +0000
parents
children 3314f46a782f
comparison
equal deleted inserted replaced
95:32c1c853062f 96:a7e72a254790
1 ;;; GNU Emacs init file for Henry Thompson
2 ;;; This part shared between all hosts
3 ;;; This part is my personal stuff, not for other incarnations
4 ;;; initialisation file for Emacs, that is, (l)emacs and epoch common
5 ;;; Last edited: Fri Sep 25 09:22:22 1992
6 ;;; Edit history since port: made load-path not site-dependant
7 ;;; split into common-init for all my incarnations and pers-init for private
8 ;;; added lemacs compatibility
9
10 ;;; mail stuff
11 (setq mail-archive-file-name "~/mail/cpy/general")
12 (setq rmail-dont-reply-to-names "hthompso*\\|h\\.thompso*\\|ht@*" )
13 (set-default 'ht-last-file (expand-file-name "~/mail/"))
14 (setq ht-diary-file-name "~/mail/diary.babyl")
15 (setq mail-append-host "inf.ed.ac.uk")
16 (setq user-full-name "Henry S. Thompson")
17 (setq user-mail-address "ht@inf.ed.ac.uk")
18 (setq mail-host-address "inf.ed.ac.uk")
19
20 ;; new mail hackery
21 (site-caseq ((edin ircs ldc)
22 (setq rmail-spool-directory (file-name-as-directory
23 (concat rmail-spool-directory
24 "ht-mail")))))
25
26 ;; sending mail on the road
27 ;; [moved to mail-from-m.el, which is required by gnus-init.el
28
29 ;; don't know why this is necessary
30 (site-caseq ((edin)
31 (setq rmail-primary-inbox-list
32 (list (concat rmail-spool-directory "ht")))))
33
34 ;; Perforce
35
36 ;;(setq p4-global-server-port "zorg.milowski.com:1666")
37 ;;(setenv "P4PORT" "zorg.milowski.com:1666")
38 ;;(setenv "P4CLIENT" "MarkupMan")
39 ;;(setenv "P4CONFIG" ".p4env")
40 ;;(load-library "p4")
41 ;;(setq p4-use-p4config-exclusively t)
42 ;;(p4-set-p4-executable "/c/Program Files/Perforce/p4.exe")
43 (setq vc-command-messages t)
44
45 (setq minibuffer-max-depth nil)
46 (defun run-kcl ()
47 "Run an inferior kcl process"
48 (interactive)
49 (switch-to-buffer (make-shell "kcl" "kcl"))
50 (inferior-lisp-mode))
51
52 ;(require 'mdn-extras)
53 (setq auto-mode-alist
54 (append '(("/perl/" . perl-mode)
55 ("\\.scm$" . scheme-mode))
56 auto-mode-alist))
57 ;(setq inferior-lisp-program "/c/Progra~1/ChezSc~1.4/bin/i3nt/petite")
58 ;;; for scheme
59 (put 'letrec 'lisp-indent-function 1)
60 (put 'case 'lisp-indent-function 1)
61
62 (site-caseq (parc (nconc load-path '("/import/local/emacs/gnus-3.13/"))
63 (setq rmail-primary-inbox-list
64 '("~/mbox" "/net/piglet/usr/spool/mail/$USER")))
65 (edin (setq load-path (cons
66 "/home/ht/emacs/shared/gnus-5.0.15/lisp"
67 load-path))))
68
69 (defun run-sicstus ()
70 "Run an inferior Prolog process, input and output via buffer *prolog*."
71 (interactive)
72 (if (not (boundp 'prolog-mode-map))
73 (let ((load-path (cons
74 (site-caseq (parc "/import/prolog-1.8/emacs")
75 (edin "??"))
76 load-path)))
77 (load "prolog" nil t)))
78 (require 'shell)
79 (switch-to-buffer (make-shell "prolog" (site-caseq (edin "sicstus")
80 (parc "prolog"))))
81 (inferior-prolog-mode))
82
83 (site-caseq ((laptop maritain cirrus))
84 (t(require 'hist)
85 (rplacd (assoc "*shell*" hk-pat-table)
86 "[a-z]+<[0-9]+>: ")))
87
88 ;; turn off suspend-emacs -- use pause-emacs (^X.) instead
89 (global-unset-key "\C-Z")
90 (global-unset-key "\C-x\C-z")
91
92 (global-set-key "\C-xl" (function goto-line))
93
94 ;(require 'repl-comment)
95
96 ;(require 'compress)
97
98 (if (string-match "Lucid" emacs-version)
99 (site-caseq ((laptop maritain cirrus))
100 (t(require 'lemacs-compat))))
101
102 (if (boundp 'epoch::version)
103 ;; epoch only goes here
104 (progn
105 (if (string-match "4\\."emacs-version)
106 (load "motion4" nil t)
107 (load "motion" nil t))
108 (redisplay-frame)
109
110 (require 'alarm)
111 (idle-save 15)
112
113 (defun ht-rooms-setup (&optional arg)
114 (interactive)
115 (redisplay-frame)
116 (require 'mail-extras)
117 (require 'diary)
118 (require 'my-news)
119 (let ((scr (current-frame)))
120 (load "ht-rooms-epoch.config" nil t)
121 (unwind-protect (make-frame-for-room "diary" "-0" "+130"))
122 (unwind-protect (make-frame-for-room "elisp" "-25" "+148"))
123 (unwind-protect (make-frame-for-room "news" "-50" "+166"))
124 (unwind-protect (make-frame-for-room "mail" "-75" "+184"))
125 (epoch::delete-frame scr))
126 ;; presumably this is now frame local, so not quite the right thing.
127 (setq ht-default-config (current-window-configuration)))
128 ))
129 (if (string-match "^\\(19\\|2\\)" emacs-version)
130 (progn
131 ;; common v19
132 (if window-system
133 (progn
134 (add-hook 'sh-mode-hook '(lambda ()
135 (font-lock-mode 1)))
136 (add-hook 'lsl-mode-hook '(lambda ()
137 (font-lock-mode 1)))
138 (add-hook 'perl-mode-hook '(lambda ()
139 (font-lock-mode 1)))
140 (add-hook 'emacs-lisp-mode-hook '(lambda ()
141 (font-lock-mode 1)))
142 (add-hook 'lisp-mode-hook '(lambda ()
143 (font-lock-mode 1)))
144 (add-hook 'sgml-mode-hook '(lambda ()
145 (if (not
146 (boundp 'sgml-font-lock-keywords))
147 (load "sgml-font-lock-keywords" t t))
148 (setq adaptive-fill-mode nil)
149 (font-lock-mode 1)
150 ))
151 (add-hook 'c-mode-hook '(lambda ()
152 (font-lock-mode 1)))
153 (add-hook 'c++-mode-hook '(lambda ()
154 (font-lock-mode 1)))
155 (add-hook 'scheme-mode-hook
156 '(lambda ()
157 (setq
158 scheme-font-lock-keywords
159 (if (or
160 (boundp 'lisp-font-lock-keywords)
161 (load "lisp-font-lock-keywords" t t))
162 lisp-font-lock-keywords))
163 (font-lock-mode 1)))
164 (add-hook 'python-mode-hook '(lambda ()
165 (font-lock-mode 1)))
166 ;(setq py-python-command "//c/Program Files/Python22/python")
167 (setq sgml-insert-missing-element-comment nil)
168 ;(load "psgml" nil t)
169 ;(load "psgml-edit" nil t)
170 ;; (load "xml-hack" nil t)
171 ; (setq sgml-catalog-files '("CATALOG" "f:/lib/sgml/catalog"))
172 (if (string-match "i386" (emacs-version))
173 (progn (defun win32-get-clipboard-data-cmd ()
174 (interactive)(insert (win32-get-clipboard-data)))
175 (global-set-key
176 "\C-x\C-y" 'win32-get-clipboard-data-cmd)))
177 ;; gnus
178 ; (setq mail-signature t)
179
180 ;; loading gnus postponed to e.g. mail-from-delphix, q.v.
181
182 ; (require 'gnus-min)
183 ))
184 (site-caseq ((cirrus))
185 (t (load "gnus-init" nil t)))
186
187 ;; (require 'idle)
188 ;; (idle-save 15)
189
190 (if (string-match "Lucid" emacs-version)
191 ;; lemacs only goes here
192 (site-caseq ((cirrus)
193 ;(load "perl-mode" nil t)
194 )
195 (t(progn
196 (setq bbdb-north-american-phone-numbers-p nil)
197 (setq bbdb-use-pop-up nil)
198 (require 'bbdb)
199 (add-hook 'rmail-mode-hook 'bbdb-insinuate-rmail)
200 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
201 (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail)
202 (add-hook 'mail-setup-hook 'bbdb-define-all-aliases)
203 (add-hook 'gnus-message-setup-hook 'bbdb-define-all-aliases)
204
205
206
207 (if window-system
208 (progn
209 (require 'highlight-headers)
210 (defun rmail-fontify-headers ()
211 (highlight-headers (point-min) (point-max) t))
212 (add-hook 'rmail-show-message-hook 'rmail-fontify-headers)
213 (setq dired-mode-hook
214 '(lambda ()
215 (font-lock-mode 1)
216 (define-key dired-mode-map
217 [button2] '(lambda (click)
218 (interactive "e")
219 (mouse-set-point click)
220 (dired-advertised-find-file)))))
221 ;; (setq highlight-headers-follow-url-function
222 ;; 'highlight-headers-ht-follow-url-netscape
223 ;; browse-url-browser-function
224 ;;'highlight-headers-ht-follow-url-netscape)
225 ))
226 ;; (load "~rjc/public_html/device-type-hacking.el")
227 (load "perl-mode" nil t)
228 (defun ht-rooms-setup (&optional arg)
229 (interactive)
230 (require 'mail-extras)
231 (require 'diary)
232 (require 'my-news)
233 ;; override changed default, except in gnus
234 (setq mail-use-rfc822 nil)
235 (add-hook 'gnus-summary-mode-hook
236 (function (lambda ()
237 (make-local-variable 'mail-use-rfc822)
238 (setq mail-use-rfc822 t))))
239 (if (>= emacs-major-version 21)
240 (progn
241 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
242 (add-hook 'gnus-startup-hook 'bbdb-insinuate-message)))
243 (defun ht-rooms-setup (&optional arg)
244 (interactive)
245 (require 'mail-extras)
246 (require 'diary)
247 (let ((scr (selected-frame)))
248 ; (sit-for 5)
249 (load "ht-rooms.config" nil t)
250 (unwind-protect (make-screen-for-room "diary" "0" "+62"))
251 ; (sit-for 5)
252 (unwind-protect (make-screen-for-room "elisp" "-25" "+79"))
253 ; (sit-for 5)
254 (unwind-protect (make-screen-for-room "news" "-50" "+96"))
255 ; (sit-for 5)
256 (unwind-protect (make-screen-for-room "mail" "-75" "+113"))
257 (sit-for 1)
258 (delete-screen scr))
259 (setq ht-default-config (current-window-configuration)))))))
260 ;; vanilla v19 goes here
261 (if window-system
262 (progn
263 (defvar ht-frame-parameter-mods
264 '((auto-raise . t)
265 (auto-lower . nil)
266 (cursor-type . bar)))
267 (nconc
268 (site-caseq ((laptop maritain) (list '(height . 35)))
269 ((cirrus))
270 (t
271 (list
272 '(font .
273 "-adobe-courier-medium-r-normal--14-*"))))
274 ht-frame-parameter-mods
275 )
276 ;; if we have X, we have ISO-Latin-1, so
277 ;; set char codes 128--255 to display as themselves.
278 (require 'disp-table)
279 (standard-display-8bit 161 255)
280 ; (transient-mark-mode t)
281 ;; hightlight searching in bold
282 (setq search-highlight t)
283 (make-face 'isearch)
284 (copy-face 'bold 'isearch)
285 ; (set-face-underline-p 'region t)
286 ; (set-face-background 'region "white")
287 ; (set-face-foreground 'region "black")
288 ; (setq c++-font-lock-keywords 'undef)
289 ; (setq c-font-lock-keywords 'undef)
290 (modify-frame-parameters
291 nil
292 ht-frame-parameter-mods)
293 (setq default-frame-alist
294 (append
295 ht-frame-parameter-mods default-frame-alist))
296 ;; fix cut and paste
297 (setq interprogram-paste-function nil
298 interprogram-cut-function nil)
299 (defun ht-mouse-set-region (click) "set region and primary selection"
300 (interactive "e")
301 (mouse-set-region click)
302 (x-set-selection "PRIMARY" (buffer-substring (point)(mark))))
303 (defun ht-mouse-drag-region (click)
304 "drag region and set primary selection"
305 (interactive "e")
306 (mouse-drag-region click)
307 (if mark-active
308 (x-set-selection "PRIMARY" (buffer-substring (point)(mark)))))
309 (global-set-key [drag-mouse-1] (function ht-mouse-set-region))
310 (global-set-key [down-mouse-1] (function ht-mouse-drag-region))
311 (defun ht-mouse-insert-primary (click)
312 "set point and insert primary selection"
313 (interactive "e")
314 (mouse-set-point click)
315 (push-mark nil nil t)
316 (insert (x-selection)))
317 (global-set-key [mouse-2] (function ht-mouse-insert-primary))
318 (setq dired-mode-hook
319 '(lambda ()
320 (font-lock-mode 1)
321 (define-key dired-mode-map
322 [mouse-2] '(lambda (click)
323 (interactive "e")
324 (mouse-set-point click)
325 (dired-advertised-find-file)))))
326
327 (defun ht-rooms-setup (&optional arg)
328 (interactive)
329 (require 'mail-extras)
330 (require 'diary)
331 (require 'my-news)
332 ;; override changed default, except in gnus
333 (setq mail-use-rfc822 nil)
334 (add-hook 'gnus-summary-mode-hook
335 (function (lambda ()
336 (make-local-variable 'mail-use-rfc822)
337 (setq mail-use-rfc822 t))))
338 (let ((scr (selected-frame)))
339 (load "ht-rooms.config" nil t)
340 (unwind-protect (make-frame-for-room "elisp" "-25" "-58"))
341 (unwind-protect (progn
342 (make-frame-for-room "news" "-50" "-40")
343 ))
344 (unwind-protect (progn
345 (make-frame-for-room "mail" "-75" "-22")
346 ))
347 (unwind-protect (progn
348 (make-frame-for-room
349 "diary"
350 "-0"
351 (concat
352 "+"
353 (format
354 "%d"
355 (-
356 (cdr
357 (assoc
358 'top
359 (frame-parameters
360 (cdr
361 (assoc
362 "elisp"
363 frames-table)))))
364 18))))
365 ))
366 (make-frame-invisible scr))
367 (setq ht-default-config (current-window-configuration)))))
368 (setq sgml-insert-missing-element-comment nil)
369 (add-hook 'sgml-mode-hook 'sgml-fix-para)
370 ))
371 ;; v18 emacs only goes here
372 (progn
373 (require 'compress)
374 (defun ht-rooms-setup (&optional arg)
375 (interactive)
376 (require 'mail-extras)
377 (require 'diary)
378 (require 'my-news)
379 (load "ht-rooms.config" nil t)
380 (setq ht-default-config (current-window-configuration)))))
381
382 (defun sgml-fix-para ()
383 (setq paragraph-separate
384 "</[^>]*>\n\\([ \t]+\\| \\)")
385 (setq paragraph-start
386 "^[ \t]*</?[A-Za-z._-]+[ >]"))
387
388 (defun highlight-headers-ht-follow-url-netscape (url)
389 (message "Sending URL to Netscape...")
390 (save-excursion
391 (set-buffer (get-buffer-create "*Shell Command Output*"))
392 (erase-buffer)
393 (if (equal 0 (call-process "netscape" nil t nil "-display" ":0.0"
394 "-remote"
395 (concat "openURL(" url ")")))
396 ;; it worked
397 nil
398 ;; it didn't work, so start a new Netscape process.
399 (call-process "netscape" nil 0 nil url)))
400 (message "Sending URL to Netscape... done"))
401
402 (site-caseq (laptop (defun system-name () "francis.markup.co.uk")))
403
404 (cd (user-home-directory))
405
406 (defun ht-custom-size ()
407 (interactive)
408 (site-caseq ((laptop maritain)
409 (message (format "pw: %s" (device-pixel-width (selected-device))))))
410 (if (fboundp 'device-pixel-width)
411 (let ((pw (device-pixel-width (selected-device)))
412 (ph (device-pixel-height (selected-device))))
413 (cond ((= pw 2048)
414 ;; we're on a _really_ big external monitor
415 (set-frame-pixel-size (selected-frame) 900 1050)
416 (set-frame-position (selected-frame) 0 0))
417 ((= pw 1920)
418 ;; we're on a 27" curved external monitor
419 (set-frame-pixel-size (selected-frame) 720 980)
420 (site-caseq (cirrus
421 (set-frame-position
422 (selected-frame) 0 0))
423 (t
424 (set-frame-position
425 (selected-frame) -8 2))))
426 ((= pw 1680)
427 ;; we're on a big external monitor
428 (font-menu-set-font nil nil 10)
429 (set-frame-pixel-size (selected-frame) 900 1000)
430 (set-frame-position (selected-frame) -3 -20))
431 ((= pw 1097)
432 ;; we're on an XPS 13, mag. 300%
433 (require 'font-menu)
434 (font-menu-set-font nil nil 9)
435 (set-frame-pixel-size (selected-frame) 583 583); 80 x 39
436 (set-frame-position (selected-frame) -5 -26))
437 ((= pw 1536)
438 ;; we're on an XPS 13, mag. 250%
439 (require 'font-menu)
440 (font-menu-set-font nil nil 10)
441 (set-frame-pixel-size (selected-frame) 670 782); 81 x 49
442 (set-frame-position (selected-frame) -5 -26))
443 ((= ph 768)
444 ;; we're on a narrow cinema-ratio laptop
445 (set-frame-pixel-size (selected-frame) 690 710)
446 (set-frame-position (selected-frame) -5 -26))
447 ((= ph 900)
448 ;; we're on a cinema-ratio laptop
449 (set-frame-pixel-size (selected-frame) 800 820)
450 (set-frame-position (selected-frame) -3 -20))
451 ((= pw 1600)
452 ;; we're on a big external monitor
453 (set-frame-pixel-size (selected-frame) 900 1120)
454 (set-frame-position (selected-frame) -3 -20))
455 ((= pw 1280)
456 (cond ((= ph 720)
457 (set-frame-pixel-size (selected-frame) 700 655)
458 (set-frame-position (selected-frame) -3 -30))
459 (t
460 (set-frame-pixel-size (selected-frame) 700 960)
461 (set-frame-position (selected-frame) -3 -20))))))))
462
463 (ht-custom-size)
464
465 ;;; make dired list directories first
466 ;(defadvice dired-insert-directory (before my-dired-insert-directory
467 ; (dir-or-list switches &optional wildcard full-p))
468 ; (setq switches (concat switches " --group-directories-first")))
469
470 ;(ad-activate 'dired-insert-directory)