🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189169

Re: backup files to a specific place POSSIBLE?

#189169
From: Silver
Date: Sun, 21 Apr 1991 07:34
54 lines
2826 bytes
My own solution to the backup/checkpoint clutter problem is to make these files
hidden, ie, by using names which start with `.'.  The code to do this follows.
This is probably enough information to get started on something a more
ambitious.  (Please let me know if you see any problems here; I'll update and
repost, thanks!)

Regards, [Ag] gaynor@paul.rutgers.edu
_______________________________________________________________________________

(provide 'hidden-files)

;;;;;;;;;; backup
;;
;; Use ".bak." to prefix backup filenames.

(defun file-name-sans-versions (path)
"Return FILENAME sans backup versions or strings.  This is a seperate procedure
so your site-init or startup file can redefine it."
  (let ((name (file-name-nondirectory path)))
    (concat (or (file-name-directory path) "")
	    (substring name (if (string-match "\\`\\.bak\\." name) 5 0)))))

(defun make-backup-file-name (path)
"Create the non-numeric backup file name for FILE.  This is a seperate function
so you can redefine it for customization."
  (concat (or (file-name-directory path) "")
	  ".bak."
	  (file-name-nondirectory path)))

(defun backup-file-name-p (path)
"Return non-nil if FILE is a backup file name (numeric or not).  This is a
separate function so you can redefine it for customization.  You may need to
redefine file-name-sans-versions as well."
  (string-match "\\`\\.bak\\." (file-name-nondirectory path)))



;;;;;;;;;; auto-save
;;
;; Use ".ckp." to prefix auto-save filenames.

(defun make-auto-save-file-name ()
"Return file name to use for auto-saves of current buffer.  Does not consider
auto-save-visited-file-name; that is checked before calling this function.  You
can redefine this for customization.  See also auto-save-file-name-p."
  (if (buffer-file-name)
    (concat (or (file-name-directory (buffer-file-name)) "")
	    ".ckp."
	    (file-name-nondirectory (buffer-file-name)))))

(defun auto-save-file-name-p (filename)
"Return t if FILENAME can be yielded by make-auto-save-file-name.  FILENAME
should lack slashes.  You can redefine this for customization."
  (string-match "\\`\\.ckp\\." filename))
Technical Details
Message-ID: <Apr.21.03.34.58.1991.17118@paul.rutgers.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!uwm.edu!psuvax1!rutgers!aramis.rutgers.edu!paul.rutgers.edu!gaynor
References: <SHAWN.91Apr16172811@litsun.epfl.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,b994b7a5dcdc743b
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-04-21 04:58:51 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!fauern!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!uwm.edu!psuvax1!rutgers!aramis.rutgers.edu!paul.rutgers.edu!gaynor
From: gaynor@paul.rutgers.edu (Silver)
Newsgroups: gnu.emacs.help
Subject: Re: backup files to a specific place POSSIBLE?
Message-ID: <Apr.21.03.34.58.1991.17118@paul.rutgers.edu>
Date: 21 Apr 91 07:34:59 GMT
References: <SHAWN.91Apr16172811@litsun.epfl.ch>
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 54