Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I would like to find a way to hide all the *~ files in Finder, which are used as backup files by Emacs. Is there a general approach to make Finder hide all the files with their names matching certain patterns? Thanks.

share|improve this question
1  
If you are only concerned about Emacs backup files, would storing them all in a single folder (e.g. ~/.emacs-backups/) be an option as well? –  patrix Jun 13 '12 at 12:32
    
@patrix Thank you, I did so. Sometimes, it's easier to customize the Emacs OS than Mac OS:) –  Ning Jun 13 '12 at 14:09
    
That's truly true. Please post the specific settings for backup-directory-alist etc. as the answer so others can benefit from it in the future. –  patrix Jun 13 '12 at 14:11
add comment

2 Answers

If you don't like all the #*# and *~ files floating around in your working directory, put the following elisp code in your .emacs file.

;; Put autosave files (ie #foo#) and backup files (ie foo~) in ~/.emacs-backups/.
(custom-set-variables
  '(auto-save-file-name-transforms '((".*" "~/.emacs-backups/autosaves/\\1" t)))
  '(backup-directory-alist '((".*" . "~/.emacs-backups/backups/"))))

;; create the autosave dir if necessary, since emacs won't.
(make-directory "~/.emacs-backups/autosaves/" t)

Reference: http://snarfed.org/gnu_emacs_backup_files

share|improve this answer
add comment

If you want to hide a file from GUI you can use chflags utility, e.g.

chflags hidden *~

As a permanent solution you can install a launchd agent with command

find $HOME -type f -name '*~' -exec chflags hidden '{}' ';'

I used Lingon for that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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