Mercurial > emacs
comparison lisp/simple.el @ 64548:cff17c5abe4d
(clone-indirect-buffer): Doc fix.
(fixup-whitespace, just-one-space, backward-delete-char-untabify, lambda):
"?\ " -> "?\s".
(next-error, next-error-highlight, next-error-highlight-no-select,
next-error-last-buffer, next-error-buffer-p, next-error-find-buffer, next-error,
previous-error, next-error-no-select, previous-error-no-select, open-line,
split-line, minibuffer-prompt-width, kill-new, binary-overwrite-mode):
Fix typos in docstrings.
(set-fill-column): Fix typo in message.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Wed, 20 Jul 2005 22:26:27 +0000 |
parents | 549c22d3fe54 |
children | e139156061a7 187d6a1f84f7 |
comparison
equal
deleted
inserted
replaced
64547:8eafe3e25a6c | 64548:cff17c5abe4d |
---|---|
72 (switch-to-buffer found))) | 72 (switch-to-buffer found))) |
73 | 73 |
74 ;;; next-error support framework | 74 ;;; next-error support framework |
75 | 75 |
76 (defgroup next-error nil | 76 (defgroup next-error nil |
77 "next-error support framework." | 77 "`next-error' support framework." |
78 :group 'compilation | 78 :group 'compilation |
79 :version "22.1") | 79 :version "22.1") |
80 | 80 |
81 (defface next-error | 81 (defface next-error |
82 '((t (:inherit region))) | 82 '((t (:inherit region))) |
84 :group 'next-error | 84 :group 'next-error |
85 :version "22.1") | 85 :version "22.1") |
86 | 86 |
87 (defcustom next-error-highlight 0.1 | 87 (defcustom next-error-highlight 0.1 |
88 "*Highlighting of locations in selected source buffers. | 88 "*Highlighting of locations in selected source buffers. |
89 If number, highlight the locus in next-error face for given time in seconds. | 89 If number, highlight the locus in `next-error' face for given time in seconds. |
90 If t, use persistent overlays fontified in next-error face. | 90 If t, use persistent overlays fontified in `next-error' face. |
91 If nil, don't highlight the locus in the source buffer. | 91 If nil, don't highlight the locus in the source buffer. |
92 If `fringe-arrow', indicate the locus by the fringe arrow." | 92 If `fringe-arrow', indicate the locus by the fringe arrow." |
93 :type '(choice (number :tag "Delay") | 93 :type '(choice (number :tag "Delay") |
94 (const :tag "Persistent overlay" t) | 94 (const :tag "Persistent overlay" t) |
95 (const :tag "No highlighting" nil) | 95 (const :tag "No highlighting" nil) |
97 :group 'next-error | 97 :group 'next-error |
98 :version "22.1") | 98 :version "22.1") |
99 | 99 |
100 (defcustom next-error-highlight-no-select 0.1 | 100 (defcustom next-error-highlight-no-select 0.1 |
101 "*Highlighting of locations in non-selected source buffers. | 101 "*Highlighting of locations in non-selected source buffers. |
102 If number, highlight the locus in next-error face for given time in seconds. | 102 If number, highlight the locus in `next-error' face for given time in seconds. |
103 If t, use persistent overlays fontified in next-error face. | 103 If t, use persistent overlays fontified in `next-error' face. |
104 If nil, don't highlight the locus in the source buffer. | 104 If nil, don't highlight the locus in the source buffer. |
105 If `fringe-arrow', indicate the locus by the fringe arrow." | 105 If `fringe-arrow', indicate the locus by the fringe arrow." |
106 :type '(choice (number :tag "Delay") | 106 :type '(choice (number :tag "Delay") |
107 (const :tag "Persistent overlay" t) | 107 (const :tag "Persistent overlay" t) |
108 (const :tag "No highlighting" nil) | 108 (const :tag "No highlighting" nil) |
120 (defvar next-error-overlay-arrow-position nil) | 120 (defvar next-error-overlay-arrow-position nil) |
121 (put 'next-error-overlay-arrow-position 'overlay-arrow-string "=>") | 121 (put 'next-error-overlay-arrow-position 'overlay-arrow-string "=>") |
122 (add-to-list 'overlay-arrow-variable-list 'next-error-overlay-arrow-position) | 122 (add-to-list 'overlay-arrow-variable-list 'next-error-overlay-arrow-position) |
123 | 123 |
124 (defvar next-error-last-buffer nil | 124 (defvar next-error-last-buffer nil |
125 "The most recent next-error buffer. | 125 "The most recent `next-error' buffer. |
126 A buffer becomes most recent when its compilation, grep, or | 126 A buffer becomes most recent when its compilation, grep, or |
127 similar mode is started, or when it is used with \\[next-error] | 127 similar mode is started, or when it is used with \\[next-error] |
128 or \\[compile-goto-error].") | 128 or \\[compile-goto-error].") |
129 | 129 |
130 (defvar next-error-function nil | 130 (defvar next-error-function nil |
141 | 141 |
142 (defsubst next-error-buffer-p (buffer | 142 (defsubst next-error-buffer-p (buffer |
143 &optional avoid-current | 143 &optional avoid-current |
144 extra-test-inclusive | 144 extra-test-inclusive |
145 extra-test-exclusive) | 145 extra-test-exclusive) |
146 "Test if BUFFER is a next-error capable buffer. | 146 "Test if BUFFER is a `next-error' capable buffer. |
147 | 147 |
148 If AVOID-CURRENT is non-nil, treat the current buffer | 148 If AVOID-CURRENT is non-nil, treat the current buffer |
149 as an absolute last resort only. | 149 as an absolute last resort only. |
150 | 150 |
151 The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer | 151 The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer |
168 (funcall extra-test-inclusive)))))) | 168 (funcall extra-test-inclusive)))))) |
169 | 169 |
170 (defun next-error-find-buffer (&optional avoid-current | 170 (defun next-error-find-buffer (&optional avoid-current |
171 extra-test-inclusive | 171 extra-test-inclusive |
172 extra-test-exclusive) | 172 extra-test-exclusive) |
173 "Return a next-error capable buffer. | 173 "Return a `next-error' capable buffer. |
174 If AVOID-CURRENT is non-nil, treat the current buffer | 174 If AVOID-CURRENT is non-nil, treat the current buffer |
175 as an absolute last resort only. | 175 as an absolute last resort only. |
176 | 176 |
177 The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer | 177 The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer |
178 that normally would not qualify. If it returns t, the buffer | 178 that normally would not qualify. If it returns t, the buffer |
221 (current-buffer))) | 221 (current-buffer))) |
222 ;; 6. Give up. | 222 ;; 6. Give up. |
223 (error "No next-error capable buffer found"))) | 223 (error "No next-error capable buffer found"))) |
224 | 224 |
225 (defun next-error (&optional arg reset) | 225 (defun next-error (&optional arg reset) |
226 "Visit next next-error message and corresponding source code. | 226 "Visit next `next-error' message and corresponding source code. |
227 | 227 |
228 If all the error messages parsed so far have been processed already, | 228 If all the error messages parsed so far have been processed already, |
229 the message buffer is checked for new ones. | 229 the message buffer is checked for new ones. |
230 | 230 |
231 A prefix ARG specifies how many error messages to move; | 231 A prefix ARG specifies how many error messages to move; |
262 | 262 |
263 (defalias 'goto-next-locus 'next-error) | 263 (defalias 'goto-next-locus 'next-error) |
264 (defalias 'next-match 'next-error) | 264 (defalias 'next-match 'next-error) |
265 | 265 |
266 (defun previous-error (&optional n) | 266 (defun previous-error (&optional n) |
267 "Visit previous next-error message and corresponding source code. | 267 "Visit previous `next-error' message and corresponding source code. |
268 | 268 |
269 Prefix arg N says how many error messages to move backwards (or | 269 Prefix arg N says how many error messages to move backwards (or |
270 forwards, if negative). | 270 forwards, if negative). |
271 | 271 |
272 This operates on the output from the \\[compile] and \\[grep] commands." | 272 This operates on the output from the \\[compile] and \\[grep] commands." |
280 This operates on the output from the \\[compile] command, for instance." | 280 This operates on the output from the \\[compile] command, for instance." |
281 (interactive "p") | 281 (interactive "p") |
282 (next-error n t)) | 282 (next-error n t)) |
283 | 283 |
284 (defun next-error-no-select (&optional n) | 284 (defun next-error-no-select (&optional n) |
285 "Move point to the next error in the next-error buffer and highlight match. | 285 "Move point to the next error in the `next-error' buffer and highlight match. |
286 Prefix arg N says how many error messages to move forwards (or | 286 Prefix arg N says how many error messages to move forwards (or |
287 backwards, if negative). | 287 backwards, if negative). |
288 Finds and highlights the source line like \\[next-error], but does not | 288 Finds and highlights the source line like \\[next-error], but does not |
289 select the source buffer." | 289 select the source buffer." |
290 (interactive "p") | 290 (interactive "p") |
291 (let ((next-error-highlight next-error-highlight-no-select)) | 291 (let ((next-error-highlight next-error-highlight-no-select)) |
292 (next-error n)) | 292 (next-error n)) |
293 (pop-to-buffer next-error-last-buffer)) | 293 (pop-to-buffer next-error-last-buffer)) |
294 | 294 |
295 (defun previous-error-no-select (&optional n) | 295 (defun previous-error-no-select (&optional n) |
296 "Move point to the previous error in the next-error buffer and highlight match. | 296 "Move point to the previous error in the `next-error' buffer and highlight match. |
297 Prefix arg N says how many error messages to move backwards (or | 297 Prefix arg N says how many error messages to move backwards (or |
298 forwards, if negative). | 298 forwards, if negative). |
299 Finds and highlights the source line like \\[previous-error], but does not | 299 Finds and highlights the source line like \\[previous-error], but does not |
300 select the source buffer." | 300 select the source buffer." |
301 (interactive "p") | 301 (interactive "p") |
424 (put-text-property from (point) 'rear-nonsticky | 424 (put-text-property from (point) 'rear-nonsticky |
425 (cons 'hard sticky))))) | 425 (cons 'hard sticky))))) |
426 | 426 |
427 (defun open-line (n) | 427 (defun open-line (n) |
428 "Insert a newline and leave point before it. | 428 "Insert a newline and leave point before it. |
429 If there is a fill prefix and/or a left-margin, insert them on the new line | 429 If there is a fill prefix and/or a `left-margin', insert them |
430 if the line would have been blank. | 430 on the new line if the line would have been blank. |
431 With arg N, insert N newlines." | 431 With arg N, insert N newlines." |
432 (interactive "*p") | 432 (interactive "*p") |
433 (let* ((do-fill-prefix (and fill-prefix (bolp))) | 433 (let* ((do-fill-prefix (and fill-prefix (bolp))) |
434 (do-left-margin (and (bolp) (> (current-left-margin) 0))) | 434 (do-left-margin (and (bolp) (> (current-left-margin) 0))) |
435 (loc (point)) | 435 (loc (point)) |
447 (end-of-line))) | 447 (end-of-line))) |
448 | 448 |
449 (defun split-line (&optional arg) | 449 (defun split-line (&optional arg) |
450 "Split current line, moving portion beyond point vertically down. | 450 "Split current line, moving portion beyond point vertically down. |
451 If the current line starts with `fill-prefix', insert it on the new | 451 If the current line starts with `fill-prefix', insert it on the new |
452 line as well. With prefix ARG, don't insert fill-prefix on new line. | 452 line as well. With prefix ARG, don't insert `fill-prefix' on new line. |
453 | 453 |
454 When called from Lisp code, ARG may be a prefix string to copy." | 454 When called from Lisp code, ARG may be a prefix string to copy." |
455 (interactive "*P") | 455 (interactive "*P") |
456 (skip-chars-forward " \t") | 456 (skip-chars-forward " \t") |
457 (let* ((col (current-column)) | 457 (let* ((col (current-column)) |
645 (delete-horizontal-space) | 645 (delete-horizontal-space) |
646 (if (or (looking-at "^\\|\\s)") | 646 (if (or (looking-at "^\\|\\s)") |
647 (save-excursion (forward-char -1) | 647 (save-excursion (forward-char -1) |
648 (looking-at "$\\|\\s(\\|\\s'"))) | 648 (looking-at "$\\|\\s(\\|\\s'"))) |
649 nil | 649 nil |
650 (insert ?\ )))) | 650 (insert ?\s)))) |
651 | 651 |
652 (defun delete-horizontal-space (&optional backward-only) | 652 (defun delete-horizontal-space (&optional backward-only) |
653 "Delete all spaces and tabs around point. | 653 "Delete all spaces and tabs around point. |
654 If BACKWARD-ONLY is non-nil, only delete spaces before point." | 654 If BACKWARD-ONLY is non-nil, only delete spaces before point." |
655 (interactive "*") | 655 (interactive "*") |
669 (interactive "*p") | 669 (interactive "*p") |
670 (let ((orig-pos (point))) | 670 (let ((orig-pos (point))) |
671 (skip-chars-backward " \t") | 671 (skip-chars-backward " \t") |
672 (constrain-to-field nil orig-pos) | 672 (constrain-to-field nil orig-pos) |
673 (dotimes (i (or n 1)) | 673 (dotimes (i (or n 1)) |
674 (if (= (following-char) ?\ ) | 674 (if (= (following-char) ?\s) |
675 (forward-char 1) | 675 (forward-char 1) |
676 (insert ?\ ))) | 676 (insert ?\s))) |
677 (delete-region | 677 (delete-region |
678 (point) | 678 (point) |
679 (progn | 679 (progn |
680 (skip-chars-forward " \t") | 680 (skip-chars-forward " \t") |
681 (constrain-to-field nil orig-pos t))))) | 681 (constrain-to-field nil orig-pos t))))) |
1272 (next-complete-history-element (- n))) | 1272 (next-complete-history-element (- n))) |
1273 | 1273 |
1274 ;; For compatibility with the old subr of the same name. | 1274 ;; For compatibility with the old subr of the same name. |
1275 (defun minibuffer-prompt-width () | 1275 (defun minibuffer-prompt-width () |
1276 "Return the display width of the minibuffer prompt. | 1276 "Return the display width of the minibuffer prompt. |
1277 Return 0 if current buffer is not a mini-buffer." | 1277 Return 0 if current buffer is not a minibuffer." |
1278 ;; Return the width of everything before the field at the end of | 1278 ;; Return the width of everything before the field at the end of |
1279 ;; the buffer; this should be 0 for normal buffers. | 1279 ;; the buffer; this should be 0 for normal buffers. |
1280 (1- (minibuffer-prompt-end))) | 1280 (1- (minibuffer-prompt-end))) |
1281 | 1281 |
1282 ;Put this on C-x u, so we can force that rather than C-_ into startup msg | 1282 ;Put this on C-x u, so we can force that rather than C-_ into startup msg |
2343 When a yank handler is specified, STRING must be non-empty (the yank | 2343 When a yank handler is specified, STRING must be non-empty (the yank |
2344 handler, if non-nil, is stored as a `yank-handler' text property on STRING). | 2344 handler, if non-nil, is stored as a `yank-handler' text property on STRING). |
2345 | 2345 |
2346 When the yank handler has a non-nil PARAM element, the original STRING | 2346 When the yank handler has a non-nil PARAM element, the original STRING |
2347 argument is not used by `insert-for-yank'. However, since Lisp code | 2347 argument is not used by `insert-for-yank'. However, since Lisp code |
2348 may access and use elements from the kill-ring directly, the STRING | 2348 may access and use elements from the kill ring directly, the STRING |
2349 argument should still be a \"useful\" string for such uses." | 2349 argument should still be a \"useful\" string for such uses." |
2350 (if (> (length string) 0) | 2350 (if (> (length string) 0) |
2351 (if yank-handler | 2351 (if yank-handler |
2352 (put-text-property 0 (length string) | 2352 (put-text-property 0 (length string) |
2353 'yank-handler yank-handler string)) | 2353 'yank-handler yank-handler string)) |
2682 (while (and (> count 0) (not (bobp))) | 2682 (while (and (> count 0) (not (bobp))) |
2683 (if (= (preceding-char) ?\t) | 2683 (if (= (preceding-char) ?\t) |
2684 (let ((col (current-column))) | 2684 (let ((col (current-column))) |
2685 (forward-char -1) | 2685 (forward-char -1) |
2686 (setq col (- col (current-column))) | 2686 (setq col (- col (current-column))) |
2687 (insert-char ?\ col) | 2687 (insert-char ?\s col) |
2688 (delete-char 1))) | 2688 (delete-char 1))) |
2689 (forward-char -1) | 2689 (forward-char -1) |
2690 (setq count (1- count)))))) | 2690 (setq count (1- count)))))) |
2691 (delete-backward-char | 2691 (delete-backward-char |
2692 (let ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t") | 2692 (let ((skip (cond ((eq backward-delete-char-untabify-method 'hungry) " \t") |
4073 (interactive "P") | 4073 (interactive "P") |
4074 (if (consp arg) | 4074 (if (consp arg) |
4075 (setq arg (current-column))) | 4075 (setq arg (current-column))) |
4076 (if (not (integerp arg)) | 4076 (if (not (integerp arg)) |
4077 ;; Disallow missing argument; it's probably a typo for C-x C-f. | 4077 ;; Disallow missing argument; it's probably a typo for C-x C-f. |
4078 (error "Set-fill-column requires an explicit argument") | 4078 (error "set-fill-column requires an explicit argument") |
4079 (message "Fill column set to %d (was %d)" arg fill-column) | 4079 (message "Fill column set to %d (was %d)" arg fill-column) |
4080 (setq fill-column arg))) | 4080 (setq fill-column arg))) |
4081 | 4081 |
4082 (defun set-selective-display (arg) | 4082 (defun set-selective-display (arg) |
4083 "Set `selective-display' to ARG; clear it if no arg. | 4083 "Set `selective-display' to ARG; clear it if no arg. |
4153 with the character typed. | 4153 with the character typed. |
4154 \\[quoted-insert] replaces the text at the cursor, just as ordinary | 4154 \\[quoted-insert] replaces the text at the cursor, just as ordinary |
4155 typing characters do. | 4155 typing characters do. |
4156 | 4156 |
4157 Note that binary overwrite mode is not its own minor mode; it is a | 4157 Note that binary overwrite mode is not its own minor mode; it is a |
4158 specialization of overwrite-mode, entered by setting the | 4158 specialization of overwrite mode, entered by setting the |
4159 `overwrite-mode' variable to `overwrite-mode-binary'." | 4159 `overwrite-mode' variable to `overwrite-mode-binary'." |
4160 (interactive "P") | 4160 (interactive "P") |
4161 (setq overwrite-mode | 4161 (setq overwrite-mode |
4162 (if (if (null arg) | 4162 (if (if (null arg) |
4163 (not (eq overwrite-mode 'overwrite-mode-binary)) | 4163 (not (eq overwrite-mode 'overwrite-mode-binary)) |
4997 (normal (nth 1 keypad-normal))) | 4997 (normal (nth 1 keypad-normal))) |
4998 (put keypad 'ascii-character normal) | 4998 (put keypad 'ascii-character normal) |
4999 (define-key function-key-map (vector keypad) (vector normal)))) | 4999 (define-key function-key-map (vector keypad) (vector normal)))) |
5000 '((kp-0 ?0) (kp-1 ?1) (kp-2 ?2) (kp-3 ?3) (kp-4 ?4) | 5000 '((kp-0 ?0) (kp-1 ?1) (kp-2 ?2) (kp-3 ?3) (kp-4 ?4) |
5001 (kp-5 ?5) (kp-6 ?6) (kp-7 ?7) (kp-8 ?8) (kp-9 ?9) | 5001 (kp-5 ?5) (kp-6 ?6) (kp-7 ?7) (kp-8 ?8) (kp-9 ?9) |
5002 (kp-space ?\ ) | 5002 (kp-space ?\s) |
5003 (kp-tab ?\t) | 5003 (kp-tab ?\t) |
5004 (kp-enter ?\r) | 5004 (kp-enter ?\r) |
5005 (kp-multiply ?*) | 5005 (kp-multiply ?*) |
5006 (kp-add ?+) | 5006 (kp-add ?+) |
5007 (kp-separator ?,) | 5007 (kp-separator ?,) |
5138 or by incrementing the N in an existing suffix. | 5138 or by incrementing the N in an existing suffix. |
5139 | 5139 |
5140 DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'. | 5140 DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'. |
5141 This is always done when called interactively. | 5141 This is always done when called interactively. |
5142 | 5142 |
5143 Optional last arg NORECORD non-nil means do not put this buffer at the | 5143 Optional third arg NORECORD non-nil means do not put this buffer at the |
5144 front of the list of recently selected ones." | 5144 front of the list of recently selected ones." |
5145 (interactive | 5145 (interactive |
5146 (progn | 5146 (progn |
5147 (if (get major-mode 'no-clone-indirect) | 5147 (if (get major-mode 'no-clone-indirect) |
5148 (error "Cannot indirectly clone a buffer in %s mode" mode-name)) | 5148 (error "Cannot indirectly clone a buffer in %s mode" mode-name)) |