unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* select 'mode' from command line?
@ 2005-06-29 19:25 Gustavo Seabra
  2005-06-29 21:51 ` Peter Dyballa
       [not found] ` <loom.20050629T211959-864-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Gustavo Seabra @ 2005-06-29 19:25 UTC (permalink / raw)


Hi,

I'm working witha code that has both fortran 77 and fortran 90 parts. All the 
files, however, are named *.f, and emacs always opens them with the 'fortran 
mode', which is actually more fortran77. So, I wonder if there's a way to tell 
emacs to use a specific 'mode' from the command line, overriding the default 
definition. Something like:

 $emacs -f90 my_f90_file.f &

to force emacs to already open the file with the f90 mode.

Thanks,

Gustavo Seabra.

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

* Re: select 'mode' from command line?
  2005-06-29 19:25 select 'mode' from command line? Gustavo Seabra
@ 2005-06-29 21:51 ` Peter Dyballa
  2005-06-29 22:24   ` Gustavo Seabra
       [not found]   ` <mailman.1641.1120084018.2857.help-gnu-emacs@gnu.org>
       [not found] ` <loom.20050629T211959-864-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
  1 sibling, 2 replies; 10+ messages in thread
From: Peter Dyballa @ 2005-06-29 21:51 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 29.06.2005 um 21:25 schrieb Gustavo Seabra:

> I'm working witha code that has both fortran 77 and fortran 90 parts. 
> All the
> files, however, are named *.f, and emacs always opens them with the 
> 'fortran
> mode', which is actually more fortran77.

Why don't you let your f90 files begin with a comment:

     C -*- mode: f90; coding: iso-8859-15; -*-

This line among the first few switches GNU Emacs in the right mood.

--
Greetings

   Pete

"One person with a belief is a social power equal to ninety-nine who 
have only interests." - John Stuart Mill

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

* Re: select 'mode' from command line?
  2005-06-29 21:51 ` Peter Dyballa
@ 2005-06-29 22:24   ` Gustavo Seabra
  2005-06-30 14:04     ` Peter Dyballa
       [not found]     ` <mailman.1729.1120140988.2857.help-gnu-emacs@gnu.org>
       [not found]   ` <mailman.1641.1120084018.2857.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 10+ messages in thread
From: Gustavo Seabra @ 2005-06-29 22:24 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 6/29/05, Peter Dyballa <Peter_Dyballa@web.de> wrote:
> 
> Am 29.06.2005 um 21:25 schrieb Gustavo Seabra:
> 
> > I'm working witha code that has both fortran 77 and fortran 90 parts.
> > All the
> > files, however, are named *.f, and emacs always opens them with the
> > 'fortran
> > mode', which is actually more fortran77.
> 
> Why don't you let your f90 files begin with a comment:
> 
>     C -*- mode: f90; coding: iso-8859-15; -*-
> 
> This line among the first few switches GNU Emacs in the right mood.
> 
> --
> Greetings
> 
>   Pete
> 
> "One person with a belief is a social power equal to ninety-nine who
> have only interests." - John Stuart Mill
> 
> 

Thanks! that solved the problem, but I had to use:

!C -*- mode: f90; coding: iso-8859-15; -*-

instead. Otherwise the f90 compiler complains (the "C" on the 1st line
is not understood as a comment in F90, "!" is.

-- 
---------------------------------------------------------------------------------------------
Gustavo Seabra

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

* Re: select 'mode' from command line?
       [not found]   ` <mailman.1641.1120084018.2857.help-gnu-emacs@gnu.org>
