unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to execute/mimick the "watch" command using Emacs features?
@ 2021-02-05 21:09 Rodrigo Morales
  2021-02-05 21:22 ` Thien-Thi Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rodrigo Morales @ 2021-02-05 21:09 UTC (permalink / raw)
  To: help-gnu-emacs


Taking into consideration that =watch= doesn't work properly in =M-x
shell= and =M-x eshell=, I'd like to know what alternatives do you guys
use for having the same behavior of the "watch" command inside Emacs? Do
you open a terminal emulator and execute "watch" there or have a pure
Emacs-approach?

I mainly use the =watch= command to see how the output of a command
changes over time. I run it in a terminal emulator (st). For example,
with the following command I would see how files are created under a
directory.

#+begin_src sh :eval no
watch -n 1 -d "find ~/Experiments | tree --fromfile"
#+end_src

Another example: I sometimes use =watch= to see how tangled files are
being generated. I only do this when working with multiple =noweb=
references in order to confirm that the tangled file doesn't contain any
error. I can mimick the behavior of the =watch= command in this scenario
by toggling =auto-revert-mode= inside Emacs.

#+begin_src sh :eval no
watch -n 1 -d -x cat ~/Experiments/tangled-file.py
#+end_src

However, I haven't found a way to mimick the behavior of "watch" for the
first example shown above. I was thinking of executing the command in
"compilation-mode" and repeatedly execute it but before going with that
approach I wanted to know your opinions.

-- 
Greetings,
Rodrigo Morales.

IRC: rdrg109 (freenode)



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

* Re: How to execute/mimick the "watch" command using Emacs features?
  2021-02-05 21:09 How to execute/mimick the "watch" command using Emacs features? Rodrigo Morales
@ 2021-02-05 21:22 ` Thien-Thi Nguyen
  2021-02-06  0:25 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-02-06  7:12 ` Eli Zaretskii
  2 siblings, 0 replies; 6+ messages in thread
From: Thien-Thi Nguyen @ 2021-02-05 21:22 UTC (permalink / raw)
  To: Rodrigo Morales; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]


() Rodrigo Morales <moralesrodrigo1100@gmail.com>
() Fri, 05 Feb 2021 16:09:58 -0500

   I was thinking of executing the command in "compilation-mode"
   and repeatedly execute it but before going with that approach
   I wanted to know your opinions.

Personally, i use ‘M-x watch’ from watch.el:
https://www.gnuvola.org/software/personal-elisp/dist/lisp/bofh/watch.el

NB: It's not asynchronous.

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)               ; (2021) Software Libero
   (pcase (context query)               ;       = Dissenso Etico
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 219 bytes --]

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

* Re: How to execute/mimick the "watch" command using Emacs features?
  2021-02-05 21:09 How to execute/mimick the "watch" command using Emacs features? Rodrigo Morales
  2021-02-05 21:22 ` Thien-Thi Nguyen
@ 2021-02-06  0:25 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-02-07 13:08   ` Leo Butler
  2021-02-06  7:12 ` Eli Zaretskii
  2 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-02-06  0:25 UTC (permalink / raw)
  To: help-gnu-emacs

Rodrigo Morales wrote:

> Taking into consideration that =watch= doesn't work properly
> in =M-x shell= and =M-x eshell=, I'd like to know what
> alternatives do you guys use for having the same behavior of
> the "watch" command inside Emacs? Do you open a terminal
> emulator and execute "watch" there or have a pure
> Emacs-approach?

You need a "fully-featured" terminal emulator for this, e.g.
vterm which is written in C and loaded as a dynamic module.
You can get it from MELPA or from

  https://github.com/akermu/emacs-libvterm

But if you are used to `shell' tho you will have some problems
in the beginning...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

* Re: How to execute/mimick the "watch" command using Emacs features?
  2021-02-05 21:09 How to execute/mimick the "watch" command using Emacs features? Rodrigo Morales
  2021-02-05 21:22 ` Thien-Thi Nguyen
  2021-02-06  0:25 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-02-06  7:12 ` Eli Zaretskii
  2 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2021-02-06  7:12 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Rodrigo Morales <moralesrodrigo1100@gmail.com>
> Date: Fri, 05 Feb 2021 16:09:58 -0500
> 
> Taking into consideration that =watch= doesn't work properly in =M-x
> shell= and =M-x eshell=, I'd like to know what alternatives do you guys
> use for having the same behavior of the "watch" command inside Emacs? Do
> you open a terminal emulator and execute "watch" there or have a pure
> Emacs-approach?

You could try writing a command based on the facilities in
filenotify.el, which is part of Emacs.



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

* Re: How to execute/mimick the "watch" command using Emacs features?
  2021-02-06  0:25 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-02-07 13:08   ` Leo Butler
  2021-02-07 18:41     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Butler @ 2021-02-07 13:08 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> Rodrigo Morales wrote:
>
>> Taking into consideration that =watch= doesn't work properly
>> in =M-x shell= and =M-x eshell=, I'd like to know what
>> alternatives do you guys use for having the same behavior of
>> the "watch" command inside Emacs? Do you open a terminal
>> emulator and execute "watch" there or have a pure
>> Emacs-approach?
>
> You need a "fully-featured" terminal emulator for this, e.g.
> vterm which is written in C and loaded as a dynamic module.
> You can get it from MELPA or from
>
>   https://github.com/akermu/emacs-libvterm
>
> But if you are used to `shell' tho you will have some problems
> in the beginning...

M-x term

That works for me and is a part of GNU emacs.

Leo



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

* Re: How to execute/mimick the "watch" command using Emacs features?
  2021-02-07 13:08   ` Leo Butler
@ 2021-02-07 18:41     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-02-07 18:41 UTC (permalink / raw)
  To: help-gnu-emacs

Leo Butler wrote:

>> You need a "fully-featured" terminal emulator for this,
>> e.g. vterm which is written in C and loaded as a dynamic
>> module. You can get it from MELPA or from
>>
>>   https://github.com/akermu/emacs-libvterm
>>
>> But if you are used to `shell' tho you will have some problems
>> in the beginning...
>
> M-x term
>
> That works for me and is a part of GNU emacs.

That's true! Good.

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

end of thread, other threads:[~2021-02-07 18:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-05 21:09 How to execute/mimick the "watch" command using Emacs features? Rodrigo Morales
2021-02-05 21:22 ` Thien-Thi Nguyen
2021-02-06  0:25 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-02-07 13:08   ` Leo Butler
2021-02-07 18:41     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-02-06  7:12 ` Eli Zaretskii

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