]> code.delx.au - gnu-emacs/blobdiff - lisp/saveplace.el
*** empty log message ***
[gnu-emacs] / lisp / saveplace.el
index 249bdfe00e31ad91815bd79dda43e8282979d2d6..b6f3a76ff232f1fe3a20b8c1e6c600f511feee31 100644 (file)
@@ -1,6 +1,7 @@
 ;;; saveplace.el --- automatically save place in files
 
-;; Copyright (C) 1993, 1994, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <kfogel@red-bean.com>
 ;; Maintainer: FSF
@@ -11,7 +12,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -21,8 +22,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -61,7 +62,10 @@ This variable is automatically buffer-local.
 If you wish your place in any file to always be automatically saved,
 simply put this in your `~/.emacs' file:
 
-\(setq-default save-place t\)"
+\(setq-default save-place t)
+\(require 'saveplace)
+
+or else use the Custom facility to set this option."
   :type 'boolean
   :require 'saveplace
   :group 'save-place)
@@ -163,7 +167,8 @@ To save places automatically in all files, put this in your `.emacs' file:
         (let ((cell (assoc buffer-file-name save-place-alist))
              (position (if (not (eq major-mode 'hexl-mode))
                            (point)
-                         (1+ (hexl-current-address)))))
+                         (with-no-warnings
+                           (1+ (hexl-current-address))))))
           (if cell
               (setq save-place-alist (delq cell save-place-alist)))
          (if (and save-place
@@ -217,7 +222,10 @@ may have changed\) back to `save-place-alist'."
               ((eq 'nospecial save-place-version-control) version-control)
               (t
                t))))
-        (write-file file)
+       (condition-case nil
+           ;; Don't use write-file; we don't want this buffer to visit it.
+           (write-region (point-min) (point-max) file)
+         (file-error (message "Can't write %s" file)))
         (kill-buffer (current-buffer))
         (message "Saving places to %s...done" file)))))
 
@@ -230,7 +238,7 @@ may have changed\) back to `save-place-alist'."
           ;; load it if it exists:
           (if (file-readable-p file)
               (save-excursion
-                (message "Loading places from %s..." save-place-file)
+                (message "Loading places from %s..." file)
                 ;; don't want to use find-file because we have been
                 ;; adding hooks to it.
                 (set-buffer (get-buffer-create " *Saved Places*"))