Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7529165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:35:12+00:00 2026-05-30T04:35:12+00:00

I modified my .emacs file to make auto-backups hidden files via the following code:

  • 0

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))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:35:13+00:00Added an answer on May 30, 2026 at 4:35 am

    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 just filename, so the whole statement would be something like:

    (if (equal (string-to-char (file-name-nondirectory filename)) ?.)
        (concat (file-name-nondirectory filename) "~")
        (concat "." (file-name-nondirectory filename) "~"))
    

    So the whole function should look something like:

    (defun make-backup-file-name (filename)
      (expand-file-name
      (if (equal (string-to-char (file-name-nondirectory filename)) ?.)
        (concat (file-name-nondirectory filename) "~")
        (concat "." (file-name-nondirectory filename) "~"))
      (file-name-directory filename)))
    

    You need to do a concat in both branches because you always want to append a ~.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I modified my project's AssemblyInfo.cs as following: [assembly:AssemblyVersion(1.0.*)] //[assembly:AssemblyFileVersion(1.0.0.0)] This updated the dll file
As far as I understand, the following sequence of commands M-x load-file ENTER ~/.emacs
I modified an existing form and saved it on my desktop as .oft file.
Has anyone ever modified the post-new.php file in their WordPress installation? I want to
I've modified my run.sh file and added JAVA_OPTS=$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n but when I start
I very often need to do some Emacs magic on some files and I
I'd like to use a keycode with modifiers in my .emacs file. However my
I'm trying to debug code in Emacs but when I try either M-x gdb
I modified the php source file, add some printfs and now I'd like to
I modified quick sort to make it multithread. I expected it to work ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.