@ 2005-06-29 22:46     ` Miles Bader
  0 siblings, 0 replies; 10+ messages in thread
From: Miles Bader @ 2005-06-29 22:46 UTC (permalink / raw)


Gustavo Seabra <gustavo.seabra@gmail.com> writes:
> !C -*- mode: f90; coding: iso-8859-15; -*-
>
> instead. Otherwise the f90 compiler complains (the "C" on the 1st line
> is not understood as a comment in F90, "!" is.

You can drop the "C" then; Emacs only cares about the stuff between the
two "-*-" markers.

-Miles
-- 
/\ /\
(^.^)
(")")
*This is the cute kitty virus, please copy this into your sig so it can spread.

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

* Re: select 'mode' from command line?
       [not found] ` <loom.20050629T211959-864-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
@ 2005-06-30  9:39   ` Jochen Küpper
  2005-06-30 15:16     ` Peter Dyballa
  2005-06-30 15:38     ` Gustavo Seabra
  0 siblings, 2 replies; 10+ messages in thread
From: Jochen Küpper @ 2005-06-30  9:39 UTC (permalink / raw)


Gustavo Seabra <gustavo.seabra-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I'm working witha code that has both fortran 77 and fortran 90 parts. All the 
> files, however, are named *.f, and emacs always opens them with the 'fortran 
> mode', which is actually more fortran77. So, I wonder if there's a way to tell 
> emacs to use a specific 'mode' from the command line, overriding the default 
> definition. 

Can you put Local Variable "cookies" into these files?

,----[ (info "(emacs)File Variables") ]
| A file can specify local variable values for use when you edit the file
| with Emacs.  Visiting the file checks for local variable
| specifications; it automatically makes these variables local to the
| buffer, and sets them to the values specified in the file.
`----

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
        (Part 3 you find in my messages before fall 2003.)

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

* Re: select 'mode' from command line?
  2005-06-29 22:24   ` Gustavo Seabra
@ 2005-06-30 14:04     ` Peter Dyballa
  2005-06-30 15:05       ` select 'mode' from command line? [OT] Emilio Lopes
       [not found]     ` <mailman.1729.1120140988.2857.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Dyballa @ 2005-06-30 14:04 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 30.06.2005 um 00:24 schrieb Gustavo Seabra:

