User: stephent
  Date: 06/07/26 04:26:25
  Modified:    packages/xemacs-packages/edit-utils ChangeLog savehist.el
Log:
Avoid use of coding systems where not available. <878xmhf6ma.fsf(a)tleepslib.sk.tsukuba.ac.jp>
Revision  Changes    Path
1.223     +5 -0      XEmacs/packages/xemacs-packages/edit-utils/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/edit-utils/ChangeLog,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -p -r1.222 -r1.223
--- ChangeLog	2006/06/28 07:58:06	1.222
+++ ChangeLog	2006/07/26 02:26:24	1.223
@@ -1,3 +1,8 @@
+2006-07-25  Stephen J. Turnbull  <stephen(a)xemacs.org>
+
+	* savehist.el (savehist-coding-system): Get a usable value
+	regardless of presence of file-coding.  Document the issue.
+
 2006-06-28  Norbert Koch  <viteno(a)xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 2.35 released.
1.5       +17 -6     XEmacs/packages/xemacs-packages/edit-utils/savehist.el
Index: savehist.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/edit-utils/savehist.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- savehist.el	2005/11/14 07:05:54	1.4
+++ savehist.el	2006/07/26 02:26:24	1.5
@@ -135,12 +135,23 @@ save."
 
 ;; This should be capable of representing characters used by Emacs.
 ;; We prefer UTF-8 over ISO 2022 because it is well-known outside
-;; Mule.  XEmacs prir to 21.5 had UTF-8 provided by an external
-;; package which may not be loaded, which is why we check for version.
-(defvar savehist-coding-system (if (and (featurep 'xemacs)
-					(<= emacs-major-version 21)
-					(< emacs-minor-version 5))
-				   'iso-2022-8 'utf-8)
+;; Mule.
+;; XEmacs 21.1 or 21.4 may not have Mule, especially on Windows, so
+;; we check for existence of *any* coding system at all.
+;; #### Use of 'binary' as the fallback for non-Mule XEmacsen should
+;; sort-of work because it's only used (a) as a coding cookie and (b) by
+;; binding `coding-system-for-write', but maybe we should error if there
+;; is a non-binary coding cookie in that case.  Needs thought....
+(defvar savehist-coding-system (if (featurep 'xemacs)
+				   (if (fboundp 'find-coding-system)
+				       (or (find-coding-system 'utf-8)
+					   (find-coding-system 'iso-2022-8)
+					   ;; support --with-file-coding
+					   (find-coding-system 'binary))
+				     ;; drop back 15 and punt!
+				     'binary)
+				 ;; assume Emacs 20, at least
+				 'utf-8))
   "The coding system savehist uses for saving the minibuffer history.
 Changing this value while Emacs is running is supported, but considered
 unwise, unless you know what you are doing.")