(pages-copy-header-and-position): Call end-of-line, not forward-line.
[bpt/emacs.git] / lisp / simple.el
index 9139298..8555773 100644 (file)
@@ -332,7 +332,11 @@ and the greater of them is not at the start of a line."
                (setq done (+ 40 done)))
              (while (re-search-forward "[\n\C-m]" nil t 1)
                (setq done (+ 1 done)))
-             done)
+             (goto-char (point-max))
+             (if (and (/= start end)
+                      (not (bolp)))
+                 (1+ done)
+               done))
          (- (buffer-size) (forward-line (buffer-size))))))))
 
 (defun what-cursor-position ()
@@ -369,7 +373,7 @@ Other major modes are defined by comparison with this one."
   (interactive)
   (kill-all-local-variables))
 
-(defvar read-expression-map (copy-keymap minibuffer-local-map)
+(defvar read-expression-map (cons 'keymap minibuffer-local-map)
   "Minibuffer keymap used for reading Lisp expressions.")
 (define-key read-expression-map "\M-\t" 'lisp-complete-symbol)
 
@@ -382,9 +386,10 @@ Other major modes are defined by comparison with this one."
 (defun eval-expression (expression)
   "Evaluate EXPRESSION and print value in minibuffer.
 Value is also consed on to front of the variable `values'."
-  (interactive (list (read-from-minibuffer "Eval: "
-                                          nil read-expression-map t
-                                          'read-expression-history)))
+  (interactive
+   (list (read-from-minibuffer "Eval: "
+                              nil read-expression-map t
+                              'read-expression-history)))
   (setq values (cons (eval expression) values))
   (prin1 (car values) t))
 
@@ -396,11 +401,6 @@ the minibuffer, then read and evaluate the result."
                                       (prin1-to-string command)
                                       read-expression-map t
                                       '(command-history . 1))))
-;;; Don't add the command to the history; read-from-minibuffer has
-;;; already done that.
-;;;    ;; Add edited command to command history, unless redundant.
-;;;    (or (equal command (car command-history))
-;;;    (setq command-history (cons command command-history)))
     (eval command)))
 
 (defun repeat-complex-command (arg)
@@ -424,18 +424,15 @@ to get different commands to edit and resubmit."
                 "Redo: " (prin1-to-string elt) read-expression-map t
                 (cons 'command-history arg)))
 
-;;;  read-from-minibuffer handles the adding of what is read to the history
-;;;  variable.
-;;;
-;;;      ;; If command was added to command-history as a string,
-;;;      ;; get rid of that.  We want only evallable expressions there.
-;;;      (if (stringp (car command-history))
-;;;          (setq command-history (cdr command-history)))
-;;;
-;;;      ;; If command to be redone does not match front of history,
-;;;      ;; add it to the history.
-;;;      (or (equal newcmd (car command-history))
-;;;          (setq command-history (cons newcmd command-history)))
+         ;; If command was added to command-history as a string,
+         ;; get rid of that.  We want only evallable expressions there.
+         (if (stringp (car command-history))
+             (setq command-history (cdr command-history)))
+
+         ;; If command to be redone does not match front of history,
+         ;; add it to the history.
+         (or (equal newcmd (car command-history))
+             (setq command-history (cons newcmd command-history)))
          (eval newcmd))
       (ding))))
 \f
@@ -2115,7 +2112,7 @@ in the mode line."
   "Move cursor momentarily to the beginning of the sexp before point."
   (interactive)
   (and (> (point) (1+ (point-min)))
-       (/= (char-syntax (char-after (- (point) 2))) ?\\ )
+       (not (memq (char-syntax (char-after (- (point) 2))) '(?/ ?\\ )))
        blink-matching-paren
        (let* ((oldpos (point))
              (blinkpos)