comparison lisp/saveplace.el @ 17481:e2757a9ccbe9

Add defgroup; use defcustom for user vars.
author Richard M. Stallman <rms@gnu.org>
date Tue, 15 Apr 1997 20:33:18 +0000
parents 62b9178b858b
children 8540d32e89cd
comparison
equal deleted inserted replaced
17480:c4258189ad2c 17481:e2757a9ccbe9
38 ;;; Code: 38 ;;; Code:
39 39
40 ;; this is what I was using during testing: 40 ;; this is what I was using during testing:
41 ;; (define-key ctl-x-map "p" 'toggle-save-place) 41 ;; (define-key ctl-x-map "p" 'toggle-save-place)
42 42
43 (defgroup save-place nil
44 "Automatically save place in files."
45 :group 'data)
46
47
43 (defvar save-place-alist nil 48 (defvar save-place-alist nil
44 "Alist of saved places to go back to when revisiting files. 49 "Alist of saved places to go back to when revisiting files.
45 Each element looks like (FILENAME . POSITION); 50 Each element looks like (FILENAME . POSITION);
46 visiting file FILENAME goes automatically to position POSITION 51 visiting file FILENAME goes automatically to position POSITION
47 rather than the beginning of the buffer. 52 rather than the beginning of the buffer.
48 This alist is saved between Emacs sessions.") 53 This alist is saved between Emacs sessions.")
49 54
50 (defvar save-place nil 55 (defcustom save-place nil
51 "*Non-nil means automatically save place in each file. 56 "*Non-nil means automatically save place in each file.
52 This means when you visit a file, point goes to the last place 57 This means when you visit a file, point goes to the last place
53 where it was when you previously visited the same file. 58 where it was when you previously visited the same file.
54 This variable is automatically buffer-local. 59 This variable is automatically buffer-local.
55 60
56 If you wish your place in any file to always be automatically saved, 61 If you wish your place in any file to always be automatically saved,
57 simply put this in your `~/.emacs' file: 62 simply put this in your `~/.emacs' file:
58 63
59 \(setq-default save-place t\)") 64 \(setq-default save-place t\)"
65 :type 'boolean
66 :group 'save-place)
60 67
61 (make-variable-buffer-local 'save-place) 68 (make-variable-buffer-local 'save-place)
62 69
63 (defvar save-place-file (convert-standard-filename "~/.emacs-places") 70 (defcustom save-place-file (convert-standard-filename "~/.emacs-places")
64 "*Name of the file that records `save-place-alist' value.") 71 "*Name of the file that records `save-place-alist' value."
65 72 :type 'file
66 (defvar save-place-version-control 'nospecial 73 :group 'save-place)
74
75 (defcustom save-place-version-control 'nospecial
67 "*Controls whether to make numbered backups of master save-place file. 76 "*Controls whether to make numbered backups of master save-place file.
68 It can have four values: t, nil, `never', and `nospecial'. The first 77 It can have four values: t, nil, `never', and `nospecial'. The first
69 three have the same meaning that they do for the variable 78 three have the same meaning that they do for the variable
70 `version-control', and the final value `nospecial' means just use the 79 `version-control', and the final value `nospecial' means just use the
71 value of `version-control'.") 80 value of `version-control'."
81 :type '(radio (const :tag "Unconditionally" t)
82 (const :tag "For VC Files" nil)
83 (const never)
84 (const :tag "Use value of version-control" nospecial))
85 :group 'save-place)
72 86
73 (defvar save-place-loaded nil 87 (defvar save-place-loaded nil
74 "Non-nil means that the `save-place-file' has been loaded.") 88 "Non-nil means that the `save-place-file' has been loaded.")
75 89
76 (defvar save-place-limit nil 90 (defcustom save-place-limit nil
77 "Maximum number of entries to retain in the list; nil means no limit.") 91 "Maximum number of entries to retain in the list; nil means no limit."
92 :type '(choice (integer :tag "Entries" :value 1)
93 (const :tag "No Limit" nil))
94 :group 'save-place)
78 95
79 (defun toggle-save-place (&optional parg) 96 (defun toggle-save-place (&optional parg)
80 "Toggle whether to save your place in this file between sessions. 97 "Toggle whether to save your place in this file between sessions.
81 If this mode is enabled, point is recorded when you kill the buffer 98 If this mode is enabled, point is recorded when you kill the buffer
82 or exit Emacs. Visiting this file again will go to that position, 99 or exit Emacs. Visiting this file again will go to that position,