GNU bug report logs - #9044
24.0.50; File mode specification error: (error "Malformed -*- line")

Previous Next

Package: emacs;

Reported by: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>

Date: Sun, 10 Jul 2011 23:37:02 UTC

Severity: minor

Found in version 24.0.50

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9044 in the body.
You can then email your comments to 9044 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sun, 10 Jul 2011 23:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Dyballa <Peter_Dyballa <at> Freenet.DE>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 10 Jul 2011 23:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; File mode specification error: (error "Malformed -*- line")
Date: Mon, 11 Jul 2011 01:36:37 +0200
Hello!

I have configured GNU Emacs without direct JPEG and TIFF support.  
After launching it with -Q I execute in *scratch* buffer

	(imagemagick-register-types)

(nil is returned). When I view from dired file.tif, then only its  
bytes are displayed in a (Fundamental View) buffer. In *Messages* buffer

	File mode specification error: (error "Malformed -*- line")
	File local-variables error: (error "Malformed -*- line")

is recorded.

GCC is GCC 4.4.6, Mac OS X 10.5.8, PPC, big-endian.

In GNU Emacs 24.0.50.2 (powerpc-apple-darwin9.8.0, GTK+ Version 2.24.4)
 of 2011-07-10 on Latsche.fritz.box
Windowing system distributor `The X.Org Foundation', version  
11.0.11002000
configured using `configure  '--without-sound' '--without-dbus' '-- 
without-pop' '--without-gconf' '--without-gpm' '--without-gsettings'  
'--without-jpeg' '--without-tiff' '--with-x-toolkit=gtk' '--enable- 
locallisppath=/Library/Application Support/Emacs/calendar24:/Library/ 
Application Support/Emacs' 'CFLAGS=-g -H -pipe -fPIC -fno-common - 
mcpu=7450 -mtune=7450 -maltivec -faltivec -mabi=altivec -Os -mfused- 
madd -mmultiple -ftree-vectorize' 'LDFLAGS=-Wl,-dead_strip_dylibs -Wl,- 
bind_at_load -Wl,-t' 'CC=gcc-4' 'CPP=cpp-4' 'PKG_CONFIG_PATH=/opt/ 
local/lib/pkgconfig:/opt/local/share/pkgconfig:/usr/lib/pkgconfig''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: de_DE.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

--
Greetings

  Pete

$ sumascii BILL GATES
  B   I   L   L   G   A   T   E   S
 66+ 73+ 76+ 76+ 71+ 65+ 84+ 69+ 83 = 663

 and add 3 because he's Bill Gates the third.





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Tue, 12 Jul 2011 21:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
Cc: 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Tue, 12 Jul 2011 17:53:40 -0400
Peter Dyballa wrote:

> 	(imagemagick-register-types)
>
> (nil is returned). When I view from dired file.tif, then only its
> bytes are displayed in a (Fundamental View) buffer. In *Messages*
> buffer
>
> 	File mode specification error: (error "Malformed -*- line")
> 	File local-variables error: (error "Malformed -*- line")

Is this for any *.tif file, or just one in particular?
If the latter, can you send it?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Tue, 12 Jul 2011 23:28:02 GMT) Full text and rfc822 format available.

Message #11 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Wed, 13 Jul 2011 01:27:15 +0200
[Message part 1 (text/plain, inline)]
Am 12.07.2011 um 23:53 schrieb Glenn Morris:

> Peter Dyballa wrote:
>
>> 	(imagemagick-register-types)
>>
>> (nil is returned). When I view from dired file.tif, then only its
>> bytes are displayed in a (Fundamental View) buffer. In *Messages*
>> buffer
>>
>> 	File mode specification error: (error "Malformed -*- line")
>> 	File local-variables error: (error "Malformed -*- line")
>
> Is this for any *.tif file, or just one in particular?
> If the latter, can you send it?


It's obviously just one, none of the 20 others I just checked:

[Image.tif (image/tiff, inline)]
[Message part 3 (text/plain, inline)]


