comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: idlwave and emacs "empty input ring"
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: idlwave and emacs "empty input ring" [message #54090] Wed, 23 May 2007 11:02
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Wed, 23 May 2007 07:05:03 -0700, Rob wrote:

> That certainly helps in the case that I forget to C-d in the IDL session.
> There are two other situations that I regularly experience that you can
> perhaps help with.
> 1) Until I fixed a video card driver issue, iTool was crashing my xserver
> which caused a loss to changes in the IDL comint history. I suppose this
> could happen again.
> 2) I often leave an emacs/IDL open on my work computer. When I get home,
> I may do a bit more work by running emacs, etc across X; also a situation
> where I don't have access to the last comint history changes. This is not
> a big deal, just a "nice to have".
>
> For situation 2), is it possible to issue a HUP-like signal from a remote
> shell to kill the emacs running on my work computer in a way which invokes
> your save comint code above?

How about the following instead:

(add-hook 'idlwave-shell-mode-hook
(lambda ()

;; Auto-save buffer contents and input history
(add-hook
'auto-save-hook
(lambda ()
(let ((buf (idlwave-shell-buffer)))
(when (get-buffer buf)
(set-buffer buf)
(if (and idlwave-shell-save-command-history
(stringp idlwave-shell-command-history-file))
(condition-case nil
(comint-write-input-ring)
(error nil))))))
nil 'local)
(auto-save-mode t)
(add-hook 'idlwave-shell-sentinel-hook
(lambda ()
(delete-auto-save-file-if-necessary 'force)))))

This piggybacks on auto-save to write out the command history every time
an auto-save happens. It also auto-saves the contents of the *idl*
buffer (as some file name like #*idl*#28538NXc#), which might be useful if
you lost your session and wanted to see what was in it. If the process is
ended legitimately, this backup file is removed.

The only real issue here is if you have multiple Emacs + IDLWAVE Shell
sessions going at once, in which case they will step on each other's
toes writing to the same command history file (though that is more or
less true already). Let me know if this works well for you; I may
consider adding it as an option to a future version of IDLWAVE.

JD
Re: idlwave and emacs "empty input ring" [message #54094 is a reply to message #54090] Wed, 23 May 2007 07:05 Go to previous message
Rob[2] is currently offline  Rob[2]
Messages: 11
Registered: May 2007
Junior Member
On May 22, 2:56 pm, JD Smith <jdsm...@as.arizona.edu> wrote:
> On Mon, 21 May 2007 15:39:00 -0700, Rob wrote:
>
>> If I close my emacs window w/o closing the IDL shell via "exit" then I
>> lose the comint history for that session. If I first exit the IDL
>> shell, then C-x C-s, when I restart emacs and C-c C-s a new IDL shell,
>> the history from the last session is available. Is there anyway to
>> have the IDL history autosave in case of a crash?
>
> Hmmm, if you can't remember to quit directly (I use C-d), you might add
> this to your idlwave-shell-mode-hook:
>
> (add-hook 'kill-emacs-hook
> (lambda ()
> (let ((buf (idlwave-shell-buffer)))
> (when (get-buffer buf)
> (set-buffer buf)
> (if (and idlwave-shell-save-command-history
> (stringp idlwave-shell-command-history-file))
> (condition-case nil
> (comint-write-input-ring)
> (error nil)))))))
>
> JD


That certainly helps in the case that I forget to C-d in the IDL
session. There are two other situations that I regularly experience
that you can perhaps help with.
1) Until I fixed a video card driver issue, iTool was crashing my
xserver which caused a loss to changes in the IDL comint history. I
suppose this could happen again.
2) I often leave an emacs/IDL open on my work computer. When I get
home, I may do a bit more work by running emacs, etc across X; also a
situation where I don't have access to the last comint history
changes. This is not a big deal, just a "nice to have".

For situation 2), is it possible to issue a HUP-like signal from a
remote shell to kill the emacs running on my work computer in a way
which invokes your save comint code above?

Thanks!

R
Re: idlwave and emacs "empty input ring" [message #54098 is a reply to message #54094] Tue, 22 May 2007 13:56 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Mon, 21 May 2007 15:39:00 -0700, Rob wrote:

>
> If I close my emacs window w/o closing the IDL shell via "exit" then I
> lose the comint history for that session. If I first exit the IDL
> shell, then C-x C-s, when I restart emacs and C-c C-s a new IDL shell,
> the history from the last session is available. Is there anyway to
> have the IDL history autosave in case of a crash?

Hmmm, if you can't remember to quit directly (I use C-d), you might add
this to your idlwave-shell-mode-hook:

(add-hook 'kill-emacs-hook
(lambda ()
(let ((buf (idlwave-shell-buffer)))
(when (get-buffer buf)
(set-buffer buf)
(if (and idlwave-shell-save-command-history
(stringp idlwave-shell-command-history-file))
(condition-case nil
(comint-write-input-ring)
(error nil)))))))

JD
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: redout of "name", "type" and "value" tags into a string
Next Topic: Re: 2D interpolation with sparse data

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:40:15 PDT 2025

Total time taken to generate the page: 0.00661 seconds