summaryrefslogtreecommitdiff
path: root/lisp/saveplace.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-09-25 01:01:05 +0000
committerKarl Heuer <kwzh@gnu.org>1997-09-25 01:01:05 +0000
commita59f6ba35e94c6232ebb3fb633ca6b13573a0b1e (patch)
tree6c7f85fccfa9a1fa6f15257126c7dfce3d9765b1 /lisp/saveplace.el
parenta4ce5edeb5e7f26e73d54eb4635442454d00ed92 (diff)
downloademacs-a59f6ba35e94c6232ebb3fb633ca6b13573a0b1e.tar.gz
(save-place-to-alist): Optimize out the degenerate
case when point is 1.
Diffstat (limited to 'lisp/saveplace.el')
-rw-r--r--lisp/saveplace.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index b3d3a24a2f5..5ac3f344c62 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -125,16 +125,17 @@ To save places automatically in all files, put this in your `.emacs' file:
(or save-place-loaded (load-save-place-alist-from-file))
(if buffer-file-name
(progn
- (let ((cell (assoc buffer-file-name save-place-alist)))
+ (let ((cell (assoc buffer-file-name save-place-alist))
+ (position (if (not (eq major-mode 'hexl-mode))
+ (point)
+ (1+ (hexl-current-address)))))
(if cell
- (setq save-place-alist (delq cell save-place-alist))))
- (if save-place
- (setq save-place-alist
- (cons (cons buffer-file-name
- (if (not (eq major-mode 'hexl-mode))
- (point)
- (1+ (hexl-current-address))))
- save-place-alist))))))
+ (setq save-place-alist (delq cell save-place-alist)))
+ (if (and save-place
+ (not (= position 1))) ;; Optimize out the degenerate case.
+ (setq save-place-alist
+ (cons (cons buffer-file-name position)
+ save-place-alist)))))))
(defun save-place-alist-to-file ()
(let ((file (expand-file-name save-place-file)))