In GNU Emacs 23.3 I get, when typing v on the file in dired:

	Type C-c C-c to view the image as text.
	File local-variables error: (error "Malformed -*- line")
	Type C-c C-c to view the image as an image.
	Reverting buffer `Arbeit'.

--
Greetings

  Pete

Perl—the only language that looks the same before and after RSA  
encryption.
				- Keith Bostic


Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Wed, 13 Jul 2011 00:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>
Cc: 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Tue, 12 Jul 2011 20:01:27 -0400
Peter Dyballa wrote:

> It's obviously just one, none of the 20 others I just checked:
[...]
> In GNU Emacs 23.3 I get, when typing v on the file in dired:
>
> 	Type C-c C-c to view the image as text.
> 	File local-variables error: (error "Malformed -*- line")


Yes; it has no relation to imagemagick and occurs in 23.3 too. The tiff
file is a single line and happens to contain "-*-" at one point. Emacs
tries to parse this as a file local variables section and fails, so it
complains. It's just a harmless message that you can ignore, it does not
affect anything. I'm not sure that it's worth trying to do anything
about this.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sun, 11 Sep 2011 03:33:01 GMT) Full text and rfc822 format available.

Message #17 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sun, 11 Sep 2011 05:24:45 +0200
Glenn Morris <rgm <at> gnu.org> writes:

> Yes; it has no relation to imagemagick and occurs in 23.3 too. The tiff
> file is a single line and happens to contain "-*-" at one point. Emacs
> tries to parse this as a file local variables section and fails, so it
> complains. It's just a harmless message that you can ignore, it does not
> affect anything. I'm not sure that it's worth trying to do anything
> about this.

Well, it would make sense to have the "-*-" parser try to be a bit more
intelligent, wouldn't it?  But I don't really have a good idea what to
do.

Having Emacs error totally out and refuse to show the image sounds like
a bad idea, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Thu, 15 Sep 2011 18:56:03 GMT) Full text and rfc822 format available.

Message #20 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Glenn Morris <rgm <at> gnu.org>, Peter Dyballa <Peter_Dyballa <at> Freenet.DE>,
	9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Thu, 15 Sep 2011 21:37:37 +0300
> Well, it would make sense to have the "-*-" parser try to be a bit more
> intelligent, wouldn't it?  But I don't really have a good idea what to
> do.
>
> Having Emacs error totally out and refuse to show the image sounds like
> a bad idea, though.

This can be fixed by limiting the search for "-*-" with some reasonable value,
e.g. modifying `set-auto-mode-1' to use: `(min (line-end-position) 1024)'.

Another solution is to add file extensions of binary image formats to
`inhibit-first-line-modes-regexps' or `inhibit-first-line-modes-suffixes'.
But a list of image formats supported by ImageMagick is too long:
(length (imagemagick-types)) => 206.  Perhaps this is not a problem.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Thu, 15 Sep 2011 20:09:01 GMT) Full text and rfc822 format available.

Message #23 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juri Linkov <juri <at> jurta.org>
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
	Peter Dyballa <Peter_Dyballa <at> freenet.de>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Thu, 15 Sep 2011 16:03:32 -0400
> Another solution is to add file extensions of binary image formats to
> `inhibit-first-line-modes-regexps' or `inhibit-first-line-modes-suffixes'.
> But a list of image formats supported by ImageMagick is too long:
> (length (imagemagick-types)) => 206.  Perhaps this is not a problem.

I don't see any problem adding it to inhibit-first-line-modes-regexps,
especially using regexp-opt.
But only for non-text formats (e.g. not xpm or postscript).


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Fri, 16 Sep 2011 02:08:02 GMT) Full text and rfc822 format available.

Message #26 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Juri Linkov <juri <at> jurta.org>, Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Fri, 16 Sep 2011 03:58:54 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

>> Another solution is to add file extensions of binary image formats to
>> `inhibit-first-line-modes-regexps' or `inhibit-first-line-modes-suffixes'.
>> But a list of image formats supported by ImageMagick is too long:
>> (length (imagemagick-types)) => 206.  Perhaps this is not a problem.
>
> I don't see any problem adding it to inhibit-first-line-modes-regexps,
> especially using regexp-opt.
> But only for non-text formats (e.g. not xpm or postscript).

