aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2001-11-13 02:09:59 +0000
committerRichard M. Stallman <[email protected]>2001-11-13 02:09:59 +0000
commit61acfe7f5d8bf84a1c002bae44009fa88879f3eb (patch)
tree730b3087a3413515cb33e6e848c41ba7f84832dd /lisp/simple.el
parentdff28924e8526936dc265e5ac63c55f20185529b (diff)
(clone-indirect-buffer): Error if major mode symbol
has a no-clone-indirect property. (clone-buffer): Check for obvious errors before reading clone name.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 5af9a18709..4bf1edf801 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.
If DISPLAY-FLAG is non-nil, the new buffer is shown with `pop-to-buffer'.
This runs the normal hook `clone-buffer-hook' in the new buffer
after it has been set up properly in other respects."
- (interactive (list (if current-prefix-arg (read-string "Name: "))
- t))
+ (interactive
+ (progn
+ (if buffer-file-name
+ (error "Cannot clone a file-visiting buffer"))
+ (if (get major-mode 'no-clone)
+ (error "Cannot clone a buffer in %s mode" mode-name))
+ (list (if current-prefix-arg (read-string "Name: "))
+ t)))
(if buffer-file-name
(error "Cannot clone a file-visiting buffer"))
(if (get major-mode 'no-clone)
@@ -3963,9 +3969,15 @@ This is always done when called interactively.
Optional last arg NORECORD non-nil means do not put this buffer at the
front of the list of recently selected ones."
- (interactive (list (if current-prefix-arg
- (read-string "BName of indirect buffer: "))
- t))
+ (interactive
+ (progn
+ (if (get major-mode 'no-clone-indirect)
+ (error "Cannot indirectly clone a buffer in %s mode" mode-name))
+ (list (if current-prefix-arg
+ (read-string "BName of indirect buffer: "))
+ t)))
+ (if (get major-mode 'no-clone-indirect)
+ (error "Cannot indirectly clone a buffer in %s mode" mode-name))
(setq newname (or newname (buffer-name)))
(if (string-match "<[0-9]+>\\'" newname)
(setq newname (substring newname 0 (match-beginning 0))))