From a59f6ba35e94c6232ebb3fb633ca6b13573a0b1e Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Thu, 25 Sep 1997 01:01:05 +0000 Subject: [PATCH] (save-place-to-alist): Optimize out the degenerate case when point is 1. --- lisp/saveplace.el | 19 ++++++++++--------- 1 file 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))) -- 2.39.2