;;; register.el --- register commands for Emacs
-;; Copyright (C) 1985, 1993, 1994, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1993, 1994, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: internal
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; pieces of buffer state to named variables. The entry points are
;; documented in the Emacs user's manual.
+;;; Global key bindings
+
+;;;###autoload (define-key ctl-x-r-map "\C-@" 'point-to-register)
+;;;###autoload (define-key ctl-x-r-map [?\C-\ ] 'point-to-register)
+;;;###autoload (define-key ctl-x-r-map " " 'point-to-register)
+;;;###autoload (define-key ctl-x-r-map "j" 'jump-to-register)
+;;;###autoload (define-key ctl-x-r-map "s" 'copy-to-register)
+;;;###autoload (define-key ctl-x-r-map "x" 'copy-to-register)
+;;;###autoload (define-key ctl-x-r-map "i" 'insert-register)
+;;;###autoload (define-key ctl-x-r-map "g" 'insert-register)
+;;;###autoload (define-key ctl-x-r-map "r" 'copy-rectangle-to-register)
+;;;###autoload (define-key ctl-x-r-map "n" 'number-to-register)
+;;;###autoload (define-key ctl-x-r-map "+" 'increment-register)
+;;;###autoload (define-key ctl-x-r-map "w" 'window-configuration-to-register)
+;;;###autoload (define-key ctl-x-r-map "f" 'frame-configuration-to-register)
+
;;; Code:
(defvar register-alist nil
Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to append."
(interactive "cAppend to register: \nr\nP")
- (or (stringp (get-register register))
- (error "Register does not contain text"))
- (set-register register (concat (get-register register)
- (filter-buffer-substring start end)))
+ (let ((reg (get-register register))
+ (text (filter-buffer-substring start end)))
+ (set-register
+ register (cond ((not reg) text)
+ ((stringp reg) (concat reg text))
+ (t (error "Register does not contain text")))))
(if delete-flag (delete-region start end)))
(defun prepend-to-register (register start end &optional delete-flag)
Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to prepend."
(interactive "cPrepend to register: \nr\nP")
- (or (stringp (get-register register))
- (error "Register does not contain text"))
- (set-register register (concat (filter-buffer-substring start end)
- (get-register register)))
+ (let ((reg (get-register register))
+ (text (filter-buffer-substring start end)))
+ (set-register
+ register (cond ((not reg) text)
+ ((stringp reg) (concat text reg))
+ (t (error "Register does not contain text")))))
(if delete-flag (delete-region start end)))
(defun copy-rectangle-to-register (register start end &optional delete-flag)
(extract-rectangle start end))))
(provide 'register)
-;;; arch-tag: ce14dd68-8265-475f-9341-5d4ec5a53035
+;; arch-tag: ce14dd68-8265-475f-9341-5d4ec5a53035
;;; register.el ends here