anchor.diff:                       (line-offset (buffer-point buffer) 0 charpos)
                        (funcall set-buffer-fn buffer))))))))
   
  -(define-command go-back (n) ("p")
  +(defun go-back-internal (record n)
     (when (plusp n)
  -    (loop :while *record-locations*
  -          :for elt := (progn
  -                        (decf *len*)
  -                        (pop *record-locations*))
  -          :for (buffer-name line-number charpos) := elt
  +    (loop :while (record-locations record)
  +          :for location := (progn
  +                             (decf (record-len record))
  +                             (pop (record-locations record)))
  +          :for (buffer-name line-number charpos) := location
             :do (alexandria:when-let ((buffer (get-buffer buffer-name)))
                   (record-location (current-point) t)
  -                (incf *len*)
  -                (alexandria:nconcf *record-locations* (list elt))
  +                (incf (record-len record))
  +                (alexandria:nconcf (record-locations record) (list location))
                   (when (zerop (decf n))
                     (switch-to-buffer buffer)
                     (let ((p (buffer-point buffer)))
  
positive.code:                     (line-offset p 0 charpos))
                    (return))))))
  
  (add-hook *set-location-hook* 'record-location)
  
negative.code: (defpackage :lem.go-back
    (:use :cl :lem :lem.sourcelist)
    (:export :*max*
             :select-go-back
             :go-back-global
             :go-back))
  (in-package :lem.go-back)
  
  (defparameter *max* 100)
  
  (defstruct record
    locations
    (len 0))
  
  (defvar *global-record* (make-record))
  
  (defun location-name (location) (first location))
  (defun location-linum (location) (second location))
  (defun location-charpos (location) (third location))
  
  (defun point-to-location (point)
    (list (buffer-name (point-buffer point))
          (line-number-at-point point)
          (point-charpos point)))
  
  (defun equal-location (location1 location2)
    (and (equal (location-name location1)
                (location-name location2))
         (= (location-linum location1)
            (location-linum location2))))
  
  (defun append-location (record location &optional tail)
    (when (if tail
              (equal-location location
                              (car (last (record-locations record))))
              (equal-location location
                              (car (record-locations record))))
      (return-from append-location))
    (if (<= *max* (record-len record))
        (progn
          (setf (record-locations record)
                (nbutlast (record-locations record)
                          (1+ (- (record-len record) *max*))))
          (setf (record-len record) *max*))
        (incf (record-len record)))
    (if tail
        (alexandria:nconcf (record-locations record)
                           (list location))
        (push location (record-locations record))))
  
  (define-command select-go-back () ()
    (with-sourcelist (sourcelist "*select-locations*" :focus t)
      (loop :for (name linum charpos) :in (record-locations *global-record*)
            :for buffer := (get-buffer name)
            :when buffer
            :do (let ((name name)
  