unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* "coding" in file variable list not effective
@ 2004-01-06 15:41 Sébastien Kirche
  2004-01-06 20:27 ` Eli Zaretskii
  2004-01-07  1:48 ` Kenichi Handa
  0 siblings, 2 replies; 5+ messages in thread
From: Sébastien Kirche @ 2004-01-06 15:41 UTC (permalink / raw)


Hi all,

i have have a file that i am currently editing under osx (actually my 
.emacs) where i use the euro sign.
So i save it with iso-latin-9-mac (iso-8859-15) encoding.

To avoid typing the whole "C-x ret c iso-latin-9-mac C-x C-f filename" 
for further editing, i placed the setting "coding: iso-latin-9-mac" in 
my variable list at the end of file.

I found that it has no effect : M-x describe-current-coding-system 
shows that i am still in iso-latin-1 which is my default file coding 
system.
But if I place the setting in the first line between the -*- marks, the 
coding is used accordingly.

Is it due to the fact that the variable list is placed at the end and 
therfore the file has already been parsed ?
Or should I send a report to gnu.emacs.bug (that didn't subscribed yet)?

Regards,
Sébastien Kirche

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

* Re: "coding" in file variable list not effective
  2004-01-06 15:41 "coding" in file variable list not effective Sébastien Kirche
@ 2004-01-06 20:27 ` Eli Zaretskii
  2004-01-07  9:43   ` Sébastien Kirche
  2004-01-07  9:48   ` Sébastien Kirche
  2004-01-07  1:48 ` Kenichi Handa
  1 sibling, 2 replies; 5+ messages in thread
From: Eli Zaretskii @ 2004-01-06 20:27 UTC (permalink / raw)
  Cc: emacs-devel

> Date: Tue, 6 Jan 2004 16:41:24 +0100
> From: =?ISO-8859-1?Q?S=E9bastien_Kirche?= <sebastien.kirche@sage.com>
> 
> To avoid typing the whole "C-x ret c iso-latin-9-mac C-x C-f filename" 
> for further editing, i placed the setting "coding: iso-latin-9-mac" in 
> my variable list at the end of file.
> 
> I found that it has no effect : M-x describe-current-coding-system 
> shows that i am still in iso-latin-1 which is my default file coding 
> system.
> But if I place the setting in the first line between the -*- marks, the 
> coding is used accordingly.

Please post the shortest file that can be used to reproduce this
problem.  It seems to work on my machine, but perhaps the file I used
is somehow different from yours.

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

* Re: "coding" in file variable list not effective
  2004-01-06 15:41 "coding" in file variable list not effective Sébastien Kirche
  2004-01-06 20:27 ` Eli Zaretskii
@ 2004-01-07  1:48 ` Kenichi Handa
  1 sibling, 0 replies; 5+ messages in thread
From: Kenichi Handa @ 2004-01-07  1:48 UTC (permalink / raw)
  Cc: emacs-devel

In article <C88E4100-405E-11D8-9520-000393861220@sage.com>, Sébastien Kirche <sebastien.kirche@sage.com> writes:

> i have have a file that i am currently editing under osx (actually my 
> .emacs) where i use the euro sign.
> So i save it with iso-latin-9-mac (iso-8859-15) encoding.

> To avoid typing the whole "C-x ret c iso-latin-9-mac C-x C-f filename" 
> for further editing, i placed the setting "coding: iso-latin-9-mac" in 
> my variable list at the end of file.

> I found that it has no effect : M-x describe-current-coding-system 
> shows that i am still in iso-latin-1 which is my default file coding 
> system.
> But if I place the setting in the first line between the -*- marks, the 
> coding is used accordingly.

Thank you for the report.  I've just installed the attached
fix.

---
Ken'ichi HANDA
handa@m17n.org

	* international/mule.el (set-auto-coding): Fix for the case that
	end-of-line is only CR.

*** mule.el.~1.196.~	Wed Dec  3 16:34:51 2003
--- mule.el	Wed Jan  7 10:41:30 2004
***************
*** 1662,1692 ****
  		  (setq coding-system nil)))))
  
  	;; If no coding: tag in the head, check the tail.
  	(when (and tail-found (not coding-system))
  	  (goto-char tail-start)
! 	  (search-forward "\n\^L" nil t)
  	  (if (re-search-forward
! 	       "^\\(.*\\)[ \t]*Local Variables:[ \t]*\\(.*\\)$" tail-end t)
! 	  ;; The prefix is what comes before "local variables:" in its
! 	   ;; line.  The suffix is what comes after "local variables:"
  	      ;; in its line.
  	      (let* ((prefix (regexp-quote (match-string 1)))
  		     (suffix (regexp-quote (match-string 2)))
  		     (re-coding
  		      (concat
! 		       "^" prefix
  		       ;; N.B. without the \n below, the regexp can
  		       ;; eat newlines.
! 		       "[ \t]*coding[ \t]*:[ \t]*\\([^ \t\n]+\\)[ \t]*"
! 		       suffix "$"))
  		     (re-unibyte
  		      (concat
! 		       "^" prefix
! 		       "[ \t]*unibyte[ \t]*:[ \t]*\\([^ \t\n]+\\)[ \t]*"
! 		       suffix "$"))
  		     (re-end
! 		      (concat "^" prefix "[ \t]*End *:[ \t]*" suffix "$"))
! 		     (pos (point)))
  		(re-search-forward re-end tail-end 'move)
  		(setq tail-end (point))
  		(goto-char pos)
--- 1662,1697 ----
  		  (setq coding-system nil)))))
  
  	;; If no coding: tag in the head, check the tail.
