Mercurial > emacs
comparison lisp/register.el @ 141:405b4fa6de27
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 16 Dec 1990 17:53:49 +0000 |
parents | 21f566443ad1 |
children | cca4fc067605 |
comparison
equal
deleted
inserted
replaced
140:9de5f63b6407 | 141:405b4fa6de27 |
---|---|
19 | 19 |
20 | 20 |
21 (defvar register-alist nil | 21 (defvar register-alist nil |
22 "Alist of elements (NAME . CONTENTS), one for each Emacs register. | 22 "Alist of elements (NAME . CONTENTS), one for each Emacs register. |
23 NAME is a character (a number). CONTENTS is a string, number, | 23 NAME is a character (a number). CONTENTS is a string, number, |
24 mark or list. A list represents a rectangle; its elements are strings.") | 24 screen configuration, mark or list. |
25 A list represents a rectangle; its elements are strings.") | |
25 | 26 |
26 (defun get-register (char) | 27 (defun get-register (char) |
27 "Return contents of Emacs register named CHAR, or nil if none." | 28 "Return contents of Emacs register named CHAR, or nil if none." |
28 (cdr (assq char register-alist))) | 29 (cdr (assq char register-alist))) |
29 | 30 |
35 (setcdr aelt value) | 36 (setcdr aelt value) |
36 (setq aelt (cons char value)) | 37 (setq aelt (cons char value)) |
37 (setq register-alist (cons aelt register-alist))) | 38 (setq register-alist (cons aelt register-alist))) |
38 value)) | 39 value)) |
39 | 40 |
40 (defun point-to-register (char) | 41 (defun point-to-register (char arg) |
41 "Store current location of point in a register. | 42 "Store current location of point in register REGISTER. |
43 With prefix argument, store current screen configuration. | |
44 Use \\[jump-to-register] to go to that location or restore that configuration. | |
42 Argument is a character, naming the register." | 45 Argument is a character, naming the register." |
43 (interactive "cPoint to register: ") | 46 (interactive "cPoint to register: \nP") |
44 (set-register char (point-marker))) | 47 (set-register char (if arg (current-screen-configuration) (point-marker)))) |
45 | 48 |
46 (fset 'register-to-point 'jump-to-register) | 49 (fset 'register-to-point 'jump-to-register) |
47 (defun jump-to-register (char) | 50 (defun jump-to-register (char) |
48 "Move point to location stored in a register. | 51 "Move point to location stored in a register. |
49 Argument is a character, naming the register." | 52 Argument is a character, naming the register." |
50 (interactive "cJump to register: ") | 53 (interactive "cJump to register: ") |
51 (let ((val (get-register char))) | 54 (let ((val (get-register char))) |
52 (if (markerp val) | 55 (condition-case () |
53 (progn | 56 (set-screen-configuration val) |
54 (switch-to-buffer (marker-buffer val)) | 57 (error |
55 (goto-char val)) | 58 (if (markerp val) |
56 (error "Register doesn't contain a buffer position")))) | 59 (progn |
60 (switch-to-buffer (marker-buffer val)) | |
61 (goto-char val)) | |
62 (error "Register doesn't contain a buffer position or screen configuration"))))) | |
57 | 63 |
58 ;(defun number-to-register (arg char) | 64 ;(defun number-to-register (arg char) |
59 ; "Store a number in a register. | 65 ; "Store a number in a register. |
60 ;Two args, NUMBER and REGISTER (a character, naming the register). | 66 ;Two args, NUMBER and REGISTER (a character, naming the register). |
61 ;If NUMBER is nil, digits in the buffer following point are read | 67 ;If NUMBER is nil, digits in the buffer following point are read |