emacs-devel
[Top][All Lists]
Advanced

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

Emacs does not detect a buffered file got deleted


From: 路客
Subject: Emacs does not detect a buffered file got deleted
Date: Mon, 8 Aug 2016 11:33:26 +0800

Hi all:

When editing a file in Emacs and switching git branches, sometimes
a file will be removed but Emacs won't detect it. Unlike modified
files it will ask me to revert, deleted files are not. Is it
intentional? After a while I found this behavior exists from the very
beginning trace back to 1991-01-14 RMS's original code in filelock.c,
function "lockfile":

{
  register Lisp_Object subject_buf = Fget_file_buffer (fn);
  if (!NULL (subject_buf)
      && NULL (Fverify_visited_file_modtime (subject_buf))
      && !NULL (Ffile_exists_p (fn))) /// <<<<<< HERE <<<<<<<<<
    call1 (intern ("ask-user-about-supersession-threat"), fn);
}

It then later changed by Jim Blandy on 1992-01-13 to change "NULL"
to "NILP":

  if (!NILP (subject_buf)
      && NILP (Fverify_visited_file_modtime (subject_buf))
      && !NILP (Ffile_exists_p (fn)))  /// <<<<<<< HERE <<<<<<<<<
    call1 (intern ("ask-user-about-supersession-threat"), fn);


Should we now consider remove the last condition
"&& !NILP (Ffile_exists_p (fn))"
to make Emacs able to detect file deletion?

Thanks.


--
Best regards,
Luke Lee


reply via email to

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