comparison lisp/simple.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
1 ;;; simple.el --- basic editing commands for XEmacs 1 ;;; simple.el --- basic editing commands for XEmacs
2 2
3 ;; Copyright (C) 1985-7, 1993-5, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985-7, 1993-5, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
5 ;; Copyright (C) 2000 Ben Wing.
5 6
6 ;; Maintainer: XEmacs Development Team 7 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: lisp, extensions, internal, dumped 8 ;; Keywords: lisp, extensions, internal, dumped
8 9
9 ;; This file is part of XEmacs. 10 ;; This file is part of XEmacs.
716 (t 717 (t
717 ;; give a basic line count 718 ;; give a basic line count
718 (message "Line %d" buffer-line))))))) 719 (message "Line %d" buffer-line)))))))
719 (setq zmacs-region-stays t)) 720 (setq zmacs-region-stays t))
720 721
721 ;;; Bob Weiner, Altrasoft, 02/12/1998 722 ;; new in XEmacs 21.2 (not in FSF).
722 ;;; Added the 3rd arg in `count-lines' to conditionalize the counting of 723 (defun line-number (&optional pos respect-narrowing)
723 ;;; collapsed lines. 724 "Return the line number of POS (defaults to point).
725 If RESPECT-NARROWING is non-nil, then the narrowed line number is returned;
726 otherwise, the absolute line number is returned. The returned line can always
727 be given to `goto-line' to get back to the current line."
728 (if (and pos (/= pos (point)))
729 (save-excursion
730 (goto-char pos)
731 (line-number nil respect-narrowing))
732 (1+ (count-lines (if respect-narrowing (point-min) 1) (point-at-bol)))))
733
724 (defun count-lines (start end &optional ignore-invisible-lines-flag) 734 (defun count-lines (start end &optional ignore-invisible-lines-flag)
725 "Return number of lines between START and END. 735 "Return number of lines between START and END.
726 This is usually the number of newlines between them, 736 This is usually the number of newlines between them,
727 but can be one more if START is not equal to END 737 but can be one more if START is not equal to END
728 and the greater of them is not at the start of a line. 738 and the greater of them is not at the start of a line.
729 739
730 With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, lines collapsed with 740 With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, lines collapsed with
731 selective-display are excluded from the line count." 741 selective-display are excluded from the line count.
742
743 NOTE: The expression to return the current line number is not obvious:
744
745 (1+ (count-lines 1 (point-at-bol)))
746
747 See also `line-number'."
732 (save-excursion 748 (save-excursion
733 (save-restriction 749 (save-restriction
734 (narrow-to-region start end) 750 (narrow-to-region start end)
735 (goto-char (point-min)) 751 (goto-char (point-min))
736 (if (and (not ignore-invisible-lines-flag) (eq selective-display t)) 752 (if (and (not ignore-invisible-lines-flag) (eq selective-display t))
1085 (interactive "_p") 1101 (interactive "_p")
1086 (forward-line (- arg)) 1102 (forward-line (- arg))
1087 (skip-chars-forward " \t")) 1103 (skip-chars-forward " \t"))
1088 1104
1089 (defcustom kill-whole-line nil 1105 (defcustom kill-whole-line nil
1090 "*If non-nil, `kill-line' with no arg at beg of line kills the whole line." 1106 "*Control when and whether `kill-line' removes entire lines.
1091 :type 'boolean 1107 Note: This only applies when `kill-line' is called interactively;
1108 otherwise, it behaves \"historically\".
1109
1110 If `always', `kill-line' with no arg always kills the whole line,
1111 wherever point is in the line. (If you want to just kill to the end
1112 of the line, use \\[historical-kill-line].)
1113
1114 If not `always' but non-nil, `kill-line' with no arg kills the whole
1115 line if point is at the beginning, and otherwise behaves historically.
1116
1117 If nil, `kill-line' behaves historically."
1118 :type '(radio (const :tag "Kill to end of line" nil)
1119 (const :tag "Kill whole line" always)
1120 (const
1121 :tag "Kill whole line at beginning, otherwise end of line" t))
1092 :group 'killing) 1122 :group 'killing)
1093 1123
1124 (defun historical-kill-line (&optional arg)
1125 "Same as `kill-line' but ignores value of `kill-whole-line'."
1126 (interactive "*P")
1127 (let ((kill-whole-line nil))
1128 (if (interactive-p)
1129 (call-interactively 'kill-line)
1130 (kill-line arg))))
1131
1094 (defun kill-line (&optional arg) 1132 (defun kill-line (&optional arg)
1095 "Kill the rest of the current line; if no nonblanks there, kill thru newline. 1133 "Kill the rest of the current line, or the entire line.
1134 If no nonblanks there, kill thru newline.
1135 If called interactively, may kill the entire line; see `kill-whole-line'.
1136 when given no argument at the beginning of a line.
1096 With prefix argument, kill that many lines from point. 1137 With prefix argument, kill that many lines from point.
1097 Negative arguments kill lines backward. 1138 Negative arguments kill lines backward.
1098 1139
1099 When calling from a program, nil means \"no arg\", 1140 When calling from a program, nil means \"no arg\",
1100 a number counts as a prefix arg. 1141 a number counts as a prefix arg."
1101
1102 If `kill-whole-line' is non-nil, then kill the whole line
1103 when given no argument at the beginning of a line."
1104 (interactive "*P") 1142 (interactive "*P")
1105 (kill-region (point) 1143 (kill-region (if (and (interactive-p)
1144 (not arg)
1145 (eq kill-whole-line 'always))
1146 (save-excursion
1147 (beginning-of-line)
1148 (point))
1149 (point))
1106 ;; Don't shift point before doing the delete; that way, 1150 ;; Don't shift point before doing the delete; that way,
1107 ;; undo will record the right position of point. 1151 ;; undo will record the right position of point.
1108 ;; FSF 1152 ;; FSF
1109 ; ;; It is better to move point to the other end of the kill 1153 ; ;; It is better to move point to the other end of the kill
1110 ; ;; before killing. That way, in a read-only buffer, point 1154 ; ;; before killing. That way, in a read-only buffer, point
1115 (save-excursion 1159 (save-excursion
1116 (if arg 1160 (if arg
1117 (forward-line (prefix-numeric-value arg)) 1161 (forward-line (prefix-numeric-value arg))
1118 (if (eobp) 1162 (if (eobp)
1119 (signal 'end-of-buffer nil)) 1163 (signal 'end-of-buffer nil))
1120 (if (or (looking-at "[ \t]*$") (and kill-whole-line (bolp))) 1164 (if (or (looking-at "[ \t]*$")
1165 (and (interactive-p)
1166 (or (eq kill-whole-line 'always)
1167 (and kill-whole-line (bolp)))))
1121 (forward-line 1) 1168 (forward-line 1)
1122 (end-of-line))) 1169 (end-of-line)))
1123 (point)))) 1170 (point))))
1124 1171
1125 ;; XEmacs 1172 ;; XEmacs
1152 ;;; `kill-hooks' seems not sufficient because 1199 ;;; `kill-hooks' seems not sufficient because
1153 ;;; `interprogram-cut-function' requires more variable about to rotate 1200 ;;; `interprogram-cut-function' requires more variable about to rotate
1154 ;;; the cut buffers. I'm afraid to change interface of `kill-hooks', 1201 ;;; the cut buffers. I'm afraid to change interface of `kill-hooks',
1155 ;;; so I add it. (1997-11-03 by MORIOKA Tomohiko) 1202 ;;; so I add it. (1997-11-03 by MORIOKA Tomohiko)
1156 1203
1157 (defvar interprogram-cut-function nil 1204 (defcustom interprogram-cut-function 'own-clipboard
1158 "Function to call to make a killed region available to other programs. 1205 "Function to call to make a killed region available to other programs.
1159 1206
1160 Most window systems provide some sort of facility for cutting and 1207 Most window systems provide some sort of facility for cutting and
1161 pasting text between the windows of different programs. 1208 pasting text between the windows of different programs.
1162 This variable holds a function that Emacs calls whenever text 1209 This variable holds a function that Emacs calls whenever text
1165 1212
1166 The function takes one or two arguments. 1213 The function takes one or two arguments.
1167 The first argument, TEXT, is a string containing 1214 The first argument, TEXT, is a string containing
1168 the text which should be made available. 1215 the text which should be made available.
1169 The second, PUSH, if non-nil means this is a \"new\" kill; 1216 The second, PUSH, if non-nil means this is a \"new\" kill;
1170 nil means appending to an \"old\" kill.") 1217 nil means appending to an \"old\" kill."
1171 1218 :type '(radio (function-item :tag "Send to Clipboard"
1172 (defvar interprogram-paste-function nil 1219 :format "%t\n"
1220 own-clipboard)
1221 (const :tag "None" nil)
1222 (function :tag "Other"))
1223 :group 'killing)
1224
1225 (defcustom interprogram-paste-function 'get-clipboard
1173 "Function to call to get text cut from other programs. 1226 "Function to call to get text cut from other programs.
1174 1227
1175 Most window systems provide some sort of facility for cutting and 1228 Most window systems provide some sort of facility for cutting and
1176 pasting text between the windows of different programs. 1229 pasting text between the windows of different programs.
1177 This variable holds a function that Emacs calls to obtain 1230 This variable holds a function that Emacs calls to obtain
1185 Note that the function should return a string only if a program other 1238 Note that the function should return a string only if a program other
1186 than Emacs has provided a string for pasting; if Emacs provided the 1239 than Emacs has provided a string for pasting; if Emacs provided the
1187 most recent string, the function should return nil. If it is 1240 most recent string, the function should return nil. If it is
1188 difficult to tell whether Emacs or some other program provided the 1241 difficult to tell whether Emacs or some other program provided the
1189 current string, it is probably good enough to return nil if the string 1242 current string, it is probably good enough to return nil if the string
1190 is equal (according to `string=') to the last text Emacs provided.") 1243 is equal (according to `string=') to the last text Emacs provided."
1244 :type '(radio (function-item :tag "Get from Clipboard"
1245 :format "%t\n"
1246 get-clipboard)
1247 (const :tag "None" nil)
1248 (function :tag "Other"))
1249 :group 'killing)
1191 1250
1192 1251
1193 ;;;; The kill ring data structure. 1252 ;;;; The kill ring data structure.
1194 1253
1195 (defvar kill-ring nil 1254 (defvar kill-ring nil
1621 ; (setq mark-active nil) 1680 ; (setq mark-active nil)
1622 ; (run-hooks 'deactivate-mark-hook) 1681 ; (run-hooks 'deactivate-mark-hook)
1623 ; (set-marker (mark-marker) nil))) 1682 ; (set-marker (mark-marker) nil)))
1624 1683
1625 (defvar mark-ring nil 1684 (defvar mark-ring nil
1626 "The list of former marks of the current buffer, most recent first.") 1685 "The list of former marks of the current buffer, most recent first.
1686 This variable is automatically buffer-local.")
1627 (make-variable-buffer-local 'mark-ring) 1687 (make-variable-buffer-local 'mark-ring)
1628 (put 'mark-ring 'permanent-local t) 1688 (put 'mark-ring 'permanent-local t)
1689
1690 (defvar dont-record-current-mark nil
1691 "If set to t, the current mark value should not be recorded on the mark ring.
1692 This is set by commands that manipulate the mark incidentally, to avoid
1693 cluttering the mark ring unnecessarily. Under most circumstances, you do
1694 not need to set this directly; it is automatically reset each time
1695 `push-mark' is called, according to `mark-ring-unrecorded-commands'. This
1696 variable is automatically buffer-local.")
1697 (make-variable-buffer-local 'dont-record-current-mark)
1698 (put 'dont-record-current-mark 'permanent-local t)
1699
1700 ;; a conspiracy between push-mark and handle-pre-motion-command
1701 (defvar in-shifted-motion-command nil)
1702
1703 (defcustom mark-ring-unrecorded-commands '(shifted-motion-commands
1704 yank
1705 mark-beginning-of-buffer
1706 mark-bob
1707 mark-defun
1708 mark-end-of-buffer
1709 mark-end-of-line
1710 mark-end-of-sentence
1711 mark-eob
1712 mark-marker
1713 mark-page
1714 mark-paragraph
1715 mark-sexp
1716 mark-whole-buffer
1717 mark-word)
1718 "*List of commands whose marks should not be recorded on the mark stack.
1719 Many commands set the mark as part of their action. Normally, all such
1720 marks get recorded onto the mark stack. However, this tends to clutter up
1721 the mark stack unnecessarily. You can control this by putting a command
1722 onto this list. Then, any marks set by the function will not be recorded.
1723
1724 The special value `shifted-motion-commands' causes marks set as a result
1725 of selection using any shifted motion commands to not be recorded.
1726
1727 The value `yank' affects all yank-like commands, as well as just `yank'."
1728 :type '(repeat (choice (const :tag "shifted motion commands"
1729 'shifted-motion-commands)
1730 (const :tag "functions that select text"
1731 :inline t
1732 '(mark-beginning-of-buffer
1733 mark-bob
1734 mark-defun
1735 mark-end-of-buffer
1736 mark-end-of-line
1737 mark-end-of-sentence
1738 mark-eob
1739 mark-marker
1740 mark-page
1741 mark-paragraph
1742 mark-sexp
1743 mark-whole-buffer
1744 mark-word))
1745 (const :tag "functions that paste text"
1746 'yank)
1747 function))
1748 :group 'killing)
1629 1749
1630 (defcustom mark-ring-max 16 1750 (defcustom mark-ring-max 16
1631 "*Maximum size of mark ring. Start discarding off end if gets this big." 1751 "*Maximum size of mark ring. Start discarding off end if gets this big."
1632 :type 'integer 1752 :type 'integer
1633 :group 'killing) 1753 :group 'killing)
1645 "Set mark at where point is, or jump to mark. 1765 "Set mark at where point is, or jump to mark.
1646 With no prefix argument, set mark, push old mark position on local mark 1766 With no prefix argument, set mark, push old mark position on local mark
1647 ring, and push mark on global mark ring. 1767 ring, and push mark on global mark ring.
1648 With argument, jump to mark, and pop a new position for mark off the ring 1768 With argument, jump to mark, and pop a new position for mark off the ring
1649 \(does not affect global mark ring\). 1769 \(does not affect global mark ring\).
1770
1771 The mark ring is a per-buffer stack of marks, most recent first. Its
1772 maximum length is controlled by `mark-ring-max'. Generally, when new
1773 marks are set, the current mark is pushed onto the stack. You can pop
1774 marks off the stack using \\[universal-argument] \\[set-mark-command]. The term \"ring\" is used because when
1775 you pop a mark off the stack, the current mark value is pushed onto the
1776 far end of the stack. If this is confusing, just think of the mark ring
1777 as a stack.
1650 1778
1651 Novice Emacs Lisp programmers often try to use the mark for the wrong 1779 Novice Emacs Lisp programmers often try to use the mark for the wrong
1652 purposes. See the documentation of `set-mark' for more information." 1780 purposes. See the documentation of `set-mark' for more information."
1653 (interactive "P") 1781 (interactive "P")
1654 (if (null arg) 1782 (if (null arg)
1655 (push-mark nil nil t) 1783 (push-mark nil nil t)
1656 (if (null (mark t)) 1784 (if (null (mark t))
1657 (error "No mark set in this buffer") 1785 (error "No mark set in this buffer")
1786 (if dont-record-current-mark (pop-mark))
1658 (goto-char (mark t)) 1787 (goto-char (mark t))
1659 (pop-mark)))) 1788 (pop-mark))))
1660 1789
1661 ;; XEmacs: Extra parameter 1790 ;; XEmacs: Extra parameter
1662 (defun push-mark (&optional location nomsg activate-region buffer) 1791 (defun push-mark (&optional location nomsg activate-region buffer)
1667 Activate mark if optional third arg ACTIVATE-REGION non-nil. 1796 Activate mark if optional third arg ACTIVATE-REGION non-nil.
1668 1797
1669 Novice Emacs Lisp programmers often try to use the mark for the wrong 1798 Novice Emacs Lisp programmers often try to use the mark for the wrong
1670 purposes. See the documentation of `set-mark' for more information." 1799 purposes. See the documentation of `set-mark' for more information."
1671 (setq buffer (decode-buffer buffer)) ; XEmacs 1800 (setq buffer (decode-buffer buffer)) ; XEmacs
1672 (if (null (mark t buffer)) ; XEmacs 1801 (if (or dont-record-current-mark (null (mark t buffer))) ; XEmacs
1673 nil 1802 nil
1674 ;; The save-excursion / set-buffer is necessary because mark-ring 1803 ;; The save-excursion / set-buffer is necessary because mark-ring
1675 ;; is a buffer local variable 1804 ;; is a buffer local variable
1676 (save-excursion 1805 (save-excursion
1677 (set-buffer buffer) 1806 (set-buffer buffer)
1681 (move-marker (car (nthcdr mark-ring-max mark-ring)) nil buffer) 1810 (move-marker (car (nthcdr mark-ring-max mark-ring)) nil buffer)
1682 (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil))))) 1811 (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil)))))
1683 (set-mark (or location (point buffer)) buffer) 1812 (set-mark (or location (point buffer)) buffer)
1684 ; (set-marker (mark-marker) (or location (point)) (current-buffer)) ; FSF 1813 ; (set-marker (mark-marker) (or location (point)) (current-buffer)) ; FSF
1685 ;; Now push the mark on the global mark ring. 1814 ;; Now push the mark on the global mark ring.
1686 (if (or (null global-mark-ring) 1815 (if (and (not dont-record-current-mark)
1687 (not (eq (marker-buffer (car global-mark-ring)) buffer))) 1816 (or (null global-mark-ring)
1817 (not (eq (marker-buffer (car global-mark-ring)) buffer))))
1688 ;; The last global mark pushed wasn't in this same buffer. 1818 ;; The last global mark pushed wasn't in this same buffer.
1689 (progn 1819 (progn
1690 (setq global-mark-ring (cons (copy-marker (mark-marker t buffer)) 1820 (setq global-mark-ring (cons (copy-marker (mark-marker t buffer))
1691 global-mark-ring)) 1821 global-mark-ring))
1692 (if (> (length global-mark-ring) global-mark-ring-max) 1822 (if (> (length global-mark-ring) global-mark-ring-max)
1693 (progn 1823 (progn
1694 (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) 1824 (move-marker (car (nthcdr global-mark-ring-max global-mark-ring))
1695 nil buffer) 1825 nil buffer)
1696 (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil))))) 1826 (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil)))))
1697 (or nomsg executing-kbd-macro (> (minibuffer-depth) 0) 1827 (setq dont-record-current-mark
1828 (not (not (or (and in-shifted-motion-command
1829 (memq 'shifted-motion-commands
1830 mark-ring-unrecorded-commands))
1831 (memq this-command mark-ring-unrecorded-commands)))))
1832 (or dont-record-current-mark nomsg executing-kbd-macro
1833 (> (minibuffer-depth) 0)
1698 (display-message 'command "Mark set")) 1834 (display-message 'command "Mark set"))
1699 (if activate-region 1835 (if activate-region
1700 (progn 1836 (progn
1701 (setq zmacs-region-stays t) 1837 (setq zmacs-region-stays t)
1702 (zmacs-activate-region))) 1838 (zmacs-activate-region)))
1802 This behavior used to be the default, and is still default in FSF Emacs. 1938 This behavior used to be the default, and is still default in FSF Emacs.
1803 We think it is an unnecessary and unwanted side-effect." 1939 We think it is an unnecessary and unwanted side-effect."
1804 :type 'boolean 1940 :type 'boolean
1805 :group 'editing-basics) 1941 :group 'editing-basics)
1806 1942
1943 (defcustom shifted-motion-keys-select-region t
1944 "*If non-nil, shifted motion keys select text, like in MS Windows.
1945 See also `unshifted-motion-keys-deselect-region'."
1946 :type 'boolean
1947 :group 'editing-basics)
1948
1949 (defcustom unshifted-motion-keys-deselect-region t
1950 "*If non-nil, unshifted motion keys deselect a shifted-motion region.
1951 This only occurs after a region has been selected using shifted motion keys
1952 (not when using the traditional set-mark-then-move method), and has no effect
1953 if `shifted-motion-keys-select-region' is nil."
1954 :type 'boolean
1955 :group 'editing-basics)
1956
1957 (defun handle-pre-motion-command-current-command-is-motion ()
1958 (and (key-press-event-p last-input-event)
1959 (memq (event-key last-input-event)
1960 '(left right up down home end prior next
1961 kp-left kp-right kp-up kp-down
1962 kp-home kp-end kp-prior kp-next))))
1963
1964 (defun handle-pre-motion-command ()
1965 (if
1966 (and
1967 (handle-pre-motion-command-current-command-is-motion)
1968 zmacs-regions
1969 shifted-motion-keys-select-region
1970 (not (region-active-p))
1971 (memq 'shift (event-modifiers last-input-event)))
1972 (let ((in-shifted-motion-command t))
1973 (push-mark nil nil t))))
1974
1975 (defun handle-post-motion-command ()
1976 (if
1977 (and
1978 (handle-pre-motion-command-current-command-is-motion)
1979 zmacs-regions
1980 (region-active-p))
1981 (cond ((memq 'shift (event-modifiers last-input-event))
1982 (if shifted-motion-keys-select-region
1983 (putf this-command-properties 'shifted-motion-command t))
1984 (setq zmacs-region-stays t))
1985 ((and (getf last-command-properties 'shifted-motion-command)
1986 unshifted-motion-keys-deselect-region)
1987 (setq zmacs-region-stays nil))
1988 (t
1989 (setq zmacs-region-stays t)))))
1990
1807 (defun forward-char-command (&optional arg buffer) 1991 (defun forward-char-command (&optional arg buffer)
1808 "Move point right ARG characters (left if ARG negative) in BUFFER. 1992 "Move point right ARG characters (left if ARG negative) in BUFFER.
1809 On attempt to pass end of buffer, stop and signal `end-of-buffer'. 1993 On attempt to pass end of buffer, stop and signal `end-of-buffer'.
1810 On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'. 1994 On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'.
1811 Error signaling is suppressed if `signal-error-on-buffer-boundary' 1995 Error signaling is suppressed if `signal-error-on-buffer-boundary'
1830 (condition-case nil 2014 (condition-case nil
1831 (backward-char arg buffer) 2015 (backward-char arg buffer)
1832 (beginning-of-buffer nil) 2016 (beginning-of-buffer nil)
1833 (end-of-buffer nil)))) 2017 (end-of-buffer nil))))
1834 2018
2019 (defun scroll-up-one ()
2020 "Scroll text of current window upward one line.
2021 On attempt to scroll past end of buffer, `end-of-buffer' is signaled.
2022 On attempt to scroll past beginning of buffer, `beginning-of-buffer' is
2023 signaled.
2024
2025 If `signal-error-on-buffer-boundary' is nil, attempts to scroll past buffer
2026 boundaries do not cause an error to be signaled."
2027 (interactive "_")
2028 (scroll-up-command 1))
2029
1835 (defun scroll-up-command (&optional n) 2030 (defun scroll-up-command (&optional n)
1836 "Scroll text of current window upward ARG lines; or near full screen if no ARG. 2031 "Scroll text of current window upward ARG lines; or near full screen if no ARG.
1837 A near full screen is `next-screen-context-lines' less than a full screen. 2032 A near full screen is `next-screen-context-lines' less than a full screen.
1838 Negative ARG means scroll downward. 2033 Negative ARG means scroll downward.
1839 When calling from a program, supply a number as argument or nil. 2034 When calling from a program, supply a number as argument or nil.
1849 (condition-case nil 2044 (condition-case nil
1850 (scroll-up n) 2045 (scroll-up n)
1851 (beginning-of-buffer nil) 2046 (beginning-of-buffer nil)
1852 (end-of-buffer nil)))) 2047 (end-of-buffer nil))))
1853 2048
2049 (defun scroll-down-one ()
2050 "Scroll text of current window downward one line.
2051 On attempt to scroll past end of buffer, `end-of-buffer' is signaled.
2052 On attempt to scroll past beginning of buffer, `beginning-of-buffer' is
2053 signaled.
2054
2055 If `signal-error-on-buffer-boundary' is nil, attempts to scroll past buffer
2056 boundaries do not cause an error to be signaled."
2057 (interactive "_")
2058 (scroll-down-command 1))
2059
1854 (defun scroll-down-command (&optional n) 2060 (defun scroll-down-command (&optional n)
1855 "Scroll text of current window downward ARG lines; or near full screen if no ARG. 2061 "Scroll text of current window downward ARG lines; or near full screen if no ARG.
1856 A near full screen is `next-screen-context-lines' less than a full screen. 2062 A near full screen is `next-screen-context-lines' less than a full screen.
1857 Negative ARG means scroll upward. 2063 Negative ARG means scroll upward.
1858 When calling from a program, supply a number as argument or nil. 2064 When calling from a program, supply a number as argument or nil.
1887 in `goal-column', which is nil when there is none. 2093 in `goal-column', which is nil when there is none.
1888 2094
1889 If you are thinking of using this in a Lisp program, consider 2095 If you are thinking of using this in a Lisp program, consider
1890 using `forward-line' instead. It is usually easier to use 2096 using `forward-line' instead. It is usually easier to use
1891 and more reliable (no dependence on goal column, etc.)." 2097 and more reliable (no dependence on goal column, etc.)."
1892 (interactive "_p") ; XEmacs 2098 (interactive "_p")
1893 (if (and next-line-add-newlines (= arg 1)) 2099 (if (and next-line-add-newlines (= arg 1))
1894 (let ((opoint (point))) 2100 (let ((opoint (point)))
1895 (end-of-line) 2101 (end-of-line)
1896 (if (eobp) 2102 (if (eobp)
1897 (newline 1) 2103 (newline 1)
1918 Then it does not try to move vertically. 2124 Then it does not try to move vertically.
1919 2125
1920 If you are thinking of using this in a Lisp program, consider using 2126 If you are thinking of using this in a Lisp program, consider using
1921 `forward-line' with a negative argument instead. It is usually easier 2127 `forward-line' with a negative argument instead. It is usually easier
1922 to use and more reliable (no dependence on goal column, etc.)." 2128 to use and more reliable (no dependence on goal column, etc.)."
1923 (interactive "_p") ; XEmacs 2129 (interactive "_p")
1924 (if (interactive-p) 2130 (if (interactive-p)
1925 (condition-case nil 2131 (condition-case nil
1926 (line-move (- arg)) 2132 (line-move (- arg))
1927 ((beginning-of-buffer end-of-buffer) 2133 ((beginning-of-buffer end-of-buffer)
1928 (when signal-error-on-buffer-boundary ; XEmacs 2134 (when signal-error-on-buffer-boundary ; XEmacs
1929 (ding nil 'buffer-bound)))) 2135 (ding nil 'buffer-bound))))
1930 (line-move (- arg))) 2136 (line-move (- arg)))
1931 nil) 2137 nil)
2138
2139 (defcustom block-movement-size 6
2140 "*Number of lines that \"block movement\" commands (\\[forward-block-of-lines], \\[backward-block-of-lines]) move by."
2141 :type 'integer
2142 :group 'editing-basics)
2143
2144 (defun backward-block-of-lines ()
2145 "Move backward by one \"block\" of lines.
2146 The number of lines that make up a block is controlled by
2147 `block-movement-size', which defaults to 6."
2148 (interactive "_")
2149 (forward-line (- block-movement-size)))
2150
2151 (defun forward-block-of-lines ()
2152 "Move forward by one \"block\" of lines.
2153 The number of lines that make up a block is controlled by
2154 `block-movement-size', which defaults to 6."
2155 (interactive "_")
2156 (forward-line block-movement-size))
1932 2157
1933 (defcustom track-eol nil 2158 (defcustom track-eol nil
1934 "*Non-nil means vertical motion starting at end of line keeps to ends of lines. 2159 "*Non-nil means vertical motion starting at end of line keeps to ends of lines.
1935 This means moving to the end of each line moved onto. 2160 This means moving to the end of each line moved onto.
1936 The beginning of a blank line does not count as the end of a line." 2161 The beginning of a blank line does not count as the end of a line."
2166 (newline) 2391 (newline)
2167 (forward-char 1))) 2392 (forward-char 1)))
2168 (forward-line arg))) 2393 (forward-line arg)))
2169 arg)) 2394 arg))
2170 2395
2171 (eval-when-compile 2396 (defun transpose-line-up (arg)
2172 ;; avoid byte-compiler warnings... 2397 "Move current line one line up, leaving point at beginning of that line.
2173 (defvar start1) 2398 This can be run repeatedly to move to current line up a number of lines."
2174 (defvar start2) 2399 (interactive "*p")
2175 (defvar end1) 2400 ;; Move forward over a line,
2176 (defvar end2)) 2401 ;; but create a newline if none exists yet.
2177 2402 (end-of-line)
2178 ; start[12] and end[12] used in transpose-subr-1 below 2403 (if (eobp)
2404 (newline)
2405 (forward-char 1))
2406 (transpose-lines (- arg))
2407 (forward-line -1))
2408
2409 (defun transpose-line-down (arg)
2410 "Move current line one line down, leaving point at beginning of that line.
2411 This can be run repeatedly to move to current line down a number of lines."
2412 (interactive "*p")
2413 ;; Move forward over a line,
2414 ;; but create a newline if none exists yet.
2415 (end-of-line)
2416 (if (eobp)
2417 (newline)
2418 (forward-char 1))
2419 (transpose-lines arg)
2420 (forward-line -1))
2421
2179 (defun transpose-subr (mover arg) 2422 (defun transpose-subr (mover arg)
2180 (let (start1 end1 start2 end2) 2423 (let (start1 end1 start2 end2)
2181 (if (= arg 0) 2424 ;; XEmacs -- use flet instead of defining a separate function and
2182 (progn 2425 ;; relying on dynamic scope!!!
2183 (save-excursion 2426 (flet ((transpose-subr-1 ()
2184 (funcall mover 1) 2427 (if (> (min end1 end2) (max start1 start2))
2185 (setq end2 (point)) 2428 (error "Don't have two things to transpose"))
2186 (funcall mover -1) 2429 (let ((word1 (buffer-substring start1 end1))
2187 (setq start2 (point)) 2430 (word2 (buffer-substring start2 end2)))
2188 (goto-char (mark t)) ; XEmacs 2431 (delete-region start2 end2)
2189 (funcall mover 1) 2432 (goto-char start2)
2190 (setq end1 (point)) 2433 (insert word1)
2191 (funcall mover -1) 2434 (goto-char (if (< start1 start2) start1
2192 (setq start1 (point)) 2435 (+ start1 (- (length word1) (length word2)))))
2193 (transpose-subr-1)) 2436 (delete-char (length word1))
2194 (exchange-point-and-mark t))) ; XEmacs 2437 (insert word2))))
2195 (while (> arg 0) 2438 (if (= arg 0)
2196 (funcall mover -1) 2439 (progn
2197 (setq start1 (point)) 2440 (save-excursion
2198 (funcall mover 1) 2441 (funcall mover 1)
2199 (setq end1 (point)) 2442 (setq end2 (point))
2200 (funcall mover 1) 2443 (funcall mover -1)
2201 (setq end2 (point)) 2444 (setq start2 (point))
2202 (funcall mover -1) 2445 (goto-char (mark t)) ; XEmacs
2203 (setq start2 (point)) 2446 (funcall mover 1)
2204 (transpose-subr-1) 2447 (setq end1 (point))
2205 (goto-char end2) 2448 (funcall mover -1)
2206 (setq arg (1- arg))) 2449 (setq start1 (point))
2207 (while (< arg 0) 2450 (transpose-subr-1))
2208 (funcall mover -1) 2451 (exchange-point-and-mark t))) ; XEmacs
2209 (setq start2 (point)) 2452 (while (> arg 0)
2210 (funcall mover -1) 2453 (funcall mover -1)
2211 (setq start1 (point)) 2454 (setq start1 (point))
2212 (funcall mover 1) 2455 (funcall mover 1)
2213 (setq end1 (point)) 2456 (setq end1 (point))
2214 (funcall mover 1) 2457 (funcall mover 1)
2215 (setq end2 (point)) 2458 (setq end2 (point))
2216 (transpose-subr-1) 2459 (funcall mover -1)
2217 (setq arg (1+ arg))))) 2460 (setq start2 (point))
2218 2461 (transpose-subr-1)
2219 ; start[12] and end[12] used free 2462 (goto-char end2)
2220 (defun transpose-subr-1 () 2463 (setq arg (1- arg)))
2221 (if (> (min end1 end2) (max start1 start2)) 2464 (while (< arg 0)
2222 (error "Don't have two things to transpose")) 2465 (funcall mover -1)
2223 (let ((word1 (buffer-substring start1 end1)) 2466 (setq start2 (point))
2224 (word2 (buffer-substring start2 end2))) 2467 (funcall mover -1)
2225 (delete-region start2 end2) 2468 (setq start1 (point))
2226 (goto-char start2) 2469 (funcall mover 1)
2227 (insert word1) 2470 (setq end1 (point))
2228 (goto-char (if (< start1 start2) start1 2471 (funcall mover 1)
2229 (+ start1 (- (length word1) (length word2))))) 2472 (setq end2 (point))
2230 (delete-char (length word1)) 2473 (transpose-subr-1)
2231 (insert word2))) 2474 (setq arg (1+ arg))))))
2475
2232 2476
2233 (defcustom comment-column 32 2477 (defcustom comment-column 32
2234 "*Column to indent right-margin comments to. 2478 "*Column to indent right-margin comments to.
2235 Setting this variable automatically makes it local to the current buffer. 2479 Setting this variable automatically makes it local to the current buffer.
2236 Each mode establishes a different default value for this variable; you 2480 Each mode establishes a different default value for this variable; you
3146 (display-message 'no-log "Unmatched parenthesis")))))))) 3390 (display-message 'no-log "Unmatched parenthesis"))))))))
3147 3391
3148 ;Turned off because it makes dbx bomb out. 3392 ;Turned off because it makes dbx bomb out.
3149 (setq blink-paren-function 'blink-matching-open) 3393 (setq blink-paren-function 'blink-matching-open)
3150 3394
3151 (eval-when-compile (defvar myhelp)) ; suppress compiler warning
3152 3395
3153 ;; XEmacs: Some functions moved to cmdloop.el: 3396 ;; XEmacs: Some functions moved to cmdloop.el:
3154 ;; keyboard-quit 3397 ;; keyboard-quit
3155 ;; buffer-quit-function 3398 ;; buffer-quit-function
3156 ;; keyboard-escape-quit 3399 ;; keyboard-escape-quit
3164 (setq element (car alist))) 3407 (setq element (car alist)))
3165 (setq alist (cdr alist))) 3408 (setq alist (cdr alist)))
3166 element)) 3409 element))
3167 3410
3168 3411
3412 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3413 ;; mail composition code ;;
3414 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3415
3169 (defcustom mail-user-agent 'sendmail-user-agent 3416 (defcustom mail-user-agent 'sendmail-user-agent
3170 "*Your preference for a mail composition package. 3417 "*Your preference for a mail composition package.
3171 Various Emacs Lisp packages (e.g. reporter) require you to compose an 3418 Various Emacs Lisp packages (e.g. reporter) require you to compose an
3172 outgoing email message. This variable lets you specify which 3419 outgoing email message. This variable lets you specify which
3173 mail-sending package you prefer. 3420 mail-sending package you prefer.
3309 (list nil nil nil current-prefix-arg)) 3556 (list nil nil nil current-prefix-arg))
3310 (compose-mail to subject other-headers continue 3557 (compose-mail to subject other-headers continue
3311 'switch-to-buffer-other-frame yank-action send-actions)) 3558 'switch-to-buffer-other-frame yank-action send-actions))
3312 3559
3313 3560
3561 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3562 ;; set variable ;;
3563 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3564
3314 (defun set-variable (var val) 3565 (defun set-variable (var val)
3315 "Set VARIABLE to VALUE. VALUE is a Lisp object. 3566 "Set VARIABLE to VALUE. VALUE is a Lisp object.
3316 When using this interactively, supply a Lisp expression for VALUE. 3567 When using this interactively, supply a Lisp expression for VALUE.
3317 If you want VALUE to be a string, you must surround it with doublequotes. 3568 If you want VALUE to be a string, you must surround it with doublequotes.
3318 If VARIABLE is a specifier, VALUE is added to it as an instantiator in 3569 If VARIABLE is a specifier, VALUE is added to it as an instantiator in
3322 it were the arg to `interactive' (which see) to interactively read the value." 3573 it were the arg to `interactive' (which see) to interactively read the value."
3323 (interactive 3574 (interactive
3324 (let* ((var (read-variable "Set variable: ")) 3575 (let* ((var (read-variable "Set variable: "))
3325 ;; #### - yucky code replication here. This should use something 3576 ;; #### - yucky code replication here. This should use something
3326 ;; from help.el or hyper-apropos.el 3577 ;; from help.el or hyper-apropos.el
3327 (minibuffer-help-form
3328 '(funcall myhelp))
3329 (myhelp 3578 (myhelp
3330 #'(lambda () 3579 #'(lambda ()
3331 (with-output-to-temp-buffer "*Help*" 3580 (with-output-to-temp-buffer "*Help*"
3332 (prin1 var) 3581 (prin1 var)
3333 (princ "\nDocumentation:\n") 3582 (princ "\nDocumentation:\n")
3338 (princ "\n\nCurrent value: ") 3587 (princ "\n\nCurrent value: ")
3339 (prin1 (symbol-value var)))) 3588 (prin1 (symbol-value var))))
3340 (save-excursion 3589 (save-excursion
3341 (set-buffer standard-output) 3590 (set-buffer standard-output)
3342 (help-mode)) 3591 (help-mode))
3343 nil)))) 3592 nil)))
3593 (minibuffer-help-form
3594 '(funcall myhelp)))
3344 (list var 3595 (list var
3345 (let ((prop (get var 'variable-interactive))) 3596 (let ((prop (get var 'variable-interactive)))
3346 (if prop 3597 (if prop
3347 ;; Use VAR's `variable-interactive' property 3598 ;; Use VAR's `variable-interactive' property
3348 ;; as an interactive spec for prompting. 3599 ;; as an interactive spec for prompting.
3351 'arg)) 3602 'arg))
3352 (eval-minibuffer (format "Set %s to value: " var))))))) 3603 (eval-minibuffer (format "Set %s to value: " var)))))))
3353 (if (and (boundp var) (specifierp (symbol-value var))) 3604 (if (and (boundp var) (specifierp (symbol-value var)))
3354 (set-specifier (symbol-value var) val) 3605 (set-specifier (symbol-value var) val)
3355 (set var val))) 3606 (set var val)))
3607
3356 3608
3357 ;; XEmacs 3609 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3358 (defun activate-region () 3610 ;; case changing code ;;
3359 "Activate the region, if `zmacs-regions' is true. 3611 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3360 Setting `zmacs-regions' to true causes LISPM-style active regions to be used.
3361 This function has no effect if `zmacs-regions' is false."
3362 (interactive)
3363 (and zmacs-regions (zmacs-activate-region)))
3364
3365 ;; XEmacs
3366 (defsubst region-exists-p ()
3367 "Return t if the region exists.
3368 If active regions are in use (i.e. `zmacs-regions' is true), this means that
3369 the region is active. Otherwise, this means that the user has pushed
3370 a mark in this buffer at some point in the past.
3371 The functions `region-beginning' and `region-end' can be used to find the
3372 limits of the region."
3373 (not (null (mark))))
3374
3375 ;; XEmacs
3376 (defun region-active-p ()
3377 "Return non-nil if the region is active.
3378 If `zmacs-regions' is true, this is equivalent to `region-exists-p'.
3379 Otherwise, this function always returns false."
3380 (and zmacs-regions zmacs-region-extent))
3381 3612
3382 ;; A bunch of stuff was moved elsewhere: 3613 ;; A bunch of stuff was moved elsewhere:
3383 ;; completion-list-mode-map 3614 ;; completion-list-mode-map
3384 ;; completion-reference-buffer 3615 ;; completion-reference-buffer
3385 ;; completion-base-size 3616 ;; completion-base-size
3416 (interactive "p") 3647 (interactive "p")
3417 (if (region-active-p) 3648 (if (region-active-p)
3418 (downcase-region (region-beginning) (region-end)) 3649 (downcase-region (region-beginning) (region-end))
3419 (downcase-word arg))) 3650 (downcase-word arg)))
3420 3651
3652 ;; #### not localized
3653 (defvar uncapitalized-title-words
3654 '("the" "a" "an" "in" "of" "for" "to" "and" "but" "at" "on" "as" "by"))
3655
3656 (defvar uncapitalized-title-word-regexp
3657 (concat "[ \t]*\\(" (mapconcat #'identity uncapitalized-title-words "\\|")
3658 "\\)\\>"))
3659
3660 (defun capitalize-string-as-title (string)
3661 "Capitalize the words in the string, except for small words (as in titles).
3662 The words not capitalized are specified in `uncapitalized-title-words'."
3663 (let ((buffer (get-buffer-create " *capitalize-string-as-title*")))
3664 (unwind-protect
3665 (progn
3666 (insert-string string buffer)
3667 (capitalize-region-as-title 1 (point-max buffer) buffer)
3668 (buffer-string buffer))
3669 (kill-buffer buffer))))
3670
3671 (defun capitalize-region-as-title (b e &optional buffer)
3672 "Capitalize the words in the region, except for small words (as in titles).
3673 The words not capitalized are specified in `uncapitalized-title-words'."
3674 (interactive "r")
3675 (save-excursion
3676 (and buffer
3677 (set-buffer buffer))
3678 (save-restriction
3679 (narrow-to-region b e)
3680 (goto-char (point-min))
3681 (let ((first t))
3682 (while (< (point) (point-max))
3683 (if (or first
3684 (not (looking-at uncapitalized-title-word-regexp)))
3685 (capitalize-word 1)
3686 (forward-word 1))
3687 (setq first nil))))))
3688
3689
3690 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3691 ;; zmacs active region code ;;
3692 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3693
3421 ;; Most of the zmacs code is now in elisp. The only thing left in C 3694 ;; Most of the zmacs code is now in elisp. The only thing left in C
3422 ;; are the variables zmacs-regions, zmacs-region-active-p and 3695 ;; are the variables zmacs-regions, zmacs-region-active-p and
3423 ;; zmacs-region-stays plus the function zmacs_update_region which 3696 ;; zmacs-region-stays plus the function zmacs_update_region which
3424 ;; simply calls the lisp level zmacs-update-region. It must remain 3697 ;; simply calls the lisp level zmacs-update-region. It must remain
3425 ;; for convenience, since it is called by core C code. 3698 ;; for convenience, since it is called by core C code.
3699
3700 ;; XEmacs
3701 (defun activate-region ()
3702 "Activate the region, if `zmacs-regions' is true.
3703 Setting `zmacs-regions' to true causes LISPM-style active regions to be used.
3704 This function has no effect if `zmacs-regions' is false."
3705 (interactive)
3706 (and zmacs-regions (zmacs-activate-region)))
3707
3708 ;; XEmacs
3709 (defsubst region-exists-p ()
3710 "Return t if the region exists.
3711 If active regions are in use (i.e. `zmacs-regions' is true), this means that
3712 the region is active. Otherwise, this means that the user has pushed
3713 a mark in this buffer at some point in the past.
3714 The functions `region-beginning' and `region-end' can be used to find the
3715 limits of the region."
3716 (not (null (mark))))
3717
3718 ;; XEmacs
3719 (defun region-active-p ()
3720 "Return non-nil if the region is active.
3721 If `zmacs-regions' is true, this is equivalent to `region-exists-p'.
3722 Otherwise, this function always returns false."
3723 (and zmacs-regions zmacs-region-extent))
3426 3724
3427 (defvar zmacs-activate-region-hook nil 3725 (defvar zmacs-activate-region-hook nil
3428 "Function or functions called when the region becomes active; 3726 "Function or functions called when the region becomes active;
3429 see the variable `zmacs-regions'.") 3727 see the variable `zmacs-regions'.")
3430 3728
3562 (when (marker-buffer (mark-marker t)) 3860 (when (marker-buffer (mark-marker t))
3563 (zmacs-make-extent-for-region (cons (point-marker t) 3861 (zmacs-make-extent-for-region (cons (point-marker t)
3564 (mark-marker t)))) 3862 (mark-marker t))))
3565 (run-hooks 'zmacs-update-region-hook))) 3863 (run-hooks 'zmacs-update-region-hook)))
3566 3864
3567 ;;;;;; 3865
3568 ;;;;;; echo area stuff 3866 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3569 ;;;;;; 3867 ;; message logging code ;;
3868 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3570 3869
3571 ;;; #### Should this be moved to a separate file, for clarity? 3870 ;;; #### Should this be moved to a separate file, for clarity?
3572 ;;; -hniksic 3871 ;;; -hniksic
3573 3872
3574 ;;; The `message-stack' is an alist of labels with messages; the first 3873 ;;; The `message-stack' is an alist of labels with messages; the first
3885 (clear-message label nil)) 4184 (clear-message label nil))
3886 (let ((str (apply 'format fmt args))) 4185 (let ((str (apply 'format fmt args)))
3887 (display-message label str) 4186 (display-message label str)
3888 str))) 4187 str)))
3889 4188
3890 4189
3891 ;;;;;; 4190 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3892 ;;;;;; warning stuff 4191 ;; warning code ;;
3893 ;;;;;; 4192 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3894 4193
3895 (defcustom log-warning-minimum-level 'info 4194 (defcustom log-warning-minimum-level 'info
3896 "Minimum level of warnings that should be logged. 4195 "Minimum level of warnings that should be logged.
3897 The warnings in levels below this are completely ignored, as if they never 4196 The warnings in levels below this are completely ignored, as if they never
3898 happened. 4197 happened.
4076 (when (or (not warning-marker) 4375 (when (or (not warning-marker)
4077 (not (eq (marker-buffer warning-marker) buffer))) 4376 (not (eq (marker-buffer warning-marker) buffer)))
4078 (setq warning-marker (make-marker)) 4377 (setq warning-marker (make-marker))
4079 (set-marker warning-marker 1 buffer)) 4378 (set-marker warning-marker 1 buffer))
4080 (if temp-buffer-show-function 4379 (if temp-buffer-show-function
4081 (let ((show-buffer (get-buffer-create "*Warnings-Show*"))) 4380 (progn
4082 (save-excursion 4381 (funcall temp-buffer-show-function buffer)
4083 (set-buffer show-buffer) 4382 (mapc #'(lambda (win) (set-window-start win warning-marker))
4084 (setq buffer-read-only nil) 4383 (windows-of-buffer buffer nil t)))
4085 (erase-buffer))
4086 (save-excursion
4087 (set-buffer buffer)
4088 (copy-to-buffer show-buffer
4089 (marker-position warning-marker)
4090 (point-max)))
4091 (funcall temp-buffer-show-function show-buffer))
4092 (set-window-start (display-buffer buffer) warning-marker)) 4384 (set-window-start (display-buffer buffer) warning-marker))
4093 (set-marker warning-marker (point-max buffer) buffer))) 4385 (set-marker warning-marker (point-max buffer) buffer)))
4386
4387
4388 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4389 ;; misc junk ;;
4390 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4094 4391
4095 (defun emacs-name () 4392 (defun emacs-name ()
4096 "Return the printable name of this instance of Emacs." 4393 "Return the printable name of this instance of Emacs."
4097 (cond ((featurep 'infodock) "InfoDock") 4394 (cond ((featurep 'infodock) "InfoDock")
4098 ((featurep 'xemacs) "XEmacs") 4395 ((featurep 'xemacs) "XEmacs")
4099 (t "Emacs"))) 4396 (t "Emacs")))
4100 4397
4398 (defun debug-print (format &rest args)
4399 "Send a string to the debugging output.
4400 The string is formatted using (apply #'format FORMAT ARGS)."
4401 (princ (apply #'format format args) 'external-debugging-output))
4402
4101 ;;; simple.el ends here 4403 ;;; simple.el ends here