The list is:

(YUV YCbCrA YCbCr Y XWD XV XPS XPM XCF XC XBM X3F X WPG WMZ WMV WMF WBMP
VST VIFF VID VICAR VDA UYVY UIL UBRL TXT TTF TTC TIM TILE TIFF64 TIFF
THUMBNAIL TGA TEXT SVGZ SVG SUN STEGANO SRF SR2 SHTML SGI SFW SCT SCR
RLE RLA RGBO RGBA RGB RBG RAS RAF RADIAL-GRADIENT R PWP PTIF PSD PSB PS3
PS2 PS PREVIEW PPM PNM PNG8 PNG32 PNG24 PNG PLASMA PJPEG PIX PICT PICON
PGX PGM PFM PFB PFA PES PEF PDFA PDF PDB PCX PCT PCL PCDS PCD PBM
PATTERN PAM PALM PAL OTF OTB ORF O NULL NEF MVG MTV MSVG MSL MRW MPG
MPEG MPC MP4 MOV MONO MNG MIFF MATTE MAT MAP M4V M2V M LABEL KDC K25 K
JPX JPG JPEG JPC JP2 JNG J2C ISOBRL IPL INLINE INFO ICON ICO ICB HTML
HTM HRZ HISTOGRAM HALD GROUP4 GRB GRAY GRADIENT GIF87 GIF GBR G3 G FTS
FRACTAL FITS FAX EXR ERF EPT3 EPT2 EPT EPSI EPSF EPS3 EPS2 EPS EPI EPDF
DPX DOT DNG DJVU DFONT DDS DCX DCR DCM CUT CUR CRW CR2 CMYKA CMYK CLIP
CIP CIN CAPTION CALS CAL C BRG BRF BMP3 BMP2 BMP BGRA BGR B AVS AVI ARW
ART AI A 3FR)

And that's a lot of text formats.

How about just adding the common ones -- jpeg?, tiff?, png, gif.  That
will take care of 99% of the problems.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Fri, 16 Sep 2011 20:20:02 GMT) Full text and rfc822 format available.

Message #29 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Fri, 16 Sep 2011 15:50:04 +0300
[Message part 1 (text/plain, inline)]
> The list is:
>
> (YUV YCbCrA YCbCr Y XWD XV XPS XPM XCF XC XBM X3F X WPG WMZ WMV WMF WBMP
> VST VIFF VID VICAR VDA UYVY UIL UBRL TXT TTF TTC TIM TILE TIFF64 TIFF
> THUMBNAIL TGA TEXT SVGZ SVG SUN STEGANO SRF SR2 SHTML SGI SFW SCT SCR
> RLE RLA RGBO RGBA RGB RBG RAS RAF RADIAL-GRADIENT R PWP PTIF PSD PSB PS3
> PS2 PS PREVIEW PPM PNM PNG8 PNG32 PNG24 PNG PLASMA PJPEG PIX PICT PICON
> PGX PGM PFM PFB PFA PES PEF PDFA PDF PDB PCX PCT PCL PCDS PCD PBM
> PATTERN PAM PALM PAL OTF OTB ORF O NULL NEF MVG MTV MSVG MSL MRW MPG
> MPEG MPC MP4 MOV MONO MNG MIFF MATTE MAT MAP M4V M2V M LABEL KDC K25 K
> JPX JPG JPEG JPC JP2 JNG J2C ISOBRL IPL INLINE INFO ICON ICO ICB HTML
> HTM HRZ HISTOGRAM HALD GROUP4 GRB GRAY GRADIENT GIF87 GIF GBR G3 G FTS
> FRACTAL FITS FAX EXR ERF EPT3 EPT2 EPT EPSI EPSF EPS3 EPS2 EPS EPI EPDF
> DPX DOT DNG DJVU DFONT DDS DCX DCR DCM CUT CUR CRW CR2 CMYKA CMYK CLIP
> CIP CIN CAPTION CALS CAL C BRG BRF BMP3 BMP2 BMP BGRA BGR B AVS AVI ARW
> ART AI A 3FR)
>
> And that's a lot of text formats.
>
> How about just adding the common ones -- jpeg?, tiff?, png, gif.  That
> will take care of 99% of the problems.

