From: moore@src.bae.co.UK (Chris Moore)
Subject: backup file directory
Organization: Gatewayed from the GNU Project mailing list help-gnu-emacs@prep.ai.mit.edu
Date: Mon, 9 Nov 1992 21:20:58 GMT


jcours@kalman.eng.ohio-state.edu (Jeffrey Cours) said:

> 1) when does the FAQ come out and/or where could I FTP a copy?

From the FAQ:

-----cut-----8<-----here-----8<--------------8<--------------
22:  Where can I get the latest version of this document (the FAQ list)?
  
  The GNU Emacs FAQ is available in several ways:
  
  * [ section on finding it via USENET deleted, since it's long and you
      probably tried that already ]

  * Via anonymous FTP.  You can fetch the FAQ articles via anonymous FTP
    (rtfm.mit.edu:pub/usenet/news.answers/GNU-Emacs-FAQ/part?).
  
  * Via e-mail.  You can send the following magical incantation in the body
    of a message to mail-server@rtfm.mit.edu:
  
      send usenet/news.answers/GNU-Emacs-FAQ/part0
      send usenet/news.answers/GNU-Emacs-FAQ/part1
      send usenet/news.answers/GNU-Emacs-FAQ/part2
      send usenet/news.answers/GNU-Emacs-FAQ/part3
      send usenet/news.answers/GNU-Emacs-FAQ/part4
      send usenet/news.answers/GNU-Emacs-FAQ/part5
  
  * Via WAIS.  The GNU Emacs FAQ is available via WAIS indexed on a
    per-question basis from the `faq' database on bigbird.bu.edu on the
    non-standard IP port number of 2210.  This is probably the best way to
    find out if there is something in the FAQ related to your question.  I
    use this myself to answer questions I see posted on gnu.emacs.help.
  
    The articles of the GNU Emacs FAQ are also available from the `usenet'
    database on rtfm.mit.edu (on the standard IP port: 210), along with a
    lot of other FAQ articles.  However, these are all indexed at the whole
    article level instead of at the question level.  This is a better place
    to look if you want to fetch the entire FAQ.
  
  * In the GNU Emacs distribution.  Since GNU Emacs 18.56, the latest
    available version of the FAQ at the time of release has been part of the
    GNU Emacs distribution as file etc/FAQ.  18.58 is the latest version,
    and it was released in February 1992.
  
  * As the very last resort, you can e-mail a request to                     !
    gnu-emacs-faq-maintainers@bigbird.bu.edu.  Don't do this unless you have !
    made a serious effort to obtain the FAQ list via one of the methods      !
    listed above.                                                            !
-----cut-----8<-----here-----8<--------------8<--------------

> 2) I'm just starting to move over to GNU emacs after spending many
> years using vi. Unfortunately, I don't know which version of emacs
> we're using on the Sun's here, or even how to find out the version
> number from within the program, which may make the answer to this
> question a little tricky.

M-x emacs-version gives the version.

> Nice as it is to have backups, having
> all those backup files around tends to clutter up my directories. Is
> there a relatively simple way to convince emacs to put the backup
> files in a different directory than the source file, maybe something
> like ~/backups ?  I'd like to keep getting backup files, but I just
> don't want them getting in the way.  Conflicting file names
> shouldn't be much of a problem since most of what I edit is my own
> stuff. Is there a variable I could set that prefixes a path name onto
> the name of any backup file emacs makes?

I hacked together some code a while ago which does a similar thing for me.
I've only really used version 18.57 and I'm not too clear on the
differences between the various emacs versions, so I can't say that this
will necessarily work for you.  With my code installed, when it wants to
create a backup file, emacs will first check the current directory to see
if it contains a subdirectory called "TILDE" (or any other name, as set by
the user).  If it does, the backups go there, otherwise they go in the
current directory.  This avoids filename clashes, which quite easily result
even if you only edit your own stuff, since you might have more than one
file called Makefile, or README, or whatever.

The code works by altering the behaviour of the function
find-backup-file-name.  I use the advise.el package to do this.  I don't
remember where I found that package and it doesn't appear to be in the
Emacs Lisp Archive - maybe somebody can post a pointer to it.  The first
line of the file is:

;;; $Header: /tmp_mnt/am/p7/utility/gmacs/f2/RCS/advise.el,v 1.2 89/03/25 14:00:55 kahle Exp $

and the 'NO WARRANTY' paragraph mentions Thinking Machines Corporation.
Maybe these clues will help you track it down.  I can mail you a copy if
you can't find it any other way.

-----cut-----8<-----here-----8<--------------8<--------------
(autoload 'advise "advise" "" t)

;; Where to put backups so our directory is neat and tidy.
(defvar backup-directory "TILDE"
  "Name of subdirectory in which to save backup files if it exists.")

;; Change find-backup-file-name to save backups in the subdirectory
;; specified by backup-directory if it exists.
;;
;; Note: you need advise.el.  You will need to [auto]load it first.
;;
(advise find-backup-file-name :before
	(if (file-directory-p backup-directory)
	    (let ((fn (car arglist)))
	      (setq arglist (list (concat (file-name-directory fn)
					  backup-directory "/"
					  (file-name-nondirectory fn)))))))
-----cut-----8<-----here-----8<--------------8<--------------

I hope this is useful.

Chris.
--
moore@src.bae.co.uk   /      Chris Moore      \
                     / Sowerby Research Centre \
                     \  British Aerospace PLC  /
tel: +44 272 363375   \      BRISTOL, UK      /
Newsgroups: gnu.emacs.help