Mercurial > hg > xemacs-beta
comparison lisp/simple.el @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children | 41dbb7a9d5f2 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
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. | |
6 | 5 |
7 ;; Maintainer: XEmacs Development Team | 6 ;; Maintainer: XEmacs Development Team |
8 ;; Keywords: lisp, extensions, internal, dumped | 7 ;; Keywords: lisp, extensions, internal, dumped |
9 | 8 |
10 ;; This file is part of XEmacs. | 9 ;; This file is part of XEmacs. |
61 ;; 97/3/14 Jareth Hein (jhod@po.iijnet.or.jp) added kinsoku processing (support | 60 ;; 97/3/14 Jareth Hein (jhod@po.iijnet.or.jp) added kinsoku processing (support |
62 ;; for filling of Asian text) into the fill code. This was ripped bleeding from | 61 ;; for filling of Asian text) into the fill code. This was ripped bleeding from |
63 ;; Mule-2.3, and could probably use some feature additions (like additional wrap | 62 ;; Mule-2.3, and could probably use some feature additions (like additional wrap |
64 ;; styles, etc) | 63 ;; styles, etc) |
65 | 64 |
66 ;; 97/06/11 Steve Baur (steve@xemacs.org) Convert use of | 65 ;; 97/06/11 Steve Baur (steve@altair.xemacs.org) Convert use of |
67 ;; (preceding|following)-char to char-(after|before). | 66 ;; (preceding|following)-char to char-(after|before). |
68 | 67 |
69 ;;; Code: | 68 ;;; Code: |
70 | 69 |
71 (defgroup editing-basics nil | 70 (defgroup editing-basics nil |
669 (message "Buffer has %d lines, %d characters" | 668 (message "Buffer has %d lines, %d characters" |
670 cnt (- (point-max) (point-min))) | 669 cnt (- (point-max) (point-min))) |
671 cnt))) | 670 cnt))) |
672 | 671 |
673 ;;; Modified by Bob Weiner, 8/24/95, to print narrowed line number also. | 672 ;;; Modified by Bob Weiner, 8/24/95, to print narrowed line number also. |
674 ;;; Expanded by Bob Weiner, BeOpen, on 02/12/1997 | 673 ;;; Expanded by Bob Weiner, Altrasoft, on 02/12/1997 |
675 (defun what-line () | 674 (defun what-line () |
676 "Print the following variants of the line number of point: | 675 "Print the following variants of the line number of point: |
677 Region line - displayed line within the active region | 676 Region line - displayed line within the active region |
678 Collapsed line - includes only selectively displayed lines; | 677 Collapsed line - includes only selectively displayed lines; |
679 Buffer line - physical line in the buffer; | 678 Buffer line - physical line in the buffer; |
717 (t | 716 (t |
718 ;; give a basic line count | 717 ;; give a basic line count |
719 (message "Line %d" buffer-line))))))) | 718 (message "Line %d" buffer-line))))))) |
720 (setq zmacs-region-stays t)) | 719 (setq zmacs-region-stays t)) |
721 | 720 |
722 ;; new in XEmacs 21.2 (not in FSF). | 721 ;;; Bob Weiner, Altrasoft, 02/12/1998 |
723 (defun line-number (&optional pos respect-narrowing) | 722 ;;; Added the 3rd arg in `count-lines' to conditionalize the counting of |
724 "Return the line number of POS (defaults to point). | 723 ;;; collapsed lines. |
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 | |
734 (defun count-lines (start end &optional ignore-invisible-lines-flag) | 724 (defun count-lines (start end &optional ignore-invisible-lines-flag) |
735 "Return number of lines between START and END. | 725 "Return number of lines between START and END. |
736 This is usually the number of newlines between them, | 726 This is usually the number of newlines between them, |
737 but can be one more if START is not equal to END | 727 but can be one more if START is not equal to END |
738 and the greater of them is not at the start of a line. | 728 and the greater of them is not at the start of a line. |
739 | 729 |
740 With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, lines collapsed with | 730 With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, lines collapsed with |
741 selective-display are excluded from the line count. | 731 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'." | |
748 (save-excursion | 732 (save-excursion |
749 (save-restriction | 733 (save-restriction |
750 (narrow-to-region start end) | 734 (narrow-to-region start end) |
751 (goto-char (point-min)) | 735 (goto-char (point-min)) |
752 (if (and (not ignore-invisible-lines-flag) (eq selective-display t)) | 736 (if (and (not ignore-invisible-lines-flag) (eq selective-display t)) |
1101 (interactive "_p") | 1085 (interactive "_p") |
1102 (forward-line (- arg)) | 1086 (forward-line (- arg)) |
1103 (skip-chars-forward " \t")) | 1087 (skip-chars-forward " \t")) |
1104 | 1088 |
1105 (defcustom kill-whole-line nil | 1089 (defcustom kill-whole-line nil |
1106 "*Control when and whether `kill-line' removes entire lines. | 1090 "*If non-nil, `kill-line' with no arg at beg of line kills the whole line." |
1107 Note: This only applies when `kill-line' is called interactively; | 1091 :type 'boolean |
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)) | |
1122 :group 'killing) | 1092 :group 'killing) |
1123 | 1093 |
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 | |
1132 (defun kill-line (&optional arg) | 1094 (defun kill-line (&optional arg) |
1133 "Kill the rest of the current line, or the entire line. | 1095 "Kill the rest of the current line; if no nonblanks there, kill thru newline. |
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. | |
1137 With prefix argument, kill that many lines from point. | 1096 With prefix argument, kill that many lines from point. |
1138 Negative arguments kill lines backward. | 1097 Negative arguments kill lines backward. |
1139 | 1098 |
1140 When calling from a program, nil means \"no arg\", | 1099 When calling from a program, nil means \"no arg\", |
1141 a number counts as a prefix arg." | 1100 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." | |
1142 (interactive "*P") | 1104 (interactive "*P") |
1143 (kill-region (if (and (interactive-p) | 1105 (kill-region (point) |
1144 (not arg) | |
1145 (eq kill-whole-line 'always)) | |
1146 (save-excursion | |
1147 (beginning-of-line) | |
1148 (point)) | |
1149 (point)) | |
1150 ;; Don't shift point before doing the delete; that way, | 1106 ;; Don't shift point before doing the delete; that way, |
1151 ;; undo will record the right position of point. | 1107 ;; undo will record the right position of point. |
1152 ;; FSF | 1108 ;; FSF |
1153 ; ;; It is better to move point to the other end of the kill | 1109 ; ;; It is better to move point to the other end of the kill |
1154 ; ;; before killing. That way, in a read-only buffer, point | 1110 ; ;; before killing. That way, in a read-only buffer, point |
1159 (save-excursion | 1115 (save-excursion |
1160 (if arg | 1116 (if arg |
1161 (forward-line (prefix-numeric-value arg)) | 1117 (forward-line (prefix-numeric-value arg)) |
1162 (if (eobp) | 1118 (if (eobp) |
1163 (signal 'end-of-buffer nil)) | 1119 (signal 'end-of-buffer nil)) |
1164 (if (or (looking-at "[ \t]*$") | 1120 (if (or (looking-at "[ \t]*$") (and kill-whole-line (bolp))) |
1165 (and (interactive-p) | |
1166 (or (eq kill-whole-line 'always) | |
1167 (and kill-whole-line (bolp))))) | |
1168 (forward-line 1) | 1121 (forward-line 1) |
1169 (end-of-line))) | 1122 (end-of-line))) |
1170 (point)))) | 1123 (point)))) |
1171 | 1124 |
1172 ;; XEmacs | 1125 ;; XEmacs |
1199 ;;; `kill-hooks' seems not sufficient because | 1152 ;;; `kill-hooks' seems not sufficient because |
1200 ;;; `interprogram-cut-function' requires more variable about to rotate | 1153 ;;; `interprogram-cut-function' requires more variable about to rotate |
1201 ;;; the cut buffers. I'm afraid to change interface of `kill-hooks', | 1154 ;;; the cut buffers. I'm afraid to change interface of `kill-hooks', |
1202 ;;; so I add it. (1997-11-03 by MORIOKA Tomohiko) | 1155 ;;; so I add it. (1997-11-03 by MORIOKA Tomohiko) |
1203 | 1156 |
1204 (defcustom interprogram-cut-function 'own-clipboard | 1157 (defvar interprogram-cut-function nil |
1205 "Function to call to make a killed region available to other programs. | 1158 "Function to call to make a killed region available to other programs. |
1206 | 1159 |
1207 Most window systems provide some sort of facility for cutting and | 1160 Most window systems provide some sort of facility for cutting and |
1208 pasting text between the windows of different programs. | 1161 pasting text between the windows of different programs. |
1209 This variable holds a function that Emacs calls whenever text | 1162 This variable holds a function that Emacs calls whenever text |
1212 | 1165 |
1213 The function takes one or two arguments. | 1166 The function takes one or two arguments. |
1214 The first argument, TEXT, is a string containing | 1167 The first argument, TEXT, is a string containing |
1215 the text which should be made available. | 1168 the text which should be made available. |
1216 The second, PUSH, if non-nil means this is a \"new\" kill; | 1169 The second, PUSH, if non-nil means this is a \"new\" kill; |
1217 nil means appending to an \"old\" kill." | 1170 nil means appending to an \"old\" kill.") |
1218 :type '(radio (function-item :tag "Send to Clipboard" | 1171 |
1219 :format "%t\n" | 1172 (defvar interprogram-paste-function nil |
1220 own-clipboard) | |
1221 (const :tag "None" nil) | |
1222 (function :tag "Other")) | |
1223 :group 'killing) | |
1224 | |
1225 (defcustom interprogram-paste-function 'get-clipboard | |
1226 "Function to call to get text cut from other programs. | 1173 "Function to call to get text cut from other programs. |
1227 | 1174 |
1228 Most window systems provide some sort of facility for cutting and | 1175 Most window systems provide some sort of facility for cutting and |
1229 pasting text between the windows of different programs. | 1176 pasting text between the windows of different programs. |
1230 This variable holds a function that Emacs calls to obtain | 1177 This variable holds a function that Emacs calls to obtain |
1238 Note that the function should return a string only if a program other | 1185 Note that the function should return a string only if a program other |
1239 than Emacs has provided a string for pasting; if Emacs provided the | 1186 than Emacs has provided a string for pasting; if Emacs provided the |
1240 most recent string, the function should return nil. If it is | 1187 most recent string, the function should return nil. If it is |
1241 difficult to tell whether Emacs or some other program provided the | 1188 difficult to tell whether Emacs or some other program provided the |
1242 current string, it is probably good enough to return nil if the string | 1189 current string, it is probably good enough to return nil if the string |
1243 is equal (according to `string=') to the last text Emacs provided." | 1190 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) | |
1250 | 1191 |
1251 | 1192 |
1252 ;;;; The kill ring data structure. | 1193 ;;;; The kill ring data structure. |
1253 | 1194 |
1254 (defvar kill-ring nil | 1195 (defvar kill-ring nil |
1680 ; (setq mark-active nil) | 1621 ; (setq mark-active nil) |
1681 ; (run-hooks 'deactivate-mark-hook) | 1622 ; (run-hooks 'deactivate-mark-hook) |
1682 ; (set-marker (mark-marker) nil))) | 1623 ; (set-marker (mark-marker) nil))) |
1683 | 1624 |
1684 (defvar mark-ring nil | 1625 (defvar mark-ring nil |
1685 "The list of former marks of the current buffer, most recent first. | 1626 "The list of former marks of the current buffer, most recent first.") |
1686 This variable is automatically buffer-local.") | |
1687 (make-variable-buffer-local 'mark-ring) | 1627 (make-variable-buffer-local 'mark-ring) |
1688 (put 'mark-ring 'permanent-local t) | 1628 (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) | |
1749 | 1629 |
1750 (defcustom mark-ring-max 16 | 1630 (defcustom mark-ring-max 16 |
1751 "*Maximum size of mark ring. Start discarding off end if gets this big." | 1631 "*Maximum size of mark ring. Start discarding off end if gets this big." |
1752 :type 'integer | 1632 :type 'integer |
1753 :group 'killing) | 1633 :group 'killing) |
1765 "Set mark at where point is, or jump to mark. | 1645 "Set mark at where point is, or jump to mark. |
1766 With no prefix argument, set mark, push old mark position on local mark | 1646 With no prefix argument, set mark, push old mark position on local mark |
1767 ring, and push mark on global mark ring. | 1647 ring, and push mark on global mark ring. |
1768 With argument, jump to mark, and pop a new position for mark off the ring | 1648 With argument, jump to mark, and pop a new position for mark off the ring |
1769 \(does not affect global mark ring\). | 1649 \(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. | |
1778 | 1650 |
1779 Novice Emacs Lisp programmers often try to use the mark for the wrong | 1651 Novice Emacs Lisp programmers often try to use the mark for the wrong |
1780 purposes. See the documentation of `set-mark' for more information." | 1652 purposes. See the documentation of `set-mark' for more information." |
1781 (interactive "P") | 1653 (interactive "P") |
1782 (if (null arg) | 1654 (if (null arg) |
1783 (push-mark nil nil t) | 1655 (push-mark nil nil t) |
1784 (if (null (mark t)) | 1656 (if (null (mark t)) |
1785 (error "No mark set in this buffer") | 1657 (error "No mark set in this buffer") |
1786 (if dont-record-current-mark (pop-mark)) | |
1787 (goto-char (mark t)) | 1658 (goto-char (mark t)) |
1788 (pop-mark)))) | 1659 (pop-mark)))) |
1789 | 1660 |
1790 ;; XEmacs: Extra parameter | 1661 ;; XEmacs: Extra parameter |
1791 (defun push-mark (&optional location nomsg activate-region buffer) | 1662 (defun push-mark (&optional location nomsg activate-region buffer) |
1796 Activate mark if optional third arg ACTIVATE-REGION non-nil. | 1667 Activate mark if optional third arg ACTIVATE-REGION non-nil. |
1797 | 1668 |
1798 Novice Emacs Lisp programmers often try to use the mark for the wrong | 1669 Novice Emacs Lisp programmers often try to use the mark for the wrong |
1799 purposes. See the documentation of `set-mark' for more information." | 1670 purposes. See the documentation of `set-mark' for more information." |
1800 (setq buffer (decode-buffer buffer)) ; XEmacs | 1671 (setq buffer (decode-buffer buffer)) ; XEmacs |
1801 (if (or dont-record-current-mark (null (mark t buffer))) ; XEmacs | 1672 (if (null (mark t buffer)) ; XEmacs |
1802 nil | 1673 nil |
1803 ;; The save-excursion / set-buffer is necessary because mark-ring | 1674 ;; The save-excursion / set-buffer is necessary because mark-ring |
1804 ;; is a buffer local variable | 1675 ;; is a buffer local variable |
1805 (save-excursion | 1676 (save-excursion |
1806 (set-buffer buffer) | 1677 (set-buffer buffer) |
1810 (move-marker (car (nthcdr mark-ring-max mark-ring)) nil buffer) | 1681 (move-marker (car (nthcdr mark-ring-max mark-ring)) nil buffer) |
1811 (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil))))) | 1682 (setcdr (nthcdr (1- mark-ring-max) mark-ring) nil))))) |
1812 (set-mark (or location (point buffer)) buffer) | 1683 (set-mark (or location (point buffer)) buffer) |
1813 ; (set-marker (mark-marker) (or location (point)) (current-buffer)) ; FSF | 1684 ; (set-marker (mark-marker) (or location (point)) (current-buffer)) ; FSF |
1814 ;; Now push the mark on the global mark ring. | 1685 ;; Now push the mark on the global mark ring. |
1815 (if (and (not dont-record-current-mark) | 1686 (if (or (null global-mark-ring) |
1816 (or (null global-mark-ring) | 1687 (not (eq (marker-buffer (car global-mark-ring)) buffer))) |
1817 (not (eq (marker-buffer (car global-mark-ring)) buffer)))) | |
1818 ;; The last global mark pushed wasn't in this same buffer. | 1688 ;; The last global mark pushed wasn't in this same buffer. |
1819 (progn | 1689 (progn |
1820 (setq global-mark-ring (cons (copy-marker (mark-marker t buffer)) | 1690 (setq global-mark-ring (cons (copy-marker (mark-marker t buffer)) |
1821 global-mark-ring)) | 1691 global-mark-ring)) |
1822 (if (> (length global-mark-ring) global-mark-ring-max) | 1692 (if (> (length global-mark-ring) global-mark-ring-max) |
1823 (progn | 1693 (progn |
1824 (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) | 1694 (move-marker (car (nthcdr global-mark-ring-max global-mark-ring)) |
1825 nil buffer) | 1695 nil buffer) |
1826 (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil))))) | 1696 (setcdr (nthcdr (1- global-mark-ring-max) global-mark-ring) nil))))) |
1827 (setq dont-record-current-mark | 1697 (or nomsg executing-kbd-macro (> (minibuffer-depth) 0) |
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) | |
1834 (display-message 'command "Mark set")) | 1698 (display-message 'command "Mark set")) |
1835 (if activate-region | 1699 (if activate-region |
1836 (progn | 1700 (progn |
1837 (setq zmacs-region-stays t) | 1701 (setq zmacs-region-stays t) |
1838 (zmacs-activate-region))) | 1702 (zmacs-activate-region))) |
1938 This behavior used to be the default, and is still default in FSF Emacs. | 1802 This behavior used to be the default, and is still default in FSF Emacs. |
1939 We think it is an unnecessary and unwanted side-effect." | 1803 We think it is an unnecessary and unwanted side-effect." |
1940 :type 'boolean | 1804 :type 'boolean |
1941 :group 'editing-basics) | 1805 :group 'editing-basics) |
1942 | 1806 |
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 | |
1991 (defun forward-char-command (&optional arg buffer) | 1807 (defun forward-char-command (&optional arg buffer) |
1992 "Move point right ARG characters (left if ARG negative) in BUFFER. | 1808 "Move point right ARG characters (left if ARG negative) in BUFFER. |
1993 On attempt to pass end of buffer, stop and signal `end-of-buffer'. | 1809 On attempt to pass end of buffer, stop and signal `end-of-buffer'. |
1994 On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'. | 1810 On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'. |
1995 Error signaling is suppressed if `signal-error-on-buffer-boundary' | 1811 Error signaling is suppressed if `signal-error-on-buffer-boundary' |
2014 (condition-case nil | 1830 (condition-case nil |
2015 (backward-char arg buffer) | 1831 (backward-char arg buffer) |
2016 (beginning-of-buffer nil) | 1832 (beginning-of-buffer nil) |
2017 (end-of-buffer nil)))) | 1833 (end-of-buffer nil)))) |
2018 | 1834 |
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 | |
2030 (defun scroll-up-command (&optional n) | 1835 (defun scroll-up-command (&optional n) |
2031 "Scroll text of current window upward ARG lines; or near full screen if no ARG. | 1836 "Scroll text of current window upward ARG lines; or near full screen if no ARG. |
2032 A near full screen is `next-screen-context-lines' less than a full screen. | 1837 A near full screen is `next-screen-context-lines' less than a full screen. |
2033 Negative ARG means scroll downward. | 1838 Negative ARG means scroll downward. |
2034 When calling from a program, supply a number as argument or nil. | 1839 When calling from a program, supply a number as argument or nil. |
2044 (condition-case nil | 1849 (condition-case nil |
2045 (scroll-up n) | 1850 (scroll-up n) |
2046 (beginning-of-buffer nil) | 1851 (beginning-of-buffer nil) |
2047 (end-of-buffer nil)))) | 1852 (end-of-buffer nil)))) |
2048 | 1853 |
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 | |
2060 (defun scroll-down-command (&optional n) | 1854 (defun scroll-down-command (&optional n) |
2061 "Scroll text of current window downward ARG lines; or near full screen if no ARG. | 1855 "Scroll text of current window downward ARG lines; or near full screen if no ARG. |
2062 A near full screen is `next-screen-context-lines' less than a full screen. | 1856 A near full screen is `next-screen-context-lines' less than a full screen. |
2063 Negative ARG means scroll upward. | 1857 Negative ARG means scroll upward. |
2064 When calling from a program, supply a number as argument or nil. | 1858 When calling from a program, supply a number as argument or nil. |
2093 in `goal-column', which is nil when there is none. | 1887 in `goal-column', which is nil when there is none. |
2094 | 1888 |
2095 If you are thinking of using this in a Lisp program, consider | 1889 If you are thinking of using this in a Lisp program, consider |
2096 using `forward-line' instead. It is usually easier to use | 1890 using `forward-line' instead. It is usually easier to use |
2097 and more reliable (no dependence on goal column, etc.)." | 1891 and more reliable (no dependence on goal column, etc.)." |
2098 (interactive "_p") | 1892 (interactive "_p") ; XEmacs |
2099 (if (and next-line-add-newlines (= arg 1)) | 1893 (if (and next-line-add-newlines (= arg 1)) |
2100 (let ((opoint (point))) | 1894 (let ((opoint (point))) |
2101 (end-of-line) | 1895 (end-of-line) |
2102 (if (eobp) | 1896 (if (eobp) |
2103 (newline 1) | 1897 (newline 1) |
2124 Then it does not try to move vertically. | 1918 Then it does not try to move vertically. |
2125 | 1919 |
2126 If you are thinking of using this in a Lisp program, consider using | 1920 If you are thinking of using this in a Lisp program, consider using |
2127 `forward-line' with a negative argument instead. It is usually easier | 1921 `forward-line' with a negative argument instead. It is usually easier |
2128 to use and more reliable (no dependence on goal column, etc.)." | 1922 to use and more reliable (no dependence on goal column, etc.)." |
2129 (interactive "_p") | 1923 (interactive "_p") ; XEmacs |
2130 (if (interactive-p) | 1924 (if (interactive-p) |
2131 (condition-case nil | 1925 (condition-case nil |
2132 (line-move (- arg)) | 1926 (line-move (- arg)) |
2133 ((beginning-of-buffer end-of-buffer) | 1927 ((beginning-of-buffer end-of-buffer) |
2134 (when signal-error-on-buffer-boundary ; XEmacs | 1928 (when signal-error-on-buffer-boundary ; XEmacs |
2135 (ding nil 'buffer-bound)))) | 1929 (ding nil 'buffer-bound)))) |
2136 (line-move (- arg))) | 1930 (line-move (- arg))) |
2137 nil) | 1931 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)) | |
2157 | 1932 |
2158 (defcustom track-eol nil | 1933 (defcustom track-eol nil |
2159 "*Non-nil means vertical motion starting at end of line keeps to ends of lines. | 1934 "*Non-nil means vertical motion starting at end of line keeps to ends of lines. |
2160 This means moving to the end of each line moved onto. | 1935 This means moving to the end of each line moved onto. |
2161 The beginning of a blank line does not count as the end of a line." | 1936 The beginning of a blank line does not count as the end of a line." |
2815 (fill-point | 2590 (fill-point |
2816 (let ((opoint (point)) | 2591 (let ((opoint (point)) |
2817 bounce | 2592 bounce |
2818 ;; 97/3/14 jhod: Kinsoku | 2593 ;; 97/3/14 jhod: Kinsoku |
2819 (re-break-point (if (featurep 'mule) | 2594 (re-break-point (if (featurep 'mule) |
2820 (concat "[ \t\n]\\|" word-across-newline | 2595 (concat "[ \t\n]\\|" word-across-newline) |
2821 ".\\|." word-across-newline) | |
2822 "[ \t\n]")) | 2596 "[ \t\n]")) |
2823 ;; end patch | 2597 ;; end patch |
2824 (first t)) | 2598 (first t)) |
2825 (save-excursion | 2599 (save-excursion |
2826 (move-to-column (1+ fill-column)) | 2600 (move-to-column (1+ fill-column)) |
2879 ;; Otherwise, if a comment prefix or fill-prefix is inserted, | 2653 ;; Otherwise, if a comment prefix or fill-prefix is inserted, |
2880 ;; point will end up before it rather than after it. | 2654 ;; point will end up before it rather than after it. |
2881 (if (save-excursion | 2655 (if (save-excursion |
2882 (skip-chars-backward " \t") | 2656 (skip-chars-backward " \t") |
2883 (= (point) fill-point)) | 2657 (= (point) fill-point)) |
2884 ;; 1999-09-17 hniksic: turn off Kinsoku until | |
2885 ;; it's debugged. | |
2886 (indent-new-comment-line) | |
2887 ;; 97/3/14 jhod: Kinsoku processing | 2658 ;; 97/3/14 jhod: Kinsoku processing |
2888 ; ;(indent-new-comment-line) | 2659 ;(indent-new-comment-line) |
2889 ; (let ((spacep (memq (char-before (point)) '(?\ ?\t)))) | 2660 (let ((spacep (memq (char-before (point)) '(?\ ?\t)))) |
2890 ; (funcall comment-line-break-function) | 2661 (funcall comment-line-break-function) |
2891 ; ;; if user type space explicitly, leave SPC | 2662 ;; if user type space explicitly, leave SPC |
2892 ; ;; even if there is no WAN. | 2663 ;; even if there is no WAN. |
2893 ; (if spacep | 2664 (if spacep |
2894 ; (save-excursion | 2665 (save-excursion |
2895 ; (goto-char fill-point) | 2666 (goto-char fill-point) |
2896 ; ;; put SPC except that there is SPC | 2667 ;; put SPC except that there is SPC |
2897 ; ;; already or there is sentence end. | 2668 ;; already or there is sentence end. |
2898 ; (or (memq (char-after (point)) '(?\ ?\t)) | 2669 (or (memq (char-after (point)) '(?\ ?\t)) |
2899 ; (fill-end-of-sentence-p) | 2670 (fill-end-of-sentence-p) |
2900 ; (insert ?\ ))))) | 2671 (insert ?\ ))))) |
2901 (save-excursion | 2672 (save-excursion |
2902 (goto-char fill-point) | 2673 (goto-char fill-point) |
2903 (funcall comment-line-break-function))) | 2674 (funcall comment-line-break-function))) |
2904 ;; If making the new line didn't reduce the hpos of | 2675 ;; If making the new line didn't reduce the hpos of |
2905 ;; the end of the line, then give up now; | 2676 ;; the end of the line, then give up now; |
3116 (setq comstart | 2887 (setq comstart |
3117 (buffer-substring (point) (match-end 0))))))) | 2888 (buffer-substring (point) (match-end 0))))))) |
3118 (if (and comcol (not fill-prefix)) ; XEmacs - (ENE) from fa-extras. | 2889 (if (and comcol (not fill-prefix)) ; XEmacs - (ENE) from fa-extras. |
3119 (let ((comment-column comcol) | 2890 (let ((comment-column comcol) |
3120 (comment-start comstart) | 2891 (comment-start comstart) |
3121 (block-comment-start comstart) | |
3122 (comment-end comment-end)) | 2892 (comment-end comment-end)) |
3123 (and comment-end (not (equal comment-end "")) | 2893 (and comment-end (not (equal comment-end "")) |
3124 ; (if (not comment-multi-line) | 2894 ; (if (not comment-multi-line) |
3125 (progn | 2895 (progn |
3126 (forward-char -1) | 2896 (forward-char -1) |
3389 (setq element (car alist))) | 3159 (setq element (car alist))) |
3390 (setq alist (cdr alist))) | 3160 (setq alist (cdr alist))) |
3391 element)) | 3161 element)) |
3392 | 3162 |
3393 | 3163 |
3394 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3395 ;; mail composition code ;; | |
3396 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3397 | |
3398 (defcustom mail-user-agent 'sendmail-user-agent | 3164 (defcustom mail-user-agent 'sendmail-user-agent |
3399 "*Your preference for a mail composition package. | 3165 "*Your preference for a mail composition package. |
3400 Various Emacs Lisp packages (e.g. reporter) require you to compose an | 3166 Various Emacs Lisp packages (e.g. reporter) require you to compose an |
3401 outgoing email message. This variable lets you specify which | 3167 outgoing email message. This variable lets you specify which |
3402 mail-sending package you prefer. | 3168 mail-sending package you prefer. |
3538 (list nil nil nil current-prefix-arg)) | 3304 (list nil nil nil current-prefix-arg)) |
3539 (compose-mail to subject other-headers continue | 3305 (compose-mail to subject other-headers continue |
3540 'switch-to-buffer-other-frame yank-action send-actions)) | 3306 'switch-to-buffer-other-frame yank-action send-actions)) |
3541 | 3307 |
3542 | 3308 |
3543 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3544 ;; set variable ;; | |
3545 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3546 | |
3547 (defun set-variable (var val) | 3309 (defun set-variable (var val) |
3548 "Set VARIABLE to VALUE. VALUE is a Lisp object. | 3310 "Set VARIABLE to VALUE. VALUE is a Lisp object. |
3549 When using this interactively, supply a Lisp expression for VALUE. | 3311 When using this interactively, supply a Lisp expression for VALUE. |
3550 If you want VALUE to be a string, you must surround it with doublequotes. | 3312 If you want VALUE to be a string, you must surround it with doublequotes. |
3551 If VARIABLE is a specifier, VALUE is added to it as an instantiator in | 3313 If VARIABLE is a specifier, VALUE is added to it as an instantiator in |
3584 'arg)) | 3346 'arg)) |
3585 (eval-minibuffer (format "Set %s to value: " var))))))) | 3347 (eval-minibuffer (format "Set %s to value: " var))))))) |
3586 (if (and (boundp var) (specifierp (symbol-value var))) | 3348 (if (and (boundp var) (specifierp (symbol-value var))) |
3587 (set-specifier (symbol-value var) val) | 3349 (set-specifier (symbol-value var) val) |
3588 (set var val))) | 3350 (set var val))) |
3589 | |
3590 | 3351 |
3591 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3352 ;; XEmacs |
3592 ;; case changing code ;; | 3353 (defun activate-region () |
3593 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3354 "Activate the region, if `zmacs-regions' is true. |
3355 Setting `zmacs-regions' to true causes LISPM-style active regions to be used. | |
3356 This function has no effect if `zmacs-regions' is false." | |
3357 (interactive) | |
3358 (and zmacs-regions (zmacs-activate-region))) | |
3359 | |
3360 ;; XEmacs | |
3361 (defsubst region-exists-p () | |
3362 "Return t if the region exists. | |
3363 If active regions are in use (i.e. `zmacs-regions' is true), this means that | |
3364 the region is active. Otherwise, this means that the user has pushed | |
3365 a mark in this buffer at some point in the past. | |
3366 The functions `region-beginning' and `region-end' can be used to find the | |
3367 limits of the region." | |
3368 (not (null (mark)))) | |
3369 | |
3370 ;; XEmacs | |
3371 (defun region-active-p () | |
3372 "Return non-nil if the region is active. | |
3373 If `zmacs-regions' is true, this is equivalent to `region-exists-p'. | |
3374 Otherwise, this function always returns false." | |
3375 (and zmacs-regions zmacs-region-extent)) | |
3594 | 3376 |
3595 ;; A bunch of stuff was moved elsewhere: | 3377 ;; A bunch of stuff was moved elsewhere: |
3596 ;; completion-list-mode-map | 3378 ;; completion-list-mode-map |
3597 ;; completion-reference-buffer | 3379 ;; completion-reference-buffer |
3598 ;; completion-base-size | 3380 ;; completion-base-size |
3629 (interactive "p") | 3411 (interactive "p") |
3630 (if (region-active-p) | 3412 (if (region-active-p) |
3631 (downcase-region (region-beginning) (region-end)) | 3413 (downcase-region (region-beginning) (region-end)) |
3632 (downcase-word arg))) | 3414 (downcase-word arg))) |
3633 | 3415 |
3634 ;; #### not localized | |
3635 (defvar uncapitalized-title-words | |
3636 '("the" "a" "an" "in" "of" "for" "to" "and" "but" "at" "on" "as" "by")) | |
3637 | |
3638 (defvar uncapitalized-title-word-regexp | |
3639 (concat "[ \t]*\\(" (mapconcat #'identity uncapitalized-title-words "\\|") | |
3640 "\\)\\>")) | |
3641 | |
3642 (defun capitalize-string-as-title (string) | |
3643 "Capitalize the words in the string, except for small words (as in titles). | |
3644 The words not capitalized are specified in `uncapitalized-title-words'." | |
3645 (let ((buffer (get-buffer-create " *capitalize-string-as-title*"))) | |
3646 (unwind-protect | |
3647 (progn | |
3648 (insert-string string buffer) | |
3649 (capitalize-region-as-title 1 (point-max buffer) buffer) | |
3650 (buffer-string buffer)) | |
3651 (kill-buffer buffer)))) | |
3652 | |
3653 (defun capitalize-region-as-title (b e &optional buffer) | |
3654 "Capitalize the words in the region, except for small words (as in titles). | |
3655 The words not capitalized are specified in `uncapitalized-title-words'." | |
3656 (interactive "r") | |
3657 (save-excursion | |
3658 (and buffer | |
3659 (set-buffer buffer)) | |
3660 (save-restriction | |
3661 (narrow-to-region b e) | |
3662 (goto-char (point-min)) | |
3663 (let ((first t)) | |
3664 (while (< (point) (point-max)) | |
3665 (if (or first | |
3666 (not (looking-at uncapitalized-title-word-regexp))) | |
3667 (capitalize-word 1) | |
3668 (forward-word 1)) | |
3669 (setq first nil)))))) | |
3670 | |
3671 | |
3672 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3673 ;; zmacs active region code ;; | |
3674 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3675 | |
3676 ;; Most of the zmacs code is now in elisp. The only thing left in C | 3416 ;; Most of the zmacs code is now in elisp. The only thing left in C |
3677 ;; are the variables zmacs-regions, zmacs-region-active-p and | 3417 ;; are the variables zmacs-regions, zmacs-region-active-p and |
3678 ;; zmacs-region-stays plus the function zmacs_update_region which | 3418 ;; zmacs-region-stays plus the function zmacs_update_region which |
3679 ;; simply calls the lisp level zmacs-update-region. It must remain | 3419 ;; simply calls the lisp level zmacs-update-region. It must remain |
3680 ;; for convenience, since it is called by core C code. | 3420 ;; for convenience, since it is called by core C code. |
3681 | |
3682 ;; XEmacs | |
3683 (defun activate-region () | |
3684 "Activate the region, if `zmacs-regions' is true. | |
3685 Setting `zmacs-regions' to true causes LISPM-style active regions to be used. | |
3686 This function has no effect if `zmacs-regions' is false." | |
3687 (interactive) | |
3688 (and zmacs-regions (zmacs-activate-region))) | |
3689 | |
3690 ;; XEmacs | |
3691 (defsubst region-exists-p () | |
3692 "Return t if the region exists. | |
3693 If active regions are in use (i.e. `zmacs-regions' is true), this means that | |
3694 the region is active. Otherwise, this means that the user has pushed | |
3695 a mark in this buffer at some point in the past. | |
3696 The functions `region-beginning' and `region-end' can be used to find the | |
3697 limits of the region." | |
3698 (not (null (mark)))) | |
3699 | |
3700 ;; XEmacs | |
3701 (defun region-active-p () | |
3702 "Return non-nil if the region is active. | |
3703 If `zmacs-regions' is true, this is equivalent to `region-exists-p'. | |
3704 Otherwise, this function always returns false." | |
3705 (and zmacs-regions zmacs-region-extent)) | |
3706 | 3421 |
3707 (defvar zmacs-activate-region-hook nil | 3422 (defvar zmacs-activate-region-hook nil |
3708 "Function or functions called when the region becomes active; | 3423 "Function or functions called when the region becomes active; |
3709 see the variable `zmacs-regions'.") | 3424 see the variable `zmacs-regions'.") |
3710 | 3425 |
3842 (when (marker-buffer (mark-marker t)) | 3557 (when (marker-buffer (mark-marker t)) |
3843 (zmacs-make-extent-for-region (cons (point-marker t) | 3558 (zmacs-make-extent-for-region (cons (point-marker t) |
3844 (mark-marker t)))) | 3559 (mark-marker t)))) |
3845 (run-hooks 'zmacs-update-region-hook))) | 3560 (run-hooks 'zmacs-update-region-hook))) |
3846 | 3561 |
3847 | 3562 ;;;;;; |
3848 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3563 ;;;;;; echo area stuff |
3849 ;; message logging code ;; | 3564 ;;;;;; |
3850 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
3851 | 3565 |
3852 ;;; #### Should this be moved to a separate file, for clarity? | 3566 ;;; #### Should this be moved to a separate file, for clarity? |
3853 ;;; -hniksic | 3567 ;;; -hniksic |
3854 | 3568 |
3855 ;;; The `message-stack' is an alist of labels with messages; the first | 3569 ;;; The `message-stack' is an alist of labels with messages; the first |
3909 ;; So, I left only a few of the really useless ones on this kill-list. | 3623 ;; So, I left only a few of the really useless ones on this kill-list. |
3910 ;; | 3624 ;; |
3911 ;; --hniksic | 3625 ;; --hniksic |
3912 (defcustom log-message-ignore-regexps | 3626 (defcustom log-message-ignore-regexps |
3913 '(;; Note: adding entries to this list slows down messaging | 3627 '(;; Note: adding entries to this list slows down messaging |
3914 ;; significantly. Wherever possible, use message labels. | 3628 ;; significantly. Wherever possible, use message lables. |
3915 | 3629 |
3916 ;; Often-seen messages | 3630 ;; Often-seen messages |
3917 "\\`\\'" ; empty message | 3631 "\\`\\'" ; empty message |
3918 "\\`\\(Beginning\\|End\\) of buffer\\'" | 3632 "\\`\\(Beginning\\|End\\) of buffer\\'" |
3919 ;;"^Quit$" | 3633 ;;"^Quit$" |
4166 (clear-message label nil)) | 3880 (clear-message label nil)) |
4167 (let ((str (apply 'format fmt args))) | 3881 (let ((str (apply 'format fmt args))) |
4168 (display-message label str) | 3882 (display-message label str) |
4169 str))) | 3883 str))) |
4170 | 3884 |
4171 | 3885 |
4172 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3886 ;;;;;; |
4173 ;; warning code ;; | 3887 ;;;;;; warning stuff |
4174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 3888 ;;;;;; |
4175 | 3889 |
4176 (defcustom log-warning-minimum-level 'info | 3890 (defcustom log-warning-minimum-level 'info |
4177 "Minimum level of warnings that should be logged. | 3891 "Minimum level of warnings that should be logged. |
4178 The warnings in levels below this are completely ignored, as if they never | 3892 The warnings in levels below this are completely ignored, as if they never |
4179 happened. | 3893 happened. |
4371 (point-max))) | 4085 (point-max))) |
4372 (funcall temp-buffer-show-function show-buffer)) | 4086 (funcall temp-buffer-show-function show-buffer)) |
4373 (set-window-start (display-buffer buffer) warning-marker)) | 4087 (set-window-start (display-buffer buffer) warning-marker)) |
4374 (set-marker warning-marker (point-max buffer) buffer))) | 4088 (set-marker warning-marker (point-max buffer) buffer))) |
4375 | 4089 |
4376 | |
4377 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4378 ;; misc junk ;; | |
4379 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
4380 | |
4381 (defun emacs-name () | 4090 (defun emacs-name () |
4382 "Return the printable name of this instance of Emacs." | 4091 "Return the printable name of this instance of Emacs." |
4383 (cond ((featurep 'infodock) "InfoDock") | 4092 (cond ((featurep 'infodock) "InfoDock") |
4384 ((featurep 'xemacs) "XEmacs") | 4093 ((featurep 'xemacs) "XEmacs") |
4385 (t "Emacs"))) | 4094 (t "Emacs"))) |
4386 | 4095 |
4387 ;;; simple.el ends here | 4096 ;;; simple.el ends here |