There are many other binary formats that may contain "-*-" in the first line.

For example, it's impossible to visit TGA files in Emacs because they contain
a lot of "-*-".  TARGA is an old raster graphics file format still used
in modern programs for saving screenshots.  You can see one example below:

[1311129378.tga (image/x-targa, inline)]
[Message part 3 (text/plain, inline)]
BTW, Gnus doesn't display images supported by ImageMagick inline.
Could you please fix this in Gnus ;-)

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sat, 17 Sep 2011 05:15:02 GMT) Full text and rfc822 format available.

Message #32 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sat, 17 Sep 2011 07:06:08 +0200
Juri Linkov <juri <at> jurta.org> writes:

>> How about just adding the common ones -- jpeg?, tiff?, png, gif.  That
>> will take care of 99% of the problems.
>
> There are many other binary formats that may contain "-*-" in the first line.
>
> For example, it's impossible to visit TGA files in Emacs because they contain
> a lot of "-*-".  TARGA is an old raster graphics file format still used
> in modern programs for saving screenshots.  You can see one example below:

Sure.  Just go through the list and add the likely formats.  But using
the list as-is just won't fly, since it even contains "TXT" and "HTML".

> BTW, Gnus doesn't display images supported by ImageMagick inline.
> Could you please fix this in Gnus ;-)

I've now added support for ImageMagick pictures, but I can't get Emacs
to display that image inline.  `create-image' says that it creates the
image just fine, but when I `insert-image' it, I just get the dreaded
blank square box.  What does that mean?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sat, 17 Sep 2011 13:15:02 GMT) Full text and rfc822 format available.

Message #35 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Cc: Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sat, 17 Sep 2011 15:48:31 +0300
> Sure.  Just go through the list and add the likely formats.  But using
> the list as-is just won't fly, since it even contains "TXT" and "HTML".

We could remove text formats currently present in `imagemagick-types-inhibit':

  (C HTML HTM TXT PDF)

>> BTW, Gnus doesn't display images supported by ImageMagick inline.
>> Could you please fix this in Gnus ;-)
>
> I've now added support for ImageMagick pictures, but I can't get Emacs
> to display that image inline.  `create-image' says that it creates the
> image just fine, but when I `insert-image' it, I just get the dreaded
> blank square box.  What does that mean?

Debugging it reveals that lambda for "image/*" (BTW, is it a typo?
shouldn't this regexp be "image/.*"?) in `mm-inline-media-tests'
gets called twice and *Messages* shows:

  Invalid image number `nil' in image `(image :type imagemagick :data ...




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sat, 17 Sep 2011 22:04:01 GMT) Full text and rfc822 format available.

Message #38 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>, 9044 <at> debbugs.gnu.org,
	Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sat, 17 Sep 2011 17:58:37 -0400
Juri Linkov <juri <at> jurta.org> writes:

>> How about just adding the common ones -- jpeg?, tiff?, png, gif.  That
>> will take care of 99% of the problems.
>
> There are many other binary formats that may contain "-*-" in the
> first line.  For example, it's impossible to visit TGA files in Emacs
> because they contain a lot of "-*-".

I propose two fixes: (1) Adding some common image types to
inhibit-first-line-modes-regexps, and (2) changing
hack-local-variables-prop-line to return nil instead of signalling an
error for the "Malformed mode line" case.

Does anyone see a problem with this approach (in particular (2))?

