all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How to configure emacs to prompt for revert modified buffer at once it was modified
Date: Tue, 21 Aug 2007 18:08:39 +0200	[thread overview]
Message-ID: <87lkc498fs.fsf@ambire.localdomain> (raw)
In-Reply-To: mailman.5052.1187708590.32220.help-gnu-emacs@gnu.org

() david@adboyd.com (J. David Boyd)
() Tue, 21 Aug 2007 11:02:39 -0400

   auto-revert-mode

below are some functions i use to monitor the .c file produced by a
(cute but buggy) scheme->C compiler.  a file visited this way is thus
protected against wanton kill-buffer commands (which fly from my fingers
regularly w/o conscious thought).  one less thing to worry about.  of
course, you need to explicitly `C-x C-q' at some point, either that or
crash the computer.  (exiting emacs also works, but who does that?!)

thi


____________________________________________
(defun bury-if-read-only ()
  "If buffer is writable, return t, otherwise bury it and return nil.
This function is intended to added to `kill-buffer-query-functions'."
  (cond ((not buffer-read-only))
        (t (message "(Burying %s -- make writable to really kill.)"
                    (buffer-name))
           (bury-buffer)
           nil)))

(defun watch-file-preciously (filename)
  (interactive "fFilename: ")
  (find-file-read-only filename)
  (add-hook 'kill-buffer-query-functions 'bury-if-read-only nil t)
  (auto-revert-mode 1))

(global-set-key "\C-x\M-f" 'watch-file-preciously)

  parent reply	other threads:[~2007-08-21 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 14:51 How to configure emacs to prompt for revert modified buffer at once it was modified Dmitry Bolshakov
2007-08-20 17:46 ` Sean Sieger
2007-08-21 15:02   ` J. David Boyd
     [not found]   ` <mailman.5052.1187708590.32220.help-gnu-emacs@gnu.org>
2007-08-21 16:08     ` Thien-Thi Nguyen [this message]
     [not found] <mailman.5008.1187621515.32220.help-gnu-emacs@gnu.org>
2007-08-20 15:50 ` aartist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lkc498fs.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.