comparison lisp/saveplace.el @ 19980:2b5cebd0da5e

(save-place-to-alist): Optimize out the degenerate case when point is 1.
author Karl Heuer <kwzh@gnu.org>
date Thu, 25 Sep 1997 01:01:05 +0000
parents 8540d32e89cd
children 33067598c22c
comparison
equal deleted inserted replaced
19979:8540d32e89cd 19980:2b5cebd0da5e
123 ;; file. If not, do so, then feel free to modify the alist. It 123 ;; file. If not, do so, then feel free to modify the alist. It
124 ;; will be saved again when Emacs is killed. 124 ;; will be saved again when Emacs is killed.
125 (or save-place-loaded (load-save-place-alist-from-file)) 125 (or save-place-loaded (load-save-place-alist-from-file))
126 (if buffer-file-name 126 (if buffer-file-name
127 (progn 127 (progn
128 (let ((cell (assoc buffer-file-name save-place-alist))) 128 (let ((cell (assoc buffer-file-name save-place-alist))
129 (position (if (not (eq major-mode 'hexl-mode))
130 (point)
131 (1+ (hexl-current-address)))))
129 (if cell 132 (if cell
130 (setq save-place-alist (delq cell save-place-alist)))) 133 (setq save-place-alist (delq cell save-place-alist)))
131 (if save-place 134 (if (and save-place
132 (setq save-place-alist 135 (not (= position 1))) ;; Optimize out the degenerate case.
133 (cons (cons buffer-file-name 136 (setq save-place-alist
134 (if (not (eq major-mode 'hexl-mode)) 137 (cons (cons buffer-file-name position)
135 (point) 138 save-place-alist)))))))
136 (1+ (hexl-current-address))))
137 save-place-alist))))))
138 139
139 (defun save-place-alist-to-file () 140 (defun save-place-alist-to-file ()
140 (let ((file (expand-file-name save-place-file))) 141 (let ((file (expand-file-name save-place-file)))
141 (save-excursion 142 (save-excursion
142 (message "Saving places to %s..." file) 143 (message "Saving places to %s..." file)