diff options
| author | Richard M. Stallman | 1993-03-09 05:40:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-03-09 05:40:33 +0000 |
| commit | af39530ef0d6622ca5d08948a2da37cbe93f1969 (patch) | |
| tree | 29360cddb762fba4ee7e42841a5370ac9d55c00d | |
| parent | af9157b9bcef785b4b17bae541f8935bd39af1c8 (diff) | |
| download | emacs-af39530ef0d6622ca5d08948a2da37cbe93f1969.tar.gz emacs-af39530ef0d6622ca5d08948a2da37cbe93f1969.zip | |
(set-mark): Activate the mark.
(mark): Handle region-active. New optional arg FORCE.
(exchange-point-and-mark, push_mark): Pass FORCE.
(set-mark-command): Likewise.
| -rw-r--r-- | lisp/simple.el | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index b2bb0c0b37c..62f70063658 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1154,11 +1154,16 @@ START and END specify the portion of the current buffer to be copied." | |||
| 1154 | (save-excursion | 1154 | (save-excursion |
| 1155 | (insert-buffer-substring oldbuf start end))))) | 1155 | (insert-buffer-substring oldbuf start end))))) |
| 1156 | 1156 | ||
| 1157 | (defun mark () | 1157 | (defun mark (&optional force) |
| 1158 | "Return this buffer's mark value as integer, or nil if no mark. | 1158 | "Return this buffer's mark value as integer, or nil if no active mark now. |
| 1159 | If optional argument FORCE is non-nil, access the mark value | ||
| 1160 | even if the mark is not currently active. | ||
| 1161 | |||
| 1159 | If you are using this in an editing command, you are most likely making | 1162 | If you are using this in an editing command, you are most likely making |
| 1160 | a mistake; see the documentation of `set-mark'." | 1163 | a mistake; see the documentation of `set-mark'." |
| 1161 | (marker-position (mark-marker))) | 1164 | (if (or force mark-active) |
| 1165 | (marker-position (mark-marker)) | ||
| 1166 | (error "The mark is not currently active"))) | ||
| 1162 | 1167 | ||
| 1163 | (defun set-mark (pos) | 1168 | (defun set-mark (pos) |
| 1164 | "Set this buffer's mark to POS. Don't use this function! | 1169 | "Set this buffer's mark to POS. Don't use this function! |
| @@ -1177,6 +1182,8 @@ store it in a Lisp variable. Example: | |||
| 1177 | 1182 | ||
| 1178 | (let ((beg (point))) (forward-line 1) (delete-region beg (point)))." | 1183 | (let ((beg (point))) (forward-line 1) (delete-region beg (point)))." |
| 1179 | 1184 | ||
| 1185 | (setq mark-active t) | ||
| 1186 | (run-hooks 'activate-mark-hook) | ||
| 1180 | (set-marker (mark-marker) pos (current-buffer))) | 1187 | (set-marker (mark-marker) pos (current-buffer))) |
| 1181 | 1188 | ||
| 1182 | (defvar mark-ring nil | 1189 | (defvar mark-ring nil |
| @@ -1197,7 +1204,7 @@ purposes. See the documentation of `set-mark' for more information." | |||
| 1197 | (interactive "P") | 1204 | (interactive "P") |
| 1198 | (if (null arg) | 1205 | (if (null arg) |
| 1199 | (push-mark) | 1206 | (push-mark) |
| 1200 | (if (null (mark)) | 1207 | (if (null (mark t)) |
| 1201 | (error "No mark set in this buffer") | 1208 | (error "No mark set in this buffer") |
| 1202 | (goto-char (mark)) | 1209 | (goto-char (mark)) |
| 1203 | (pop-mark)))) | 1210 | (pop-mark)))) |
| @@ -1208,7 +1215,7 @@ Displays \"Mark set\" unless the optional second arg NOMSG is non-nil. | |||
| 1208 | 1215 | ||
| 1209 | Novice Emacs Lisp programmers often try to use the mark for the wrong | 1216 | Novice Emacs Lisp programmers often try to use the mark for the wrong |
| 1210 | purposes. See the documentation of `set-mark' for more information." | 1217 | purposes. See the documentation of `set-mark' for more information." |
| 1211 | (if (null (mark)) | 1218 | (if (null (mark t)) |
| 1212 | nil | 1219 | nil |
| 1213 | (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring)) | 1220 | (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring)) |
| 1214 | (if (> (length mark-ring) mark-ring-max) | 1221 | (if (> (length mark-ring) mark-ring-max) |
| @@ -1233,9 +1240,11 @@ Does not set point. Does nothing if mark ring is empty." | |||
| 1233 | 1240 | ||
| 1234 | (fset 'exchange-dot-and-mark 'exchange-point-and-mark) | 1241 | (fset 'exchange-dot-and-mark 'exchange-point-and-mark) |
| 1235 | (defun exchange-point-and-mark () | 1242 | (defun exchange-point-and-mark () |
| 1236 | "Put the mark where point is now, and point where the mark is now." | 1243 | "Put the mark where point is now, and point where the mark is now. |
| 1244 | This command works even when the mark is not active, | ||
| 1245 | and it reactivates the mark." | ||
| 1237 | (interactive nil) | 1246 | (interactive nil) |
| 1238 | (let ((omark (mark))) | 1247 | (let ((omark (mark t))) |
| 1239 | (if (null omark) | 1248 | (if (null omark) |
| 1240 | (error "No mark set in this buffer")) | 1249 | (error "No mark set in this buffer")) |
| 1241 | (set-mark (point)) | 1250 | (set-mark (point)) |
| @@ -1869,7 +1878,9 @@ when close-paren is inserted.") | |||
| 1869 | ; this is just something for the luser to see in a keymap -- this is not | 1878 | ; this is just something for the luser to see in a keymap -- this is not |
| 1870 | ; how quitting works normally! | 1879 | ; how quitting works normally! |
| 1871 | (defun keyboard-quit () | 1880 | (defun keyboard-quit () |
| 1872 | "Signal a quit condition." | 1881 | "Signal a quit condition. |
| 1882 | During execution of Lisp code, this character causes a quit directly. | ||
| 1883 | At top-level, as an editor command, this simply beeps." | ||
| 1873 | (interactive) | 1884 | (interactive) |
| 1874 | (signal 'quit nil)) | 1885 | (signal 'quit nil)) |
| 1875 | 1886 | ||