help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rename existing *shell* to *MYshell.txt. Now, how making "C-x s" SAV


From: Xah
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)
User-agent: G2/1.0

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 <address@hidden> wrote:
> In article <address@hidden>,
>  address@hidden (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, address@hidden
> 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 ***



reply via email to

[Prev in Thread] Current Thread [Next in Thread]