summaryrefslogtreecommitdiff
path: root/lisp/subr.el
diff options
context:
space:
mode:
authorKaroly Lorentey <karoly@lorentey.hu>2007-04-22 12:12:29 +0000
committerKaroly Lorentey <karoly@lorentey.hu>2007-04-22 12:12:29 +0000
commitaac2e6e4a9dd8602d5848abf70ab9f2fc4d6e8d2 (patch)
treef452d7d432f4498a7e7e3f8f5ccedb5635a548a3 /lisp/subr.el
parente4cec79ec01676bebee3aa12263f13107efb5052 (diff)
parent96a0120aeb5172c2d738bd8a6e26549b3b6cee97 (diff)
downloademacs-aac2e6e4a9dd8602d5848abf70ab9f2fc4d6e8d2.tar.gz
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-660 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-661 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-662 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-663 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-664 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-665 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-666 Fix read-only prompt problem in isearch * emacs@sv.gnu.org/emacs--devo--0--patch-667 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-668 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-669 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-670 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-671 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-672 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-673 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-206 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-207 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-208 Update from CVS git-archimport-id: lorentey@elte.hu--2004/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 ce4a2507602..4b5c5e3f076 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