1

Each open org-mode buffer on my laptop shows a link involving my internet provider, for example,

lrwxr-xr-x   1 peterkelly  staff    47 Jun 15 09:48 .#todo.org -> peterkelly@Peters-MBP.hsd1.ct.comcast.net.89840

Why are these links created?

  • I see this too, but it is not org-mode specific. If I edit any file via an SSHFS mount, this can happen. Thus I might see something like #.gitignore -> loris@laptop.3305:1565075355 on the server and ?????????? ? ? ? ? ? .#.gitignore on my laptop in the SSHFS-mounted directory. – loris Jun 16 at 12:48
  • These are file locks to prevent simultaneous editing. – NickD Jun 16 at 13:38
  • 2
    Does this answer your question? What are the '.#' links for? – NickD Jun 16 at 13:40
  • Thank you NickD. I didn't know enough about what I was seeing to get that answer by searching. – Pete Kelly Jun 17 at 13:14
3

This is a lock file created automatically by Emacs in order to prevent accidents. The name of the lock file is based on the name of the file that it locks, and the contents are built from information about the user who the lock belongs to and the computer that they are using at the time. From the Elisp manual:

The target of the symbolic link will be of the form ‘USER@HOST.PID:BOOT’, where USER is replaced with the current username (from ‘user-login-name’), HOST with the name of the host where Emacs is running (from ‘system-name’), PID with Emacs’s process id, and BOOT with the time since the last reboot. ‘:BOOT’ is omitted if the boot time is unavailable.

From this I deduce that your computer's host name must be Peters-MBP.hsd1.ct.comcast.net. This is not very unusual; the default on OSX is to construct a host name from the owner's name (thus "Peters-MBP"), and it's not that uncommon for an ISP to specify some suffix for the computer to use when making fully-qualified domain names. On Linux I can check the FQDN of my machine by running hostname -f; perhaps there is something similar for OSX. You'll probably find that this changes when you take your machine to work, to a coffee shop, etc.

Of course, it's increasingly unlikely that this lock file will protect you from accidents, since most computers only ever have one user these days. It used to be that a computer might serve hundreds of individual users, who were all active at once. If two of them happened to edit the same file at the same time, then one of them would probably lose their work. The lock files prevent this from happening.

You can turn them off by adding (setq create-lockfiles nil) to your Emacs init file (or by using the customization system; type M-x customize-variable create-lockfiles RET to open it).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.