From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#31636: 27.0.50; lockfile syntax searchable from info manual Date: Fri, 01 Jun 2018 12:47:54 +0200 Message-ID: <87h8mmu6jp.fsf@gmail.com> References: <20180529073311.EEA09102DA@mailuser.nyi.internal> <876036hn2e.fsf@gmail.com> <87tvqqd7rp.fsf@gmail.com> <87r2lufvo9.fsf@gmail.com> <83r2luv28h.fsf@gnu.org> <87a7sib7ty.fsf@gmail.com> <83in75vp8l.fsf@gnu.org> <87wovkyv6l.fsf@gmail.com> <83tvqmga79.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1527850027 12348 195.159.176.226 (1 Jun 2018 10:47:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 1 Jun 2018 10:47:07 +0000 (UTC) Cc: mail@bradyt.com, 31636@debbugs.gnu.org, eggert@cs.ucla.edu, npostavs@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 01 12:47:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fOhaI-00036h-CS for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Jun 2018 12:47:02 +0200 Original-Received: from localhost ([::1]:54743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOhcP-0002Uy-Hr for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Jun 2018 06:49:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOhcI-0002Uj-TX for bug-gnu-emacs@gnu.org; Fri, 01 Jun 2018 06:49:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOhcF-0007X0-Pm for bug-gnu-emacs@gnu.org; Fri, 01 Jun 2018 06:49:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOhcF-0007Ws-Kg for bug-gnu-emacs@gnu.org; Fri, 01 Jun 2018 06:49:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fOhcE-0000ez-9q for bug-gnu-emacs@gnu.org; Fri, 01 Jun 2018 06:49:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <20180529073311.EEA09102DA@mailuser.nyi.internal> Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Jun 2018 10:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31636 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31636-submit@debbugs.gnu.org id=B31636.15278500842475 (code B ref 31636); Fri, 01 Jun 2018 10:49:02 +0000 Original-Received: (at 31636) by debbugs.gnu.org; 1 Jun 2018 10:48:04 +0000 Original-Received: from localhost ([127.0.0.1]:56845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fOhbH-0000dr-GE for submit@debbugs.gnu.org; Fri, 01 Jun 2018 06:48:03 -0400 Original-Received: from mail-wm0-f68.google.com ([74.125.82.68]:54848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fOhbG-0000dH-0G for 31636@debbugs.gnu.org; Fri, 01 Jun 2018 06:48:02 -0400 Original-Received: by mail-wm0-f68.google.com with SMTP id o13-v6so2159315wmf.4 for <31636@debbugs.gnu.org>; Fri, 01 Jun 2018 03:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:message-id:mime-version:content-transfer-encoding; bh=LPejr6STdSOIqGsE1B4PoP0wrIW11420hk+GwChMKEQ=; b=BceoqXEIhbaC97TRzpb4PyLhJmD5iT7KThHHcYorJXNI4ctDEbYR/hUvsqeZWCIc7L msj5pqM4a5iW8bUCX1zPmstpVoEsezNa1exR5RX901skDWyVY0lDqHJO4Ht5WxqzbSIr +VVseJozGBeoXWCxDOFerx/5qwViLXG6k3EqBbTAHPU+PN7ldcQVNL9DA+HIMRbGHz+X QxIH991ewkUnWe3tyqPI1s246BpNdLEdFxsZol47Y9qfmoKEvUlLmK992ALepIHF6iOn nGIXWvhHMr9WsCHGYBZ18wlL7385BKYpp9X672EZJBYA1KCWbxeZUVj45EoEbMoh32V1 Ymbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:message-id:mime-version :content-transfer-encoding; bh=LPejr6STdSOIqGsE1B4PoP0wrIW11420hk+GwChMKEQ=; b=g2kEJPwrX57YOnnzuVGvJCYyy1OPNBcB+dc60g5ZFQIvpOvWFsNFLURRflZ4WD6/Ix xiBExzovcJbxyRPe1aBzpeBumFEdyJpNgJXnUcRk9rmoR4FApAZPupIophBr5VdrFass jMA9Qng+lYJlBUagphJAFsSmqTkUGHhkXddjn6YLv8seJyFmFKZWlJoDT93KsFwhb9Oo teq5pjPZ5EM1St5paiQcGeA2K0UCProf/DUYV2sGdos4yRR7EZQOqAODvRgq+Ox+hi1U vqw/lct2zw0UXq0t+nm8tztyBG9m6iK7w1pWO4nNvGpqJnpsxO2lZxOVJ1VPGfIby5zP OcVA== X-Gm-Message-State: ALKqPwcxFXXPRUnh0MEFPdRLTcjo0hHWmuWnp4E9CpRpn3E3Rwkh4uj7 jkNczg41DvanB4sUJ4QsFOY= X-Google-Smtp-Source: ADUXVKJT2/jImCIdBr6D54WTbnklC8s2zPOQD75D1CW+AuHvF5IH2xcr0L2aL5wJKUVelEpFmsocRw== X-Received: by 2002:a1c:e619:: with SMTP id d25-v6mr2110726wmh.23.1527850075998; Fri, 01 Jun 2018 03:47:55 -0700 (PDT) Original-Received: from rpluim-ubuntu ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id m64-v6sm2995730wmb.12.2018.06.01.03.47.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 03:47:54 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:146816 Archived-At: Eli Zaretskii writes: >> From: Robert Pluim >> Cc: mail@bradyt.com, 31636@debbugs.gnu.org, eggert@cs.ucla.edu, npost= avs@gmail.com >> Date: Thu, 31 May 2018 12:29:54 +0200 >>=20 >> Do we want a '.#' index entry in the lispref as well? > > Yes. > Done. >> Do I need to explain that USER will be replaced by the current user, >> etc? > > Yes, I think so. I should have known better than to ask. Done. I even gritted my teeth and wrote "Emacs's". > This should use @var{user}, @var{host} etc. for the components of the > target file name, and it should explain shortly what each component > stands for. I don=CA=BCt see any difference in the visual appearance from using @var, but I made the change anyway, and expanded the explanation (I noticed that texinfo.el has no bindings for inserting @ref, @xref, and @pxref, should I add some? C-cC-c[rp] are free, but x is already used for @example, so 'C-cC-cX'? Or maybe 'C-cC-cC-x' for @xref?) > Here I would say that the name of the lockfile is constructed by > prepending a '.#' to the name of the file being locked. Done. 2018-05-31 Robert Pluim * src/filelock.c (create-lockfiles): Add cross reference to file locking in user manual and to 'lock-buffer'. Add string '.#' to help users find the doc string. * doc/emacs/files.texi (Interlocking): Point user at detailed file locking description in lisp reference manual. Add index entry for '.#' to improve disoverability of information about locking. * doc/lispref/files.texi (File Locks): Describe in detail what the form of the lock file is. Add index entry for '.#' to improve disoverability of information about locking. diff --git i/doc/emacs/files.texi w/doc/emacs/files.texi index 1ced7ca07c..406e7d980c 100644 --- i/doc/emacs/files.texi +++ w/doc/emacs/files.texi @@ -766,13 +766,16 @@ Interlocking =20 @findex ask-user-about-lock @cindex locking files +@cindex .#, lock file names +@cindex file locking When you make the first modification in an Emacs buffer that is visiting a file, Emacs records that the file is @dfn{locked} by you. (It does this by creating a specially-named symbolic link@footnote{If your file system does not support symbolic links, a regular file is -used.} with special contents in the same directory.) Emacs removes the lo= ck -when you save the changes. The idea is that the file is locked -whenever an Emacs buffer visiting it has unsaved changes. +used.} with special contents in the same directory. @xref{File +Locks,,, elisp} for more details.) Emacs removes the lock when you +save the changes. The idea is that the file is locked whenever an +Emacs buffer visiting it has unsaved changes. =20 @vindex create-lockfiles You can prevent the creation of lock files by setting the variable diff --git i/doc/lispref/files.texi w/doc/lispref/files.texi index f62b670f47..012a7a0a7c 100644 --- i/doc/lispref/files.texi +++ w/doc/lispref/files.texi @@ -712,6 +712,7 @@ File Locks @section File Locks @cindex file locks @cindex lock file +@cindex .#, lock file names =20 When two users edit the same file at the same time, they are likely to interfere with each other. Emacs tries to prevent this situation @@ -720,8 +721,17 @@ File Locks Emacs can then detect the first attempt to modify a buffer visiting a file that is locked by another Emacs job, and ask the user what to do. The file lock is really a file, a symbolic link with a special name, -stored in the same directory as the file you are editing. (On file -systems that do not support symbolic links, a regular file is used.) +stored in the same directory as the file you are editing. The name is +constructed by prepending @file{.#} to the filename of the buffer. +The target of the symbolic link will be of the form +@code{@var{user}@@@var{host}.@var{pid}:@var{boot}}, where @var{user} +is replaced with the current username (from @code{user-login-name}), +@var{host} with the name of the host where Emacs is running (from +@code{system-name}), @var{pid} with Emacs's process id, and @var{boot} +with the time since the last reboot. @code{:@var{boot}} is omitted if +the boot time is unavailable. (On file systems that do not support +symbolic links, a regular file is used instead, with contents of the +form @code{@var{user}@@@var{host}.@var{pid}:@var{boot}}.) =20 When you access files using NFS, there may be a small probability that you and another user will both lock the same file simultaneously. diff --git i/src/filelock.c w/src/filelock.c index f2dc723407..d33063c879 100644 --- i/src/filelock.c +++ w/src/filelock.c @@ -849,7 +849,10 @@ syms_of_filelock (void) Vtemporary_file_directory =3D Qnil; =20 DEFVAR_BOOL ("create-lockfiles", create_lockfiles, - doc: /* Non-nil means use lockfiles to avoid editing collisions. = */); + doc: /* Non-nil means use lockfiles to avoid editing collisions. +The name of the (per-buffer) lockfile is constructed by prepending a +'.#' to the name of the file being locked. See also `lock-buffer' and +Info node `(emacs)Interlocking'. */); create_lockfiles =3D 1; =20 defsubr (&Sunlock_buffer);