Be more consistent in using register-read-with-preview to read registers

* frameset.el (frameset-to-register):
* kmacro.el (kmacro-to-register):
* register.el (increment-register):
* calc/calc-yank.el (calc-copy-to-register, calc-insert-register)
(calc-append-to-register, calc-prepend-to-register):
* play/gametree.el (gametree-layout-to-register)
(gametree-apply-register-layout):
* textmodes/picture.el (picture-clear-rectangle-to-register)
(picture-yank-rectangle-from-register):
* vc/emerge.el (emerge-combine-versions-register):
Use register-read-with-preview to read registers.

* cedet/semantic/senator.el (senator-copy-tag-to-register):
Use register-read-with-preview, if available.

* calculator.el, emulation/viper-cmd.el: Comments.
This commit is contained in:
Glenn Morris 2014-02-02 16:40:49 -08:00
parent 5dca7759a7
commit 6a6b8e405e
12 changed files with 96 additions and 26 deletions

View file

@ -1,3 +1,17 @@
2014-02-03 Glenn Morris <rgm@gnu.org>
* frameset.el (frameset-to-register):
* kmacro.el (kmacro-to-register):
* register.el (increment-register):
* calc/calc-yank.el (calc-copy-to-register, calc-insert-register)
(calc-append-to-register, calc-prepend-to-register):
* play/gametree.el (gametree-layout-to-register)
(gametree-apply-register-layout):
* textmodes/picture.el (picture-clear-rectangle-to-register)
(picture-yank-rectangle-from-register):
* vc/emerge.el (emerge-combine-versions-register):
Use register-read-with-preview to read registers.
2014-02-03 João Távora <joaotavora@gmail.com>
* elec-pair.el (electric-pair-backward-delete-char): Don't error

View file

