emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/subr.el,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/subr.el,v
Date: Thu, 04 Jan 2007 21:46:06 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       07/01/04 21:46:06

Index: subr.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/subr.el,v
retrieving revision 1.540
retrieving revision 1.541
diff -u -b -r1.540 -r1.541
--- subr.el     2 Jan 2007 23:44:44 -0000       1.540
+++ subr.el     4 Jan 2007 21:46:06 -0000       1.541
@@ -1884,6 +1884,11 @@
   (if all (save-excursion (set-buffer (other-buffer))))
   (set-buffer-modified-p (buffer-modified-p)))
 
+(defface momentary
+  '((t (:inherit mode-line)))
+  "Face for momentarily displaying text in the current buffer."
+  :group 'display)
+
 (defun momentary-string-display (string pos &optional exit-char message)
   "Momentarily display STRING in the buffer at POS.
 Display remains until next event is input.
@@ -1895,24 +1900,13 @@
 Display MESSAGE (optional fourth arg) in the echo area.
 If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
   (or exit-char (setq exit-char ?\s))
-  (let ((inhibit-read-only t)
-       ;; Don't modify the undo list at all.
-       (buffer-undo-list t)
-       (modified (buffer-modified-p))
-       (name buffer-file-name)
-       insert-end)
+  (let ((momentary-overlay (make-overlay pos pos nil t)))
+    (overlay-put momentary-overlay 'before-string
+                (propertize string 'face 'momentary))
     (unwind-protect
        (progn
-         (save-excursion
-           (goto-char pos)
-           ;; To avoid trouble with out-of-bounds position
-           (setq pos (point))
-           ;; defeat file locking... don't try this at home, kids!
-           (setq buffer-file-name nil)
-           (insert-before-markers string)
-           (setq insert-end (point))
            ;; If the message end is off screen, recenter now.
-           (if (< (window-end nil t) insert-end)
+         (if (< (window-end nil t) (+ pos (length string)))
                (recenter (/ (window-height) 2)))
            ;; If that pushed message start off the screen,
            ;; scroll to start it at the top of the screen.
@@ -1920,7 +1914,7 @@
            (if (> (point) pos)
                (progn
                  (goto-char pos)
-                 (recenter 0))))
+               (recenter 0)))
          (message (or message "Type %s to continue editing.")
                   (single-key-description exit-char))
          (let (char)
@@ -1940,11 +1934,7 @@
              (or (eq char exit-char)
                  (eq char (event-convert-list exit-char))
                  (setq unread-command-events (list char))))))
-      (if insert-end
-         (save-excursion
-           (delete-region pos insert-end)))
-      (setq buffer-file-name name)
-      (set-buffer-modified-p modified))))
+      (delete-overlay momentary-overlay))))
 
 
 ;;;; Overlay operations




reply via email to

[Prev in Thread] Current Thread [Next in Thread]