Commit b42e6156 authored by Richard M. Stallman's avatar Richard M. Stallman

*** empty log message ***

parent c9a9e8bc
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
(defvar register-alist nil (defvar register-alist nil
"Alist of elements (NAME . CONTENTS), one for each Emacs register. "Alist of elements (NAME . CONTENTS), one for each Emacs register.
NAME is a character (a number). CONTENTS is a string, number, NAME is a character (a number). CONTENTS is a string, number,
mark or list. A list represents a rectangle; its elements are strings.") screen configuration, mark or list.
A list represents a rectangle; its elements are strings.")
(defun get-register (char) (defun get-register (char)
"Return contents of Emacs register named CHAR, or nil if none." "Return contents of Emacs register named CHAR, or nil if none."
...@@ -37,11 +38,13 @@ Returns VALUE." ...@@ -37,11 +38,13 @@ Returns VALUE."
(setq register-alist (cons aelt register-alist))) (setq register-alist (cons aelt register-alist)))
value)) value))
(defun point-to-register (char) (defun point-to-register (char arg)
"Store current location of point in a register. "Store current location of point in register REGISTER.
With prefix argument, store current screen configuration.
Use \\[jump-to-register] to go to that location or restore that configuration.
Argument is a character, naming the register." Argument is a character, naming the register."
(interactive "cPoint to register: ") (interactive "cPoint to register: \nP")
(set-register char (point-marker))) (set-register char (if arg (current-screen-configuration) (point-marker))))
(fset 'register-to-point 'jump-to-register) (fset 'register-to-point 'jump-to-register)
(defun jump-to-register (char) (defun jump-to-register (char)
...@@ -49,11 +52,14 @@ Argument is a character, naming the register." ...@@ -49,11 +52,14 @@ Argument is a character, naming the register."
Argument is a character, naming the register." Argument is a character, naming the register."
(interactive "cJump to register: ") (interactive "cJump to register: ")
(let ((val (get-register char))) (let ((val (get-register char)))
(if (markerp val) (condition-case ()
(progn (set-screen-configuration val)
(switch-to-buffer (marker-buffer val)) (error
(goto-char val)) (if (markerp val)
(error "Register doesn't contain a buffer position")))) (progn
(switch-to-buffer (marker-buffer val))
(goto-char val))
(error "Register doesn't contain a buffer position or screen configuration")))))
;(defun number-to-register (arg char) ;(defun number-to-register (arg char)
; "Store a number in a register. ; "Store a number in a register.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment