From ec1b9b17fa69a4ac051f64e21c85660d127c23a5 Mon Sep 17 00:00:00 2001
From: Glenn Morris <rgm@gnu.org>
Date: Tue, 7 Dec 2010 19:45:45 -0800
Subject: [PATCH] Make verify-visited-file-modtime default to the current
 buffer.

* src/fileio.c (Fverify_visited_file_modtime): Default to current buffer.
* doc/lispref/buffers.texi (Modification Time):
verify-visited-file-modtime now defaults to the current buffer.
---
 doc/lispref/ChangeLog    |  8 ++++++--
 doc/lispref/buffers.texi | 18 ++++++++----------
 src/ChangeLog            |  4 ++++
 src/fileio.c             | 14 +++++++++-----
 4 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index c6d851f55ec..36d85bc98ba 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,7 +1,11 @@
+2010-12-08  Glenn Morris  <rgm@gnu.org>
+
+	* buffers.texi (Modification Time):
+	verify-visited-file-modtime now defaults to the current buffer.
+
 2010-11-27  Chong Yidong  <cyd@stupidchicken.com>
 
-	* nonascii.texi (Converting Representations): Document
-	byte-to-string.
+	* nonascii.texi (Converting Representations): Document byte-to-string.
 
 	* strings.texi (Creating Strings): Don't mention semi-obsolete
 	function char-to-string.
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 2a7a603e733..8811178fe92 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1,7 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002,
-@c   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+@c   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/buffers
 @node Buffers, Windows, Backups and Auto-Saving, Top
@@ -594,12 +595,12 @@ therefore checks the file's modification time using the functions
 described below before saving the file.  (@xref{File Attributes},
 for how to examine a file's modification time.)
 
-@defun verify-visited-file-modtime buffer
-This function compares what @var{buffer} has recorded for the
-modification time of its visited file against the actual modification
-time of the file as recorded by the operating system.  The two should be
-the same unless some other process has written the file since Emacs
-visited or saved it.
+@defun verify-visited-file-modtime &optional buffer
+This function compares what @var{buffer} (by default, the
+current-buffer) has recorded for the modification time of its visited
+file against the actual modification time of the file as recorded by the
+operating system.  The two should be the same unless some other process
+has written the file since Emacs visited or saved it.
 
 The function returns @code{t} if the last actual modification time and
 Emacs's recorded modification time are the same, @code{nil} otherwise.
@@ -1223,6 +1224,3 @@ This function returns the current gap position in the current buffer.
 This function returns the current gap size of the current buffer.
 @end defun
 
-@ignore
-   arch-tag: 2e53cfab-5691-41f6-b5a8-9c6a3462399c
-@end ignore
diff --git a/src/ChangeLog b/src/ChangeLog
index 47dd5c650c3..eeba4192e25 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-08  Glenn Morris  <rgm@gnu.org>
+
+	* fileio.c (Fverify_visited_file_modtime): Default to current buffer.
+
 2010-12-06  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* xml.c (parse_region): Ignore blank HTML nodes.
diff --git a/src/fileio.c b/src/fileio.c
index 36b6cc3ca8b..886e5ebc411 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5044,9 +5044,10 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system
 }
 
 DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime,
-       Sverify_visited_file_modtime, 1, 1, 0,
+       Sverify_visited_file_modtime, 0, 1, 0,
        doc: /* Return t if last mod time of BUF's visited file matches what BUF records.
 This means that the file has not been changed since it was visited or saved.
+If BUF is omitted or nil, it defaults to the current buffer.
 See Info node `(elisp)Modification Time' for more details.  */)
   (Lisp_Object buf)
 {
@@ -5055,8 +5056,13 @@ See Info node `(elisp)Modification Time' for more details.  */)
   Lisp_Object handler;
   Lisp_Object filename;
 
-  CHECK_BUFFER (buf);
-  b = XBUFFER (buf);
+  if (NILP (buf))
+    b = current_buffer;
+  else
+    {
+      CHECK_BUFFER (buf);
+      b = XBUFFER (buf);
+    }
 
   if (!STRINGP (b->filename)) return Qt;
   if (b->modtime == 0) return Qt;
@@ -5863,5 +5869,3 @@ This includes interactive calls to `delete-file' and
 #endif
 }
 
-/* arch-tag: 64ba3fd7-f844-4fb2-ba4b-427eb928786c
-   (do not change this comment) */
-- 
2.39.5