comparison src/filelock.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 9ee227acff29
children 7e54bd776075
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
403 unlock_file (b->file_truename); 403 unlock_file (b->file_truename);
404 } 404 }
405 } 405 }
406 406
407 407
408 DEFUN ("lock-buffer", Flock_buffer, Slock_buffer, 0, 1, 0 /* 408 DEFUN ("lock-buffer", Flock_buffer, 0, 1, 0, /*
409 Lock FILE, if current buffer is modified. 409 Lock FILE, if current buffer is modified.
410 FILE defaults to current buffer's visited file, 410 FILE defaults to current buffer's visited file,
411 or else nothing is done if current buffer isn't visiting a file. 411 or else nothing is done if current buffer isn't visiting a file.
412 */ ) 412 */
413 (fn) 413 (fn))
414 Lisp_Object fn;
415 { 414 {
416 /* This function can GC */ 415 /* This function can GC */
417 if (NILP (fn)) 416 if (NILP (fn))
418 fn = current_buffer->file_truename; 417 fn = current_buffer->file_truename;
419 CHECK_STRING (fn); 418 CHECK_STRING (fn);
421 && !NILP (fn)) 420 && !NILP (fn))
422 lock_file (fn); 421 lock_file (fn);
423 return Qnil; 422 return Qnil;
424 } 423 }
425 424
426 DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer, 0, 0, 0 /* 425 DEFUN ("unlock-buffer", Funlock_buffer, 0, 0, 0, /*
427 Unlock the file visited in the current buffer, 426 Unlock the file visited in the current buffer,
428 if it should normally be locked. 427 if it should normally be locked.
429 */ ) 428 */
430 () 429 ())
431 { 430 {
432 if (BUF_SAVE_MODIFF (current_buffer) < BUF_MODIFF (current_buffer) 431 if (BUF_SAVE_MODIFF (current_buffer) < BUF_MODIFF (current_buffer)
433 && STRINGP (current_buffer->file_truename)) 432 && STRINGP (current_buffer->file_truename))
434 unlock_file (current_buffer->file_truename); 433 unlock_file (current_buffer->file_truename);
435 return Qnil; 434 return Qnil;
444 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) 443 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
445 && STRINGP (buffer->file_truename)) 444 && STRINGP (buffer->file_truename))
446 unlock_file (buffer->file_truename); 445 unlock_file (buffer->file_truename);
447 } 446 }
448 447
449 DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 0, 1, 0 /* 448 DEFUN ("file-locked-p", Ffile_locked_p, 0, 1, 0, /*
450 Return nil if the FILENAME is not locked, 449 Return nil if the FILENAME is not locked,
451 t if it is locked by you, else a string of the name of the locker. 450 t if it is locked by you, else a string of the name of the locker.
452 */ ) 451 */
453 (fn) 452 (fn))
454 Lisp_Object fn;
455 { 453 {
456 /* This function can GC */ 454 /* This function can GC */
457 REGISTER char *lfname; 455 REGISTER char *lfname;
458 int owner; 456 int owner;
459 457
476 474
477 void 475 void
478 syms_of_filelock (void) 476 syms_of_filelock (void)
479 { 477 {
480 /* This function can GC */ 478 /* This function can GC */
481 defsubr (&Sunlock_buffer); 479 DEFSUBR (Funlock_buffer);
482 defsubr (&Slock_buffer); 480 DEFSUBR (Flock_buffer);
483 defsubr (&Sfile_locked_p); 481 DEFSUBR (Ffile_locked_p);
484 482
485 defsymbol (&Qask_user_about_supersession_threat, 483 defsymbol (&Qask_user_about_supersession_threat,
486 "ask-user-about-supersession-threat"); 484 "ask-user-about-supersession-threat");
487 defsymbol (&Qask_user_about_lock, "ask-user-about-lock"); 485 defsymbol (&Qask_user_about_lock, "ask-user-about-lock");
488 } 486 }