@ -163,8 +163,12 @@ text) or `nil'."
(defun calc-copy-to-register (register start end &optional delete-flag)
"Copy the lines in the region into register REGISTER.
With prefix arg, delete as well."
(interactive "cCopy to register: \nr\nP")
With prefix arg, delete as well.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Copy to register: ")
(region-beginning) (region-end)
current-prefix-arg))
(if (eq major-mode 'calc-mode)
(let* ((top-num (calc-locate-cursor-element start))
(top-pos (save-excursion
@ -183,8 +187,10 @@ With prefix arg, delete as well."
(copy-to-register register start end delete-flag)))
(defun calc-insert-register (register)
"Insert the contents of register REGISTER."
(interactive "cInsert register: ")
"Insert the contents of register REGISTER.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Insert register: ")))
(if (eq major-mode 'calc-mode)
(let ((val (calc-get-register register)))
(calc-wrapper
@ -237,16 +243,24 @@ otherwise the end. If DELETE-FLAG is non-nil, also delete the region."
(defun calc-append-to-register (register start end &optional delete-flag)
"Copy the lines in the region to the end of register REGISTER.
With prefix arg, also delete the region."
(interactive "cAppend to register: \nr\nP")
With prefix arg, also delete the region.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Append to register: ")
(region-beginning) (region-end)
current-prefix-arg))
(if (eq major-mode 'calc-mode)
(calc-add-to-register register start end nil delete-flag)
(append-to-register register start end delete-flag)))
(defun calc-prepend-to-register (register start end &optional delete-flag)
"Copy the lines in the region to the beginning of register REGISTER.
With prefix arg, also delete the region."
(interactive "cPrepend to register: \nr\nP")
With prefix arg, also delete the region.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Prepend to register: ")
(region-beginning) (region-end)
current-prefix-arg))
(if (eq major-mode 'calc-mode)
(calc-add-to-register register start end t delete-flag)
(prepend-to-register register start end delete-flag)))

View file

@ -1618,6 +1618,8 @@ Optional string argument KEYS will force using it as the keys entered."
(setq s (match-string 1 s)))
(kill-new s)))))
;; FIXME this should use register-read-with-preview, but it
;; uses calculator-registers rather than register-alist.
(defun calculator-set-register (reg)
"Set a register value for REG."
(interactive "cRegister to store into: ")
@ -1660,6 +1662,8 @@ Used by `calculator-paste' and `get-register'."
(or (match-string 3 str) ""))))
(ignore-errors (calculator-string-to-number str)))))
;; FIXME this should use register-read-with-preview, but it
;; uses calculator-registers rather than register-alist.
(defun calculator-get-register (reg)
"Get a value from a register REG."
(interactive "cRegister to get value from: ")

View file

@ -1,3 +1,8 @@
2014-02-03 Glenn Morris <rgm@gnu.org>
* semantic/senator.el (senator-copy-tag-to-register):
Use register-read-with-preview, if available.
2014-01-13 Eric Ludlam <zappo@gnu.org>
* semantic/analyze/refs.el (semantic-analyze-refs-impl): Fix typo

View file

@ -722,8 +722,14 @@ yanked to."
(defun senator-copy-tag-to-register (register &optional kill-flag)
"Copy the current tag into REGISTER.
Optional argument KILL-FLAG will delete the text of the tag to the
kill ring."
(interactive "cTag to register: \nP")
kill ring.
Interactively, reads the register using `register-read-with-preview',
if available."
(interactive (list (if (fboundp 'register-read-with-preview)
(register-read-with-preview "Tag to register: ")
(read-char "Tag to register: "))
current-prefix-arg))
(semantic-fetch-tags)
(let ((ft (semantic-obtain-foreign-tag)))
(when ft

View file

@ -4831,6 +4831,7 @@ Please, specify your level now: ")
(beep 1))
;; FIXME Use register-read-with-preview?
;; if ENFORCE-BUFFER is not nil, error if CHAR is a marker in another buffer
(defun viper-register-to-point (char &optional enforce-buffer)
"Like `jump-to-register', but switches to another buffer in another window."

View file

@ -1223,8 +1223,11 @@ Called from `jump-to-register'. Internal use only."
(defun frameset-to-register (register &optional _arg)
"Store the current frameset in register REGISTER.
Use \\[jump-to-register] to restore the frameset.
Argument is a character, naming the register."
(interactive "cFrameset to register: \nP")
Argument is a character, naming the register.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Frameset to register: ")
current-prefix-arg))
(set-register register
(registerv-make
(vector (frameset-save nil

View file

@ -845,11 +845,13 @@ Such a \"function\" cannot be called from Lisp, but it is a valid editor command
(kmacro-call-macro current-prefix-arg nil nil k))
(defun kmacro-to-register (r)
"Store the last keyboard macro in register R."
"Store the last keyboard macro in register R.
Interactively, reads the register using `register-read-with-preview'."
(interactive
(progn
(or last-kbd-macro (error "No keyboard macro defined"))
(list (read-char "Save to register: "))))
(list (register-read-with-preview "Save to register: "))))
(set-register r (registerv-make
last-kbd-macro
:jump-func 'kmacro-execute-from-register

View file

@ -531,8 +531,10 @@ Subnodes which have been manually scored are honored."
(defun gametree-layout-to-register (register)
"Store current tree layout in register REGISTER.
Use \\[gametree-apply-register-layout] to restore that configuration.
Argument is a character, naming the register."
(interactive "cLayout to register: ")
Argument is a character, naming the register.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Layout to register: ")))
(save-excursion
(goto-char (point-min))
(set-register register
@ -540,8 +542,13 @@ Argument is a character, naming the register."
(defun gametree-apply-register-layout (char)
"Return to a tree layout stored in a register.
Argument is a character, naming the register."
(interactive "*cApply layout from register: ")
Argument is a character, naming the register.
Interactively, reads the register using `register-read-with-preview'."
(interactive
(progn
(barf-if-buffer-read-only)
(list (register-read-with-preview "Apply layout from register: "))))
(save-excursion
(goto-char (point-min))
(gametree-apply-layout (get-register char) 0 t)))

View file

@ -296,8 +296,11 @@ If REGISTER contains a number, add `prefix-numeric-value' of
PREFIX to it.
If REGISTER is empty or if it contains text, call
`append-to-register' with `delete-flag' set to PREFIX."
(interactive "P\ncIncrement register: ")
`append-to-register' with `delete-flag' set to PREFIX.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list current-prefix-arg
(register-read-with-preview "Increment register: ")))
(let ((register-val (get-register register)))
(cond
((numberp register-val)

View file

@ -494,8 +494,12 @@ prefix argument, the rectangle is actually killed, shifting remaining text."
(defun picture-clear-rectangle-to-register (start end register &optional killp)
"Clear rectangle delineated by point and mark into REGISTER.
The rectangle is saved in REGISTER and replaced with whitespace. With
prefix argument, the rectangle is actually killed, shifting remaining text."
(interactive "r\ncRectangle to register: \nP")
prefix argument, the rectangle is actually killed, shifting remaining text.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (region-beginning) (region-end)
(register-read-with-preview "Rectangle to register: ")
current-prefix-arg))
(set-register register (picture-snarf-rectangle start end killp)))
(defun picture-snarf-rectangle (start end &optional killp)
@ -534,8 +538,11 @@ regardless of where you click."
The rectangle is positioned with upper left corner at point, overwriting
existing text. With prefix argument, the rectangle is
inserted instead, shifting existing text. Leaves mark at one corner
of rectangle and point at the other (diagonally opposed) corner."
(interactive "cRectangle from register: \nP")
of rectangle and point at the other (diagonally opposed) corner.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Rectangle from register: ")
current-prefix-arg))
(let ((rectangle (get-register register)))
(if (not (consp rectangle))
(error "Register %c does not contain a rectangle" register)

View file

@ -2516,8 +2516,12 @@ for how the template is interpreted.
Refuses to function if this difference has been edited, i.e., if it is
neither the A nor the B variant.
An argument forces the variant to be selected even if the difference has
been edited."
(interactive "cRegister containing template: \nP")
been edited.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list
(register-read-with-preview "Register containing template: ")
current-prefix-arg))
(let ((template (get-register char)))
(if (not (stringp template))
(error "Register does not contain text"))