+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
(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
(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
(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)))
(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: ")
(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: ")
+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
(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
(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."
(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
(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
(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
(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)))
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)
(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)
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)
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"))