Gnus development mailing list
 help / color / mirror / Atom feed
* nnmaildir and XEmacs
@ 2006-10-09 14:28 Michael Piotrowski
  2006-10-10 21:53 ` Reiner Steib
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Piotrowski @ 2006-10-09 14:28 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hi,

I recently noticed that nnmaildir.el contains Emacs-specific code,
namely calls to `write-region' where the seventh argument is used with
the semantics of "mustbenew", e.g.:

  (write-region (point-min) (point-max) file nil 'no-message nil 'excl)

On XEmacs however, the seventh argument is "coding-system".
Consequently, a call as above results in the error message "No such
coding system: excl" on XEmacs.

Attached is a patch which fixes the problem for me.

Greetings

-- 
Michael Piotrowski, M.A.                               <mxp@dynalabs.de>
Public key at <http://www.dynalabs.de/mxp/pubkey.txt>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Make nnmaildir.el work on XEmacs --]
[-- Type: text/x-patch, Size: 2475 bytes --]

Index: nnmaildir.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmaildir.el,v
retrieving revision 7.11
diff -C2 -r7.11 nnmaildir.el
*** nnmaildir.el	5 Jul 2005 22:34:47 -0000	7.11
--- nnmaildir.el	8 Oct 2006 22:18:33 -0000
***************
*** 115,118 ****
--- 115,126 ----
  (defmacro nnmaildir--nov-set-mtime (nov value) `(aset ,nov 3 ,value))
  (defmacro nnmaildir--nov-set-extra (nov value) `(aset ,nov 4 ,value))
