Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* XEmacs, Gnus and mm-coding-system-priorities.
@ 2004-12-02 11:59 Aidan Kehoe
       [not found] ` <v9oehcoozg.fsf@marauder.physik.uni-ulm.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Aidan Kehoe @ 2004-12-02 11:59 UTC (permalink / raw)



Hi, 

Further to my message of the 26th, lvmzx4a1vb.fsf@ns5.nestdesign.com , I’ve
made a patch to mm-util.el that takes advantage of Stephen Turnbull’s Latin
Unity to remap messages’ characters and to take notice of the
mm-coding-system-priorities variable under XEmacs. 

With this patch applied, and with latin-unity available,

     (setq mm-coding-system-priorities '(iso-8859-1 iso-8859-15 utf-8))

in your init file tells Gnus to post in Latin 1 if the message fits into
Latin 1--including if, say, Latin 2 U WITH DIAERESIS is used--iso-8859-15 if
the message fits into that but not Latin 1, and UTF-8 if neither of those
things is true. This is much preferable to the current behaviour.

Tested under 21.4, 21.5 and the stable GNU Emacs. If you have trouble
applying the patch from a news article, there’s a plain text version
available at
http://parhasard.net/mm-util-xemacs-coding-system-priorities.diff .

What do I have to do get this included in the standard Gnus?

Best regards, 

        - Aidan
-- 
“As democracy is perfected, the office of president represents, more and
more closely, the inner soul of the people. On some great and glorious day
the plain folks of the land will reach their heart’s desire at last and the
White House will be adorned by a downright moron.” – H.L. Mencken 

--- mm-util.el~	2004-12-02 10:43:08.000000000 +0000
+++ mm-util.el	2004-12-02 11:42:03.000000000 +0000
@@ -587,11 +587,68 @@
 	       charsets))
 	;; Otherwise we're not multibyte, we're XEmacs, or a single
 	;; coding system won't cover it.
-	(setq charsets
-	      (mm-delete-duplicates
-	       (mapcar 'mm-mime-charset
-		       (delq 'ascii
-			     (mm-find-charset-region b e))))))
+
+	;; For intelligent handling of the various ISO-8859-? character sets
+	;; and their common subsets under XEmacs, we use latin-unity.
+	(when (and (not (featurep 'latin-unity))
+		   (locate-library "latin-unity"))
+	  (require 'latin-unity))
+
+	(if (featurep 'latin-unity)
+	    (let ((csets (latin-unity-representations-feasible-region b e))
+		  (psets (latin-unity-representations-present-region b e))
+		  (systems mm-coding-system-priorities)
+		  (chars-region (delq 'ascii (charsets-in-region b e))) curset)
+
+	      (assert (featurep 'xemacs) t 
+		      "Latin Unity shouldn't be available on GNU Emacs.")
+
+	      (setq charsets
+		    (catch 'done
+
+		       ;; Check whether all Latin Unity knows about all the
+		       ;; character sets in the region. If it doesn't, and we
+		       ;; have a universal coding system in the
+		       ;; mm-coding-system-priorities list, return that
+		       ;; universal coding system. Otherwise, we can't do the
+		       ;; right thing; return a multiple-entry list, so Gnus
+		       ;; will do its broken thing.
+
+		       (dolist (curset chars-region)
+			 (unless (memq curset latin-unity-character-sets)
+			   (dolist (curset systems)
+			     (if (memq curset latin-unity-ucs-list)
+				 (throw 'done (list curset))))
+			   (throw 'done (mapcar 'mm-mime-charset
+						(delq 'ascii
+						      (charsets-in-region
+						       b e))))))
+
+		       ;; Okay, Latin Unity does know all about the
+		       ;; character sets in the region. Pass back the first
+		       ;; coding system in the preferred list that can
+		       ;; encode the whole buffer.
+
+		       (dolist (curset systems)
+			 (setq curset 
+			       (latin-unity-massage-name curset 
+							 'buffer-default))
+			 (if (memq curset latin-unity-ucs-list)
+			     (throw 'done (list curset)))
+			 (if (latin-unity-maybe-remap b e curset csets psets t)
+			     (throw 'done (list curset))))
+
+		       ;; Can't encode using anything from the
+		       ;; mm-coding-system-priorities list. Return a
+		       ;; multiple entry list.
+		       (mapcar 'mm-mime-charset 
+			       (delq 'ascii (charsets-in-region b e))))))
+	  ;; Otherwise, there's nothing really intelligent we can do with
+	  ;; the characters.
+	  (setq charsets
+		(mm-delete-duplicates 
+		 (mapcar 'mm-mime-charset 
+			 (delq 'ascii (mm-find-charset-region b e)))))))
     (if (and (> (length charsets) 1)
 	     (memq 'iso-8859-15 charsets)
 	     (memq 'iso-8859-15 hack-charsets)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: XEmacs, Gnus and mm-coding-system-priorities.
       [not found]   ` <16815.6410.553114.367045.z25zdq@parhasard.net>
@ 2004-12-02 19:35     ` Reiner Steib
  2004-12-03  1:21     ` Stephen J. Turnbull
  1 sibling, 0 replies; 3+ messages in thread
From: Reiner Steib @ 2004-12-02 19:35 UTC (permalink / raw)


On Thu, Dec 02 2004, Aidan Kehoe wrote:

>  Ar an dara lá de mí na Nollaig, scríobh Reiner Steib: 
[...]
> It’s not readable as is, but I’m happy to separate it out.  

TIA.

>  > If your patch is more than a "tiny change" (approximately 15 line of
>  > new code, IIRC), we need a copyright assignment.
>
> If I declare the code public domain, would that be sufficient to have it go
> in? 

No it is not sufficient unless it is a "tiny change".

> I’d prefer to have it public domain to having it GPLed, but if
> assignment and GPL’ing are a necessity, then I can do that.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: XEmacs, Gnus and mm-coding-system-priorities.
       [not found]   ` <16815.6410.553114.367045.z25zdq@parhasard.net>
  2004-12-02 19:35     ` Reiner Steib
@ 2004-12-03  1:21     ` Stephen J. Turnbull
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen J. Turnbull @ 2004-12-03  1:21 UTC (permalink / raw)


>>>>> "Aidan" == Aidan Kehoe <kehoea@parhasard.net> writes:

    >> If your patch is more than a "tiny change" (approximately 15
    >> line of new code, IIRC), we need a copyright assignment.

    Aidan> If I declare the code public domain, would that be
    Aidan> sufficient to have it go in? I’d prefer to have it public
    Aidan> domain to having it GPLed, but if assignment and GPL’ing
    Aidan> are a necessity, then I can do that.

Publish it now under a permissive license, then assign it to the FSF.
There's nothing they can do to revoke the existing license.

Note that declaring it public domain has no advantages over a
permissive license, except to make it easier for Chaotic Evil Monsters
(think "SCO") to give you an invitation to court that you can't
refuse, or to abuse your good name to advertise their products.

-- 
Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-03  1:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-02 11:59 XEmacs, Gnus and mm-coding-system-priorities Aidan Kehoe
     [not found] ` <v9oehcoozg.fsf@marauder.physik.uni-ulm.de>
     [not found]   ` <16815.6410.553114.367045.z25zdq@parhasard.net>
2004-12-02 19:35     ` Reiner Steib
2004-12-03  1:21     ` Stephen J. Turnbull

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).