comparison lisp/simple.el @ 91073:4bc33ffdda1a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 902-908) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 131-137) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 261-262) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-278
author Miles Bader <miles@gnu.org>
date Sat, 27 Oct 2007 09:12:07 +0000
parents 1251cabc40b7 9a8400cb685c
children 880960b70474
comparison
equal deleted inserted replaced
91072:74ab3ea909f9 91073:4bc33ffdda1a
631 ;; Be careful to insert the newline before indenting the line. 631 ;; Be careful to insert the newline before indenting the line.
632 ;; Otherwise, the indentation might be wrong. 632 ;; Otherwise, the indentation might be wrong.
633 (newline) 633 (newline)
634 (save-excursion 634 (save-excursion
635 (goto-char pos) 635 (goto-char pos)
636 ;; Usually indent-according-to-mode should "preserve" point, but it is 636 ;; We are at EOL before the call to indent-according-to-mode, and
637 ;; not guaranteed; e.g. indent-to-left-margin doesn't. 637 ;; after it we usually are as well, but not always. We tried to
638 (save-excursion (indent-according-to-mode)) 638 ;; address it with `save-excursion' but that uses a normal marker
639 ;; whereas we need `move after insertion', so we do the save/restore
640 ;; by hand.
641 (setq pos (copy-marker pos t))
642 (indent-according-to-mode)
643 (goto-char pos)
644 ;; Remove the trailing white-space after indentation because
645 ;; indentation may introduce the whitespace.
639 (delete-horizontal-space t)) 646 (delete-horizontal-space t))
640 (indent-according-to-mode))) 647 (indent-according-to-mode)))
641 648
642 (defun quoted-insert (arg) 649 (defun quoted-insert (arg)
643 "Read next input character and insert it. 650 "Read next input character and insert it.
1293 1300
1294 (defun goto-history-element (nabs) 1301 (defun goto-history-element (nabs)
1295 "Puts element of the minibuffer history in the minibuffer. 1302 "Puts element of the minibuffer history in the minibuffer.
1296 The argument NABS specifies the absolute history position." 1303 The argument NABS specifies the absolute history position."
1297 (interactive "p") 1304 (interactive "p")
1298 (let ((minimum (if minibuffer-default -1 0)) 1305 (let ((minimum (if minibuffer-default
1306 (- (if (listp minibuffer-default)
1307 (length minibuffer-default)
1308 1))
1309 0))
1299 elt minibuffer-returned-to-present) 1310 elt minibuffer-returned-to-present)
1300 (if (and (zerop minibuffer-history-position) 1311 (if (and (zerop minibuffer-history-position)
1301 (null minibuffer-text-before-history)) 1312 (null minibuffer-text-before-history))
1302 (setq minibuffer-text-before-history 1313 (setq minibuffer-text-before-history
1303 (minibuffer-contents-no-properties))) 1314 (minibuffer-contents-no-properties)))
1315 ((eobp) nil) 1326 ((eobp) nil)
1316 (t (point)))))) 1327 (t (point))))))
1317 (goto-char (point-max)) 1328 (goto-char (point-max))
1318 (delete-minibuffer-contents) 1329 (delete-minibuffer-contents)
1319 (setq minibuffer-history-position nabs) 1330 (setq minibuffer-history-position nabs)
1320 (cond ((= nabs -1) 1331 (cond ((< nabs 0)
1321 (setq elt minibuffer-default)) 1332 (setq elt (if (listp minibuffer-default)
1333 (nth (1- (abs nabs)) minibuffer-default)
1334 minibuffer-default)))
1322 ((= nabs 0) 1335 ((= nabs 0)
1323 (setq elt (or minibuffer-text-before-history "")) 1336 (setq elt (or minibuffer-text-before-history ""))
1324 (setq minibuffer-returned-to-present t) 1337 (setq minibuffer-returned-to-present t)
1325 (setq minibuffer-text-before-history nil)) 1338 (setq minibuffer-text-before-history nil))
1326 (t (setq elt (nth (1- minibuffer-history-position) 1339 (t (setq elt (nth (1- minibuffer-history-position)