diff options
| author | Miles Bader | 2004-06-28 07:56:49 +0000 |
|---|---|---|
| committer | Miles Bader | 2004-06-28 07:56:49 +0000 |
| commit | 327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801 (patch) | |
| tree | 21de188e13b5e41a79bb50040933072ae0235217 /lisp/simple.el | |
| parent | 852f73b7fa7b71910282eacb6263b3ecfd4ee783 (diff) | |
| parent | 376de73927383d6062483db10b8a82448505f52b (diff) | |
| download | emacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.tar.gz emacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.zip | |
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221
Restore deleted tagline in etc/TUTORIAL.ru
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229
Remove TeX output files from the archive
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248
src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264
Update from CVS: lispref/display.texi: emacs -> Emacs.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275
Update from CVS: man/makefile.w32-in: Revert last change
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296
Allow restarting an existing debugger session that's exited
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328
Update from CVS: src/.gdbinit (xsymbol): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345
Tweak source regexps so that building in place won't cause problems
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352
Update from CVS: lisp/flymake.el: New file.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362
Support " [...]" style defaults in minibuffer-electric-default-mode
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363
(read-number): Use canonical format for default in prompt.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368
Improve display-supports-face-attributes-p on non-ttys
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Rewrite face-differs-from-default-p
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Move `display-supports-face-attributes-p' entirely into C code
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Simplify face-differs-from-default-p; don't consider :stipple.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
(tty_supports_face_attributes_p): Ensure attributes differ from default
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
(Fdisplay_supports_face_attributes_p): Work around bootstrapping problem
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Face merging cleanups
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396
Tweak arch tagging to make build/install-in-place less annoying
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397
Work around vc-arch problems when building eshell
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399
Tweak directory permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401
More build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403
Yet more build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410
Make sure image types are initialized for lookup too
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416
Update from CVS
Diffstat (limited to 'lisp/simple.el')
| -rw-r--r-- | lisp/simple.el | 304 |
1 files changed, 237 insertions, 67 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 2d0a176de0c..8da9e8028f0 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; simple.el --- basic editing commands for Emacs | 1 | ;;; simple.el --- basic editing commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 99, | 3 | ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 99, |
| 4 | ;; 2000, 2001, 2002, 2003 | 4 | ;; 2000, 01, 02, 03, 04 |
| 5 | ;; Free Software Foundation, Inc. | 5 | ;; Free Software Foundation, Inc. |
| 6 | 6 | ||
| 7 | ;; Maintainer: FSF | 7 | ;; Maintainer: FSF |
| @@ -37,7 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | (defgroup killing nil | 39 | (defgroup killing nil |
| 40 | "Killing and yanking commands" | 40 | "Killing and yanking commands." |
| 41 | :group 'editing) | 41 | :group 'editing) |
| 42 | 42 | ||
| 43 | (defgroup paren-matching nil | 43 | (defgroup paren-matching nil |
| @@ -66,6 +66,154 @@ | |||
| 66 | (setq list (cdr list))) | 66 | (setq list (cdr list))) |
| 67 | (switch-to-buffer found))) | 67 | (switch-to-buffer found))) |
| 68 | 68 | ||
| 69 | ;;; next-error support framework | ||
| 70 | (defvar next-error-last-buffer nil | ||
| 71 | "The most recent next-error buffer. | ||
| 72 | A buffer becomes most recent when its compilation, grep, or | ||
| 73 | similar mode is started, or when it is used with \\[next-error] | ||
| 74 | or \\[compile-goto-error].") | ||
| 75 | |||
| 76 | (defvar next-error-function nil | ||
| 77 | "Function to use to find the next error in the current buffer. | ||
| 78 | The function is called with 2 parameters: | ||
| 79 | ARG is an integer specifying by how many errors to move. | ||
| 80 | RESET is a boolean which, if non-nil, says to go back to the beginning | ||
| 81 | of the errors before moving. | ||
| 82 | Major modes providing compile-like functionality should set this variable | ||
| 83 | to indicate to `next-error' that this is a candidate buffer and how | ||
| 84 | to navigate in it.") | ||
| 85 | |||
| 86 | (make-variable-buffer-local 'next-error-function) | ||
| 87 | |||
| 88 | (defsubst next-error-buffer-p (buffer &optional extra-test) | ||
| 89 | "Test if BUFFER is a next-error capable buffer." | ||
| 90 | (with-current-buffer buffer | ||
| 91 | (or (and extra-test (funcall extra-test)) | ||
| 92 | next-error-function))) | ||
| 93 | |||
| 94 | ;; Return a next-error capable buffer according to the following rules: | ||
| 95 | ;; 1. If the current buffer is a next-error capable buffer, return it. | ||
| 96 | ;; 2. If one window on the selected frame displays such buffer, return it. | ||
| 97 | ;; 3. If next-error-last-buffer is set to a live buffer, use that. | ||
| 98 | ;; 4. Otherwise, look for a next-error capable buffer in a buffer list. | ||
| 99 | ;; 5. Signal an error if there are none. | ||
| 100 | (defun next-error-find-buffer (&optional other-buffer extra-test) | ||
| 101 | (if (and (not other-buffer) | ||
| 102 | (next-error-buffer-p (current-buffer) extra-test)) | ||
| 103 | ;; The current buffer is a next-error capable buffer. | ||
| 104 | (current-buffer) | ||
| 105 | (or | ||
| 106 | (let ((window-buffers | ||
| 107 | (delete-dups | ||
| 108 | (delq nil | ||
| 109 | (mapcar (lambda (w) | ||
| 110 | (and (next-error-buffer-p (window-buffer w) extra-test) | ||
| 111 | (window-buffer w))) | ||
| 112 | (window-list)))))) | ||
| 113 | (if other-buffer | ||
| 114 | (setq window-buffers (delq (current-buffer) window-buffers))) | ||
| 115 | (if (eq (length window-buffers) 1) | ||
| 116 | (car window-buffers))) | ||
| 117 | (if (and next-error-last-buffer (buffer-name next-error-last-buffer) | ||
| 118 | (next-error-buffer-p next-error-last-buffer extra-test) | ||
| 119 | (or (not other-buffer) (not (eq next-error-last-buffer | ||
| 120 | (current-buffer))))) | ||
| 121 | next-error-last-buffer | ||
| 122 | (let ((buffers (buffer-list))) | ||
| 123 | (while (and buffers (or (not (next-error-buffer-p (car buffers) extra-test)) | ||
| 124 | (and other-buffer | ||
| 125 | (eq (car buffers) (current-buffer))))) | ||
| 126 | (setq buffers (cdr buffers))) | ||
| 127 | (if buffers | ||
| 128 | (car buffers) | ||
| 129 | (or (and other-buffer | ||
| 130 | (next-error-buffer-p (current-buffer) extra-test) | ||
| 131 | ;; The current buffer is a next-error capable buffer. | ||
| 132 | (progn | ||
| 133 | (if other-buffer | ||
| 134 | (message "This is the only next-error capable buffer.")) | ||
| 135 | (current-buffer))) | ||
| 136 | (error "No next-error capable buffer found")))))))) | ||
| 137 | |||
| 138 | (defun next-error (arg &optional reset) | ||
| 139 | "Visit next next-error message and corresponding source code. | ||
| 140 | |||
| 141 | If all the error messages parsed so far have been processed already, | ||
| 142 | the message buffer is checked for new ones. | ||
| 143 | |||
| 144 | A prefix ARG specifies how many error messages to move; | ||
| 145 | negative means move back to previous error messages. | ||
| 146 | Just \\[universal-argument] as a prefix means reparse the error message buffer | ||
| 147 | and start at the first error. | ||
| 148 | |||
| 149 | The RESET argument specifies that we should restart from the beginning. | ||
| 150 | |||
| 151 | \\[next-error] normally uses the most recently started | ||
| 152 | compilation, grep, or occur buffer. It can also operate on any | ||
| 153 | buffer with output from the \\[compile], \\[grep] commands, or, | ||
| 154 | more generally, on any buffer in Compilation mode or with | ||
| 155 | Compilation Minor mode enabled, or any buffer in which | ||
| 156 | `next-error-function' is bound to an appropriate | ||
| 157 | function. To specify use of a particular buffer for error | ||
| 158 | messages, type \\[next-error] in that buffer. | ||
| 159 | |||
| 160 | Once \\[next-error] has chosen the buffer for error messages, | ||
| 161 | it stays with that buffer until you use it in some other buffer which | ||
| 162 | uses Compilation mode or Compilation Minor mode. | ||
| 163 | |||
| 164 | See variables `compilation-parse-errors-function' and | ||
| 165 | \`compilation-error-regexp-alist' for customization ideas." | ||
| 166 | (interactive "P") | ||
| 167 | (if (consp arg) (setq reset t arg nil)) | ||
| 168 | (when (setq next-error-last-buffer (next-error-find-buffer)) | ||
| 169 | ;; we know here that next-error-function is a valid symbol we can funcall | ||
| 170 | (with-current-buffer next-error-last-buffer | ||
| 171 | (funcall next-error-function (prefix-numeric-value arg) reset)))) | ||
| 172 | |||
| 173 | (defalias 'goto-next-locus 'next-error) | ||
| 174 | (defalias 'next-match 'next-error) | ||
| 175 | |||
| 176 | (define-key ctl-x-map "`" 'next-error) | ||
| 177 | |||
| 178 | (defun previous-error (n) | ||
| 179 | "Visit previous next-error message and corresponding source code. | ||
| 180 | |||
| 181 | Prefix arg N says how many error messages to move backwards (or | ||
| 182 | forwards, if negative). | ||
| 183 | |||
| 184 | This operates on the output from the \\[compile] and \\[grep] commands." | ||
| 185 | (interactive "p") | ||
| 186 | (next-error (- n))) | ||
| 187 | |||
| 188 | (defun first-error (n) | ||
| 189 | "Restart at the first error. | ||
| 190 | Visit corresponding source code. | ||
| 191 | With prefix arg N, visit the source code of the Nth error. | ||
| 192 | This operates on the output from the \\[compile] command, for instance." | ||
| 193 | (interactive "p") | ||
| 194 | (next-error n t)) | ||
| 195 | |||
| 196 | (defun next-error-no-select (n) | ||
| 197 | "Move point to the next error in the next-error buffer and highlight match. | ||
| 198 | Prefix arg N says how many error messages to move forwards (or | ||
| 199 | backwards, if negative). | ||
| 200 | Finds and highlights the source line like \\[next-error], but does not | ||
| 201 | select the source buffer." | ||
| 202 | (interactive "p") | ||
| 203 | (next-error n) | ||
| 204 | (pop-to-buffer next-error-last-buffer)) | ||
| 205 | |||
| 206 | (defun previous-error-no-select (n) | ||
| 207 | "Move point to the previous error in the next-error buffer and highlight match. | ||
| 208 | Prefix arg N says how many error messages to move backwards (or | ||
| 209 | forwards, if negative). | ||
| 210 | Finds and highlights the source line like \\[previous-error], but does not | ||
| 211 | select the source buffer." | ||
| 212 | (interactive "p") | ||
| 213 | (next-error-no-select (- n))) | ||
| 214 | |||
| 215 | ;;; | ||
| 216 | |||
| 69 | (defun fundamental-mode () | 217 | (defun fundamental-mode () |
| 70 | "Major mode not specialized for anything in particular. | 218 | "Major mode not specialized for anything in particular. |
| 71 | Other major modes are defined by comparison with this one." | 219 | Other major modes are defined by comparison with this one." |
| @@ -159,7 +307,7 @@ than the value of `fill-column' and ARG is nil." | |||
| 159 | (put-text-property from (point) 'rear-nonsticky | 307 | (put-text-property from (point) 'rear-nonsticky |
| 160 | (cons 'hard sticky))))) | 308 | (cons 'hard sticky))))) |
| 161 | 309 | ||
| 162 | (defun open-line (arg) | 310 | (defun open-line (n) |
| 163 | "Insert a newline and leave point before it. | 311 | "Insert a newline and leave point before it. |
| 164 | If there is a fill prefix and/or a left-margin, insert them on the new line | 312 | If there is a fill prefix and/or a left-margin, insert them on the new line |
| 165 | if the line would have been blank. | 313 | if the line would have been blank. |
| @@ -170,23 +318,23 @@ With arg N, insert N newlines." | |||
| 170 | (loc (point)) | 318 | (loc (point)) |
| 171 | ;; Don't expand an abbrev before point. | 319 | ;; Don't expand an abbrev before point. |
| 172 | (abbrev-mode nil)) | 320 | (abbrev-mode nil)) |
| 173 | (newline arg) | 321 | (newline n) |
| 174 | (goto-char loc) | 322 | (goto-char loc) |
| 175 | (while (> arg 0) | 323 | (while (> n 0) |
| 176 | (cond ((bolp) | 324 | (cond ((bolp) |
| 177 | (if do-left-margin (indent-to (current-left-margin))) | 325 | (if do-left-margin (indent-to (current-left-margin))) |
| 178 | (if do-fill-prefix (insert-and-inherit fill-prefix)))) | 326 | (if do-fill-prefix (insert-and-inherit fill-prefix)))) |
| 179 | (forward-line 1) | 327 | (forward-line 1) |
| 180 | (setq arg (1- arg))) | 328 | (setq n (1- n))) |
| 181 | (goto-char loc) | 329 | (goto-char loc) |
| 182 | (end-of-line))) | 330 | (end-of-line))) |
| 183 | 331 | ||
| 184 | (defun split-line (&optional arg) | 332 | (defun split-line (&optional arg) |
| 185 | "Split current line, moving portion beyond point vertically down. | 333 | "Split current line, moving portion beyond point vertically down. |
| 186 | If the current line starts with `fill-prefix', insert it on the new | 334 | If the current line starts with `fill-prefix', insert it on the new |
| 187 | line as well. With prefix arg, don't insert fill-prefix on new line. | 335 | line as well. With prefix ARG, don't insert fill-prefix on new line. |
| 188 | 336 | ||
| 189 | When called from Lisp code, the arg may be a prefix string to copy." | 337 | When called from Lisp code, ARG may be a prefix string to copy." |
| 190 | (interactive "*P") | 338 | (interactive "*P") |
| 191 | (skip-chars-forward " \t") | 339 | (skip-chars-forward " \t") |
| 192 | (let* ((col (current-column)) | 340 | (let* ((col (current-column)) |
| @@ -637,6 +785,23 @@ If nil, don't change the value of `debug-on-error'." | |||
| 637 | :type 'boolean | 785 | :type 'boolean |
| 638 | :version "21.1") | 786 | :version "21.1") |
| 639 | 787 | ||
| 788 | (defun eval-expression-print-format (value) | ||
| 789 | "Format VALUE as a result of evaluated expression. | ||
| 790 | Return a formatted string which is displayed in the echo area | ||
| 791 | in addition to the value printed by prin1 in functions which | ||
| 792 | display the result of expression evaluation." | ||
| 793 | (if (and (integerp value) | ||
| 794 | (or (not (memq this-command '(eval-last-sexp eval-print-last-sexp))) | ||
| 795 | (eq this-command last-command) | ||
| 796 | (and (boundp 'edebug-active) edebug-active))) | ||
| 797 | (let ((char-string | ||
| 798 | (if (or (and (boundp 'edebug-active) edebug-active) | ||
| 799 | (memq this-command '(eval-last-sexp eval-print-last-sexp))) | ||
| 800 | (prin1-char value)))) | ||
| 801 | (if char-string | ||
| 802 | (format " (0%o, 0x%x) = %s" value value char-string) | ||
| 803 | (format " (0%o, 0x%x)" value value))))) | ||
| 804 | |||
| 640 | ;; We define this, rather than making `eval' interactive, | 805 | ;; We define this, rather than making `eval' interactive, |
| 641 | ;; for the sake of completion of names like eval-region, eval-current-buffer. | 806 | ;; for the sake of completion of names like eval-region, eval-current-buffer. |
| 642 | (defun eval-expression (eval-expression-arg | 807 | (defun eval-expression (eval-expression-arg |
| @@ -671,7 +836,10 @@ the echo area." | |||
| 671 | (with-no-warnings | 836 | (with-no-warnings |
| 672 | (let ((standard-output (current-buffer))) | 837 | (let ((standard-output (current-buffer))) |
| 673 | (eval-last-sexp-print-value (car values)))) | 838 | (eval-last-sexp-print-value (car values)))) |
| 674 | (prin1 (car values) t)))) | 839 | (prog1 |
| 840 | (prin1 (car values) t) | ||
| 841 | (let ((str (eval-expression-print-format (car values)))) | ||
| 842 | (if str (princ str t))))))) | ||
| 675 | 843 | ||
| 676 | (defun edit-and-eval-command (prompt command) | 844 | (defun edit-and-eval-command (prompt command) |
| 677 | "Prompting with PROMPT, let user edit COMMAND and eval result. | 845 | "Prompting with PROMPT, let user edit COMMAND and eval result. |
| @@ -785,7 +953,8 @@ See also `minibuffer-history-case-insensitive-variables'." | |||
| 785 | nil | 953 | nil |
| 786 | minibuffer-local-map | 954 | minibuffer-local-map |
| 787 | nil | 955 | nil |
| 788 | 'minibuffer-history-search-history))) | 956 | 'minibuffer-history-search-history |
| 957 | (car minibuffer-history-search-history)))) | ||
| 789 | ;; Use the last regexp specified, by default, if input is empty. | 958 | ;; Use the last regexp specified, by default, if input is empty. |
| 790 | (list (if (string= regexp "") | 959 | (list (if (string= regexp "") |
| 791 | (if minibuffer-history-search-history | 960 | (if minibuffer-history-search-history |
| @@ -987,7 +1156,7 @@ as an argument limits undo to changes within the current region." | |||
| 987 | (undo-start)) | 1156 | (undo-start)) |
| 988 | ;; get rid of initial undo boundary | 1157 | ;; get rid of initial undo boundary |
| 989 | (undo-more 1)) | 1158 | (undo-more 1)) |
| 990 | ;; If we got this far, the next command should be a consecutive undo. | 1159 | ;; If we got this far, the next command should be a consecutive undo. |
| 991 | (setq this-command 'undo) | 1160 | (setq this-command 'undo) |
| 992 | ;; Check to see whether we're hitting a redo record, and if | 1161 | ;; Check to see whether we're hitting a redo record, and if |
| 993 | ;; so, ask the user whether she wants to skip the redo/undo pair. | 1162 | ;; so, ask the user whether she wants to skip the redo/undo pair. |
| @@ -1935,7 +2104,7 @@ the text, but put the text in the kill ring anyway. This means that | |||
| 1935 | you can use the killing commands to copy text from a read-only buffer. | 2104 | you can use the killing commands to copy text from a read-only buffer. |
| 1936 | 2105 | ||
| 1937 | This is the primitive for programs to kill text (as opposed to deleting it). | 2106 | This is the primitive for programs to kill text (as opposed to deleting it). |
| 1938 | Supply two arguments, character numbers indicating the stretch of text | 2107 | Supply two arguments, character positions indicating the stretch of text |
| 1939 | to be killed. | 2108 | to be killed. |
| 1940 | Any command that calls this function is a \"kill command\". | 2109 | Any command that calls this function is a \"kill command\". |
| 1941 | If the previous command was also a kill command, | 2110 | If the previous command was also a kill command, |
| @@ -2009,11 +2178,12 @@ visual feedback indicating the extent of the region being copied." | |||
| 2009 | ;; look like a C-g typed as a command. | 2178 | ;; look like a C-g typed as a command. |
| 2010 | (inhibit-quit t)) | 2179 | (inhibit-quit t)) |
| 2011 | (if (pos-visible-in-window-p other-end (selected-window)) | 2180 | (if (pos-visible-in-window-p other-end (selected-window)) |
| 2012 | (unless transient-mark-mode | 2181 | (unless (and transient-mark-mode |
| 2182 | (face-background 'region)) | ||
| 2013 | ;; Swap point and mark. | 2183 | ;; Swap point and mark. |
| 2014 | (set-marker (mark-marker) (point) (current-buffer)) | 2184 | (set-marker (mark-marker) (point) (current-buffer)) |
| 2015 | (goto-char other-end) | 2185 | (goto-char other-end) |
| 2016 | (sit-for 1) | 2186 | (sit-for blink-matching-delay) |
| 2017 | ;; Swap back. | 2187 | ;; Swap back. |
| 2018 | (set-marker (mark-marker) other-end (current-buffer)) | 2188 | (set-marker (mark-marker) other-end (current-buffer)) |
| 2019 | (goto-char opoint) | 2189 | (goto-char opoint) |
| @@ -2051,7 +2221,7 @@ The argument is used for internal purposes; do not supply one." | |||
| 2051 | The value should be a list of text properties to discard or t, | 2221 | The value should be a list of text properties to discard or t, |
| 2052 | which means to discard all text properties." | 2222 | which means to discard all text properties." |
| 2053 | :type '(choice (const :tag "All" t) (repeat symbol)) | 2223 | :type '(choice (const :tag "All" t) (repeat symbol)) |
| 2054 | :group 'editing | 2224 | :group 'killing |
| 2055 | :version "21.4") | 2225 | :version "21.4") |
| 2056 | 2226 | ||
| 2057 | (defvar yank-window-start nil) | 2227 | (defvar yank-window-start nil) |
| @@ -2261,8 +2431,7 @@ With prefix arg, kill that many lines starting from the current line. | |||
| 2261 | If arg is negative, kill backward. Also kill the preceding newline. | 2431 | If arg is negative, kill backward. Also kill the preceding newline. |
| 2262 | \(This is meant to make C-x z work well with negative arguments.\) | 2432 | \(This is meant to make C-x z work well with negative arguments.\) |
| 2263 | If arg is zero, kill current line but exclude the trailing newline." | 2433 | If arg is zero, kill current line but exclude the trailing newline." |
| 2264 | (interactive "P") | 2434 | (interactive "p") |
| 2265 | (setq arg (prefix-numeric-value arg)) | ||
| 2266 | (if (and (> arg 0) (eobp) (save-excursion (forward-visible-line 0) (eobp))) | 2435 | (if (and (> arg 0) (eobp) (save-excursion (forward-visible-line 0) (eobp))) |
| 2267 | (signal 'end-of-buffer nil)) | 2436 | (signal 'end-of-buffer nil)) |
| 2268 | (if (and (< arg 0) (bobp) (save-excursion (end-of-visible-line) (bobp))) | 2437 | (if (and (< arg 0) (bobp) (save-excursion (end-of-visible-line) (bobp))) |
| @@ -3257,15 +3426,14 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 3257 | ;; (Actually some major modes use a different auto-fill function, | 3426 | ;; (Actually some major modes use a different auto-fill function, |
| 3258 | ;; but this one is the default one.) | 3427 | ;; but this one is the default one.) |
| 3259 | (defun do-auto-fill () | 3428 | (defun do-auto-fill () |
| 3260 | (let (fc justify bol give-up | 3429 | (let (fc justify give-up |
| 3261 | (fill-prefix fill-prefix)) | 3430 | (fill-prefix fill-prefix)) |
| 3262 | (if (or (not (setq justify (current-justification))) | 3431 | (if (or (not (setq justify (current-justification))) |
| 3263 | (null (setq fc (current-fill-column))) | 3432 | (null (setq fc (current-fill-column))) |
| 3264 | (and (eq justify 'left) | 3433 | (and (eq justify 'left) |
| 3265 | (<= (current-column) fc)) | 3434 | (<= (current-column) fc)) |
| 3266 | (save-excursion (beginning-of-line) | 3435 | (and auto-fill-inhibit-regexp |
| 3267 | (setq bol (point)) | 3436 | (save-excursion (beginning-of-line) |
| 3268 | (and auto-fill-inhibit-regexp | ||
| 3269 | (looking-at auto-fill-inhibit-regexp)))) | 3437 | (looking-at auto-fill-inhibit-regexp)))) |
| 3270 | nil ;; Auto-filling not required | 3438 | nil ;; Auto-filling not required |
| 3271 | (if (memq justify '(full center right)) | 3439 | (if (memq justify '(full center right)) |
| @@ -3288,16 +3456,15 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 3288 | ;; Determine where to split the line. | 3456 | ;; Determine where to split the line. |
| 3289 | (let* (after-prefix | 3457 | (let* (after-prefix |
| 3290 | (fill-point | 3458 | (fill-point |
| 3291 | (let ((opoint (point))) | 3459 | (save-excursion |
| 3292 | (save-excursion | 3460 | (beginning-of-line) |
| 3293 | (beginning-of-line) | 3461 | (setq after-prefix (point)) |
| 3294 | (setq after-prefix (point)) | 3462 | (and fill-prefix |
| 3295 | (and fill-prefix | 3463 | (looking-at (regexp-quote fill-prefix)) |
| 3296 | (looking-at (regexp-quote fill-prefix)) | 3464 | (setq after-prefix (match-end 0))) |
| 3297 | (setq after-prefix (match-end 0))) | 3465 | (move-to-column (1+ fc)) |
| 3298 | (move-to-column (1+ fc)) | 3466 | (fill-move-to-break-point after-prefix) |
| 3299 | (fill-move-to-break-point after-prefix) | 3467 | (point)))) |
| 3300 | (point))))) | ||
| 3301 | 3468 | ||
| 3302 | ;; See whether the place we found is any good. | 3469 | ;; See whether the place we found is any good. |
| 3303 | (if (save-excursion | 3470 | (if (save-excursion |
| @@ -4116,27 +4283,29 @@ The completion list buffer is available as the value of `standard-output'.") | |||
| 4116 | 4283 | ||
| 4117 | ;; This function goes in completion-setup-hook, so that it is called | 4284 | ;; This function goes in completion-setup-hook, so that it is called |
| 4118 | ;; after the text of the completion list buffer is written. | 4285 | ;; after the text of the completion list buffer is written. |
| 4119 | (defface completion-emphasis | 4286 | (defface completions-first-difference |
| 4120 | '((t (:inherit bold))) | 4287 | '((t (:inherit bold))) |
| 4121 | "Face put on the first uncommon character in completions in *Completions* buffer." | 4288 | "Face put on the first uncommon character in completions in *Completions* buffer." |
| 4122 | :group 'completion) | 4289 | :group 'completion) |
| 4123 | 4290 | ||
| 4124 | (defface completion-de-emphasis | 4291 | (defface completions-common-part |
| 4125 | '((t (:inherit default))) | 4292 | '((t (:inherit default))) |
| 4126 | "Face put on the common prefix substring in completions in *Completions* buffer." | 4293 | "Face put on the common prefix substring in completions in *Completions* buffer. |
| 4294 | The idea of `completions-common-part' is that you can use it to | ||
| 4295 | make the common parts less visible than normal, so that the rest | ||
| 4296 | of the differing parts is, by contrast, slightly highlighted." | ||
| 4127 | :group 'completion) | 4297 | :group 'completion) |
| 4128 | 4298 | ||
| 4129 | (defun completion-setup-function () | 4299 | (defun completion-setup-function () |
| 4130 | (save-excursion | 4300 | (let ((mainbuf (current-buffer)) |
| 4131 | (let ((mainbuf (current-buffer)) | 4301 | (mbuf-contents (minibuffer-contents))) |
| 4132 | (mbuf-contents (minibuffer-contents))) | 4302 | ;; When reading a file name in the minibuffer, |
| 4133 | ;; When reading a file name in the minibuffer, | 4303 | ;; set default-directory in the minibuffer |
| 4134 | ;; set default-directory in the minibuffer | 4304 | ;; so it will get copied into the completion list buffer. |
| 4135 | ;; so it will get copied into the completion list buffer. | 4305 | (if minibuffer-completing-file-name |
| 4136 | (if minibuffer-completing-file-name | 4306 | (with-current-buffer mainbuf |
| 4137 | (with-current-buffer mainbuf | 4307 | (setq default-directory (file-name-directory mbuf-contents)))) |
| 4138 | (setq default-directory (file-name-directory mbuf-contents)))) | 4308 | (with-current-buffer standard-output |
| 4139 | (set-buffer standard-output) | ||
| 4140 | (completion-list-mode) | 4309 | (completion-list-mode) |
| 4141 | (make-local-variable 'completion-reference-buffer) | 4310 | (make-local-variable 'completion-reference-buffer) |
| 4142 | (setq completion-reference-buffer mainbuf) | 4311 | (setq completion-reference-buffer mainbuf) |
| @@ -4145,35 +4314,36 @@ The completion list buffer is available as the value of `standard-output'.") | |||
| 4145 | ;; use the number of chars before the start of the | 4314 | ;; use the number of chars before the start of the |
| 4146 | ;; last file name component. | 4315 | ;; last file name component. |
| 4147 | (setq completion-base-size | 4316 | (setq completion-base-size |
| 4148 | (save-excursion | 4317 | (with-current-buffer mainbuf |
| 4149 | (set-buffer mainbuf) | 4318 | (save-excursion |
| 4150 | (goto-char (point-max)) | 4319 | (goto-char (point-max)) |
| 4151 | (skip-chars-backward "^/") | 4320 | (skip-chars-backward "^/") |
| 4152 | (- (point) (minibuffer-prompt-end)))) | 4321 | (- (point) (minibuffer-prompt-end))))) |
| 4153 | ;; Otherwise, in minibuffer, the whole input is being completed. | 4322 | ;; Otherwise, in minibuffer, the whole input is being completed. |
| 4154 | (save-match-data | 4323 | (if (minibufferp mainbuf) |
| 4155 | (if (minibufferp mainbuf) | 4324 | (setq completion-base-size 0))) |
| 4156 | (setq completion-base-size 0)))) | 4325 | ;; Put faces on first uncommon characters and common parts. |
| 4157 | ;; Put emphasis and de-emphasis faces on completions. | ||
| 4158 | (when completion-base-size | 4326 | (when completion-base-size |
| 4159 | (let ((common-string-length (length | 4327 | (let* ((common-string-length |
| 4160 | (substring mbuf-contents | 4328 | (- (length mbuf-contents) completion-base-size)) |
| 4161 | completion-base-size))) | 4329 | (element-start (next-single-property-change |
| 4162 | (element-start (next-single-property-change | 4330 | (point-min) |
| 4163 | (point-min) | 4331 | 'mouse-face)) |
| 4164 | 'mouse-face)) | 4332 | (element-common-end |
| 4165 | element-common-end) | 4333 | (+ (or element-start nil) common-string-length)) |
| 4166 | (while element-start | 4334 | (maxp (point-max))) |
| 4167 | (setq element-common-end (+ element-start common-string-length)) | 4335 | (while (and element-start (< element-common-end maxp)) |
| 4168 | (when (and (get-char-property element-start 'mouse-face) | 4336 | (when (and (get-char-property element-start 'mouse-face) |
| 4169 | (get-char-property element-common-end 'mouse-face)) | 4337 | (get-char-property element-common-end 'mouse-face)) |
| 4170 | (put-text-property element-start element-common-end | 4338 | (put-text-property element-start element-common-end |
| 4171 | 'font-lock-face 'completion-de-emphasis) | 4339 | 'font-lock-face 'completions-common-part) |
| 4172 | (put-text-property element-common-end (1+ element-common-end) | 4340 | (put-text-property element-common-end (1+ element-common-end) |
| 4173 | 'font-lock-face 'completion-emphasis)) | 4341 | 'font-lock-face 'completions-first-difference)) |
| 4174 | (setq element-start (next-single-property-change | 4342 | (setq element-start (next-single-property-change |
| 4175 | element-start | 4343 | element-start |
| 4176 | 'mouse-face))))) | 4344 | 'mouse-face)) |
| 4345 | (if element-start | ||
| 4346 | (setq element-common-end (+ element-start common-string-length)))))) | ||
| 4177 | ;; Insert help string. | 4347 | ;; Insert help string. |
| 4178 | (goto-char (point-min)) | 4348 | (goto-char (point-min)) |
| 4179 | (if (display-mouse-p) | 4349 | (if (display-mouse-p) |
| @@ -4624,5 +4794,5 @@ works by saving the value of `buffer-invisibility-spec' and setting it to nil." | |||
| 4624 | 4794 | ||
| 4625 | (provide 'simple) | 4795 | (provide 'simple) |
| 4626 | 4796 | ||
| 4627 | ;;; arch-tag: 24af67c0-2a49-44f6-b3b1-312d8b570dfd | 4797 | ;; arch-tag: 24af67c0-2a49-44f6-b3b1-312d8b570dfd |
| 4628 | ;;; simple.el ends here | 4798 | ;;; simple.el ends here |