aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/saveplace.el71
2 files changed, 35 insertions, 39 deletions
diff --git a/etc/NEWS b/etc/NEWS
index a505cf2f0e7..1a1492b6697 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -237,6 +237,9 @@ Unicode standards.
237 237
238 238
239* Changes in Specialized Modes and Packages in Emacs 25.1 239* Changes in Specialized Modes and Packages in Emacs 25.1
240
241** The `save-place' variable is replaced by a `save-place-mode'.
242
240** Midnight-mode 243** Midnight-mode
241*** `midnight-mode' is a proper minor mode. 244*** `midnight-mode' is a proper minor mode.
242*** clean-buffer-*-regexps can now specify buffers via predicate functions. 245*** clean-buffer-*-regexps can now specify buffers via predicate functions.
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index 4c53632affd..fe54743e393 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -50,28 +50,10 @@ visiting file FILENAME goes automatically to position POSITION
50rather than the beginning of the buffer. 50rather than the beginning of the buffer.
51This alist is saved between Emacs sessions.") 51This alist is saved between Emacs sessions.")
52 52
53(defcustom save-place nil
54 "Non-nil means automatically save place in each file.
55This means when you visit a file, point goes to the last place
56where it was when you previously visited the same file.
57
58If you wish your place in any file to always be automatically
59saved, set this to t using the Customize facility, or put the
60following code in your init file:
61
62\(setq-default save-place t)
63\(require 'saveplace)"
64 :type 'boolean
65 :require 'saveplace
66 :group 'save-place)
67
68(make-variable-buffer-local 'save-place)
69
70(defcustom save-place-file (locate-user-emacs-file "places" ".emacs-places") 53(defcustom save-place-file (locate-user-emacs-file "places" ".emacs-places")
71 "Name of the file that records `save-place-alist' value." 54 "Name of the file that records `save-place-alist' value."
72 :version "24.4" ; added locate-user-emacs-file 55 :version "24.4" ; added locate-user-emacs-file
73 :type 'file 56 :type 'file)
74 :group 'save-place)
75 57
76(defcustom save-place-version-control nil 58(defcustom save-place-version-control nil
77 "Controls whether to make numbered backups of master save-place file. 59 "Controls whether to make numbered backups of master save-place file.
@@ -82,8 +64,7 @@ value of `version-control'."
82 :type '(radio (const :tag "Unconditionally" t) 64 :type '(radio (const :tag "Unconditionally" t)
83 (const :tag "For VC Files" nil) 65 (const :tag "For VC Files" nil)
84 (const never) 66 (const never)
85 (const :tag "Use value of `version-control'" nospecial)) 67 (const :tag "Use value of `version-control'" nospecial)))
86 :group 'save-place)
87 68
88(defvar save-place-loaded nil 69(defvar save-place-loaded nil
89 "Non-nil means that the `save-place-file' has been loaded.") 70 "Non-nil means that the `save-place-file' has been loaded.")
@@ -92,8 +73,7 @@ value of `version-control'."
92 "Maximum number of entries to retain in the list; nil means no limit." 73 "Maximum number of entries to retain in the list; nil means no limit."
93 :version "24.1" ; nil -> 400 74 :version "24.1" ; nil -> 400
94 :type '(choice (integer :tag "Entries" :value 1) 75 :type '(choice (integer :tag "Entries" :value 1)
95 (const :tag "No Limit" nil)) 76 (const :tag "No Limit" nil)))
96 :group 'save-place)
97 77
98(defcustom save-place-forget-unreadable-files t 78(defcustom save-place-forget-unreadable-files t
99 "Non-nil means forget place in unreadable files. 79 "Non-nil means forget place in unreadable files.
@@ -106,7 +86,7 @@ You may do this anytime by calling the complementary function,
106`save-place-forget-unreadable-files'. When this option is turned on, 86`save-place-forget-unreadable-files'. When this option is turned on,
107this happens automatically before saving `save-place-alist' to 87this happens automatically before saving `save-place-alist' to
108`save-place-file'." 88`save-place-file'."
109 :type 'boolean :group 'save-place) 89 :type 'boolean)
110 90
111(defcustom save-place-save-skipped t 91(defcustom save-place-save-skipped t
112 "If non-nil, remember files matching `save-place-skip-check-regexp'. 92 "If non-nil, remember files matching `save-place-skip-check-regexp'.
@@ -114,7 +94,7 @@ this happens automatically before saving `save-place-alist' to
114When filtering `save-place-alist' for unreadable files, some will not 94When filtering `save-place-alist' for unreadable files, some will not
115be checked, based on said regexp, and instead saved or forgotten based 95be checked, based on said regexp, and instead saved or forgotten based
116on this flag." 96on this flag."
117 :type 'boolean :group 'save-place) 97 :type 'boolean)
118 98
119(defcustom save-place-skip-check-regexp 99(defcustom save-place-skip-check-regexp
120 ;; thanks to ange-ftp-name-format 100 ;; thanks to ange-ftp-name-format
@@ -127,7 +107,7 @@ subject to `save-place-save-skipped'.
127 107
128Files for which such a check may be inconvenient include those on 108Files for which such a check may be inconvenient include those on
129removable and network volumes." 109removable and network volumes."
130 :type 'regexp :group 'save-place) 110 :type 'regexp)
131 111
132(defcustom save-place-ignore-files-regexp 112(defcustom save-place-ignore-files-regexp
133 "\\(?:COMMIT_EDITMSG\\|hg-editor-[[:alnum:]]+\\.txt\\|svn-commit\\.tmp\\|bzr_log\\.[[:alnum:]]+\\)$" 113 "\\(?:COMMIT_EDITMSG\\|hg-editor-[[:alnum:]]+\\.txt\\|svn-commit\\.tmp\\|bzr_log\\.[[:alnum:]]+\\)$"
@@ -136,11 +116,34 @@ Useful for temporary file such as commit message files that are
136automatically created by the VCS. If set to nil, this feature is 116automatically created by the VCS. If set to nil, this feature is
137disabled, i.e., the position is recorded for all files." 117disabled, i.e., the position is recorded for all files."
138 :version "24.1" 118 :version "24.1"
139 :type 'regexp :group 'save-place) 119 :type 'regexp)
140 120
141(declare-function dired-current-directory "dired" (&optional localp)) 121(declare-function dired-current-directory "dired" (&optional localp))
142 122
143(defun toggle-save-place (&optional parg) 123(define-obsolete-variable-alias 'save-place 'save-place-mode "25.1")
124;;;###autoload
125(define-minor-mode save-place-mode
126 "Non-nil means automatically save place in each file.
127This means when you visit a file, point goes to the last place
128where it was when you previously visited the same file."
129 :global t
130 :group 'save-place
131 (cond
132 (save-place-mode
133 (add-hook 'find-file-hook 'save-place-find-file-hook t)
134 (add-hook 'dired-initial-position-hook 'save-place-dired-hook)
135 (unless noninteractive
136 (add-hook 'kill-emacs-hook 'save-place-kill-emacs-hook))
137 (add-hook 'kill-buffer-hook 'save-place-to-alist))
138 (t
139 (remove-hook 'find-file-hook 'save-place-find-file-hook t)
140 (remove-hook 'dired-initial-position-hook 'save-place-dired-hook)
141 (remove-hook 'kill-emacs-hook 'save-place-kill-emacs-hook)
142 (remove-hook 'kill-buffer-hook 'save-place-to-alist))))
143
144(make-variable-buffer-local 'save-place-mode) ; Hysterical raisins.
145
146(defun toggle-save-place (&optional parg) ;FIXME: save-place-local-mode!
144 "Toggle whether to save your place in this file between sessions. 147 "Toggle whether to save your place in this file between sessions.
145If this mode is enabled, point is recorded when you kill the buffer 148If this mode is enabled, point is recorded when you kill the buffer
146or exit Emacs. Visiting this file again will go to that position, 149or exit Emacs. Visiting this file again will go to that position,
@@ -353,15 +356,5 @@ may have changed) back to `save-place-alist'."
353 (if save-place-loaded 356 (if save-place-loaded
354 (save-place-alist-to-file))) 357 (save-place-alist-to-file)))
355 358
356(add-hook 'find-file-hook 'save-place-find-file-hook t) 359(provide 'saveplace)
357
358(add-hook 'dired-initial-position-hook 'save-place-dired-hook)
359
360(unless noninteractive
361 (add-hook 'kill-emacs-hook 'save-place-kill-emacs-hook))
362
363(add-hook 'kill-buffer-hook 'save-place-to-alist)
364
365(provide 'saveplace) ; why not...
366
367;;; saveplace.el ends here 360;;; saveplace.el ends here