+ (defun nnmaildir--write-region  (start end file &optional append visit
+ 				       lockname)
+   (if (featurep 'xemacs)
+       (if (file-exists-p file)
+ 	  (signal 'file-already-exists
+ 		  (list "File exists" file))
+ 	(write-region start end file append visit lockname))
+     (write-region start end file append visit lockname 'excl)))
  
  (defstruct nnmaildir--art
***************
*** 482,486 ****
  	(setq file (concat novfile ":"))
  	(nnmaildir--unlink file)
! 	(write-region (point-min) (point-max) file nil 'no-message nil 'excl))
        (rename-file file novfile 'replace)
        (setf (nnmaildir--art-msgid article) msgid)
--- 490,495 ----
  	(setq file (concat novfile ":"))
  	(nnmaildir--unlink file)
! 	(nnmaildir--write-region (point-min) (point-max) file nil
! 				 'no-message nil))
        (rename-file file novfile 'replace)
        (setf (nnmaildir--art-msgid article) msgid)
***************
*** 1299,1304 ****
        (save-excursion
  	(set-buffer buffer)
! 	(write-region (point-min) (point-max) tmpfile nil 'no-message nil
! 		      'excl))
        (unix-sync) ;; no fsync :(
        (rename-file tmpfile (concat (nnmaildir--cur dir) file suffix) 'replace)
--- 1308,1313 ----
        (save-excursion
  	(set-buffer buffer)
! 	(nnmaildir--write-region (point-min) (point-max) tmpfile nil
! 				 'no-message nil))
        (unix-sync) ;; no fsync :(
        (rename-file tmpfile (concat (nnmaildir--cur dir) file suffix) 'replace)
***************
*** 1393,1398 ****
        (condition-case nil (add-name-to-file nnmaildir--file tmpfile)
  	(error
! 	 (write-region (point-min) (point-max) tmpfile nil 'no-message nil
! 		       'excl)
  	 (unix-sync))) ;; no fsync :(
        (nnheader-cancel-timer 24h)
--- 1402,1407 ----
        (condition-case nil (add-name-to-file nnmaildir--file tmpfile)
  	(error
! 	 (nnmaildir--write-region (point-min) (point-max) tmpfile nil
! 				  'no-message nil)
  	 (unix-sync))) ;; no fsync :(
        (nnheader-cancel-timer 24h)

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

* Re: nnmaildir and XEmacs
  2006-10-09 14:28 nnmaildir and XEmacs Michael Piotrowski
@ 2006-10-10 21:53 ` Reiner Steib
  2006-10-11  2:19   ` Katsumi Yamaoka
  2006-10-18  9:03   ` Michael Piotrowski
  0 siblings, 2 replies; 7+ messages in thread
From: Reiner Steib @ 2006-10-10 21:53 UTC (permalink / raw)


On Mon, Oct 09 2006, Michael Piotrowski wrote:

> I recently noticed that nnmaildir.el contains Emacs-specific code,

Strange, this code is there since September 2002.

> namely calls to `write-region' where the seventh argument is used with
> the semantics of "mustbenew", e.g.:
>
>   (write-region (point-min) (point-max) file nil 'no-message nil 'excl)
>
> On XEmacs however, the seventh argument is "coding-system".
> Consequently, a call as above results in the error message "No such
> coding system: excl" on XEmacs.

Does this change (installed in trunk and v5-10) fix the problem as well?

,----
| 2006-10-10  Reiner Steib  <Reiner.Steib@gmx.de>
| 
| 	* gmm-utils.el (gmm-write-region): New function based on compatibility
| 	code from `mm-make-temp-file'.
| 
| 	* mm-util.el (mm-make-temp-file): Use `gmm-write-region'.
| 
| 	* nnmaildir.el (nnmaildir--update-nov)
| 	(nnmaildir-request-replace-article, nnmaildir-request-accept-article):
| 	Use `gmm-write-region'.
`----

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




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

* Re: nnmaildir and XEmacs
  2006-10-10 21:53 ` Reiner Steib
@ 2006-10-11  2:19   ` Katsumi Yamaoka
  2006-10-11  3:49     ` Katsumi Yamaoka
  2006-10-18  9:03   ` Michael Piotrowski
  1 sibling, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2006-10-11  2:19 UTC (permalink / raw)


>>>>> In <v9fydvu9bs.fsf@marauder.physik.uni-ulm.de>
>>>>>	Reiner Steib wrote:

>| 2006-10-10  Reiner Steib  <Reiner.Steib@gmx.de>
>|
>| 	* gmm-utils.el (gmm-write-region): New function based on compatibility
>| 	code from `mm-make-temp-file'.

It is strange that Emacs doesn't complain about undefined
variable name.  XEmacs said:

While compiling gmm-write-region in file gnus/lisp/gmm-utils.el:
  ** reference to free variable file

Anyway, I've fixed this.



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

* Re: nnmaildir and XEmacs
  2006-10-11  2:19   ` Katsumi Yamaoka
@ 2006-10-11  3:49     ` Katsumi Yamaoka
  2006-10-11  8:09       ` Reiner Steib
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2006-10-11  3:49 UTC (permalink / raw)


>>>>> In <b4mpsczh9vr.fsf@jpl.org> Katsumi Yamaoka wrote:

> It is strange that Emacs doesn't complain about undefined
> variable name.  XEmacs said:

> While compiling gmm-write-region in file gnus/lisp/gmm-utils.el:
>   ** reference to free variable file

The cause is that `dgnushack-compile' binds the variable `file'.
I don't know how XEmacs does it cleverly, though.



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

* Re: nnmaildir and XEmacs
  2006-10-11  3:49     ` Katsumi Yamaoka
@ 2006-10-11  8:09       ` Reiner Steib
  2006-10-11 12:13         ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Reiner Steib @ 2006-10-11  8:09 UTC (permalink / raw)


On Wed, Oct 11 2006, Katsumi Yamaoka wrote:

>>>>>> In <b4mpsczh9vr.fsf@jpl.org> Katsumi Yamaoka wrote:
>
>> It is strange that Emacs doesn't complain about undefined
>> variable name.  XEmacs said:
>
>> While compiling gmm-write-region in file gnus/lisp/gmm-utils.el:
>>   ** reference to free variable file
>> 
>> Anyway, I've fixed this.

Thanks.  (Seem that I copied the declaration from `write-region' and
the body from `mm-make-temp-file').

> The cause is that `dgnushack-compile' binds the variable `file'.

dgnushack might be considered harmful.

> I don't know how XEmacs does it cleverly, though.

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




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

* Re: nnmaildir and XEmacs
  2006-10-11  8:09       ` Reiner Steib
@ 2006-10-11 12:13         ` Katsumi Yamaoka
  0 siblings, 0 replies; 7+ messages in thread
From: Katsumi Yamaoka @ 2006-10-11 12:13 UTC (permalink / raw)


>>>>> In <v9slhvff4u.fsf@marauder.physik.uni-ulm.de>
>>>>>	Reiner Steib wrote:
> On Wed, Oct 11 2006, Katsumi Yamaoka wrote:

>> The cause is that `dgnushack-compile' binds the variable `file'.

> dgnushack might be considered harmful.

I think so, but there seems to be no way to solve it except for
improving of Emacs.  Actually Emacs doesn't warn about some
undefined variables.  For instance, the following two forms issue
no warning:

--8<---------------cut here---------------start------------->8---
(byte-compile '(lambda () (list fun macro)))
--8<---------------cut here---------------end--------------->8---
;;
--8<---------------cut here---------------start------------->8---
(progn
  (write-region "\
\(defun foo ()\n\
  (list target-file input-buffer output-buffer))\n"
		nil
		"~/byte-compile-warn-test.el")
  (byte-compile-file "~/byte-compile-warn-test.el"))
--8<---------------cut here---------------end--------------->8---

>> I don't know how XEmacs does it cleverly, though.

XEmacs uses the built-in function `globally-boundp' instead of
`boundp'.

--8<---------------cut here---------------start------------->8---
(let (foo-bar-baz)
  (list (globally-boundp 'foo-bar-baz) (boundp 'foo-bar-baz)))
 => (nil t)
--8<---------------cut here---------------end--------------->8---



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

* Re: nnmaildir and XEmacs
  2006-10-10 21:53 ` Reiner Steib
  2006-10-11  2:19   ` Katsumi Yamaoka
@ 2006-10-18  9:03   ` Michael Piotrowski
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Piotrowski @ 2006-10-18  9:03 UTC (permalink / raw)


Hi,

I was on vacation, that's why my answer is a little late.

On 2006-10-10, Reiner Steib <reinersteib+gmane@imap.cc> wrote:

>> I recently noticed that nnmaildir.el contains Emacs-specific code,
>
> Strange, this code is there since September 2002.

Well, yes.  I was puzzled, too, that nobody had run into it before.
However, the problem didn't occur immediately, only in some cases when
entering the group after its content had changed; maybe that's why
nobody had noticed it.  I started to use nnmaildir only recently for
Mairix search results, it's faster than nnmh and the article count is
correct.

>> namely calls to `write-region' where the seventh argument is used with
>> the semantics of "mustbenew", e.g.:
>> 
>>   (write-region (point-min) (point-max) file nil 'no-message nil 'excl)
>> 
>> On XEmacs however, the seventh argument is "coding-system".
>> Consequently, a call as above results in the error message "No such
>> coding system: excl" on XEmacs.
>
> Does this change (installed in trunk and v5-10) fix the problem as well?
>
> ,----
> | 2006-10-10  Reiner Steib  <Reiner.Steib@gmx.de>
> | 
> | 	* gmm-utils.el (gmm-write-region): New function based on compatibility
> | 	code from `mm-make-temp-file'.
> | 
> | 	* mm-util.el (mm-make-temp-file): Use `gmm-write-region'.
> | 
> | 	* nnmaildir.el (nnmaildir--update-nov)
> | 	(nnmaildir-request-replace-article, nnmaildir-request-accept-article):
> | 	Use `gmm-write-region'.
> `----

I've just updated to the latest trunk version, and yes, it seems to
work fine.  Thanks!

Greetings

-- 
Michael Piotrowski, M.A.                               <mxp@dynalabs.de>
Public key at <http://www.dynalabs.de/mxp/pubkey.txt>




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

end of thread, other threads:[~2006-10-18  9:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-09 14:28 nnmaildir and XEmacs Michael Piotrowski
2006-10-10 21:53 ` Reiner Steib
2006-10-11  2:19   ` Katsumi Yamaoka
2006-10-11  3:49     ` Katsumi Yamaoka
2006-10-11  8:09       ` Reiner Steib
2006-10-11 12:13         ` Katsumi Yamaoka
2006-10-18  9:03   ` Michael Piotrowski

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).