help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug when compiling elc code?


From: Sven Joachim
Subject: Re: Bug when compiling elc code?
Date: Wed, 08 Aug 2007 14:17:00 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

Hadron <hadronquark@googlemail.com> writes:

> I recently added this bit of lisp to my .emacs in order to automatically
> byte compile any el files I saved
>
> ,----
> | (add-hook 'emacs-lisp-mode-hook
> |           '(lambda ()
> |              (make-local-hook 'after-save-hook)
> |              (add-hook 'after-save-hook
> |                        '(lambda ()
> |                           (byte-compile-file buffer-file-name))
> |                        nil t)))
> `----
>
> I have my gnus specifics such as smtp server names and passwords in a
> "personal.el" file which is obviously not readable by anyone but my own
> login and root.
>
> Unfortunately byte-compile-file produced the following:
>
> -rw------- 1 hadron hadron 4961 2007-08-08 12:19 personal.el
> -rw-r--r-- 1 hadron hadron 3795 2007-08-08 12:19 personal.elc
>
> In other words a readable by anyone elc file.
>
> I just checked - I can load up the elc file and see all my passwords.
>
> Bug or feature? Seems like a nasty bug to me.

No, not really.  If personal.elc does not exist, Emacs creates it
according to your current umask, like any other file.  You can change
this default with the function set-default-file-modes, please try the
following: 

(add-hook 'emacs-lisp-mode-hook
          '(lambda ()
             (make-local-hook 'after-save-hook)
             (add-hook 'after-save-hook
                       '(lambda ()
                          (let ((old-mode (default-file-modes)))
                            (set-default-file-modes (file-modes 
buffer-file-name))
                            (byte-compile-file buffer-file-name)
                            (set-default-file-modes old-mode)))
                       nil t)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]