Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Mac Applications / February 2005



Tip: Looking for answers? Try searching our database.

How to make Mac OSX rememember to open a file in emacs?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Newbie - 25 Feb 2005 19:19 GMT
I am using mac OSX 10.3. I created a small text file with emacs
("enhanced carbon" 21.3) but when I double click on the file's icon it
open in textedit, not emacs.  This is quite unusual for macosx where
most document open in the app that created them

How to make the os remmebr that it is an emacs file? Do I need a
special ending (like name.emacs)?
Emily Jackson - 25 Feb 2005 20:31 GMT
>>>>> "Newbie" == Newbie  <newbie@no.spam> writes:

   Newbie> I am using mac OSX 10.3. I created a small text file with
   Newbie> emacs ("enhanced carbon" 21.3) but when I double click on
   Newbie> the file's icon it open in textedit, not emacs.  This is
   Newbie> quite unusual for macosx where most document open in the app
   Newbie> that created them

Try running this command (if you have XCode installed):

SetFile -c EMAx -t ttxt path/to/file

Or look on versiontracker.com for utilities to change creator codes of
files; in any case, changing a file's creator code to EMAx should work.

HTH,

Emily

Signature

"If it seem slow, wait for it; it will surely come, it will not delay."
Emily Jackson
E-mail address altered; reply to m5comp AT fastmail DOT fm
<http://home.hiwaay.net/~emilyj/missjackson.html>

markg5@SPAMBLOCKmyrealbox.com - 25 Feb 2005 21:01 GMT
> I am using mac OSX 10.3. I created a small text file with emacs
> ("enhanced carbon" 21.3) but when I double click on the file's icon it
[quoted text clipped - 3 lines]
> How to make the os remmebr that it is an emacs file? Do I need a
> special ending (like name.emacs)?

