[comp.emacs] Writing/Saving Buffers in Certain Mode

msc_wdqn@jhunix.HCF.JHU.EDU (Daniel Q Naiman) (01/30/91)

I am using GNU-EMACS and want to customize it 
so that when I save/write to a file, the resulting
file is readable only by me. From reading the manual
it is my impression that the solution to this 
problem has something to do with the hook
variable "write-file-hooks" but beyond that 
I do not know how to proceed. 

Can anyone help?

Please send replies to dan@jesse.mts.jhu.edu

Thanks. 

Dan Naiman (dan@jesse.mts.jhu.edu) 
Department of Mathematical Sciences
Johns Hopkins University

marc@arnor.uucp (02/02/91)

In article <7450@jhunix.HCF.JHU.EDU> msc_wdqn@jhunix.HCF.JHU.EDU (Daniel Q Naiman) writes:

>I am using GNU-EMACS and want to customize it 
>so that when I save/write to a file, the resulting
>file is readable only by me. From reading the manual
>it is my impression that the solution to this 
>problem has something to do with the hook
>variable "write-file-hooks" but beyond that 
>I do not know how to proceed. 

A brute force solution is to start emacs with a umask of 77, in which
case all files it creates will have no group or other permissions.
In ksh - (umask 77; emacs)

--


Marc Auslander       <marc@ibm.com>

cbrown@eeserv1.ic.sunysb.edu (Charles T Brown) (02/02/91)

In article <7450@jhunix.HCF.JHU.EDU> msc_wdqn@jhunix.HCF.JHU.EDU (Daniel Q Naiman) writes:
>
>I am using GNU-EMACS and want to customize it 
>so that when I save/write to a file, the resulting
>file is readable only by me. From reading the manual
>it is my impression that the solution to this 
>problem has something to do with the hook
>variable "write-file-hooks" but beyond that 
>I do not know how to proceed. 
>
>Can anyone help?
>
>Please send replies to dan@jesse.mts.jhu.edu
>
>Thanks. 
>
>Dan Naiman (dan@jesse.mts.jhu.edu) 
>Department of Mathematical Sciences
>Johns Hopkins University

Try 'man umask' and see what that gets you... (I'm on a SYSV system
acting like a  BSD4.3 system sometimes, so I'm never sure what
is just SYSV or just BSD... :-)

--Titus

-- 
"Never put off until tomorrow, that which can be done the day after tomorrow"
          -- C. Titus Brown, anonymous student, brown@max.physics.sunysb.edu

                UNIX is good, you say?  Which UNIX, say I!

kyle@uunet.UU.NET (Kyle Jones) (02/02/91)

msc_wdqn@jhunix.HCF.JHU.EDU (Daniel Q Naiman) writes:
 > I am using GNU-EMACS and want to customize it 
 > so that when I save/write to a file, the resulting
 > file is readable only by me. From reading the manual
 > it is my impression that the solution to this 
 > problem has something to do with the hook
 > variable "write-file-hooks" but beyond that 
 > I do not know how to proceed. 

marc@arnor.uucp writes:
 > A brute force solution is to start emacs with a umask of 77, in which
 > case all files it creates will have no group or other permissions.
 > In ksh - (umask 77; emacs)

In my opinion this is the best solution.  Using write-file-hooks
won't completely work, as Emacs creates some files without
running those hooks.  E.g. auto save files.

swansonc@acc.stolaf.edu (Chris Swanson, St. Olaf College) (02/07/91)

umask is on BSD as well.  To set up your default permissions as you
want, set your umask to 077, which will make the default permissions
for files that you write 600 or 700

That is set by the command:
umask 022

	-Chris

--
Chris Swanson, Chem/CS/Pre-med Undergrad, St. Olaf College, Northfield,MN 55057
  DDN: CDS6	INTERNET:  swansonc@acc.stolaf.edu	UUCP: swansonc@stolaf
  AT&T:		Work: (507)-645-6845			Home: (507)-663-6424
	I would deny this reality, but that wouldn't pay the bills...