 (defun psl-compile-to-elisp ()
   "Compile the current buffer into an Emacs Lisp s-expression."
   (let ((buffer (current-buffer)))
-    (setq mpd-start (point2 nil 0))
+    (setq mpd-start (save-excursion (beginning-of-line) (point)))
     (setq mpd-point-stack ())
     (with-temp-buffer
       (insert-buffer-substring buffer) ; lose the text properties

(defvar mpd-token-stack ()
  "Stack of tokens at this point.")

(defun mpd-set-best ()
  "Update the current best parsing position."
  (if (point2> (point2) mpd-best)
      (setq mpd-best (point2))))

(defun mpd-get-token-func (token funcs)
  "Get the manipulation function for the given token."
  (or (cdr (assq token funcs)) #'cons))

(defun mpd-parse (tokens &optional funcs pattern)
  "Return the next item in the current buffer."
  (setq mpd-best (point2 0 0))
  (setq mpd-token-stack ())
  (if pattern
      (mpd-match pattern tokens funcs)

      (cons `(cons (quote ,(caar fields)) ,(cdar fields))
            (psl-make-object (cdr fields))))))

;;; Parser functions

(defvar mpd-best 0
  "The furthest most point that parsing reached. This information
can be used to determine where parsing failed.")

(defvar mpd-start 0
  "Position of point in original source buffer. The purpose is
for auto-indentation.")

