* writing a file to disc
@ 2007-11-28 13:17 rahed
2007-11-28 14:30 ` Peter Dyballa
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: rahed @ 2007-11-28 13:17 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I have a file in a buffer and want to write it (C-x C-w) to disc under a
different name. At the same time I want to leave in the
buffer only the original one.
Is there a some simple key binding to do it?
--
Radek
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: writing a file to disc
2007-11-28 13:17 rahed
@ 2007-11-28 14:30 ` Peter Dyballa
2007-11-28 15:56 ` Kevin Rodgers
[not found] ` <mailman.4255.1196265534.18990.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 8+ messages in thread
From: Peter Dyballa @ 2007-11-28 14:30 UTC (permalink / raw)
To: rahed; +Cc: help-gnu-emacs
Am 28.11.2007 um 14:17 schrieb rahed:
> Is there a some simple key binding to do it?
No. Not yet.
--
Greetings
<]
Pete o __o |__ o recumbo
___o /I -\<, |o \ -\),-% ergo sum!
___/\ /\___./ \___...O/ O____.....`-O-'-()--o_________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: writing a file to disc
2007-11-28 13:17 rahed
2007-11-28 14:30 ` Peter Dyballa
@ 2007-11-28 15:56 ` Kevin Rodgers
2007-11-28 18:32 ` rahed
[not found] ` <mailman.4266.1196275142.18990.help-gnu-emacs@gnu.org>
[not found] ` <mailman.4255.1196265534.18990.help-gnu-emacs@gnu.org>
2 siblings, 2 replies; 8+ messages in thread
From: Kevin Rodgers @ 2007-11-28 15:56 UTC (permalink / raw)
To: help-gnu-emacs
rahed wrote:
> Hi,
>
> I have a file in a buffer and want to write it (C-x C-w) to disc under a
> different name. At the same time I want to leave in the
> buffer only the original one.
>
> Is there a some simple key binding to do it?
How about:
(defun clone-file (filename)
"Clone the current buffer and write the new buffer into file FILENAME."
(interactive "FWrite file: ")
(let* ((buffer-file-name nil))
(with-current-buffer (clone-buffer nil (interactive-p))
(write-file filename (interactive-p)))))
(global-set-key "\C-xW" 'clone-file)
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: writing a file to disc
2007-11-28 15:56 ` Kevin Rodgers
@ 2007-11-28 18:32 ` rahed
[not found] ` <mailman.4266.1196275142.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: rahed @ 2007-11-28 18:32 UTC (permalink / raw)
To: help-gnu-emacs
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
> (defun clone-file (filename)
> "Clone the current buffer and write the new buffer into file FILENAME."
> (interactive "FWrite file: ")
> (let* ((buffer-file-name nil))
> (with-current-buffer (clone-buffer nil (interactive-p))
> (write-file filename (interactive-p)))))
>
> (global-set-key "\C-xW" 'clone-file)
It makes two buffers, a new one and the original. I don't know
lisp, could you possibly trim it so that only the original occupy the
buffer?
Many thanks.
--
Radek
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.4266.1196275142.18990.help-gnu-emacs@gnu.org>]
* Re: writing a file to disc
[not found] ` <mailman.4266.1196275142.18990.help-gnu-emacs@gnu.org>
@ 2007-11-28 21:02 ` Scott Frazer
2007-11-29 7:59 ` rahed
0 siblings, 1 reply; 8+ messages in thread
From: Scott Frazer @ 2007-11-28 21:02 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 28, 1:32 pm, rahed <rah...@gmail.com> wrote:
> Kevin Rodgers <kevin.d.rodg...@gmail.com> writes:
> > (defun clone-file (filename)
> > "Clone the current buffer and write the new buffer into file FILENAME."
> > (interactive "FWrite file: ")
> > (let* ((buffer-file-name nil))
> > (with-current-buffer (clone-buffer nil (interactive-p))
> > (write-file filename (interactive-p)))))
>
> > (global-set-key "\C-xW" 'clone-file)
>
> It makes two buffers, a new one and the original. I don't know
> lisp, could you possibly trim it so that only the original occupy the
> buffer?
>
> Many thanks.
My newsreader was acting funny, so sorry if this is a duplicate.
(defun clone-file (filename)
"Clone the current buffer and write it into FILENAME."
(interactive "FClone to file: ")
(let ((buffer-file-name nil))
(kill-buffer (with-current-buffer (clone-buffer)
(write-file filename (interactive-p))
(current-buffer)))))
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: writing a file to disc
2007-11-28 21:02 ` Scott Frazer
@ 2007-11-29 7:59 ` rahed
0 siblings, 0 replies; 8+ messages in thread
From: rahed @ 2007-11-29 7:59 UTC (permalink / raw)
To: help-gnu-emacs
Scott Frazer <frazer.scott@gmail.com> writes:
> My newsreader was acting funny, so sorry if this is a duplicate.
>
> (defun clone-file (filename)
> "Clone the current buffer and write it into FILENAME."
> (interactive "FClone to file: ")
> (let ((buffer-file-name nil))
> (kill-buffer (with-current-buffer (clone-buffer)
> (write-file filename (interactive-p))
> (current-buffer)))))
Thank you (and others).
--
Radek
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.4255.1196265534.18990.help-gnu-emacs@gnu.org>]
end of thread, other threads:[~2007-11-30 17:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.4235.1196255887.18990.help-gnu-emacs@gnu.org>
2007-11-30 17:02 ` writing a file to disc Stefan Monnier
2007-11-28 13:17 rahed
2007-11-28 14:30 ` Peter Dyballa
2007-11-28 15:56 ` Kevin Rodgers
2007-11-28 18:32 ` rahed
[not found] ` <mailman.4266.1196275142.18990.help-gnu-emacs@gnu.org>
2007-11-28 21:02 ` Scott Frazer
2007-11-29 7:59 ` rahed
[not found] ` <mailman.4255.1196265534.18990.help-gnu-emacs@gnu.org>
2007-11-29 1:01 ` Johan Bockgård
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.