> I had to use:
>
> !C -*- mode: f90; coding: iso-8859-15; -*-
>
> instead. Otherwise the f90 compiler complains (the "C" on the 1st line
> is not understood as a comment in F90, "!" is.


Ahemm, my FORTRAN seems to be from '66! I thought you still have to put 
a C in column 6 ...

Actually Emacs reads what's between the -*- markers, the C is not part 
of the syntax, as Miles Bader remarks!

--
Greetings

   Pete

"Computers are good at following instructions,
but not at reading your mind."
D. E. Knuth, The TeXbook, Addison-Wesley 1984, 1986, 1996, p. 9

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

* Re: select 'mode' from command line?
       [not found]     ` <mailman.1729.1120140988.2857.help-gnu-emacs@gnu.org>
@ 2005-06-30 14:45       ` Miles Bader
  0 siblings, 0 replies; 10+ messages in thread
From: Miles Bader @ 2005-06-30 14:45 UTC (permalink / raw)


Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> Ahemm, my FORTRAN seems to be from '66! I thought you still have to put
> a C in column 6 ...

Wow, the original Emacs supported harcopy terminals (really!) but I
didn't know there was any version that could handle a card punch!

-Miles
-- 
=====
(^o^;
(()))
*This is the cute octopus virus, please copy it into your sig so it can spread.

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

* Re: select 'mode' from command line? [OT]
  2005-06-30 14:04     ` Peter Dyballa
@ 2005-06-30 15:05       ` Emilio Lopes
  0 siblings, 0 replies; 10+ messages in thread
From: Emilio Lopes @ 2005-06-30 15:05 UTC (permalink / raw)


Peter Dyballa <Peter_Dyballa <at> Web.DE> writes:

> Am 30.06.2005 um 00:24 schrieb Gustavo Seabra:
> 
> > I had to use:
> >
> > !C -*- mode: f90; coding: iso-8859-15; -*-
> >
> > instead. Otherwise the f90 compiler complains (the "C" on the 1st line
> > is not understood as a comment in F90, "!" is.
> 
> Ahemm, my FORTRAN seems to be from '66! I thought you still have to put 
> a C in column 6 ...

Actually the comment char (a 'C' in FORTRAN 66, alternativelly a '*' in
FORTRAN 77) must appear in the *first* column.  A character (any valid
character!)in column 6 indicates a continuation line.

 -ECL

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

* Re: select 'mode' from command line?
  2005-06-30  9:39   ` Jochen Küpper
@ 2005-06-30 15:16     ` Peter Dyballa
  2005-06-30 15:38     ` Gustavo Seabra
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2005-06-30 15:16 UTC (permalink / raw)
  Cc: Gustavo Seabra


Am 30.06.2005 um 11:39 schrieb Jochen Küpper:

> Can you put Local Variable "cookies" into these files?
>

These local variables are placed at the end of the file and consist of 
a few lines. Here is an example where I try to teach AUCTeX to use a 
specific programme to tex that specific TeX file:

%%% Local Variables:
%%% TeX-command-default: "xelatex"
%%% End:

This comes from a shell script and uses 'mode':

# Local Variables:
# mode: shell-script
# sh-indentation: 3
# coding: iso-8859-1
# End:

And here a hook is performed on opening that file in GNU Emacs:

;; Local Variables:
;; eval: (cl-indent 'when-debugging 1)
;; End:

You see that the comments vary and can you make a lot buffer local.

--
Greetings

   Pete

In a world without walls and fences, who needs gates and windows?

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

* Re: select 'mode' from command line?
  2005-06-30  9:39   ` Jochen Küpper
  2005-06-30 15:16     ` Peter Dyballa
@ 2005-06-30 15:38     ` Gustavo Seabra
  1 sibling, 0 replies; 10+ messages in thread
From: Gustavo Seabra @ 2005-06-30 15:38 UTC (permalink / raw)


Jochen Küpper <jochen@...> writes:

> 
> Gustavo Seabra <gustavo.seabra@...> writes:
> 
> > I'm working witha code that has both fortran 77 and fortran 90 parts. All 
the 
> > files, however, are named *.f, and emacs always opens them with 
the 'fortran 
> > mode', which is actually more fortran77. So, I wonder if there's a way to 
tell 
> > emacs to use a specific 'mode' from the command line, overriding the 
default 
> > definition. 
> 
> Can you put Local Variable "cookies" into these files?
> 
> ,----[ (info "(emacs)File Variables") ]
> | A file can specify local variable values for use when you edit the file
> | with Emacs.  Visiting the file checks for local variable
> | specifications; it automatically makes these variables local to the
> | buffer, and sets them to the values specified in the file.
> `----
> 
> Greetings,
> Jochen

Thanks. In fact I'm working on someone else's code, so I try to minimize any 
changes that are not *directly* related to what I'm doing. In this sense, 
Peter's suggestion worked fine, since it is only one line at the top of the 
file.

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

end of thread, other threads:[~2005-06-30 15:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-29 19:25 select 'mode' from command line? Gustavo Seabra
2005-06-29 21:51 ` Peter Dyballa
2005-06-29 22:24   ` Gustavo Seabra
2005-06-30 14:04     ` Peter Dyballa
2005-06-30 15:05       ` select 'mode' from command line? [OT] Emilio Lopes
     [not found]     ` <mailman.1729.1120140988.2857.help-gnu-emacs@gnu.org>
2005-06-30 14:45       ` select 'mode' from command line? Miles Bader
     [not found]   ` <mailman.1641.1120084018.2857.help-gnu-emacs@gnu.org>
2005-06-29 22:46     ` Miles Bader
     [not found] ` <loom.20050629T211959-864-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2005-06-30  9:39   ` Jochen Küpper
2005-06-30 15:16     ` Peter Dyballa
2005-06-30 15:38     ` Gustavo Seabra

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