--- Begin Message ---
- From: Nix <nix@xxxxxxxxxxxxxxxxxx>
- Date: 24 Mar 2002 12:10:18 +0000
I couldn't work out where to send this patch: I hope you'll do, as the
person who introduced the use of `detect-coding-region-with-priority'
into emacs-w3m in the first place :)
'w3m-detect-coding-region' calls `w3m-detect-coding-with-priority' in
both Emacs and XEmacs. In Emacs, this is fine, but it is a bad thing in
XEmacs, because `w3m-detect-coding-with-priority' is defined in the
mule-base package, which need not be installed if your XEmacs is not
MULE-capable.
If you have file-coding enabled (which will be mandated in the next
major release of XEmacs), then you have the closely related
`detect-coding-region'; without that, you must punt back to the
`w3m-coding-system'. So this patch introduces a wrapper macro that does
the appropriate thing (depending on the build system, so it may not be
ideal for .elc file distributors; but I disapprove of .elc distribution
anyway.)
(If `detect-coding-region-with-priority' gets used outside of
Emacs/XEmacs-specific, the wrapper macro may need to be provided in
fsf.el as an empty wrapper. For now there's no need though.
It may well apply to the trunk too.)
2002-03-24 Nix <nix@esperi.demon.co.uk>
* w3m-xmas.el:
* w3m-xmas.el (w3m-detect-coding-with-priority): New function,
handle non-MULE XEmacsen.
* w3m-xmas.el (w3m-detect-coding-region): Use it.
Index: w3m-xmas.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m-xmas.el,v
retrieving revision 1.58.2.7
diff -u -r1.58.2.7 w3m-xmas.el
--- w3m-xmas.el 2002/02/26 02:09:07 1.58.2.7
+++ w3m-xmas.el 2002/03/24 12:03:00
@@ -66,6 +66,15 @@
(defalias 'w3m-make-ccl-coding-system (if (featurep 'mule)
'make-ccl-coding-system
'ignore))
+(defmacro w3m-detect-coding-with-priority (from to priority-list)
+ (cond
+ ((featurep 'mule)
+ `(detect-coding-with-priority ,from ,to ,priority-list))
+ ((featurep 'file-coding)
+ `(detect-coding-region ,from ,to))
+ (t
+ w3m-default-coding-system)))
+
(unless (featurep 'mule)
(defalias 'coding-system-category 'ignore)
(defmacro define-ccl-program (&rest args)))
@@ -80,7 +89,7 @@
(setq category (coding-system-category codesys))
(unless (assq category categories)
(push (cons category codesys) categories)))
- (if (consp (setq codesys (detect-coding-with-priority
+ (if (consp (setq codesys (w3m-detect-coding-with-priority
start end (nreverse categories))))
(car codesys)
codesys)))
--
`Oh, I seeeee, good light; bad light. Presumably the bad light is
different -- perhaps it's a sawtooth waveform, and the pointy bits
scratch your eyes?' --- John Ineson to a `monitors emit radiation,
all radiation is bad, therefore monitors are bad' tub-thumper
--- End Message ---