=== modified file 'lisp/files.el'
*** lisp/files.el	2011-09-12 20:45:56 +0000
--- lisp/files.el	2011-09-17 21:56:13 +0000
***************
*** 2461,2467 ****
  
  See also `auto-mode-alist'.")
  
! (defvar inhibit-first-line-modes-regexps (mapcar 'purecopy '("\\.tar\\'" "\\.tgz\\'"))
    "List of regexps; if one matches a file name, don't look for `-*-'.")
  
  (defvar inhibit-first-line-modes-suffixes nil
--- 2461,2469 ----
  
  See also `auto-mode-alist'.")
  
! (defvar inhibit-first-line-modes-regexps
!   (mapcar 'purecopy '("\\.tar\\'" "\\.tgz\\'" "\\.tiff?\\'"
! 		      "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'"))
    "List of regexps; if one matches a file name, don't look for `-*-'.")
  
  (defvar inhibit-first-line-modes-suffixes nil
***************
*** 2952,2961 ****
  and VAL is the specified value.  Ignores any specification for
  `mode:' and `coding:' (which should have already been handled
  by `set-auto-mode' and `set-auto-coding', respectively).
! Throws an error if the -*- line is malformed.
  
  If MODE-ONLY is non-nil, just returns the symbol specifying the
  mode, if there is one, otherwise nil."
    (save-excursion
      (goto-char (point-min))
      (let ((end (set-auto-mode-1))
--- 2954,2964 ----
  and VAL is the specified value.  Ignores any specification for
  `mode:' and `coding:' (which should have already been handled
  by `set-auto-mode' and `set-auto-coding', respectively).
! Return nil if the -*- line is malformed.
  
  If MODE-ONLY is non-nil, just returns the symbol specifying the
  mode, if there is one, otherwise nil."
+   (catch 'fail
    (save-excursion
      (goto-char (point-min))
      (let ((end (set-auto-mode-1))
***************
*** 2974,2981 ****
  	     (while (and (or (not mode-only)
  			     (not result))
  			 (< (point) end))
! 	       (or (looking-at "[ \t]*\\([^ \t\n:]+\\)[ \t]*:[ \t]*")
! 		   (error "Malformed -*- line"))
  	       (goto-char (match-end 0))
  	       ;; There used to be a downcase here,
  	       ;; but the manual didn't say so,
--- 2977,2985 ----
  	     (while (and (or (not mode-only)
  			     (not result))
  			 (< (point) end))
! 	       (unless (looking-at "[ \t]*\\([^ \t\n:]+\\)[ \t]*:[ \t]*")
! 		 (message "Malformed mode-line")
! 		 (throw 'fail nil))
  	       (goto-char (match-end 0))
  	       ;; There used to be a downcase here,
  	       ;; but the manual didn't say so,
***************
*** 3005,3011 ****
  				       val) result)
  			 (error nil))))
  		 (skip-chars-forward " \t;")))
! 	     result)))))
  
  (defun hack-local-variables-filter (variables dir-name)
    "Filter local variable settings, querying the user if necessary.
--- 3009,3015 ----
  				       val) result)
  			 (error nil))))
  		 (skip-chars-forward " \t;")))
! 	     result))))))
  
  (defun hack-local-variables-filter (variables dir-name)
    "Filter local variable settings, querying the user if necessary.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sun, 18 Sep 2011 08:13:04 GMT) Full text and rfc822 format available.

Message #41 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sun, 18 Sep 2011 09:49:02 +0200
Juri Linkov <juri <at> jurta.org> writes:

> Debugging it reveals that lambda for "image/*" (BTW, is it a typo?
> shouldn't this regexp be "image/.*"?)

Yup, fixed.

> in `mm-inline-media-tests' gets called twice and *Messages* shows:
>
>   Invalid image number `nil' in image `(image :type imagemagick :data ...

Hm.  Where does that message come from?  And what does it mean?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sun, 18 Sep 2011 08:13:04 GMT) Full text and rfc822 format available.

Message #44 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Juri Linkov <juri <at> jurta.org>, Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sun, 18 Sep 2011 09:50:30 +0200
Chong Yidong <cyd <at> stupidchicken.com> writes:

> (2) changing hack-local-variables-prop-line to return nil instead of
> signalling an error for the "Malformed mode line" case.
>
> Does anyone see a problem with this approach (in particular (2))?

Sounds good to me.  Not being able to examine a file just because of
spurious text in the file isn't very nice.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




bug closed, send any further explanations to 9044 <at> debbugs.gnu.org and Peter Dyballa <Peter_Dyballa <at> Freenet.DE> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sun, 18 Sep 2011 15:36:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sun, 18 Sep 2011 19:41:01 GMT) Full text and rfc822 format available.

