🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87390

[19.27] Enhancement to rmailout.el: file protection modes

#87390
From: Mike Long
Date: Wed, 28 Sep 1994 17:25
58 lines
2843 bytes
In GNU Emacs 19.27.1 (sparc-sun-sunos4.1.3, X toolkit) of Sun Sep 18 1994 on cthulhu

The patches below add the ability to control the file protection modes
of files newly created by Rmail.  I'm sure you'll want to fiddle with
the variable name, &c., but this works for me.

--- rmail.el.orig	Sun Sep  4 20:10:12 1994
+++ rmail.el	Wed Sep 28 10:38:01 1994
@@ -87,6 +87,10 @@
 *Non-nil means automatically delete a message that is copied to a file.")
 
 ;;;###autoload
+(defvar rmail-output-file-modes 384 "\
+*File protection mode for newly created mail files.  The value is an integer.")
+
+;;;###autoload
 (defvar rmail-primary-inbox-list nil "\
 *List of files which are inboxes for user's primary mail file `~/RMAIL'.
 `nil' means the default, which is (\"/usr/spool/mail/$USER\")
--- rmailout.el.orig	Thu Aug  4 02:39:51 1994
+++ rmailout.el	Wed Sep 28 10:34:41 1994
@@ -109,6 +109,7 @@
 		(rmail-insert-rmail-file-header)
 		(let ((require-final-newline nil))
 		  (write-region (point-min) (point-max) file-name t 1)))
+	      (set-file-modes file-name rmail-output-file-modes)
 	      (kill-buffer file-buffer))
 	  (error "Output file does not exist")))
     (while (> count 0)
@@ -249,7 +250,8 @@
 		    (forward-line 1)
 		    (= (following-char) ?0)))))
 	  header-beginning
-	  mail-from)
+	  mail-from
+	  new-file)
       (while (> count 0)
 	(or from-gnus
 	    (setq mail-from
@@ -281,8 +283,10 @@
 	  (while (search-forward "\nFrom " nil t)
 	    (forward-char -5)
 	    (insert ?>))
+	  (setq new-file (not (file-exists-p file-name)))
 	  (write-region (point-min) (point-max) file-name t
-			(if noattribute 'nomsg)))
+			(if noattribute 'nomsg))
+	  (if new-file (set-file-modes file-name rmail-output-file-modes)))
 	(or noattribute
 	    (if (equal major-mode 'rmail-mode)
 		(rmail-set-attribute "filed" t)))


-- 
Mike Long                                         Mike.Long@Analog.com
VLSI Design Engineer                    (PGP 2.6 public key available)
Analog Devices, CPD Division
Norwood, MA 02062 USA                assert(*this!=opinionof(Analog));
Technical Details
Message-ID: <9409281719.AA07602@cthulhu>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!analog.COM!mike.long

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,f6698000477d9e07,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-29 00:43:48 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!analog.COM!mike.long
From: mike.long@analog.COM (Mike Long)
Newsgroups: gnu.emacs.bug
Subject: [19.27] Enhancement to rmailout.el: file protection modes
Date: 28 Sep 1994 13:25:30 -0400
Organization: Analog Devices Inc, Norwood MA, USA
Lines: 58
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9409281719.AA07602@cthulhu>
Reply-To: Mike Long <Mike.Long@analog.com>