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

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

Re: Does anyone really use emacs in terminal?


From: Thorsten Jolitz
Subject: Re: Does anyone really use emacs in terminal?
Date: Thu, 09 May 2013 10:21:18 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com> writes:

> No, the only real risk with emacs, is that it's so agreable to use, that
> you may forgot you're logged as root.   For this, I have:
>
>     (when (= (user-uid) 0)
>      (set-background-color "black")
>      (set-foreground-color "red"))
>
> in my .emacs files…

I have this in my (minimal) init file for Emacs root sessions, which is
quite nice since it keeps the e.g. black background and wheat foreground
colors and only adds a red header line at the top of the buffer. I
copied it from somewhere, probably Fabrice Niessen's .emacs, but I'm not
sure about it. 

,--------------------------------------------------------------------
| ;; **  Warning about being 'root'
| 
| (message "emacs-ESU-script root warning ...")
| 
| (defface find-file-root-header-face
|   '((t (:foreground "white" :background "red3")))
|   "*Face use to display header-lines for files opened as root.")
| 
| (defun find-file-root-header-warning ()
|   "*Display a warning in header line of the current buffer.
|   This function is suitable to add to `find-file-root-hook'."
|   (let* ((warning "WARNING: EDITING FILE WITH ROOT PRIVILEGES!")
|          (space (+ 6 (- (frame-width) (length warning))))
|          (bracket (make-string (/ space 2) ?-))
|          (warning (concat bracket warning bracket)))
|     (setq header-line-format
|           (propertize warning 'face 'find-file-root-header-face))))
| 
| (add-hook 'find-file-hook 'find-file-root-header-warning)
| (add-hook 'dired-mode-hook 'find-file-root-header-warning)
`--------------------------------------------------------------------

-- 
cheers,
Thorsten




reply via email to

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