From: yamaoka Date: Thu, 29 Nov 2001 06:36:00 +0000 (+0000) Subject: * gnus-vers.el (gnus-revision-number): Increment to 09. X-Git-Tag: t-gnus-6_15_4-09-quimby X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=68c1598d616ad10f0aa1bbfa2f6734b4d3b52a11;p=elisp%2Fgnus.git- * gnus-vers.el (gnus-revision-number): Increment to 09. * canlock-om.el: New file. * dgnushack.el: Load canlock-om.el for compiling canlock.el when `MULE' is bound. (dgnushack-unexporting-files): Add canlock-om.el when `MULE' is not bound. * message.el: Require `canlock-om' when Mule is running; autoload cus-edit for the function `customize-save-variable'. * nnheader.el (customize-save-variable): Remove. --- diff --git a/ChangeLog b/ChangeLog index a7a4180..cfca5e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-11-29 Katsumi Yamaoka + + * lisp/gnus-vers.el (gnus-revision-number): Increment to 09. + + * lisp/canlock-om.el: New file. + * lips/dgnushack.el: Load canlock-om.el for compiling canlock.el + when `MULE' is bound. + (dgnushack-unexporting-files): Add canlock-om.el when `MULE' is + not bound. + * lisp/message.el: Require `canlock-om' when Mule is running; + autoload cus-edit for the function `customize-save-variable'. + * lisp/nnheader.el (customize-save-variable): Remove. + 2001-11-26 Katsumi Yamaoka * lisp/message.el (message-strip-special-text-properties): Default diff --git a/lisp/canlock-om.el b/lisp/canlock-om.el new file mode 100644 index 0000000..831b7f5 --- /dev/null +++ b/lisp/canlock-om.el @@ -0,0 +1,215 @@ +;;; canlock-om.el --- Mule 2 specific functions for canlock +;; Copyright (C) 2001 Katsumi Yamaoka + +;; Author: Katsumi Yamaoka +;; Keywords: mule, cancel-lock + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; This program is used to make canlock.el work with Mule 2.3 based on +;; Emacs 19.34. See README.ja in the canlock distribution for details. + +;;; Code: + +(eval-and-compile + (cond ((and (boundp 'emacs-major-version) + (> emacs-major-version 19)) + (error "\ +Error: You should never use canlock-om.el(c) for this environment")) + ((and (boundp 'MULE) + (boundp 'emacs-major-version) + (= emacs-major-version 19) + (>= emacs-minor-version 29))) + (t + (error "Error: Canlock does not support this version of Emacs")))) + +(eval-when-compile + (require 'cl)) + +(require 'custom) +(eval-and-compile + (unless (fboundp 'custom-declare-variable) + (error "Error: Canlock requires new custom"))) + +(eval-when-compile + (unless (fboundp 'byte-compile-file-form-custom-declare-variable) + (defun byte-compile-file-form-custom-declare-variable (form) + ;; Bind defcustom'ed variables. + (if (memq 'free-vars byte-compile-warnings) + (setq byte-compile-bound-variables + (cons (nth 1 (nth 1 form)) byte-compile-bound-variables))) + (if (memq ':version (nthcdr 4 form)) + ;; Make the variable uncustomizable. + `(defvar ,(nth 1 (nth 1 form)) ,(nth 1 (nth 2 form)) + ,(substring (nth 3 form) + (if (string-match "^[\t *]+" (nth 3 form)) + (match-end 0) + 0))) + ;; Ignore unsupported keyword(s). + (if (memq ':set-after (nthcdr 4 form)) + (let ((newform (list (car form) (nth 1 form) + (nth 2 form) (nth 3 form))) + (args (nthcdr 4 form))) + (while args + (or (eq (car args) ':set-after) + (setq newform (nconc newform (list (car args) + (car (cdr args)))))) + (setq args (cdr (cdr args)))) + newform) + form))) + (put 'custom-declare-variable 'byte-hunk-handler + 'byte-compile-file-form-custom-declare-variable)) + + (define-compiler-macro with-temp-buffer (&whole form &rest forms) + (let ((def (if (fboundp 'with-temp-buffer) + (symbol-function 'with-temp-buffer)))) + (if (and def + (consp def) + (or (eq (car def) 'macro) + (and (eq (car def) 'autoload) + (memq (nth 4 def) '(macro t))))) + form + ;; The function definition is imported from APEL. + `(let ((obuffer (current-buffer)) + (buffer (generate-new-buffer " *temp*"))) + (unwind-protect + (progn + (set-buffer buffer) + ,@forms) + (if (buffer-name buffer) + (kill-buffer buffer)) + (if (buffer-live-p obuffer) + (set-buffer obuffer)))))))) + +(autoload 'base64-encode "base64") + +(defcustom canlock-base64-encode-function 'base64-encode-string + "Function to call to base64 encode a string." + :type '(radio (function-item base64-encode-string) + (function-item base64-encode) + (function-item canlock-base64-encode-string-with-mmencode) + (function :tag "Other")) + :group 'canlock) + +(defcustom canlock-mmencode-program "mmencode" + "Name of mmencode program." + :type 'string + :group 'canlock) + +(defcustom canlock-mmencode-args-for-encoding nil + "Arguments passed to mmencode program for encoding." + :type 'sexp + :group 'canlock) + +(defun canlock-base64-encode-string-with-mmencode (string) + "Base64 encode a string using mmencode." + (with-temp-buffer + (setq mc-flag nil) + (insert string) + (let ((default-process-coding-system (cons *iso-2022-jp*dos *noconv*)) + program-coding-system-alist selective-display) + (apply 'call-process-region (point-min) (point-max) + canlock-mmencode-program t t nil + canlock-mmencode-args-for-encoding)) + (goto-char (point-max)) + (skip-chars-backward "\n") + (buffer-substring (point-min) (point)))) + +;; The following macros will only be used to byte-compile canlock.el. +(eval-when-compile + (define-compiler-macro base64-encode-string + (&whole form string &optional no-line-break) + (if (and (string-equal (buffer-name) " *Compiler Input*") + (string-equal ";;; canlock.el" + (buffer-substring (point-min) + (min (+ (point-min) 14) + (point-max))))) + (if no-line-break + `(let ((string ,string)) + (if ,no-line-break + (with-temp-buffer + (insert (funcall canlock-base64-encode-function string)) + (goto-char (point-min)) + (while (search-forward "\n" nil t) + (delete-char -1)) + (buffer-string)) + (funcall canlock-base64-encode-function string))) + `(funcall canlock-base64-encode-function ,string)) + form)) + + (define-compiler-macro split-string (&whole form string &optional pattern) + (if (and (string-equal (buffer-name) " *Compiler Input*") + (string-equal ";;; canlock.el" + (buffer-substring (point-min) + (min (+ (point-min) 14) + (point-max))))) + ;; The function definition is imported from APEL. + (if pattern + `(let ((string ,string) + (pattern ,pattern) + (start 0) + parts) + (while (string-match pattern string start) + (setq parts (cons (substring string + start (match-beginning 0)) + parts) + start (match-end 0))) + (nreverse (cons (substring string start) parts))) + `(let ((string ,string) + (start 0) + parts) + (while (string-match "[ \f\t\n\r\v]+" string start) + (setq parts (cons (substring string + start (match-beginning 0)) + parts) + start (match-end 0))) + (nreverse (cons (substring string start) parts)))) + form))) + +;; The following variables might not be bound if the old version of +;; canlock.el(c) exists. +(eval-when-compile + (defvar canlock-openssl-args) + (defvar canlock-openssl-program)) + +(defun canlock-om-sha1-with-openssl (message) + "Make a SHA-1 digest of MESSAGE using OpenSSL." + (with-temp-buffer + (setq mc-flag nil) + (insert message) + (let ((default-process-coding-system (cons *iso-2022-jp*dos *noconv*)) + program-coding-system-alist selective-display) + (apply 'call-process-region (point-min) (point-max) + canlock-openssl-program t t nil canlock-openssl-args)) + (goto-char (point-min)) + (insert "\"") + (while (re-search-forward "\\([0-9A-Fa-f][0-9A-Fa-f]\\)" nil t) + (replace-match "\\\\x\\1")) + (insert "\"") + (goto-char (point-min)) + (read (current-buffer)))) + +;; Override the original function. +(eval-after-load "canlock" + '(defalias 'canlock-sha1-with-openssl 'canlock-om-sha1-with-openssl)) + +(provide 'canlock-om) + +(require 'canlock) + +;;; canlock-om.el ends here diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index b6ced4a..1f515ba 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -225,6 +225,10 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (load (expand-file-name "gnus-clfns.el" srcdir) nil t t) +(when (boundp 'MULE) + ;; Load special macros for compiling canlock.el. + (load (expand-file-name "canlock-om.el" srcdir) nil t t)) + (require 'custom) ;; Bind functions defined by `defun-maybe'. @@ -485,7 +489,9 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (subrp (symbol-function 'base64-decode-string))) '("base64.el")) (when (and (fboundp 'md5) (subrp (symbol-function 'md5))) - '("md5.el"))) + '("md5.el")) + (unless (boundp 'MULE) + '("canlock-om.el"))) "Files which will not be installed.") (defconst dgnushack-exporting-files diff --git a/lisp/gnus-vers.el b/lisp/gnus-vers.el index c39fe35..4be92e7 100644 --- a/lisp/gnus-vers.el +++ b/lisp/gnus-vers.el @@ -34,7 +34,7 @@ (require 'product) (provide 'gnus-vers) -(defconst gnus-revision-number "08" +(defconst gnus-revision-number "09" "Revision number for this version of gnus.") ;; Product information of this gnus. diff --git a/lisp/message.el b/lisp/message.el index 9fc66a8..d877e9f 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -40,7 +40,10 @@ (require 'cl) (require 'smtp) (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary -(require 'canlock) +(eval-and-compile + (if (boundp 'MULE) + (require 'canlock-om) + (require 'canlock))) (require 'mailheader) (require 'nnheader) ;; This is apparently necessary even though things are autoloaded: @@ -56,7 +59,8 @@ (require 'rfc822) (eval-and-compile - (autoload 'sha1 "sha1-el")) + (autoload 'sha1 "sha1-el") + (autoload 'customize-save-variable "cus-edit"));; for Mule 2. (defgroup message '((user-mail-address custom-variable) (user-full-name custom-variable)) diff --git a/lisp/nnheader.el b/lisp/nnheader.el index a0ea2f2..8e641a4 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -1202,27 +1202,6 @@ find-file-hooks, etc. (read-coding-system prompt)) 'read-coding-system)) -(defun-maybe customize-save-variable (var val) - "Set the default for VARIABLE to VALUE, and save it for future sessions. -If VARIABLE has a `custom-set' property, that is used for setting -VARIABLE, otherwise `set-default' is used. - -The `customized-value' property of the VARIABLE will be set to a list -with a quoted VALUE as its sole list member. - -If VARIABLE has a `variable-interactive' property, that is used as if -it were the arg to `interactive' (which see) to interactively read the value. - -If VARIABLE has a `custom-type' property, it must be a widget and the -`:prompt-value' property of that widget will be used for reading the value. - -NOTE: This function is imported from Emacs 20.7 for old Emacsen." - (interactive (custom-prompt-variable "Set and ave variable: " - "Set and save value for %s as: ")) - (funcall (or (get var 'custom-set) 'set-default) var val) - (put var 'saved-value (list (custom-quote val))) - (custom-save-all)) - (when (featurep 'xemacs) (require 'nnheaderxm))