]> code.delx.au - gnu-emacs/blobdiff - src/filelock.c
(x_connection_closed): Don't check _Xdebug.
[gnu-emacs] / src / filelock.c
index 2e7e2e20e94de182449ac7a8ca4d8c1175b6f312..27b4be4ad35eee3f212a60aa2477b2533d8c2b62 100644 (file)
@@ -14,7 +14,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 
 #include <sys/types.h>
@@ -199,16 +200,19 @@ void
 lock_file (fn)
      register Lisp_Object fn;
 {
-  register Lisp_Object attack;
+  register Lisp_Object attack, orig_fn;
   register char *lfname;
 
+  orig_fn = fn;
+  fn = Fexpand_file_name (fn, Qnil);
+
   MAKE_LOCK_NAME (lfname, fn);
 
   /* See if this file is visited and has changed on disk since it was
      visited.  */
   {
     register Lisp_Object subject_buf;
-    subject_buf = Fget_file_buffer (fn);
+    subject_buf = get_truename_buffer (orig_fn);
     if (!NILP (subject_buf)
        && NILP (Fverify_visited_file_modtime (subject_buf))
        && !NILP (Ffile_exists_p (fn)))
@@ -329,6 +333,8 @@ unlock_file (fn)
 {
   register char *lfname;
 
+  fn = Fexpand_file_name (fn, Qnil);
+
   MAKE_LOCK_NAME (lfname, fn);
 
   lock_superlock (lfname);
@@ -381,8 +387,8 @@ unlock_all_files ()
   for (tail = Vbuffer_alist; GC_CONSP (tail); tail = XCONS (tail)->cdr)
     {
       b = XBUFFER (XCONS (XCONS (tail)->car)->cdr);
-      if (STRINGP (b->filename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
-       unlock_file (b->filename);
+      if (STRINGP (b->file_truename) && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
+       unlock_file (b->file_truename);
     }
 }
 
@@ -392,16 +398,16 @@ DEFUN ("lock-buffer", Flock_buffer, Slock_buffer,
   "Lock FILE, if current buffer is modified.\n\
 FILE defaults to current buffer's visited file,\n\
 or else nothing is done if current buffer isn't visiting a file.")
-  (fn)
-     Lisp_Object fn;
+  (file)
+     Lisp_Object file;
 {
-  if (NILP (fn))
-    fn = current_buffer->filename;
+  if (NILP (file))
+    file = current_buffer->file_truename;
   else
-    CHECK_STRING (fn, 0);
+    CHECK_STRING (file, 0);
   if (SAVE_MODIFF < MODIFF
-      && !NILP (fn))
-    lock_file (fn);
+      && !NILP (file))
+    lock_file (file);
   return Qnil;    
 }
 
@@ -412,8 +418,8 @@ if it should normally be locked.")
   ()
 {
   if (SAVE_MODIFF < MODIFF
-      && STRINGP (current_buffer->filename))
-    unlock_file (current_buffer->filename);
+      && STRINGP (current_buffer->file_truename))
+    unlock_file (current_buffer->file_truename);
   return Qnil;
 }
 
@@ -424,22 +430,22 @@ unlock_buffer (buffer)
      struct buffer *buffer;
 {
   if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
-      && STRINGP (buffer->filename))
-    unlock_file (buffer->filename);
+      && STRINGP (buffer->file_truename))
+    unlock_file (buffer->file_truename);
 }
 
 DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 0, 1, 0,
   "Return nil if the FILENAME is not locked,\n\
 t if it is locked by you, else a string of the name of the locker.")
-  (fn)
-  Lisp_Object fn;
+  (filename)
+  Lisp_Object filename;
 {
   register char *lfname;
   int owner;
 
-  fn = Fexpand_file_name (fn, Qnil);
+  filename = Fexpand_file_name (filename, Qnil);
 
-  MAKE_LOCK_NAME (lfname, fn);
+  MAKE_LOCK_NAME (lfname, filename);
 
   owner = current_lock_owner (lfname);
   if (owner <= 0)