Mercurial > emacs
comparison lisp/simple.el @ 40966:0eb891bb0d3e
(clone-indirect-buffer): Error if major mode symbol
has a no-clone-indirect property.
(clone-buffer): Check for obvious errors before reading clone name.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 13 Nov 2001 02:09:59 +0000 |
parents | a0dc24114eee |
children | e4e7371d61e9 |
comparison
equal
deleted
inserted
replaced
40965:eac4b1ccb6b8 | 40966:0eb891bb0d3e |
---|---|
3896 NEWNAME is modified by adding or incrementing <N> at the end as necessary. | 3896 NEWNAME is modified by adding or incrementing <N> at the end as necessary. |
3897 | 3897 |
3898 If DISPLAY-FLAG is non-nil, the new buffer is shown with `pop-to-buffer'. | 3898 If DISPLAY-FLAG is non-nil, the new buffer is shown with `pop-to-buffer'. |
3899 This runs the normal hook `clone-buffer-hook' in the new buffer | 3899 This runs the normal hook `clone-buffer-hook' in the new buffer |
3900 after it has been set up properly in other respects." | 3900 after 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) |
3906 (error "Cannot clone a buffer in %s mode" mode-name)) | 3912 (error "Cannot clone a buffer in %s mode" mode-name)) |
3907 (setq newname (or newname (buffer-name))) | 3913 (setq newname (or newname (buffer-name))) |
3961 DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'. | 3967 DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'. |
3962 This is always done when called interactively. | 3968 This is always done when called interactively. |
3963 | 3969 |
3964 Optional last arg NORECORD non-nil means do not put this buffer at the | 3970 Optional last arg NORECORD non-nil means do not put this buffer at the |
3965 front of the list of recently selected ones." | 3971 front 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)))) |
3972 (let* ((name (generate-new-buffer-name newname)) | 3984 (let* ((name (generate-new-buffer-name newname)) |
3973 (buffer (make-indirect-buffer (current-buffer) name t))) | 3985 (buffer (make-indirect-buffer (current-buffer) name t))) |