(progn ; early initialization (progn ; these progn for indentation only ;;;(setq debug-on-error t) ; in some cases this is not enough ; when .emacs itself has errors, you may need --debug-init on the command line, when launching Emacs ;;; no idea why this is appearing in trace messages: Warning: no fonts matching `-*-fixed-medium-r-normal-*-16-*-*-*-*-*-iso8859-1' available [2 times] (menu-bar-mode nil) ; early, else menu flashes on screen (setq load-path (append (list "/usr/local/share/emacs/site-lisp" ;; others here . . . ) load-path)))) ; . . . and other load-path appends, below ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defface error '((((type tty pc) (class color) (background light)) (:foreground "red")) (((type tty pc) (class color) (background dark)) (:foreground "red1")) (((class grayscale) (background light)) (:foreground "DimGray" :bold t :italic t)) (((class grayscale) (background dark)) (:foreground "LightGray" :bold t :italic t)) (((class color) (background light)) (:foreground "rgb:C0/C0/C0")) (((class color) (background dark)) (:foreground "rgb:E0/A0/A0")) (t (:bold t :italic t))) "Face for error messages and other such alarums." :group 'basic-faces) (defun page-next-buffer() "Pages to the next buffer in alphabetic order." (interactive) (delete-other-windows) ; In case visiting multiple initial files, when Emacs shows a split frame, with a buffer list in the second window; this deletes the second window. Not sure how else to correct it, or where better to place this call -- both after-init-hook and --funcall operate too early, prior to load. Besides, it's not bad to see the buffer list, as long as it goes away, without effort. And this does the trick. (let ((list_of_buffer (_list-buffer-names-in-order_init)) (current_buffer_name (buffer-name))) (while list_of_buffer (if (equal current_buffer_name (car list_of_buffer)) (progn ;;; switch to next list entry or first list entry if current is last (switch-to-buffer (or (car(cdr list_of_buffer)) (car(_list-buffer-names-in-order_init)))) (setq list_of_buffer nil)) (setq list_of_buffer (cdr list_of_buffer)))))) (defun page-previous-buffer() "Pages to the previous buffer in alphabetic order." (interactive) (delete-other-windows) ; per page-next-buffer (let ((list_of_buffer (reverse (_list-buffer-names-in-order_init))) (current_buffer_name (buffer-name))) (while list_of_buffer (if (equal current_buffer_name (car list_of_buffer)) (progn ;;; switch to next list entry or first list entry if current is last (switch-to-buffer (or (cadr list_of_buffer) (car (last (_list-buffer-names-in-order_init))))) (setq list_of_buffer nil))) (setq list_of_buffer (cdr list_of_buffer))))) (defface subdued '((((type tty pc) (class color) (background light)) (:foreground "red")) (((type tty pc) (class color) (background dark)) (:foreground "red1")) (((class grayscale) (background light)) (:foreground "DimGray" :bold t :italic t)) (((class grayscale) (background dark)) (:foreground "LightGray" :bold t :italic t)) (((class color) (background light)) (:foreground "rgb:FF/00/00")) (((class color) (background dark)) (:foreground "rgb:C0/C0/C0")) (t (:bold t :italic t))) "Face that is just slightly subdued. To de-emphasize symbolic clutter." :group 'basic-faces) (defface textbender-genetic-face '((((type tty pc) (class color) (background light)) (:foreground "red")) (((type tty pc) (class color) (background dark)) (:foreground "red1")) (((class grayscale) (background light)) (:foreground "DimGray" :bold t :italic t)) (((class grayscale) (background dark)) (:foreground "LightGray" :bold t :italic t)) (((class color) (background light)) (:foreground "rgb:FF/00/00")) (((class color) (background dark)) (:foreground "rgb:C0/C0/C0")) (t (:bold t :italic t))) "Face for embedded genetic markup in recombinant texts." :group 'basic-faces) (defface textbender-clipboard-face '((((type tty pc) (class color) (background light)) (:foreground "red")) (((type tty pc) (class color) (background dark)) (:foreground "red1")) (((class grayscale) (background light)) (:foreground "DimGray" :bold t :italic t)) (((class grayscale) (background dark)) (:foreground "LightGray" :bold t :italic t)) (((class color) (background light)) (:foreground "rgb:FF/00/00")) (((class color) (background dark)) (:foreground "rgb:C0/C0/C0")) (t (:bold t :italic t))) "Face for temporary genes from clipboard." :group 'basic-faces) ;;;; I m p l e m e n t a t i o n ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun _activate-behaviour-modes_init() "Activate various behaviour modes." ;; Custom's stuff. Placed here in case it activates modes. ;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;; cannot move these into plain setq's, or it dies (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(pc-select-meta-moves-sexps t) '(pc-select-selection-keys-only t) '(pc-selection-mode t nil (pc-select))) ;; - - - (when (string-equal window-system "x") (mouse-wheel-mode) (setq mouse-wheel-scroll-amount '(6 . 1)))) (defun _do-nothing_init() nil) (defun _ebuild-mode_init() "Initialze Gentoo ebuild mode." (define-derived-mode ebuild-mode shell-script-mode "ebuild" "Gentoo ebuild files." ;; per http://www.gentoo.org/doc/en/gentoo-howto.xml: (setq indent-tabs-mode 1) (make-local-variable 'tab-width) (setq tab-width 4) ) (add-to-list 'auto-mode-alist '("[^/]\\.ebuild$" . ebuild-mode)) (add-to-list 'auto-mode-alist '("^/home/mike/project/.+/ebuild$" . ebuild-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.eclass$" . ebuild-mode)) ) (fset '_html-a-href_init [?\C-w ?< ?a ? ?h ?r ?e ?f ?= ?' ?' ?> ?\C-v ?< ?/ ?a ?> ?\C-r ?< ?a right right right right right right right right right]) (defun _html-common-mode-hook_init(mode-map) "HTML related init, common to various mode hooks." (fset '_double_quote [?\C-w ?& ?# ?x ?2 ?0 ?1 ?C ?; ?\C-v ?& ?# ?x ?2 ?0 ?1 ?D ?;]) (fset '_single_quote [?\C-w ?& ?# ?x ?2 ?0 ?1 ?8 ?; ?\C-v ?& ?# ?x ?2 ?0 ?1 ?9 ?;]) ;; Many keys cannot be bound here, because bindings are clobbered in sgml-mode.el. ;; Test first with describe-key-briefly. Changing, change also in swatch.txt. (define-key mode-map [?\C-c ?, ?a ?h] '_html-a-href_init) (define-key mode-map [?\C-c ?, ?i] '_html-id_init) (define-key mode-map [?\C-c ?, ?s] '_html-span-aside) (define-key mode-map [?\C-c ?'] '_single_quote) (define-key mode-map [?\C-c ?"] '_double_quote) ; " just to end the quote, which is confusing font-lock (define-key mode-map [?\M-,] '_sgml-entag_init) ; was something to do with Emacs tags (define-key mode-map [?\M-.] '_sgml-entag-end_init) ; " ) (fset '_html-id_init [?\C-w ?< ?s ?p ?a ?n ? ?i ?d ?= ?' ?' ?> ?\C-v ?< ?/ ?s ?p ?a ?n ?> ?\C-r ?< ?s right right right right right right right right right right]) (defun _html-mode_init() "Initialze HTML mode." (add-to-list 'auto-mode-alist '("[^/]\\.htmlf$" . html-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.jspf?$" . html-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.jspxf?$" . html-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.xht$" . html-mode)) ) (fset '_html-span-aside [?\C-w ?< ?s ?p ?a ?n ? ?c ?l ?a ?s ?s ?= ?' ?a ?s ?i ?d ?e ?' ?>?\C-v ?< ?/ ?s ?p ?a ?n ?>]) (defun _indent-relative-plain_init() (indent-relative t)) (defun _init() "Initialize. A grab-bag of general, initial configuration." (setq auto-save-default nil column-number-mode t default-major-mode 'text-mode default-truncate-lines t frame-title-format (format "%%b %%f") inhibit-startup-message t kill-whole-line t make-backup-files nil query-replace-highlight t read-quoted-char-radix 16 vc-cvs-stay-local nil) (add-hook ; auto-revert to avoid spurious "file changed on disk" edit-guards, for remote files 'find-file-hooks '(lambda () ;;; (when (eq (string-match "/home/mike/code/uhm/mnt/" buffer-file-truename) 0) (when (eq (string-match "~/code/uhm/mnt/" buffer-file-truename) 0) (message "enabling auto-revert-mode (remote file)") (auto-revert-mode 1)) ;;; (when (eq (string-match "/home/mike/var/deploy/votorola/" buffer-file-truename) 0) (when (eq (string-match "~/var/deploy/" buffer-file-truename) 0) (message-box "warning - this is a built file") ; so I don't forget and edit these things (auto-revert-mode 1)) )) (setq-default indent-tabs-mode nil) ;(menu-bar-mode nil) ;;; done earlier, q.v. (put 'narrow-to-region 'disabled nil) (setq require-final-newline t) ; (setq-default require-final-newline t) ;; but don't know how to mask it or unset it locally in major modes where it is unwanted ; so instead I could explicitly set it (locally) ;(setq bell-volume 0) ; enforce silence ;;;;; does not work, but this does: (setq ring-bell-function `_do-nothing_init) (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60)) (blink-cursor-mode nil) ;(mouse-avoidance-mode 'cat-and-mouse) ;;;;; but raises window whenever it scurries ) (defun _java-mode_init() "Initialze Java mode." (add-hook 'java-mode-hook '(lambda () (fset '_comment-down [?/ ?/ left left down]) (fset '_comment-down-overwrite [insert ?/ ?/ insert left left down]) (fset '_comment-old [?/ ?* ?* ?/ left left]) (fset '_comment-up [?/ ?/ left left up]) (fset '_comment-up-overwrite [insert ?/ ?/ insert left left up]) (fset '_javadoc-linkplain [?\C-w ?{ ?@ ?l ?i ?n ?k ?p ?l ?a ?i ?n ? ?\C-v ?} ?\C-r ?{ ?@ ?l ?i ?n ?k C-right ? ?#]) (fset '_open-javadoc [f8 ?/ ?* ?* return ? ? ?* ?/ up ? ?. left]) (fset '_println [?S ?y ?s ?t ?e ?m ?. ?o ?u ?t ?. ?p ?r ?i ?n ?t ?l ?n ?( ? ?" ?= ?" ? ?+ ? ? ?) ?\; left left left]) (define-key java-mode-map [?\C-c ?, ?a ?h] '_html-a-href_init) (define-key java-mode-map [?\C-c ?, ?i] '_html-id_init) (define-key java-mode-map [?\C-c ?, ?s] '_html-span-aside) (define-key java-mode-map [?\C-c ?* ?*] '_open-javadoc) (define-key java-mode-map [?\C-c ?* ?l] '_javadoc-linkplain) (define-key java-mode-map [?\C-c ?/] '_comment-old) (define-key java-mode-map [?\C-c ?p] '_println) (define-key java-mode-map [?\M-,] '_sgml-entag_init) ; was something to do with Emacs tags (define-key java-mode-map [?\M-.] '_sgml-entag-end_init) ; " (define-key java-mode-map [f12] '_comment-down) (define-key java-mode-map [f11] '_comment-down-overwrite) (define-key java-mode-map [tab] 'tab-to-tab-stop) ; C-i still maps to indent, if you need it ;; undo stuff in cc-mode.el (define-key c-mode-base-map "{" 'self-insert-command) (define-key c-mode-base-map "}" 'self-insert-command) (define-key c-mode-base-map ";" 'self-insert-command) (define-key c-mode-base-map "#" 'self-insert-command) (define-key c-mode-base-map ":" 'self-insert-command) (define-key c-mode-base-map "(" 'self-insert-command) (define-key c-mode-base-map ")" 'self-insert-command) (define-key c-mode-base-map [delete] 'delete-char) (define-key c-mode-base-map [backspace] 'delete-backward-char) (define-key c-mode-base-map "," 'self-insert-command) (define-key c-mode-base-map "*" 'self-insert-command) (define-key c-mode-base-map "/" 'self-insert-command) (setq indent-line-function '_indent-relative-plain_init abbrev-mode nil ; otherwise infinite regress involving c-electric-continued-statement() occurs after you type "else" or other words in abbrev table ) (set-fill-column 90) (message nil) )) (font-lock-add-keywords 'java-mode '( ; ("\\<\\(final\\|private\\|protected\\|public\\|static\\|transient\\)\\>" ; 1 font-lock-builtin-face t) ; t override existing fontification ;;;;; but this takes effect in strings, comments, etc., so modify font-lock.el instead ; ;; fontify deletions ; ("^\\(//.*\\)$" 1 'header-line t) ; t override existing fontification ; ;; fontify comment edges ; ("^ *\\(///.*\\)$" 1 'header-line t) ; t override existing fontification ; ("^ *\\(//\\)" 1 'header-line t) ; t override existing fontification ;; javadocs ("^ *\\(?:/\\*\\)?\\* *@?\\(.*\\)$" 1 font-lock-doc-face t) ; t override existing fontification ;; meta-programming keywords ("\\(@\\)\\(\\sw+\\)\\(?: *\\((\\) *\\([^)]*\\)\\()\\)\\)?" (1 font-lock-comment-face)(2 'subdued)(3 'subdued t t)(4 font-lock-comment-face t t)(5 'subdued t t)) ("\\bassert\\b.+?;" 0 font-lock-comment-face t) ("\\(?:textbender.g.util.logging.\\)?[lL]ogger.+\\(?:log\\|severe\\|warning\\|info\\|config\\|fine\\|finer\\|finest\\)(.+?;" 0 font-lock-comment-face t) ;; minor qualifying keywords ("^package " . 'subdued) ("^ *\\(import .*\\);" 1 'subdued) ("\\bvoid\\b" . 'subdued) ;; generic formal parameters ("[^ ]\\(<\\)\\([^>]+\\)\\(>\\)" (1 font-lock-comment-face)(2 font-lock-builtin-face)(3 font-lock-comment-face)) ("static +\\(<\\)\\([^>]+\\)\\(>\\) " (1 font-lock-comment-face)(2 font-lock-builtin-face)(3 font-lock-comment-face)) ;; punctuation ("[,;:]" . font-lock-comment-face) ("['\"]" 0 font-lock-comment-face t) ; t override existing fontification ("[{}]" . 'subdued) ;; synchronized statement ; ("\\b\\(synchronized\\) *(" 1 font-lock-keyword-face t) ; t override existing fontification ("\\b\\(synchronized\\) *(" 1 font-lock-keyword-face) ) ) (add-to-list 'auto-mode-alist '("[^/]\\.css$" . java-mode)) ; for the sake of the comments (add-to-list 'auto-mode-alist '("[^/]\\.js$" . java-mode)) ; JavaScript executable (add-to-list 'auto-mode-alist '("[^/]\\.jsm$" . java-mode)) ; JavaScript module ) (defun _keys_init() "Set initial key bindings and related configuration." (global-unset-key [f10]) ; was tmm-menubar (global-unset-key [?\C-a]) ; was beginning-of-line, but I use "Home" key instead ;(global-unset-key [?\C-d]) ; was delete-char, but I use "Delete" key instead ;;;;; but then the Delete key ceases to function (apparently it is remapped to [d at a low level? (global-unset-key [?\C-o]) ; was open-line, but I use my _open-line-before_init/after (global-unset-key [?\C-x ?u]) ; was advertised-undo, but I use |[- for this (global-unset-key [?\C-x ?\C-z]) ; was iconify-or-deiconify-frame, but I don't ever do that (makes window disappear, as though killed) (global-unset-key [?\C-z]) ; was iconify-or-deiconify-frame (global-set-key [C-prior] 'page-previous-buffer) ; was scroll-right (global-set-key [C-next] 'page-next-buffer) ; was scroll-left (when (string-equal window-system "x") (global-set-key [C-mouse-4] 'page-previous-buffer) (global-set-key [C-mouse-5] 'page-next-buffer)) ;; file ;; ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` (global-set-key [?\C-x ?s] '_save-all-buffers_init) ; was save-some-buffers (which prompts, whereas this is silent) ;; window & frame ;; ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` (global-set-key [?\C-x <] 'scroll-right) ; was scroll-left (global-set-key [?\C-x >] 'scroll-left) ; was scroll-right (global-set-key [M-down] (function (lambda nil (interactive) ; was backward-line-nomark (scroll-up 1)))) (global-set-key [M-up] (function (lambda nil (interactive) ; was forward-line-nomark (scroll-down 1)))) ;; mark & point ;; ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` (setq search-highlight t) ;(setq track-eol t) ; too surprising, when you don't want it ;(transient-mark-mode t) ; already enabled (by pc-selection-mode?) (global-set-key [C-home] 'beginning-of-buffer) ; was beginning-of-buffer-nomark (global-set-key [C-end] 'end-of-buffer) ; was end-of-buffer-nomark; can also use M-> ;; edit ;; ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` (global-unset-key [?\C-j]) ; was newline-and-indent (global-set-key [?\r] 'newline-and-indent) ; was newline (global-set-key [M-return] 'newline) (global-set-key [f5] (function (lambda nil (interactive) (indent-rigidly (region-beginning)(region-end) -1)))) (global-set-key [f6] 'indent-rigidly) (global-set-key [f7] '_newline-before_init) (global-set-key [f9] '_newline-after_init) (global-set-key [f8] '_open-line-before_init) (global-set-key [f10] '_open-line-after_init) ;; kill & yank ;; ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ;(global-set-key [?\C-c] 'copy-region-as-kill-nomark) ;;;;; bad idea, because it's a standard prefix (modes will clobber it) (global-set-key [?\C-v] 'yank) ; was scroll-up (global-set-key [?\M-v] 'yank-pop) ; was scroll-down (global-set-key [?\M-k] '_kill-ring-save-line_init) ; was kill-sentence ;; rectangle ;; ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` (global-unset-key [?\C-x ?r ?y]) ; was yank-rectangle (global-set-key [?\C-x ?r ?v] 'yank-rectangle) ) (fset '_kill-ring-save-line_init "\C-k\C-_") (defun _list-buffer-names-in-order_init() "Return a sorted list of buffer names. Exclude those whose names start or end with '*'." (require 'cl) (let (buffer_names) (loop for a_buffer in (buffer-list) do (let ((a_name (buffer-name a_buffer))) (if (not (or (equal"*" (substring a_name 0 1)) ; starts with * (equal "*" (substring a_name -1)) ; ends with * ;;;(string= a_name "TAGS") ; what was purpose of this? ;;;(string= a_name " SPEEDBAR") ; "? ;;;(equal "*" (substring a_name 1 2)) ; fails for file names of length 1. What was purpose of this? )) (setq buffer_names (cons a_name buffer_names))))) (sort buffer_names '_string-lessp-i))) (defun _load-editable-tasks_init() ; deprecated "Load editable task files. Called by /usr/local/bin/desk-launch _launch_editor(). It would rather specify the files at startup, on the command line; but, with >2 files, Emacs always shows a buffer list, which is annoying. So it loads them afterwards by specifiying this function on the command line." ; (interactive) ;(find-file "/home/mike/client/Alpha_Laboratories/time/.month-so-far") ;(find-file "/home/mike/client/Alpha_Laboratories/._/alpha.task") ;(find-file "/home/mike/mnt/jaxe/._/jaxe.task") ;(find-file "/home/mike/mnt/matchmedia/._/matchmedia.task") ;(find-file "/home/mike/personal/._/personal.task") ;(find-file "/home/mike/project/textbender/a/b/demo/demo.task") ;(find-file "/home/mike/project/textbender/a/b/rhinohideDemo/rhinohideDemo.task") ;(find-file "/home/mike/project/textbender/a/r/desk/desk.task") ;(find-file "/home/mike/project/textbender/a/r/page/page.task") (find-file "/home/mike/project/textbender/a/r/page/navmod/navmod.task") ;(find-file "/home/mike/project/textbender/a/u/fragmentTransfer/fragmentTransfer.task") ;(find-file "/home/mike/project/textbender/a/u/shadowPoint/shadowPoint.task") ;(find-file "/home/mike/project/textbender/a/u/shadowSelect/shadowSelect.task") ;(find-file "/home/mike/project/textbender/d/gene/gene.task") ;(find-file "/home/mike/project/textbender/d/pair/pair.task") ;(find-file "/home/mike/project/textbender/d/simplex/simplex.task") ;(find-file "/home/mike/project/textbender/o/rhinohide/rhinohide.task") ;(find-file "/home/mike/project/textbender/o/revision/revision.task") (find-file "/home/mike/project/textbender/textbender.task") ;(find-file "/home/mike/system/system.task") (find-file "/home/mike/.task")) ; last, per /usr/local/bin/desk-launch _launch_editor() $last_file_to_load ;(find-file "/home/mike_obsidian.zelea.com/.task")) ; " (defun _modes_init() "Configure major and minor modes." (_ebuild-mode_init) (_html-mode_init) (_java-mode_init) (_mutt-mode_init) (_perl-mode_init) (_sh-mode_init) (_sgml-mode_init) (_task-sheet-mode_init) (_text-mode_init) ;(add-to-list 'interpreter-mode-alist '("python" . python-mode)) ;(autoload 'python-mode "python-mode" "Python editing mode." t) (add-to-list 'interpreter-mode-alist '("runscript" . shell-script-mode)) ; Gentoo init scripts (add-to-list 'auto-mode-alist '("[./]properties$" . shell-script-mode)) ; Java properties ) (defun _mutt-mode_init() "Initialze Mutt mode." (define-derived-mode mutt-mail-mode text-mode "Mutt-Mail" "For composing mail in a buffer invoked by Mutt." (setq show-trailing-whitespace nil) ; (setq indent-line-function 'indent-relative) (defvar mutt-mail-font-lock-keywords (list '("^\\(?:From: \\|Cc: \\|Bcc: \\|Reply-To: \\|In-Reply-To: \\).*$" . font-lock-comment-face) '("^\\(?:To: \\).*$" . font-lock-string-face) '("^\\(?:Subject: \\).*$" . font-lock-type-face) '("^\\(?: *> *>\\)+ *\\(?:[^ >\xA].*\\)?$" ; quote me (even) . font-lock-comment-face) '("^ *>.*$" ; quote other (odd) . font-lock-string-face) '("^-- $" ; signature delimiter . font-lock-comment-face) '("^\\(?:Mike\\|Michael Allan\\)$" ; signature . font-lock-comment-face) ) "For mutt-mail-mode.") (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(mutt-mail-font-lock-keywords t)) ) (add-to-list 'auto-mode-alist '("mutt-.+-[0-9]+-[0-9]+\\'" . mutt-mail-mode)) (add-hook 'mutt-mail-mode-hook '(lambda () ; (make-local-variable 'require-final-newline) ; (setq require-final-newline nil) ;;;;;; no effect ; rather than unsetting it like this, explicitly, I would have to set it explicitly everywhere else [just don't like how Mutt's viewer shows the final newline] but it's not worth it [and mail handlers append newlines etc. anyway, it seems] (re-search-forward "^$") ; move down to 1st blank line, past the headers (forward-line) ; and one more, to beginning of message body )) ) (fset '_newline-after_init [end M-return]) (fset '_newline-before_init [home M-return up]) (fset '_open-line-after_init [end return]) (fset '_open-line-before_init [end return ?\C-x ?\C-t up up end]) (defun _perl-mode_init() "Initialze Perl mode." (add-hook 'perl-mode-hook '(lambda () (fset 'comment-down [?# left down]) (fset 'comment-down-overwrite [insert ?# insert left down]) (fset 'comment-up [insert ?# insert left up]) (fset 'comment-up-overwrite [insert ?# left up]) (define-key perl-mode-map [f12] 'comment-down) (define-key perl-mode-map [f11] 'comment-down-overwrite) ;; undo stuff in perl-mode.el (define-key perl-mode-map "{" 'self-insert-command) ; auto-indent too often wrong (define-key perl-mode-map "}" 'self-insert-command) (define-key perl-mode-map ";" 'self-insert-command) (define-key perl-mode-map ":" 'self-insert-command) (define-key perl-mode-map "\t" 'tab-to-tab-stop) ; C-i still maps to indent, if you need it (set-fill-column 90) (setq indent-line-function '_indent-relative-plain_init) (message nil) )) (font-lock-add-keywords 'perl-mode '( ;; subdue punctuation ("[,;:]" . font-lock-comment-face) ("['\"]" 0 font-lock-comment-face t) ; t override existing fontification ("[{}$@%*]" . 'subdued) ; unless already fontified )) ) (defun _save-all-buffers_init() (interactive) (save-some-buffers t)) (defun _sh-mode_init() "Initialze shell mode." (add-hook 'sh-mode-hook '(lambda () ; (make-local-variable 'require-final-newline) ; (setq require-final-newline t) (define-key sh-mode-map [tab] 'tab-to-tab-stop) ; C-i still maps to indent, if you need it )) ) (fset '_sgml-entag_init [?\C- M-left ?\C-w ?< ?\C-v ?>]) (fset '_sgml-entag-end_init "\C-r<\C-m") (defun _sgml-mode_init() "Initialze SGML mode." (add-to-list 'auto-mode-alist '("[./]tld$" . sgml-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.ent$" . sgml-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.mod$" . sgml-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.xsd$" . sgml-mode)) (add-to-list 'auto-mode-alist '("[^/]\\.xslt$" . sgml-mode)) (add-hook 'sgml-mode-hook '(lambda () ; (make-local-variable 'require-final-newline) ; (setq require-final-newline t) (_html-common-mode-hook_init sgml-mode-map) (define-key sgml-mode-map [tab] 'tab-to-tab-stop) ; C-i still maps to indent, if you need it ;; undo stuff in sgml-mode.el (define-key sgml-mode-map "/" 'self-insert-command) ; refuses to obey insert/overwrite mode (set-fill-column 90) (message nil) )) ; (font-lock-add-keywords ; 'sgml-mode ; '( ; ) ; ) ;;;;;; Fails to affect derived modes like html, so I instead patch sgml-mode.el ) (defun _string-lessp-i (string1 string2) "Like 'string-lessp' but ignores case." (setq string1(downcase string1)) (setq string2(downcase string2)) (string-lessp string1 string2) ) (defun _t-b-desktop_init() "Initialize interface to textbender.recombinant.assembly.desktop." (setq load-path (append (list "/home/mike/var/deploy/recombinant-desktop") load-path)) ;(setq load-path (append (list "/tmp/x/recombinant-desktop-0.0.7") load-path)) ;(setq load-path (append (list "/tmp/y/recombinant-desktop-0.0.7") load-path)) (load "textbender/recombinant/assembly/desktop/editor/emacs.gnu.org/interface") (setq java-launcher "/opt/jdk/jre/bin/java") ; "java" is the default (setq population-server "http://localhost:8080") ; "http://ivory.zelea.com:8080" is the default, which is best for most users (setq target-gene-java-option-list ; not required, the default is an empty list (list "-Dt-r-genotypeFont=Courier New-16" ; format per java.awt.Font.decode(), e.g.: 'Georgia-18' or 'Serif BOLD 16' ;; for debugging, in-development testing: "-Djava.util.logging.config.file=/home/mike/mnt/textbender/recombinant/assembly/desktop/editor/java-logging.properties" ; which is also at: http://zelea.com/.config/textbender/recombinant/assembly/desktop/editor/java-logging.properties "-enableassertions:textbender..." "-Xfuture" )) (add-hook 'sgml-mode-hook '(lambda () ;; key bindings here are apt to be clobbered by sgml-mode.el ;; test first with describe-key-briefly (define-key sgml-mode-map [?\C-c ?g] 'mark-gene) (define-key sgml-mode-map [?\C-c ?t] 'shift-target-gene) ; see also 'target-gene, which creates additional targets (define-key sgml-mode-map [?\C-c ?u] 'untarget-gene) )) ;(define-derived-mode t-r-html-mode ; html-mode ; "t-r-html" "For ." ; ; (defvar t-r-html-font-lock-keywords ; (list ; '("a" ; . font-lock-comment-face) ; '("1" ; 1 font-lock-comment-face) ; ) ; "For t-r-html-mode.") ; ;; (make-local-variable 'font-lock-defaults) ;; (setq font-lock-defaults '(t-r-html-font-lock-keywords t)) ;;;;;; blows away HTML/SGML font locks, so: ;; (font-lock-add-keywords 'html-mode t-r-html-font-lock-keywords) ;;;;;; no effect ; ) ;;;;; resort to modifying sgml.el directly ) (defun _task-sheet-mode_init() "Initialze Task-Sheet mode." (define-derived-mode task-sheet-mode fundamental-mode "Task-Sheet" "for .task project plans" (setq indent-line-function '_indent-relative-plain_init) (defconst task-sheet-font-lock-keywords-a (list '("^/.*$" ; / ~ ~~~ complete . font-lock-comment-face) '("^ *\\(/\\) \\(.*\\)$" ; / ~ ~~~ ignore (1 'subdued) (2 font-lock-comment-face)) '("^ *// .*$" ; // ~~~ reason for ignoring . 'subdued) '("^ *\\((\\) \\(.*\\)$" ; ( ~ ~~~ block (1 'font-lock-string-face) (2 font-lock-comment-face)) '("^ *(( .*$" ; (( ~~~ reason for block . 'font-lock-string-face) ) "high priority rules") (defconst task-sheet-font-lock-keywords-filter (list '("^ *\\([.]\\) \\(.*\\)$" ; . ~ ~~~ filter (1 'font-lock-string-face) (2 font-lock-comment-face)) ) "filter rules") (defconst task-sheet-font-lock-keywords-b (list '("^ *_+[ \\t]*$" ; ________ section top line . font-lock-comment-face) '("\\(?:[=!?] \\)?\\(.*\\)`[ \\t]*$" ; ~~~ ` section title . 1) '("^\\(?: [ .] \\)*=\\(.*\\)$" ; = ~~~ task 1 font-lock-function-name-face) '("^\\(?: [ .] \\)*\\+\\(.*\\)$" ; + ~~~ special task 1 font-lock-type-face) '("^\\(?: [ .] \\)*\\?\\(.*\\)$" ; ? ~~~ priority task 1 font-lock-warning-face) '("^\\(?: [ .] \\)*!\\(.*\\)$" ; ! ~~~ priority task 1 'error) ) ; ~ ~~~ note (i.e. preceded by other char) "all other rules") ;; Font lock decoration levels. ;; These essentially turn filter decorations off or on (default). ;; Use font-lock-decoration-toggle to switch between them. (defconst task-sheet-font-lock-keywords-0 (append task-sheet-font-lock-keywords-a task-sheet-font-lock-keywords-b nil) ; last append item, not copied like those above; so use a dummy [i could just use the list function instead] "disables filter decorations") (defconst task-sheet-font-lock-keywords-1 (append task-sheet-font-lock-keywords-a task-sheet-font-lock-keywords-filter task-sheet-font-lock-keywords-b) "normal decorations") (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '( (task-sheet-font-lock-keywords-0 task-sheet-font-lock-keywords-1) t)) ) (add-hook 'task-sheet-mode-hook '(lambda () (_html-common-mode-hook_init task-sheet-mode-map) ; (make-local-variable 'require-final-newline) ; (setq require-final-newline t) (define-key task-sheet-mode-map [?\t] 'tab-to-tab-stop) (fset 'comment-down [?/ left down]) (fset 'comment-down-overwrite [insert ?/ insert left down]) (fset 'comment-up [?/ left up]) (fset 'comment-up-overwrite [insert ?/ insert left up]) (define-key task-sheet-mode-map [f12] 'comment-down) (define-key task-sheet-mode-map [f11] 'comment-down-overwrite) )) ) (defun _text-mode_init() "Initialze text mode." (add-hook 'text-mode-hook '(lambda () (define-key text-mode-map [tab] 'tab-to-tab-stop) ; C-i still maps to indent, if you need it )) (add-to-list 'auto-mode-alist '("/ChangeLog$" . text-mode)) ; was Change Log, which is not Gentoo format ) (defun _x_init() "Initialize for X Window System." (global-set-key [S-down-mouse-1] 'mouse-save-then-kill) ; was mouse-set-font (global-set-key [mouse-3] 'mouse-set-font) ; was mouse-save-then-kill (setq-default show-trailing-whitespace t) (setq x-select-enable-clipboard t) ; else kills are invisible to other apps (add-to-list 'default-frame-alist '(unsplittable . t)) (global-font-lock-mode 1) ; Cursor. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (show-paren-mode 1) ; colouring them when under point (defun adjust-cursor-type (&optional frame) "Set cursor colour according to overwrite-mode." (modify-frame-parameters (or frame (selected-frame)) (list (cons 'cursor-type (if overwrite-mode 'box 'bar))))) ; (defadvice overwrite-mode (after adjusted-cursor activate) (adjust-cursor-type)) ; (defadvice binary-overwrite-mode (after adjusted-cursor activate) (adjust-cursor-type)) ; (add-hook 'after-make-frame-functions 'adjust-cursor-type) ; (defadvice other-window (after adjusted-cursor activate) (adjust-cursor-type)) ; (defadvice switch-to-buffer (after adjusted-cursor activate) (adjust-cursor-type)) ;; incomplete -- overwrite mode is per buffer, but cursor type is per frame -- need more hooks to tie them together -- easier to use brute force: (add-hook 'post-command-hook 'adjust-cursor-type) ; inefficient, will slow all commands OPT ; Prevent border appearing when frame loses focus. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; (set-face-background 'border "red") ;; works on in-focus border ; (set-face-foreground 'border "yellow") ;; does nothing ; (set-border-color red) ;; works on in-focus border ; Emacs.borderWidth: (in .Xresources; does nothing) ; ; ; (setq default-frame-alist ; ; '((top . 200) (left . 400) ; ; (border-width . 10) ; ; (width . 80) (height . 40) ; ; (cursor-color . "white") ; ; (cursor-type . box) ; ; (foreground-color . "wheat") ; ; (background-color . "black") ; ; )) ; ;; other parameters in this test code work, you can see 'em in new frames, ; ;; but not border-width (I suspect that is supposed to be WM borders, anyway; ; ;; and not the one I'm looking for) ; ;; Nothing works except this, in .Xresources: ; ; Emacs.foreground: black ; ;; Then setting the proper colour here, in .emacs : ; (set-face-foreground 'default "rgb:E9/E9/E9") ; (set-face-foreground 'default "rgb:40/40/40") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (progn (progn ; these progn for indentation only (_activate-behaviour-modes_init) ; early, so they don't clobber other, later config (_init) (when (string-equal window-system "x") (_x_init)) (_keys_init) (_modes_init) ;;;(_t-b-desktop_init) ))