;;;
;;; .emacs additions from mud-telnet-Sleeper.el (mud.el from Sleeper)
;;;
;;;
;;; Uncomment to make Emacs search ~/emacs/lisp for lisp code. (Recommended)
;;;
;;;(setq load-path (append
;;; (list (concat (getenv "HOME") "/emacs/lisp"))
;;; load-path))
(if window-system
(progn
;; use 'light instead of 'dark if you have a light background
(setq hilit-background-mode 'dark
hilit-mode-enable-list '(not empire-map-mode text-mode)
hilit-face-check nil ;; use t if changing fonts
hilit-auto-rehighlight-fallback '(20000 . 200)
hilit-auto-rehighlight 200) ;; max amount of rehighlighting
;;; Define colors available for use in regular expressions later:
;;; 4 fields: name, treatment for light bg, treatment for dark bg, trtmnt for mono.
;;; (You can cheat on the modes you wont be using if you feel like it.)
(setq hilit-user-face-table
;;; ;; face light dark mono
'(;;;(prompt blue-bold cyan-bold default-bold)
(prompt blue-bold cyan default-bold)
;;;(input firebrick-bold-italic khaki-bold default-bold)
(input firebrick-bold-italic khaki default-bold)
;;;(error red-bold yellow bold)
(error red yellow bold)
;;; YOU
(mud-player-name blue cyan-italic bold)
;;; BUDDIES
(mud-buddy pink pink bold-italic)
;;; PAGES
(mud-page orange yellow/gray50 bold-italic)
;;; [Helpers]
(mud-helpers blue orange/gray50 bold-italic)
;;; Help>>
(mud-help brown yellow/black bold-italic)
))
(setq hilit-hook-list
'(yank yank-pop recenter find-file info mail gnus dired))
(setq hilit-new-style-patterns t) ;; use mega single patterns
(require 'hl319)
;;
;; Set up mud highlighting
;;
(if (featurep 'hilit19)
;;; Hilit patterns are usaully hard to reset once they are loaded.
;;; I define a function here called mud-hilit, so you can change
;;; the patterns, M-x mud-hilit and immediately see the changes.
(defun mud-hilit ()
(interactive)
(hilit-set-mode-patterns
'mud-interactive-mode
;;; OK. Big, ugly regexps. Followed by nil (meaning the 1st regexp
;;; matches the complete pattern, instead of specifying the start with
;;; the ending in the 2nd regexp) The third field is a color
;;; predefined in hl319, or defined by you (as above) with the
;;; hilit-user-face-table
'(
;;; First is YOU. Default cyan as defined above.
;;; - Your connecting player name is handled by mud.el
;;; - If you're gursting, change none_ to the guest name, M-C-x
;;; to eval the function, then M-x mud-hilit to turn it on.
;;; (Only necesary when forcing a name. like a guest name.)
;;; - the ``to you, \"'' lights up the directed say
;;; - You can take out the ``blue'' if it annoys you...
;;; - If you change morphs a lot, you may wish to add your common
;;; aliases, since only the main connecting name is handled by
;;; mud-telnet-Sleeper.el automagically
;;; Note the escaping of the or (`|') operator, also note that
;;; \\b is useful to match word boundaries. For example, the
;;; ``blue'' in ``bluegrass'' will not be highlighted with this pattern
("none_Guest\\|to you, \"\\|\\bblue\\b" nil mud-player-name)
;;; Now pals: remember \\b if their name is found commonly in other words.
("Sleeper\\|Quinn" nil mud-buddy)
;;; Helpline & buffer overflow
("^HELP>.*\\|^>> ?Network buffer overflow:" nil mud-help)
;;; [+][Helpers]
("^\\[.\\]\\[Helpers\\].*" nil mud-helpers)
;;; pages -- you'll want to match these (somewhat) with the regexp in
;;; mud-telnet-Sleeper.el
("^-> .*\\|.* pages?[,:].*\\|.* responds?,.*\\|^\\[from .*\\].*\\|^(from .*).*\\|<hiding under \\(the\\|your\\) bed>.*\\|<in the hot tub>.*\\|^From the shadows, .*\\|^You have new mail .*" nil mud-page)
)
nil
t)
(setq hilit-buffer-compiled-patterns nil)
(hilit-rehighlight-buffer)
)
)
;;; Run it, the first time.
(mud-hilit)
)
)
;;;
;;; MUD stuff
;;;
;;; MOO
;;; (autoload 'mud "mud-telnet-Sleeper"
;;; "Starts mud mode."
;;; t)
;;; Just load it, so we don't have to worry about using eval-after-load...
(load "mud-telnet-Sleeper" nil t)
;;; don't use telnet (Useful behind (old) firewalls mainly)
(setq mud-use-telnet nil)
;;; keep prompt at bottom
(setq mud-use-entire-window t)
;;; pop buffer when a page comes
(setq mud-show-page t)
;;; The number of commands to keep in history
(setq mud-input-history-size 50)
;;; OK, now for a better function for when a page arrives.
(defun mud-check-page ()
"Look for page message, and pop-up buffer if specified."
(goto-char (point-min))
(while (not (eobp))
(if (and mud-show-page (looking-at (mud-page-regexp)))
(progn
;(make-frame-visible) ; <- deiconify, but don't raise
(raise-frame (selected-frame)) ; <- deiconify and/or raise
(display-buffer (current-buffer))
(message "You are being paged in %s"
(buffer-name (current-buffer)))))
(beginning-of-line 2)))
;;; ################################################
;;; ################################################
;;; Now, a set of tweaks for hl319...
;;; Tweak hilit-repaint-command so that bogus rehighlights don't occur
;;; (only in RMAIL mode (so far) (Hmmm.... now we have a parse
;;; function or folding-mode.... let's see if it still makes sense)
(defun hilit-repaint-command (arg)
"Rehighlights according to the value of hilit-auto-rehighlight, or the
prefix argument if that is specified. Warning: If a parser is associated
with a mode, then this function will execute the parser function and
*not* repaint according to the argument.
\t\\[hilit-repaint-command]\t\trepaint according to hilit-auto-rehighlight
\t^U \\[hilit-repaint-command]\trepaint entire buffer
\t^U ^U \\[hilit-repaint-command]\trecompile patterns, then repaint buffer
\t^U - \\[hilit-repaint-command]\trepaint current 'defun' around cursor
\t^U 0 \\[hilit-repaint-command]\trepaint visible portion of buffer
\t^U n \\[hilit-repaint-command]\trepaint n lines to either side of point"
(interactive "P")
(let (st en quietly (parse-fn (cdr (assq major-mode hilit-parser-alist))))
(or arg (setq arg hilit-auto-rehighlight))
(cond (parse-fn ;; if there is a parse function, ignore any arg!!
(funcall parse-fn quietly)) ;; used only for RMAIL... short...
((or (eq arg 'visible) (eq arg 0))
(setq st (window-start) en (window-end) quietly t))
((or (eq arg 'defun) (eq arg '-))
(setq st (save-excursion (beginning-of-defun) (point))
en (save-excursion (end-of-defun) (point))
quietly t))
((numberp arg)
(setq st (save-excursion (forward-line (- arg)) (point))
en (save-excursion (forward-line arg) (point))))
((consp arg)
(cond ((eq (car arg) 64)
(setq hilit-buffer-compiled-patterns nil)
(let ((hilit-new-style-patterns
(not hilit-new-style-patterns)))
(hilit-rehighlight-buffer)))
(t
(and (eq (car arg) 16)
(setq hilit-buffer-compiled-patterns nil))
(hilit-rehighlight-buffer))))
(t (hilit-rehighlight-buffer)))
(if st
(hilit-rehighlight-region st en quietly))))
;;;
;;; Sure is annoying not getting highlighting.... This fixes it.
;;;
(defun hilit-find-file-hook ()
"Find-file hook for hilit package. See the variable hilit-auto-highlight."
(cond ((and hilit-auto-highlight
(assq major-mode hilit-patterns-alist))
(if (> buffer-saved-size (car hilit-auto-rehighlight-fallback))
(setq hilit-auto-rehighlight
(cdr hilit-auto-rehighlight-fallback)))
(if (> buffer-saved-size hilit-auto-highlight-maxout)
(hilit-repaint-command nil)
(hilit-rehighlight-buffer)
(set-buffer-modified-p nil)))))
;;; need this for big RMAIL files
(defun hilit-rehighlight-message (quietly)
"Highlight a buffer containing a news article or mail message."
(save-excursion
(goto-char (point-min))
(re-search-forward (concat "^\\("
(regexp-quote mail-header-separator)
"\\)?$")
nil 'noerr)
(hilit-unhighlight-region (point-min) (point-max) quietly)
(hilit-highlight-region (point-min) (point) 'msg-header quietly)
(if (> buffer-saved-size hilit-auto-highlight-maxout)
(hilit-highlight-region
(point)
(save-excursion
(forward-line
(if (numberp hilit-auto-rehighlight) hilit-auto-rehighlight 100))
(point))
'msg-body quietly)
(hilit-highlight-region (point) (point-max) 'msg-body quietly))))
(if (not (string-match "\\.19\\." emacs-version))
(defun hilit-install-line-hooks ()
"Enable on-the-fly highlighting in the current buffer only.
Before-change-hook gets trashed, presently."
(interactive)
(make-local-variable 'after-change-functions)
(or (memq 'hilit-rehighlight-changed-lines after-change-functions)
(setq after-change-functions (cons 'hilit-rehighlight-changed-lines
after-change-functions))))
)
;;; from news
(if (and window-system (featurep 'hilit19) (not (string-match "\\.19\\." emacs-version)))
(add-hook 'find-file-hooks 'hilit-install-line-hooks)
)
;;;
;;; Highlight yanked mail messages
;;;
(if (featurep 'hilit19)
(progn
(if (not (boundp 'mail-citation-hook))
(add-hook 'mail-citation-hook 'mail-indent-citation))
(add-hook 'mail-citation-hook 'hilit-rehighlight-message-quietly t)
)
)
;;;
;;; fix highliting of large yanks...just put out the message for now.
;;;
(defun hilit-yank (arg)
"Yank with rehighlighting"
(interactive "*P")
(let ((transient-mark-mode nil))
(yank arg)
(and hilit-auto-rehighlight
(hilit-rehighlight-region (region-beginning) (region-end)
(< (abs (- (region-beginning) (region-end))) 10000)))
(setq this-command 'yank)))
(put 'hilit-yank 'delete-selection t)
(defun hilit-yank-pop (arg)
"Yank-pop with rehighlighting"
(interactive "*p")
(let ((transient-mark-mode nil))
(yank-pop arg)
(and hilit-auto-rehighlight
(hilit-rehighlight-region (region-beginning) (region-end)
(< (abs (- (region-beginning) (region-end))) 10000)))
(setq this-command 'yank)))
;;;
;;; Fix Info patterns
;;;
(if (and window-system (featurep 'hilit19))
(hilit-set-mode-patterns
'Info-mode
'((:buildme:
(jargon-entry "^\\* [^:]+:+")
(jargon-xref "\\*[Nn]ote\\b[^:]+:+")
(jargon-xref " \\(Next\\|Prev\\|Up\\):")
;; keywords for the emacs & lisp manuals
(jargon-keyword "^[ \t]*[*][A-Za-z][^*\n]+[*]" ; bfd.info (output of 'chew')
(:and: "- " (:or: "Variable" "Function" "Macro" "Command"
"Special Form" "User Option") ":.*$"))
)))
)
;;;
;;; End of .emacs additions from mud-telnet-Sleeper.el (mud.el from Sleeper)
;;;