aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-11-13 02:09:59 +0000
committerRichard M. Stallman2001-11-13 02:09:59 +0000
commit61acfe7f5d8bf84a1c002bae44009fa88879f3eb (patch)
tree730b3087a3413515cb33e6e848c41ba7f84832dd
parentdff28924e8526936dc265e5ac63c55f20185529b (diff)
downloademacs-61acfe7f5d8bf84a1c002bae44009fa88879f3eb.tar.gz
emacs-61acfe7f5d8bf84a1c002bae44009fa88879f3eb.zip
(clone-indirect-buffer): Error if major mode symbol
has a no-clone-indirect property. (clone-buffer): Check for obvious errors before reading clone name.
-rw-r--r--lisp/simple.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 5af9a187091..4bf1edf801f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3898,8 +3898,14 @@ NEWNAME is modified by adding or incrementing <N> at the end as necessary.
3898If DISPLAY-FLAG is non-nil, the new buffer is shown with `pop-to-buffer'. 3898If DISPLAY-FLAG is non-nil, the new buffer is shown with `pop-to-buffer'.
3899This runs the normal hook `clone-buffer-hook' in the new buffer 3899This runs the normal hook `clone-buffer-hook' in the new buffer
3900after it has been set up properly in other respects." 3900after it has been set up properly in other respects."
3901 (interactive (list (if current-prefix-arg (read-string "Name: ")) 3901 (interactive
3902 t)) 3902 (progn
3903 (if buffer-file-name
3904 (error "Cannot clone a file-visiting buffer"))
3905 (if (get major-mode 'no-clone)
3906 (error "Cannot clone a buffer in %s mode" mode-name))
3907 (list (if current-prefix-arg (read-string "Name: "))
3908 t)))
3903 (if buffer-file-name 3909 (if buffer-file-name
3904 (error "Cannot clone a file-visiting buffer")) 3910 (error "Cannot clone a file-visiting buffer"))
3905 (if (get major-mode 'no-clone) 3911 (if (get major-mode 'no-clone)
@@ -3963,9 +3969,15 @@ This is always done when called interactively.
3963 3969
3964Optional last arg NORECORD non-nil means do not put this buffer at the 3970Optional last arg NORECORD non-nil means do not put this buffer at the
3965front of the list of recently selected ones." 3971front of the list of recently selected ones."
3966 (interactive (list (if current-prefix-arg 3972 (interactive
3967 (read-string "BName of indirect buffer: ")) 3973 (progn
3968 t)) 3974 (if (get major-mode 'no-clone-indirect)
3975 (error "Cannot indirectly clone a buffer in %s mode" mode-name))
3976 (list (if current-prefix-arg
3977 (read-string "BName of indirect buffer: "))
3978 t)))
3979 (if (get major-mode 'no-clone-indirect)
3980 (error "Cannot indirectly clone a buffer in %s mode" mode-name))
3969 (setq newname (or newname (buffer-name))) 3981 (setq newname (or newname (buffer-name)))
3970 (if (string-match "<[0-9]+>\\'" newname) 3982 (if (string-match "<[0-9]+>\\'" newname)
3971 (setq newname (substring newname 0 (match-beginning 0)))) 3983 (setq newname (substring newname 0 (match-beginning 0))))