Sunday, October 18, 2015

Tags disappear after saving a buffer in emacs

Tags and Emacs

Tags and Emacs


This post is written with e[ ⎋Esc ]m[ ⌥Meta ]a[ ⌥Alt ]c[ ^Ctrl ]s[ ⇧Shift ] org-mode.


System Environments

Operating Systems

  • Main- : OS X Yosemite (10.10.5)
  • Sub- : Debian GNU/Linux Wheezy (7.9)
  • Server: Debian GNU/Linux Wheezy || Squeeze
  • Mobile: iOS 9.0.2

Softwares mentioned here

Tags disappear after saving a buffer in emacs, OS X

If your tags disappear sometimes, I bet you are an emacs and OS X user like me. It could happen under your .emacs file manually (il-)modified, particularly the backup file configuration.

It turns out that the reason why my tags disappear is caused by emacs. My il-modified .emacs had the following elisp code inside.

(setq backup-directory-alist `(("." . "~/.emacs.d/auto-save-list")))

That made all automatically generated backup files, i.e. file_name.extenson~, moved into the directory ~/.emacs.d/auto-save-list. I set it up, because file_name.extenson~ was nothing but bothering me. If an original file has a tag, then its emacs backup is gonna have the same tag as well. Whenever I tried to access such files via tags such as quicksilver's File Attribute Plugin, emacs backups also are there. Even further worse. So I decided to move them all to one directory by the elisp code above. However it was a wrong choice. According to this, a file with tags had its tags killed after saving it(^x ^s or ⌘s) in emacs.

I don't know why or how it technically happens, but it is true that the above elisp is the reason. Instead of putting all emacs backups to one directory, I simply disable all automatic backup precess by adding the following into my .emacs.

(setq backup-inhibited t)

There will be no tags disappearing again.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Created: 2015-10-18 Sun 22:56

Emacs 24.3.1 (Org mode 8.2.10)

No comments:

Post a Comment