]> code.delx.au - gnu-emacs/blobdiff - lisp/register.el
Add a new function `svg-embed'
[gnu-emacs] / lisp / register.el
index 24146065384c882f5a896200876b7282559af443..045a4308fd5bc9606d805a06e4b8dcf6c133da81 100644 (file)
@@ -1,6 +1,6 @@
 ;;; register.el --- register commands for Emacs      -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1985, 1993-1994, 2001-2014 Free Software Foundation,
+;; Copyright (C) 1985, 1993-1994, 2001-2016 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: emacs-devel@gnu.org
@@ -135,7 +135,8 @@ Format of each entry is controlled by the variable `register-preview-function'."
     (with-current-buffer-window
      buffer
      (cons 'display-buffer-below-selected
-          '((window-height . fit-window-to-buffer)))
+          '((window-height . fit-window-to-buffer)
+            (preserve-size . (nil . t))))
      nil
      (with-current-buffer standard-output
        (setq cursor-in-non-selected-windows nil)
@@ -219,7 +220,7 @@ Interactively, reads the register using `register-read-with-preview'."
 (set-advertised-calling-convention 'frame-configuration-to-register
                                   '(register) "24.4")
 
-(make-obsolete 'frame-configuration-to-register 'frameset-to-register' "24.4")
+(make-obsolete 'frame-configuration-to-register 'frameset-to-register "24.4")
 
 (defalias 'register-to-point 'jump-to-register)
 (defun jump-to-register (register &optional delete)
@@ -251,19 +252,22 @@ Interactively, reads the register using `register-read-with-preview'."
       (goto-char (cadr val)))
      ((markerp val)
       (or (marker-buffer val)
-         (error "That register's buffer no longer exists"))
+         (user-error "That register's buffer no longer exists"))
       (switch-to-buffer (marker-buffer val))
+      (unless (or (= (point) (marker-position val))
+                  (eq last-command 'jump-to-register))
+        (push-mark))
       (goto-char val))
      ((and (consp val) (eq (car val) 'file))
       (find-file (cdr val)))
      ((and (consp val) (eq (car val) 'file-query))
       (or (find-buffer-visiting (nth 1 val))
          (y-or-n-p (format "Visit file %s again? " (nth 1 val)))
-         (error "Register access aborted"))
+         (user-error "Register access aborted"))
       (find-file (nth 1 val))
       (goto-char (nth 2 val)))
      (t
-      (error "Register doesn't contain a buffer position or configuration")))))
+      (user-error "Register doesn't contain a buffer position or configuration")))))
 
 (defun register-swap-out ()
   "Turn markers into file-query references when a buffer is killed."
@@ -315,7 +319,7 @@ Interactively, reads the register using `register-read-with-preview'."
        (set-register register (+ number register-val))))
      ((or (not register-val) (stringp register-val))
       (append-to-register register (region-beginning) (region-end) prefix))
-     (t (error "Register does not contain a number or text")))))
+     (t (user-error "Register does not contain a number or text")))))
 
 (defun view-register (register)
   "Display what is contained in register named REGISTER.
@@ -448,7 +452,7 @@ Interactively, reads the register using `register-read-with-preview'."
      ((and (markerp val) (marker-position val))
       (princ (marker-position val) (current-buffer)))
      (t
-      (error "Register does not contain text"))))
+      (user-error "Register does not contain text"))))
   (if (not arg) (exchange-point-and-mark)))
 
 (defun copy-to-register (register start end &optional delete-flag region)
@@ -491,7 +495,7 @@ Interactively, reads the register using `register-read-with-preview'."
     (set-register
      register (cond ((not reg) text)
                     ((stringp reg) (concat reg separator text))
-                    (t (error "Register does not contain text")))))
+                    (t (user-error "Register does not contain text")))))
   (setq deactivate-mark t)
   (cond (delete-flag
         (delete-region start end))
@@ -515,7 +519,7 @@ Interactively, reads the register using `register-read-with-preview'."
     (set-register
      register (cond ((not reg) text)
                     ((stringp reg) (concat text separator reg))
-                    (t (error "Register does not contain text")))))
+                    (t (user-error "Register does not contain text")))))
   (setq deactivate-mark t)
   (cond (delete-flag
         (delete-region start end))