comparison lisp/prim/simple.el @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents e04119814345
children 131b0175ea99
comparison
equal deleted inserted replaced
47:11c6df210d7f 48:56c54cf7c5b6
1075 ;; this code, but only for text-properties and not full extents. -sb 1075 ;; this code, but only for text-properties and not full extents. -sb
1076 ;; If the buffer is read-only, we should beep, in case the person 1076 ;; If the buffer is read-only, we should beep, in case the person
1077 ;; just isn't aware of this. However, there's no harm in putting 1077 ;; just isn't aware of this. However, there's no harm in putting
1078 ;; the region's text in the kill ring, anyway. 1078 ;; the region's text in the kill ring, anyway.
1079 ((or (and buffer-read-only (not inhibit-read-only)) 1079 ((or (and buffer-read-only (not inhibit-read-only))
1080 (text-property-not-all beg end 'read-only nil)) 1080 (text-property-not-all (min beg end) (max beg end) 'read-only nil))
1081 ;; This is redundant. 1081 ;; This is redundant.
1082 ;; (if verbose (message "Copying %d characters" 1082 ;; (if verbose (message "Copying %d characters"
1083 ;; (- (max beg end) (min beg end)))) 1083 ;; (- (max beg end) (min beg end))))
1084 (copy-region-as-kill beg end) 1084 (copy-region-as-kill beg end)
1085 ;; ;; This should always barf, and give us the correct error. 1085 ;; ;; This should always barf, and give us the correct error.
1102 tail) 1102 tail)
1103 (delete-region beg end) 1103 (delete-region beg end)
1104 ;; Search back in buffer-undo-list for this string, 1104 ;; Search back in buffer-undo-list for this string,
1105 ;; in case a change hook made property changes. 1105 ;; in case a change hook made property changes.
1106 (setq tail buffer-undo-list) 1106 (setq tail buffer-undo-list)
1107 (while (not (stringp (car-safe (car-safe tail)))) ; XEmacs 1107 (while (and tail
1108 (setq tail (cdr tail))) 1108 (not (stringp (car-safe (car-safe tail))))) ; XEmacs
1109 (pop tail))
1109 ;; Take the same string recorded for undo 1110 ;; Take the same string recorded for undo
1110 ;; and put it in the kill-ring. 1111 ;; and put it in the kill-ring.
1111 (kill-new (car (car tail))))) 1112 (and tail
1113 (kill-new (car (car tail))))))
1112 1114
1113 (t 1115 (t
1114 ;; if undo is not kept, grab the string then delete it (which won't 1116 ;; if undo is not kept, grab the string then delete it (which won't
1115 ;; add another string to the undo list). 1117 ;; add another string to the undo list).
1116 (copy-region-as-kill beg end) 1118 (copy-region-as-kill beg end)
1203 (if before 1205 (if before
1204 ;; This is like exchange-point-and-mark, but doesn't activate the mark. 1206 ;; This is like exchange-point-and-mark, but doesn't activate the mark.
1205 ;; It is cleaner to avoid activation, even though the command 1207 ;; It is cleaner to avoid activation, even though the command
1206 ;; loop would deactivate the mark because we inserted text. 1208 ;; loop would deactivate the mark because we inserted text.
1207 (goto-char (prog1 (mark t) 1209 (goto-char (prog1 (mark t)
1208 (set-marker (mark-marker) (point) (current-buffer)))))) 1210 (set-marker (mark-marker t) (point) (current-buffer))))))
1209 nil) 1211 nil)
1210 1212
1211 1213
1212 (defun yank (&optional arg) 1214 (defun yank (&optional arg)
1213 "Reinsert the last stretch of killed text. 1215 "Reinsert the last stretch of killed text.
3129 you should just use (message nil)." 3131 you should just use (message nil)."
3130 (or frame (setq frame (selected-frame))) 3132 (or frame (setq frame (selected-frame)))
3131 (let ((clear-stream (and message-stack (eq 'stream (frame-type frame))))) 3133 (let ((clear-stream (and message-stack (eq 'stream (frame-type frame)))))
3132 (remove-message label frame) 3134 (remove-message label frame)
3133 (let ((buffer (get-buffer " *Echo Area*")) 3135 (let ((buffer (get-buffer " *Echo Area*"))
3136 (inhibit-read-only t)
3134 (zmacs-region-stays zmacs-region-stays)) ; preserve from change 3137 (zmacs-region-stays zmacs-region-stays)) ; preserve from change
3135 (erase-buffer buffer)) 3138 (erase-buffer buffer))
3136 (if clear-stream 3139 (if clear-stream
3137 (send-string-to-terminal ?\n stdout-p)) 3140 (send-string-to-terminal ?\n stdout-p))
3138 (if no-restore 3141 (if no-restore
3167 (run-hook-with-args 'remove-message-hook 3170 (run-hook-with-args 'remove-message-hook
3168 (car (car log)) (cdr (car log))) 3171 (car (car log)) (cdr (car log)))
3169 (error (setq remove-message-hook nil) 3172 (error (setq remove-message-hook nil)
3170 (message "remove-message-hook error: %s" e) 3173 (message "remove-message-hook error: %s" e)
3171 (sit-for 2) 3174 (sit-for 2)
3172 (erase-buffer (get-buffer " *Echo Area*")) 3175 (let ((inhibit-read-only t))
3176 (erase-buffer (get-buffer " *Echo Area*")))
3173 (signal (car e) (cdr e)))) 3177 (signal (car e) (cdr e))))
3174 (setq log (cdr log))))) 3178 (setq log (cdr log)))))
3175 3179
3176 (defun append-message (label message &optional frame stdout-p) 3180 (defun append-message (label message &optional frame stdout-p)
3177 (or frame (setq frame (selected-frame))) 3181 (or frame (setq frame (selected-frame)))
3187 (if (eq message "") nil 3191 (if (eq message "") nil
3188 (let ((buffer (get-buffer " *Echo Area*")) 3192 (let ((buffer (get-buffer " *Echo Area*"))
3189 (zmacs-region-stays zmacs-region-stays)) ; preserve from change 3193 (zmacs-region-stays zmacs-region-stays)) ; preserve from change
3190 (save-excursion 3194 (save-excursion
3191 (set-buffer buffer) 3195 (set-buffer buffer)
3192 (insert message)) 3196 (let ((inhibit-read-only t))
3197 (insert message)))
3193 ;; Conditionalizing on the device type in this way is not that clean, 3198 ;; Conditionalizing on the device type in this way is not that clean,
3194 ;; but neither is having a device method, as I originally implemented 3199 ;; but neither is having a device method, as I originally implemented
3195 ;; it: all non-stream devices behave in the same way. Perhaps 3200 ;; it: all non-stream devices behave in the same way. Perhaps
3196 ;; the cleanest way is to make the concept of a "redisplayable" 3201 ;; the cleanest way is to make the concept of a "redisplayable"
3197 ;; device, which stream devices are not. Look into this more if 3202 ;; device, which stream devices are not. Look into this more if