X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmessagexmas.el;h=a375cd1490e31747f8590d385cf4d0622b6ca662;hb=6dec94a79261794ce4ce843a2780d23a4effa334;hp=c85cbb9b5779481f0afea1b4b8c4267fedd44258;hpb=d12901e0b4585ca9b0a270fbd71c82bb73011712;p=gnus diff --git a/lisp/messagexmas.el b/lisp/messagexmas.el index c85cbb9b5..a375cd149 100644 --- a/lisp/messagexmas.el +++ b/lisp/messagexmas.el @@ -1,7 +1,7 @@ ;;; messagexmas.el --- XEmacs extensions to message -;; Copyright (C) 1996 Free Software Foundation, Inc. +;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc. -;; Author: Lars Magne Ingebrigtsen +;; Author: Lars Magne Ingebrigtsen ;; Keywords: mail, news ;; This file is part of GNU Emacs. @@ -25,7 +25,9 @@ ;;; Code: -(defvar message-xmas-dont-activate-region nil +(require 'nnheader) + +(defvar message-xmas-dont-activate-region t "If t, don't activate region after yanking.") (defvar message-xmas-glyph-directory nil @@ -37,37 +39,22 @@ automatically.") 'default-toolbar nil) "*If nil, do not use a toolbar. -If it is non-nil, it must be a toolbar. The five legal values are +If it is non-nil, it must be a toolbar. The five valid values are `default-toolbar', `top-toolbar', `bottom-toolbar', `right-toolbar', and `left-toolbar'.") -(defvar message-toolbar +(defvar message-toolbar '([message-spell ispell-message t "Spell"] [message-help (Info-goto-node "(Message)Top") t "Message help"]) "The message buffer toolbar.") (defun message-xmas-find-glyph-directory (&optional package) (setq package (or package "message")) - (let ((path load-path) - (dir (symbol-value - (intern-soft (concat package "-xmas-glyph-directory")))) - result) + (let ((dir (symbol-value + (intern-soft (concat package "-xmas-glyph-directory"))))) (if (and (stringp dir) (file-directory-p dir)) dir - ;; We try to find the dir by looking at the load path, - ;; stripping away the last component and adding "etc/". - (while path - (if (and (car path) - (file-exists-p - (setq dir (concat - (file-name-directory - (directory-file-name (car path))) - "etc/" (or package "message") "/"))) - (file-directory-p dir)) - (setq result dir - path nil) - (setq path (cdr path)))) - result))) + (nnheader-find-etc-directory package)))) (defun message-xmas-setup-toolbar (bar &optional force package) (let ((dir (message-xmas-find-glyph-directory package)) @@ -105,6 +92,33 @@ If it is non-nil, it must be a toolbar. The five legal values are (fset 'message-exchange-point-and-mark 'message-xmas-exchange-point-and-mark) +(defun message-xmas-maybe-fontify () + (when (featurep 'font-lock) + (font-lock-set-defaults))) + +(defun message-xmas-make-caesar-translation-table (n) + "Create a rot table with offset N." + (let ((i -1) + (table (make-string 256 0)) + (a (mm-char-int ?a)) + (A (mm-char-int ?A))) + (while (< (incf i) 256) + (aset table i i)) + (concat + (substring table 0 A) + (substring table (+ A n) (+ A n (- 26 n))) + (substring table A (+ A n)) + (substring table (+ A 26) a) + (substring table (+ a n) (+ a n (- 26 n))) + (substring table a (+ a n)) + (substring table (+ a 26) 255)))) + +(when (>= emacs-major-version 20) + (fset 'message-make-caesar-translation-table + 'message-xmas-make-caesar-translation-table)) + +(add-hook 'message-mode-hook 'message-xmas-maybe-fontify) + (provide 'messagexmas) ;;; messagexmas.el ends here