Not sure about the extension, but select the file and do a "get info"
(Apple-I) Flip the triangle to see the Open With section. Click the button
(currently saying "textedit (default)) and navigate to your chosen
application (emacs or whatever). That should do it

I'm not sure about the extension. If you create a file in emacs what
extension does it get? (Again, you may need to use Get Info if you have
extensions hidden as a preference). If it is txt, like textedit there may be
other problems. HOWEVER if you want all txt files to open in emacs when you
select it as above hit the "change all" button (in Open With). Now all text
files will open in emacs, unless you tell it otherwise

Hope this makes some sense!
Warren Oates - 25 Feb 2005 22:25 GMT
:> I am using mac OSX 10.3. I created a small text file with emacs
:> ("enhanced carbon" 21.3) but when I double click on the file's icon it
[quoted text clipped - 15 lines]
:select it as above hit the "change all" button (in Open With). Now all text
:files will open in emacs, unless you tell it otherwise

Emacs will save the file with whatever extension you give it. If it's
.txt, that's what the Mac will see, and will open the file in whatever
app it normally opens *.txt files with. As you point out, this can be
changed with CMD-i.  

With Emacs, on OS X, you should probably work on a file-to-file
basis. If you use Emacs to edit your HTML files (say), they'll be
saved as *.html, and probably (hopefully) will open with Firefox. You
don't want Emacs as the default in this case.

Signature

Looks like more of Texas to Me

jacob@ruccs.rutgers.edu - 26 Feb 2005 01:48 GMT
I simply invented a new extension, .emx, for this purpose. After giving
this extension to one file, you can the use get-info to "change all"
with this extension, and henceforth all .emx files open with emacs. As
another poster suggested though, you'll only want to do this with files
that you normally want to open with emacs, which for me is only a small
subset of the files that I use emacs to create.

A distantly related question: I have tried to use OS X's color-coding
scheme to mark files that I am currently working on. But emacs
automatically makes temp backups of files it works on (eg filename~),
and for some reason these files "inherit" the color while the original
file loses it. This makes it unusable of course because you don't want
to open the backup file. Anybody know how to fix this?

-jacob
Paul Mitchum - 26 Feb 2005 02:13 GMT
[..]
> A distantly related question: I have tried to use OS X's color-coding
> scheme to mark files that I am currently working on. But emacs
> automatically makes temp backups of files it works on (eg filename~), and
> for some reason these files "inherit" the color while the original file
> loses it. This makes it unusable of course because you don't want to open
> the backup file. Anybody know how to fix this?

In order to fix it, you'd have to reprogram emacs to copy the color
label info to the new file. You might email the developers about it.
Julian Lighton - 27 Feb 2005 01:22 GMT
>A distantly related question: I have tried to use OS X's color-coding
>scheme to mark files that I am currently working on. But emacs
>automatically makes temp backups of files it works on (eg filename~),
>and for some reason these files "inherit" the color while the original
>file loses it. This makes it unusable of course because you don't want
>to open the backup file. Anybody know how to fix this?

Add:
(setq backup-by-copying t)
to your .emacs

Emacs' default behavior is to make its backup files by renaming the old
one, then writing out a brand new file with the updated contents.
Viktor Haag - 28 Feb 2005 15:25 GMT
> Emacs will save the file with whatever extension you give
> it. If it's .txt, that's what the Mac will see, and will open
> the file in whatever app it normally opens *.txt files with. As
> you point out, this can be changed with CMD-i.

It's not as simple as "file extensions" on OSX; there are also
"creator codes" which, I believe, live in a file's resource
fork. I'm not precisely positive what OSX's policy is, but I
think it's this:

- open a file with that file's creator, if it has a resource fork
 with a creator code in it; in this case, ignore the file's name
 extension.

- if a file has resource fork, but no creator code, open it with
 the application associated with the file's name extension.

- if a file has no resource fork, open it with the application
 associated with the file's name extension.

I'm not sure under what circumstances an application will add a
creator code into a file's resource fork when it saves a file,
but I'm sure this behaviour varies from app to app, and is not
part of the basic OSX file API. Also, I'm pretty sure that Emacs
completely ignores the resource fork of files, and so the only
way to get it to automatically open with files is to (a)
associate the app with a file extension, and then (b) make sure
that files with that extension won't have a resource fork with a
creator code written in it.

For example, I'm not sure whether TextEdit.app writes its creator
code into files it saves, but if it does then it will "co-opt"
any file it edits and saves, including ones that you give a
special ".emacs" file extension.

One way to get around this problem is to use 'open' from a
command line -- you can use it to specify an application to open
a file. If you're using Emacs but not the command line, I'm must
admit to being surprised, and suggest you start (using the
command line, that is).

With OSX's memory manager operating the way it does, there's no
need to open Emacs and then quit it all the time; open it when
you log on, and leave it running all the time, hiding it when
you're not using it. That way, editing a file with it is just a
few CMD-TABs and some keystrokes away.

Signature

Viktor Haag : Senior Technical Writer : Research In Motion

Tim Streater - 28 Feb 2005 16:19 GMT
> > Emacs will save the file with whatever extension you give
> > it. If it's .txt, that's what the Mac will see, and will open
[quoted text clipped - 5 lines]
> fork. I'm not precisely positive what OSX's policy is, but I
> think it's this:

No they don't. Word files (.doc under Win) have no resource fork but can
have file type and creator codes.

-- tim
Miles Bader - 28 Feb 2005 22:26 GMT
>> It's not as simple as "file extensions" on OSX; there are also
>> "creator codes" which, I believe, live in a file's resource
[quoted text clipped - 3 lines]
> No they don't. Word files (.doc under Win) have no resource fork but can
> have file type and creator codes.

I vaguely recall hearing that Apple was "de-emphasizing" resource forks
these days (presumably for greater inter-operability with non-Apple
filesystems), though I have no idea what that means in practice....
Is this just a rumour?

-Miles
Signature

.Numeric stability is probably not all that important when you're guessing.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.