all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* wait/sleep in a keyboard macro?
@ 2010-08-30 14:44 kent williams
  2010-09-10  6:10 ` Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: kent williams @ 2010-08-30 14:44 UTC (permalink / raw)
  To: help-gnu-emacs

Prior to emacs 23, I had a simple keyboard macro I used to log in to a
chat server via telnet.  Yes, the password was plain text in the macro
body in my .emacs, but this was not a high-security thing.

But this dumb macro stopped working in emacs 23.  The reason being --
well the behavior differs now based on whether the buffer for the
telnet session already exists, but most commonly, I get an error
message "Marker does not point anywhere".

The macro itself is this:


(fset 'hardcorps
   [?\M-x ?t ?e ?l ?n ?e ?t ?\C-m ?c ?h ?a ?t ?. ?f ?4 ?. ?c ?a ?  ?6
?6 ?2 ?3 ?\C-m ?* ?* ?* ?* ?\C-m ?* ?* ?* ?* ?* ?* ?* ?* ?* ?*
?\C-m])

in other words: alt-X 'telnet chat.f4.ca 6623' <return> '<login name>'
<return> '<password>' return

It appears (to me) that what happens is that the macro runs too fast,
such that when it tries to add the login name to the buffer, the
buffer isn't yet connected to the server, or it isn't ready for input.
Or something!

I suppose it's possible to do this in a more sophisticated way in
lisp, but this hasn't risen to the level of importance for me that I'm
ready to puzzle out how to wait for prompts from a remote host before
adding text to the buffer.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: wait/sleep in a keyboard macro?
       [not found] <mailman.0.1283179471.17644.help-gnu-emacs@gnu.org>
@ 2010-08-30 19:06 ` Sean McAfee
  0 siblings, 0 replies; 3+ messages in thread
From: Sean McAfee @ 2010-08-30 19:06 UTC (permalink / raw)
  To: help-gnu-emacs

kent williams <nkwmailinglists@gmail.com> writes:

> (fset 'hardcorps
>    [?\M-x ?t ?e ?l ?n ?e ?t ?\C-m ?c ?h ?a ?t ?. ?f ?4 ?. ?c ?a ?  ?6
> ?6 ?2 ?3 ?\C-m ?* ?* ?* ?* ?\C-m ?* ?* ?* ?* ?* ?* ?* ?* ?* ?*
> ?\C-m])
>
> in other words: alt-X 'telnet chat.f4.ca 6623' <return> '<login name>'
> <return> '<password>' return
>
> It appears (to me) that what happens is that the macro runs too fast,
> such that when it tries to add the login name to the buffer, the
> buffer isn't yet connected to the server, or it isn't ready for input.
> Or something!

How about advising the telnet function to wait a bit after it runs if a
keyboard macro is executing?

(defadvice telnet (after pause-during-keyboard-macro activate)
  (when executing-kbd-macro
    (sleep-for 1)))

Season the sleep-for delay to taste.
    
Not very sophisticated, but it gets the job done.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: wait/sleep in a keyboard macro?
  2010-08-30 14:44 wait/sleep in a keyboard macro? kent williams
@ 2010-09-10  6:10 ` Kevin Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2010-09-10  6:10 UTC (permalink / raw)
  To: help-gnu-emacs

On 8/30/10 8:44 AM, kent williams wrote:
> Prior to emacs 23, I had a simple keyboard macro I used to log in to a
> chat server via telnet.  Yes, the password was plain text in the macro
> body in my .emacs, but this was not a high-security thing.
>
> But this dumb macro stopped working in emacs 23.  The reason being --
> well the behavior differs now based on whether the buffer for the
> telnet session already exists, but most commonly, I get an error
> message "Marker does not point anywhere".
>
> The macro itself is this:
>
>
> (fset 'hardcorps
>     [?\M-x ?t ?e ?l ?n ?e ?t ?\C-m ?c ?h ?a ?t ?. ?f ?4 ?. ?c ?a ?  ?6
> ?6 ?2 ?3 ?\C-m ?* ?* ?* ?* ?\C-m ?* ?* ?* ?* ?* ?* ?* ?* ?* ?*
> ?\C-m])
>
> in other words: alt-X 'telnet chat.f4.ca 6623'<return>  '<login name>'
> <return>  '<password>' return
>
> It appears (to me) that what happens is that the macro runs too fast,
> such that when it tries to add the login name to the buffer, the
> buffer isn't yet connected to the server, or it isn't ready for input.
> Or something!
>
> I suppose it's possible to do this in a more sophisticated way in
> lisp, but this hasn't risen to the level of importance for me that I'm
> ready to puzzle out how to wait for prompts from a remote host before
> adding text to the buffer.

Try M-: (sleep-for 1) RET

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-10  6:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 14:44 wait/sleep in a keyboard macro? kent williams
2010-09-10  6:10 ` Kevin Rodgers
     [not found] <mailman.0.1283179471.17644.help-gnu-emacs@gnu.org>
2010-08-30 19:06 ` Sean McAfee

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.