I modified my .emacs file to make auto-backups hidden files via the following code:
(defun make-backup-file-name (filename)
(expand-file-name
(concat "." (file-name-nondirectory filename) "~")
(file-name-directory filename)))
It works great except that backups of hidden-files go from “.hidden-file.xxx” to “..no-longer-hidden-file.xxx’
I know zero Lisp, can someone give me a quick work-around like:
(if (filename) doesn't-start-with "."
(concat
(else do-nothing))
You could use
(equal (string-to-char filename) ?.). This turns the filename string into its first character and compares it to?., which is the character notation for a..By the looks of it, you want to check
(file-name-nondirectory filename)rather than justfilename, so the whole statement would be something like:So the whole function should look something like:
You need to do a
concatin both branches because you always want to append a~.