Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6246647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:43:40+00:00 2026-05-24T12:43:40+00:00

How do I make emacs notify me about the fact that one or more

  • 0

How do I make emacs notify me about the fact that one or more visited files are changed from elsewhere? Here’s how this functionality is implemented in Gedit:

gedit - notify about external changes

I’ve taken a look at the approaches explained in the “Revert Buffer” document at EmacsWiki and found sort of a workaround (modified a bit for my personal preference):

(global-set-key (kbd "<f5>") (lambda ()
  (interactive)
  (if (string= (buffer-name) ecb-directories-buffer-name)
    (refresh-ecb)
    (if (buffer-modified-p)
      (revert-buffer) ; ask for confirmation
      (revert-buffer t t))))) ; don't ask for confirmation - it's unnecessary, since the buffer hasn't been modified

That’s great, but what I would like is to have an automatic solution. Maybe, some kind of noisy message inlined in a buffer (like in the screenshot). Maybe, even a modal dialog as implemented in Visual Studio (that’s annoying, but it does the trick, after all). What would be your suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:43:43+00:00Added an answer on May 24, 2026 at 12:43 pm

    Here’s what I’ve been able to come up with – big thanks to the guys from EmacsWiki for hints. I created a callback that gets triggered every few seconds – it checks modtime and displays an annoying message if the file has been modified.

    On the upside, the solution mostly works and notifies me about changes regardless of whether the buffer is modified or not. On the downside, it involves constant polling of current file for modtime, but my work scenarios can tolerate that.

    emacs notify external changes

    ;(global-auto-revert-mode 1)
    (defun ask-user-about-supersession-threat (fn) "blatantly ignore files that changed on disk")
    (run-with-timer 0 2 'my-check-external-modifications)
    (add-hook 'after-save-hook 'my-check-external-modifications)
    (add-hook 'after-revert-hook 'my-check-external-modifications)
    
    (defun my-load-external-modifications ()
      (interactive)
      (if (string= (buffer-name) ecb-directories-buffer-name)
        (refresh-ecb)
        (if (buffer-modified-p)
          (revert-buffer) ; ask for confirmation
          (revert-buffer t t)) ; don't ask for confirmation - it's unnecessary, since the buffer hasn't been modified
        (my-check-external-modifications))) 
    
    (defun my-overwrite-external-modifications ()
      (interactive)
      (clear-visited-file-modtime)
      (set-buffer-modified-p (current-buffer))
      (save-buffer)
      (my-check-external-modifications))
    
    (defun my-check-external-modifications ()
      (if (verify-visited-file-modtime (current-buffer))
        (progn
          (global-set-key (kbd "<f5>") 'my-load-external-modifications)
          (global-set-key (kbd "C-s") 'save-buffer)
          (setq header-line-format tabbar-header-line-format))
        (progn
          (global-set-key (kbd "<f5>") 'my-load-external-modifications)
          (global-set-key (kbd "C-s") 'my-overwrite-external-modifications)
          (setq header-line-format (format "%s. Press F5 to load external changes, C-s to overwrite them"
            (propertize "This file has been changed externally" 'face '(:foreground "#f00")))))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: EmacsW32 is a version of Emacs that allows the user to make Emacs
Are there any mnemonics or patterns that make memorizing emacs key combos easier?
How can I make a cross-platform emacs command that opens another instance of emacs
How to make Emacs to indent cases like this switch ($foo) { case foo:
ruby-mode from svn, looks equal to 1.1 version here is emacs indentation of hash
I modified my .emacs file to make auto-backups hidden files via the following code:
I'm trying to make emacs' delete-file function delete files with exclamation marks in their
Is there anything that should be done to make GNU Emacs 23.2 work well
I want to have a make-shells command in emacs that will open a number
From time to time I delete files that I shouldn't and worst is files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.