Message #49 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>, 9044 <at> debbugs.gnu.org,
	Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sun, 18 Sep 2011 22:28:39 +0300
> I propose two fixes: (1) Adding some common image types to
> inhibit-first-line-modes-regexps,

There is a little inconsistency: the default values for some formats
are added to `inhibit-first-line-modes-regexps' in files.el.
But other values are added to `inhibit-first-line-modes-suffixes'
dynamically by `jka-compr-install' in jka-cmpr-hook.el.
But this is not important because some image formats are
already present in files.el in `auto-mode-alist'.

> and (2) changing hack-local-variables-prop-line to return nil instead
> of signalling an error for the "Malformed mode line" case.

Yes, displaying a message is better even when "Malformed mode-line"
is momentarily replaced with "Type C-c C-c to view the image as text",
because it still allows visiting image files.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Sun, 18 Sep 2011 20:56:02 GMT) Full text and rfc822 format available.

Message #52 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>,
	Peter Dyballa <Peter_Dyballa <at> freenet.de>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Sun, 18 Sep 2011 23:50:16 +0300
BTW, I discovered a related problem - visiting the file `ebrowse'
in the `info' subdir fails with:

Debugger entered--Lisp error: (error "No Ebrowse file header found")
  signal(error ("No Ebrowse file header found"))
  error("No Ebrowse file header found")
  ebrowse-read()
  ebrowse-tree-mode()
  set-auto-mode-0(ebrowse-tree-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer ebrowse> "info/ebrowse" nil nil "info/ebrowse" (4068440 2054))
  find-file-noselect("info/ebrowse" nil nil nil)
  find-file("info/ebrowse")
  dired-find-file()
  call-interactively(dired-find-file nil nil)

It has the following entry in `auto-mode-alist':

     ("BROWSE\\'" . ebrowse-tree-mode)

but its case is ignored due to `auto-mode-case-fold'=t.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Mon, 19 Sep 2011 13:12:02 GMT) Full text and rfc822 format available.

Message #55 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> jurta.org>
Cc: Chong Yidong <cyd <at> stupidchicken.com>,
	Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Lars Magne Ingebrigtsen <larsi <at> gnus.org>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Mon, 19 Sep 2011 09:06:49 -0400
> It has the following entry in `auto-mode-alist':
>      ("BROWSE\\'" . ebrowse-tree-mode)
> but its case is ignored due to `auto-mode-case-fold'=t.

Congratulations for finding the first such case.  The fix is simple:
rename `ebrowse' to `ebrowse.info'.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9044; Package emacs. (Mon, 19 Sep 2011 14:35:02 GMT) Full text and rfc822 format available.

Message #58 received at 9044 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Chong Yidong <cyd <at> stupidchicken.com>,
	Peter Dyballa <Peter_Dyballa <at> freenet.de>,
	Lars Magne Ingebrigtsen <larsi <at> gnus.org>, 9044 <at> debbugs.gnu.org
Subject: Re: bug#9044: 24.0.50;
	File mode specification error: (error "Malformed -*- line")
Date: Mon, 19 Sep 2011 17:18:37 +0300
>> It has the following entry in `auto-mode-alist':
>>      ("BROWSE\\'" . ebrowse-tree-mode)
>> but its case is ignored due to `auto-mode-case-fold'=t.
>
> Congratulations for finding the first such case.

Maybe auto-mode-alist should be case-insensitive only for entries
that don't contain upper case letters (i.e. to follow the logic of
`isearch-no-upper-case-p')?

> The fix is simple: rename `ebrowse' to `ebrowse.info'.

Yes, this would help.  I don't know why Info files in the `info' subdir
miss the `.info' file extension.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Oct 2011 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 356 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.