unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Printing with timer
@ 2022-12-03  5:13 Heime
  2022-12-04 13:05 ` Jean Louis
  2022-12-04 13:17 ` Jean Louis
  0 siblings, 2 replies; 4+ messages in thread
From: Heime @ 2022-12-03  5:13 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

I would like to insert the letter using a timer.  After each interval, the letter "T" is printed.
After four intervals, the characters are cleared, and the printing starts again.

Here X means whitespace

XXXX    ; After time interval t (all columns off)

TXXX    ; After time interval t (one column green)

TTXX    ; After time interval t

TTTX    ; After time interval t

TTTT    ; After time interval t

XXXX    

I have started with the following function.  Quite unsure if I should (and how)
the timer can be stopped.


(defun fire-indicator ()
  "TODO."
  (interactive)
  (insert "T")

(defun fire-clock ()
  "TODO."
  (interactive)

  (let* ( (tr (run-with-timer 3 1 (fire-indicator))) )
    ) )




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

* Re: Printing with timer
  2022-12-03  5:13 Printing with timer Heime
@ 2022-12-04 13:05 ` Jean Louis
  2022-12-04 13:17 ` Jean Louis
  1 sibling, 0 replies; 4+ messages in thread
From: Jean Louis @ 2022-12-04 13:05 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

If you start running with timer, then you better be sure in which
buffer you want that be inserted, function should seek the proper
buffer to insert text.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: Printing with timer
  2022-12-03  5:13 Printing with timer Heime
  2022-12-04 13:05 ` Jean Louis
@ 2022-12-04 13:17 ` Jean Louis
  2022-12-04 17:15   ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 4+ messages in thread
From: Jean Louis @ 2022-12-04 13:17 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

* Heime <heimeborgia@protonmail.com> [2022-12-03 08:15]:
> I would like to insert the letter using a timer.  After each interval, the letter "T" is printed.
> After four intervals, the characters are cleared, and the printing starts again.
> 
> Here X means whitespace
> 
> XXXX    ; After time interval t (all columns off)
> 
> TXXX    ; After time interval t (one column green)
> 
> TTXX    ; After time interval t
> 
> TTTX    ; After time interval t
> 
> TTTT    ; After time interval t
> 
> XXXX    

If it is for the aircraft flight control system, and you do not write
in that buffer, then maybe you should designate specific character
position, and you should maybe have buffer empty, with characters
 inside, as to delete character and insert one:

(defun my-char-at-place (position char buffer)
  (set-buffer buffer)
  (goto-char position)
  (delete-char 1)
  (insert char))
TXX   
(my-char-at-place 886 "X" (current-buffer))
(my-char-at-place 886 "T" (current-buffer))
(my-char-at-place 887 "X" (current-buffer))
(my-char-at-place 888 "X" (current-buffer))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



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

* Re: Printing with timer
  2022-12-04 13:17 ` Jean Louis
@ 2022-12-04 17:15   ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-12-04 17:15 UTC (permalink / raw)
  To: help-gnu-emacs

> (defun my-char-at-place (position char buffer)
>   (set-buffer buffer)
>   (goto-char position)
>   (delete-char 1)
>   (insert char))

As a rule of thumb, I recommend to stay clear of `set-buffer` and use
`with-current-buffer` instead.


        Stefan




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

end of thread, other threads:[~2022-12-04 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-03  5:13 Printing with timer Heime
2022-12-04 13:05 ` Jean Louis
2022-12-04 13:17 ` Jean Louis
2022-12-04 17:15   ` Stefan Monnier via Users list for the GNU Emacs text editor

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).