aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorKaroly Lorentey <[email protected]>2007-04-22 12:12:29 +0000
committerKaroly Lorentey <[email protected]>2007-04-22 12:12:29 +0000
commite18c709364b095ea0be8ecabe458ac9a642a252f (patch)
treeefe814a842f932f387b3947c572bf43a548d17ef /lisp/subr.el
parent81088e260b086fe28f36964f32b6338210ec6fd8 (diff)
parent9f25e707aaad5ed14a9448e9c5d345ff0bdbc5a7 (diff)
Merged from [email protected]
Patches applied: * [email protected]/emacs--devo--0--patch-660 Update from CVS * [email protected]/emacs--devo--0--patch-661 Merge from gnus--rel--5.10 * [email protected]/emacs--devo--0--patch-662 Update from CVS * [email protected]/emacs--devo--0--patch-663 Update from CVS * [email protected]/emacs--devo--0--patch-664 Update from CVS * [email protected]/emacs--devo--0--patch-665 Update from CVS * [email protected]/emacs--devo--0--patch-666 Fix read-only prompt problem in isearch * [email protected]/emacs--devo--0--patch-667 Update from CVS * [email protected]/emacs--devo--0--patch-668 Update from CVS * [email protected]/emacs--devo--0--patch-669 Merge from gnus--rel--5.10 * [email protected]/emacs--devo--0--patch-670 Update from CVS * [email protected]/emacs--devo--0--patch-671 Update from CVS * [email protected]/emacs--devo--0--patch-672 Update from CVS * [email protected]/emacs--devo--0--patch-673 Update from CVS * [email protected]/gnus--rel--5.10--patch-206 Merge from emacs--devo--0 * [email protected]/gnus--rel--5.10--patch-207 Merge from emacs--devo--0 * [email protected]/gnus--rel--5.10--patch-208 Update from CVS git-archimport-id: [email protected]/emacs--multi-tty--0--patch-600
Diffstat (limited to 'lisp/subr.el')
-rw-r--r--lisp/subr.el51
1 files changed, 37 insertions, 14 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index ce4a250760..4b5c5e3f07 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -55,7 +55,7 @@ that complains if FORM ever does return differing values."
(defmacro def-edebug-spec (symbol spec)
"Set the `edebug-form-spec' property of SYMBOL according to SPEC.
-Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol
+Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol
\(naming a function), or a list."
`(put (quote ,symbol) 'edebug-form-spec (quote ,spec)))
@@ -99,12 +99,20 @@ change the list."
(list 'setq listname (list 'cdr listname)))))
(defmacro when (cond &rest body)
- "If COND yields non-nil, do BODY, else return nil."
+ "If COND yields non-nil, do BODY, else return nil.
+When COND yields non-nil, eval BODY forms sequentially and return
+value of last one, or nil if there are none.
+
+\(fn COND BODY ...)"
(declare (indent 1) (debug t))
(list 'if cond (cons 'progn body)))
(defmacro unless (cond &rest body)
- "If COND yields nil, do BODY, else return nil."
+ "If COND yields nil, do BODY, else return nil.
+When COND yields nil, eval BODY forms sequentially and return
+value of last one, or nil if there are none.
+
+\(fn COND BODY ...)"
(declare (indent 1) (debug t))
(cons 'if (cons cond (cons nil body))))
@@ -1895,21 +1903,32 @@ input (as a command if nothing else).
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 ((momentary-overlay (make-overlay pos pos nil t)))
- (overlay-put momentary-overlay 'before-string
- (propertize string 'face 'momentary))
+ (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)
(unwind-protect
(progn
- ;; If the message end is off screen, recenter now.
- (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.
(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)
+ (recenter (/ (window-height) 2)))
+ ;; If that pushed message start off the screen,
+ ;; scroll to start it at the top of the screen.
(move-to-window-line 0)
(if (> (point) pos)
- (goto-char pos)
- (recenter 0)))
+ (progn
+ (goto-char pos)
+ (recenter 0))))
(message (or message "Type %s to continue editing.")
(single-key-description exit-char))
(let (char)
@@ -1929,7 +1948,11 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
(or (eq char exit-char)
(eq char (event-convert-list exit-char))
(setq unread-command-events (list char))))))
- (delete-overlay momentary-overlay))))
+ (if insert-end
+ (save-excursion
+ (delete-region pos insert-end)))
+ (setq buffer-file-name name)
+ (set-buffer-modified-p modified))))
;;;; Overlay operations