Mercurial > emacs
comparison lisp/register.el @ 2699:83fee0378e0e
(jump-to-register): Allow file name "in" a register.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 09 May 1993 00:57:56 +0000 |
parents | b65cf676a09b |
children | 7520bbbe9100 |
comparison
equal
deleted
inserted
replaced
2698:6940c6b5d988 | 2699:83fee0378e0e |
---|---|
32 | 32 |
33 (defvar register-alist nil | 33 (defvar register-alist nil |
34 "Alist of elements (NAME . CONTENTS), one for each Emacs register. | 34 "Alist of elements (NAME . CONTENTS), one for each Emacs register. |
35 NAME is a character (a number). CONTENTS is a string, number, | 35 NAME is a character (a number). CONTENTS is a string, number, |
36 frame configuration, mark or list. | 36 frame configuration, mark or list. |
37 A list represents a rectangle; its elements are strings.") | 37 A list of strings represents a rectangle. |
38 A list of the form (file . NAME) represents the file named NAME.") | |
38 | 39 |
39 (defun get-register (char) | 40 (defun get-register (char) |
40 "Return contents of Emacs register named CHAR, or nil if none." | 41 "Return contents of Emacs register named CHAR, or nil if none." |
41 (cdr (assq char register-alist))) | 42 (cdr (assq char register-alist))) |
42 | 43 |
43 (defun set-register (char value) | 44 (defun set-register (char value) |
44 "Set contents of Emacs register named CHAR to VALUE. Returns VALUE." | 45 "Set contents of Emacs register named CHAR to VALUE. Returns VALUE. |
46 See the documentation of the variable `register-alist' for possible VALUE." | |
45 (let ((aelt (assq char register-alist))) | 47 (let ((aelt (assq char register-alist))) |
46 (if aelt | 48 (if aelt |
47 (setcdr aelt value) | 49 (setcdr aelt value) |
48 (setq aelt (cons char value)) | 50 (setq aelt (cons char value)) |
49 (setq register-alist (cons aelt register-alist))) | 51 (setq register-alist (cons aelt register-alist))) |
72 (set-register char (current-frame-configuration))) | 74 (set-register char (current-frame-configuration))) |
73 | 75 |
74 (defalias 'register-to-point 'jump-to-register) | 76 (defalias 'register-to-point 'jump-to-register) |
75 (defun jump-to-register (char) | 77 (defun jump-to-register (char) |
76 "Move point to location stored in a register. | 78 "Move point to location stored in a register. |
79 If the register contains a file name, find that file. | |
80 \(To put a file name in a register, you must use `set-register'.) | |
77 If the register contains a window configuration (one frame) or a frame | 81 If the register contains a window configuration (one frame) or a frame |
78 configuration (all frames), restore that frame or all frames accordingly. | 82 configuration (all frames), restore that frame or all frames accordingly. |
79 Argument is a character, naming the register." | 83 Argument is a character, naming the register." |
80 (interactive "cJump to register: ") | 84 (interactive "cJump to register: ") |
81 (let ((val (get-register char))) | 85 (let ((val (get-register char))) |
85 ((window-configuration-p val) | 89 ((window-configuration-p val) |
86 (set-window-configuration val)) | 90 (set-window-configuration val)) |
87 ((markerp val) | 91 ((markerp val) |
88 (switch-to-buffer (marker-buffer val)) | 92 (switch-to-buffer (marker-buffer val)) |
89 (goto-char val)) | 93 (goto-char val)) |
94 ((and (consp val) (eq (car val) 'file)) | |
95 (find-file (cdr val))) | |
90 (t | 96 (t |
91 (error "Register doesn't contain a buffer position or configuration"))))) | 97 (error "Register doesn't contain a buffer position or configuration"))))) |
92 | 98 |
93 ;(defun number-to-register (arg char) | 99 ;(defun number-to-register (arg char) |
94 ; "Store a number in a register. | 100 ; "Store a number in a register. |