From: Xah <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: rename existing *shell* to *MYshell.txt. Now, how making "C-x s" SAVE it?
Date: Sun, 29 Jun 2008 01:23:00 -0700 (PDT) [thread overview]
Message-ID: <90a2e4c3-a904-41e6-a834-b0f56810f4e2@c19g2000prf.googlegroups.com> (raw)
In-Reply-To: barmar-7D3696.02213529062008@newsgroups.comcast.net
David Combs wrote:
«So I have this existing *shell* that I've been working with,
...
Question: now, how to "bind" it to a disk file of the same name?
»
Barry Margolin
«
C-x C-w MYshell.txt RET
I don't know of a way to make it automatically update the file. But
once you associate it with a file with C-x C-w, you can then use C-x C-
s to update the file manually.
»
adding to Barry Margolin's comments... you can use a timer that
performs a action periodically. So, say every 10 min, your shell will
be saved to disk.
for example, i have the following:
(run-with-timer 600 600 'desktop-save "~/")
which record opened files every 10 min. So in case of system crash, i
still know which files are left open in previous session (that i was
working on or still needs to work on)
to write your function to save would be pretty easy...
your function will just call save-buffer...
depending how robust or elaborate you want, you may need to check
whether you have that particularly named buffer... and what file you
want it to save to. etc
and if the buffer doesn't exist, kill the timer.
the basic functions you might need are:
(buffer-name)
(buffer-file-name)
(write-file ...) or (save-buffer)
(kill-buffer ...)
Xah
∑ http://xahlee.org/
☄
On Jun 28, 11:21 pm, Barry Margolin <bar...@alum.mit.edu> wrote:
> In article <g475vf$13...@panix2.panix.com>,
> dkco...@panix.com (David Combs) wrote:
>
> > So I have this existing *shell* that I've been working with,
> > and it belatedly turns out that I want it to "also live
> > as a disk file" -- to be a physical record of what I've
> > been doing (in *that* shell).
>
> > So I M-x rename-buffer it to MYshell.txt.
>
> > Question: now, how to "bind" it to a disk file of the
> > same name?
>
> You don't need to rename it, just write it to a file:
>
> C-x C-w MYshell.txt RET
>
>
>
> > Or if not that (
>
> > bind implying that by some magic that
> > whatever chars appear in *shell* (Well, MYshell.txt buffer)
> > automatically appears in the disk file too, maybe
>
> > ), then where all I need to do is C-x s and the disk-file
> > gets updated.
>
> I don't know of a way to make it automatically update the file. But
> once you associate it with a file with C-x C-w, you can then use C-x C-s
> to update the file manually.
>
> --
> Barry Margolin, bar...@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***
prev parent reply other threads:[~2008-06-29 8:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 5:18 rename existing *shell* to *MYshell.txt. Now, how making "C-x s" SAVE it? David Combs
2008-06-29 6:21 ` Barry Margolin
2008-06-29 8:23 ` Xah [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90a2e4c3-a904-41e6-a834-b0f56810f4e2@c19g2000prf.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).