diff lisp/simple.el @ 5923:61d7d7bcbe76 cygwin

merged heads after pull -u
author Henry Thompson <ht@markup.co.uk>
date Thu, 05 Feb 2015 17:19:05 +0000
parents 9e5f3a0d4e66
children ccb0cff115d2
line wrap: on
line diff
--- a/lisp/simple.el	Wed Apr 23 22:22:37 2014 +0100
+++ b/lisp/simple.el	Thu Feb 05 17:19:05 2015 +0000
@@ -2441,7 +2441,7 @@
 
 ;; This is the guts of next-line and previous-line.
 ;; Count says how many lines to move.
-(defun line-move (count)
+(defun line-move (count &optional noerror)
   ;; Don't run any point-motion hooks, and disregard intangibility,
   ;; for intermediate positions.
   (let ((inhibit-point-motion-hooks t)
@@ -2470,14 +2470,16 @@
 			     (zerop (forward-line 1)))
 		    (and (zerop (forward-line count))
 			 (bolp)))
-		  (signal (if (< count 0)
-			      'beginning-of-buffer
-			    'end-of-buffer)
-			  nil))
+		  (if (not noerror)
+		      (signal (if (< count 0)
+				  'beginning-of-buffer
+				'end-of-buffer)
+			      nil)))
 	    ;; Move by count lines, but ignore invisible ones.
 	    (while (> count 0)
 	      (end-of-line)
 	      (and (zerop (vertical-motion 1))
+		   (not noerror)
 		   (signal 'end-of-buffer nil))
 	      ;; If the following character is currently invisible,
 	      ;; skip all characters with that same `invisible' property value.
@@ -2495,6 +2497,7 @@
 	    (while (< count 0)
 	      (beginning-of-line)
 	      (and (zerop (vertical-motion -1))
+		   (not noerror)
 		   (signal 'beginning-of-buffer nil))
 	      (while (and (not (bobp))
 			  (let ((prop
@@ -4412,14 +4415,21 @@
 			    (car (car log)) (cdr (car log))))
       (setq log (cdr log)))))
 
-(defun append-message (label message &optional frame stdout-p)
+(defun* append-message (label message &optional frame stdout-p
+                              &key (start 0) end)
   "Add MESSAGE to the message-stack, or append it to the existing text.
+
 LABEL is the class of the message.  If it is the same as that of the top of
 the message stack, MESSAGE is appended to the existing message, otherwise
 it is pushed on the stack.
+
 FRAME determines the minibuffer window to send the message to.
+
 STDOUT-P is ignored, except for output to stream devices.  For streams,
-STDOUT-P non-nil directs output to stdout, otherwise to stderr."
+STDOUT-P non-nil directs output to stdout, otherwise to stderr.
+
+START and END, if supplied, designate a substring of MESSAGE to add. See
+`write-sequence'."
   (or frame (setq frame (selected-frame)))
   ;; If outputting to the terminal, make sure output from anyone else clears
   ;; the left side first, but don't do it ourselves, otherwise we won't be
@@ -4430,17 +4440,18 @@
     (if (eq label (car top))
 	(setcdr top (concat (cdr top) message))
       (push (cons label message) message-stack)))
-  (raw-append-message message frame stdout-p)
+  (raw-append-message message frame stdout-p :start start :end end)
   (if (eq 'stream (frame-type frame))
       (set-device-clear-left-side (frame-device frame) t)))
 
 ;; Really append the message to the echo area.  No fiddling with
 ;; message-stack.
-(defun raw-append-message (message &optional frame stdout-p)
+(defun* raw-append-message (message &optional frame stdout-p
+                                    &key (start 0) end)
   (unless (equal message "")
     (let ((inhibit-read-only t))
       (with-current-buffer " *Echo Area*"
-	(insert-string message)
+	(write-sequence message (current-buffer) :start start :end end)
 	;; #### This needs to be conditional; cf discussion by Stefan Monnier
 	;; et al on emacs-devel in mid-to-late April 2007.  One problem is
 	;; there is no known good way to guess whether the user wants to have
@@ -4489,7 +4500,8 @@
 	  ;; we ever create another non-redisplayable device type (e.g.
 	  ;; processes?  printers?).
 	  (if (eq 'stream (frame-type frame))
-	      (send-string-to-terminal message stdout-p (frame-device frame))
+	      (send-string-to-terminal (subseq message start end) stdout-p
+                                       (frame-device frame))
 	    (funcall redisplay-echo-area-function))))))
 
 (defun display-message (label message &optional frame stdout-p)