+ 	;; Here we must pay attention to the case that the end-of-line
+ 	;; is just "\r" and we can't use "^" nor "$" in regexp.
  	(when (and tail-found (not coding-system))
  	  (goto-char tail-start)
! 	  (re-search-forward "[\r\n]\^L" nil t)
  	  (if (re-search-forward
! 	       "[\r\n]\\([^[\r\n]*\\)[ \t]*Local Variables:[ \t]*\\([^\r\n]*\\)[\r\n]" 
! 	       tail-end t)
! 	      ;; The prefix is what comes before "local variables:" in its
! 	      ;; line.  The suffix is what comes after "local variables:"
  	      ;; in its line.
  	      (let* ((prefix (regexp-quote (match-string 1)))
  		     (suffix (regexp-quote (match-string 2)))
  		     (re-coding
  		      (concat
! 		       "[\r\n]" prefix
  		       ;; N.B. without the \n below, the regexp can
  		       ;; eat newlines.
! 		       "[ \t]*coding[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*"
! 		       suffix "[\r\n]"))
  		     (re-unibyte
  		      (concat
! 		       "[\r\n]" prefix
! 		       "[ \t]*unibyte[ \t]*:[ \t]*\\([^ \t\r\n]+\\)[ \t]*"
! 		       suffix "[\r\n]"))
  		     (re-end
! 		      (concat "[\r\n]" prefix "[ \t]*End *:[ \t]*" suffix 
! 			      "[\r\n]?"))
! 		     (pos (1- (point))))
! 		(forward-char -1)	; skip back \r or \n.
  		(re-search-forward re-end tail-end 'move)
  		(setq tail-end (point))
  		(goto-char pos)

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

* Re: "coding" in file variable list not effective
  2004-01-06 20:27 ` Eli Zaretskii
@ 2004-01-07  9:43   ` Sébastien Kirche
  2004-01-07  9:48   ` Sébastien Kirche
  1 sibling, 0 replies; 5+ messages in thread
From: Sébastien Kirche @ 2004-01-07  9:43 UTC (permalink / raw)
  Cc: emacs-devel

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


Le mardi, 6 jan 2004, à 21:27 Europe/Paris, Eli Zaretskii a écrit :

> Please post the shortest file that can be used to reproduce this
> problem.  It seems to work on my machine, but perhaps the file I used
> is somehow different from yours.

Ok, I have attached a quite minimal file that exposes the problem.

Given that my default coding  system (prefer-coding-system) is latin-1 
and I
am on mac osx with that emacs : GNU Emacs 21.3.50.1 
(powerpc-apple-darwin6.6)
of 2003-09-08 on asterix [1],

-  if you  open the  file as  it is,  the buffer  coding system  is 
actually
   iso-latin-9-mac and the third line shows a euro sign at the end

-  if you  delete  the first  line  or even  only the  -*-  marks 
(being  in
   iso-latin-9-mac encoding),  on the next opening,  the euro sign  is 
then a
   dollar  sign, and describe-current-coding-system  shows that  the 
encoding
   switched back to latin-1

If you may need more infos about my personnal settings, I can post my 
.emacs,
or make if available online.
Thanks for looking at that.

[1] :  i realize that  this is  a quite old  cvs version, but  with 
savannah
problems and the termination of the pserver,  i didn't get a fresh one 
for a
while. All my apologizes if it is a corrected bug since september.

Regards,
Sébastien Kirche


[-- Attachment #2: coding-test --]
[-- Type: application/octet-stream, Size: 131 bytes --]

;; -*- coding: iso-latin-9-mac -*-\r\r;Test euro char: ¤\r\r;; Local Variables:\r;; mode: emacs-lisp\r;; coding: iso-latin-9-mac\r;; end:\r

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

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

* Re: "coding" in file variable list not effective
  2004-01-06 20:27 ` Eli Zaretskii
  2004-01-07  9:43   ` Sébastien Kirche
@ 2004-01-07  9:48   ` Sébastien Kirche
  1 sibling, 0 replies; 5+ messages in thread
From: Sébastien Kirche @ 2004-01-07  9:48 UTC (permalink / raw)
  Cc: emacs-devel

Oops, i missed that it was *already* fixed by Kenichi Handa...

Thanks :)

Sébastien Kirche

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

end of thread, other threads:[~2004-01-07  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-06 15:41 "coding" in file variable list not effective Sébastien Kirche
2004-01-06 20:27 ` Eli Zaretskii
2004-01-07  9:43   ` Sébastien Kirche
2004-01-07  9:48   ` Sébastien Kirche
2004-01-07  1:48 ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).