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

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

Re: not good proposal: "C-z <letter>" reserved for users


From: Jean Louis
Subject: Re: not good proposal: "C-z <letter>" reserved for users
Date: Sun, 14 Feb 2021 10:58:21 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Dmitry Gutov <dgutov@yandex.ru> [2021-02-14 03:36]:
> > Lots of people who have started using Emacs recently came to from the
> > terminal.  You can see that on Emacs Reddit.
> 
> Those are often former Vim developers, too. So it might not be due to the
> nature of their work, but largely due to their previous habits.

People still think Vim is best programming editor as referenced on
this page:
https://www.slant.co/topics/12/~best-programming-text-editors

Side notes:

I wish I could liberate Emacs Lisp and be able to use it anywhere, in
any application. Espanso does at least global expansion of
abbreviations and functional abbreviations.

Espanso detects when you type a keyword and replaces it while you're typing.
https://espanso.org/

If I could use globally Emacs Lisp in similar fashion like Espanso,
then I would be using Vim or other editors. Espanso also proves it
could be possible to globalize and listen on any text in X
environment. If I type :people I get it expanded to 220005 in any
editor under X (works with Vim in many terminals but not all) as it
uses database to query the number of the people.

> It's not a 100% conclusion of the survey we have referred to previously,
> but its results state that ~30% of all users are in the terminal, ~30% of
> all users are using a Vim key bindings emulation, and ~30% of all users have
> been using Vim as their primary editor previously. They can't be all the
> same users, but it's an interesting coincidence.

If there are 200 million Ubuntu users, 13 million Emacs users by using
Popularity Contest survey data, then 30% of those would be few
millions of Emacs users using it in terminal. 

> First, we don't usually edit the code on the server unless it's something
> really urgent and critical (and even then, we try not to).

Safe and good principle of work.

> I do see people working in the terminal, but that's either someone using Vim
> (which has no popular graphical UI still), or running tests, or doing some
> exploration in a REPL. Some edit code inside Docker, though.

I am not working with anybody in the team and still see so many
reasons of using terminal and editor inside of terminal. How many
self-hosted software is today offered and available, it is more than
ever. People who need to install such software mostly need to use
terminal. Awesome list is here:
https://github.com/awesome-selfhosted/awesome-selfhosted

Almost any of such software needs terminal. Almost any Fediverse
installation needs terminal, configurations, and launches or launch
setups in terminal. Adding new users to remote servers may need a
terminal, handling spam filtering, setting up emails, DNS, DMARC, SPF,
may need terminal, setting up VPNs, downloading Python packages to
server, updating servers with new packages and version of the system
needs a terminal. And so on, and so on. Today is terminal used more
than ever. Today there are more Vim users then ever before. There are
more Emacs users then before. There is more free software and cool
software then before, people are installing it. Github is telling
there are 50 million developers. A lot of software is meant for remote
servers, remote databases, replication databases, CDNs, and so on and
so on. People use terminals more than ever before. New terminal
applications in various graphical environments are not developed
without reason.

Websites have to be configured usually through terminal. You are maybe
using web based website configuration but somebody had to install web
based configuration system through terminal or physically (or maybe
not with automated instances).

Recent applications I have been installing through terminal are
Nextcloud, Improved File Manager, advertising server, Gnusocial
Fediverse instance, Pleroma Fediverse instance, Courier mail server,
then I often use terminal to setup new website configurations with
Nginx web server.

Today we have more websites, more configurations and more terminal
users. Not less. We have more applications, and terminal user number
is raising, not becoming smaller.

IMF: https://github.com/misterunknown/ifm

> But I rarely ever see someone using the 'C-z' -> 'fg' pair, in fact, I
> struggle to remember anyone do that (except some of the sysadmins, I
> guess).

If you have not get clear picture of number of terminal users you
cannot possibly know somebody is using job control in their shells.

If you have not invoke programs that process large data sets it is
harder to understand. 220005 people need to be updated for their
number of interactions (their emails, SMS, calls, notes, tasks) and
that process involves harvesting their emails, counting it,
harvesting the database and counting. I wish it would be fast but it
is not. The process will take usually 2 days. I do it maybe once per
quarter. It blocks the system and computer has to be used. Suspending
a job is easier, then unsuspending it when I am not personally on
computer.

Sending emails to thousands of people may also need to be suspended
and unsuspended. People do that mostly on remote servers, that is why
those servers are dedicated. But I do not keep the database on the
remote server for safety, so I am sending it from office computer.

Depending of the mail queue involved and environmental circumstances,
things can go wrong. Power can be off due to outage in East Africa
where I am circumstantially located. Network provider may cencor some
of the IP addresses or there can be political voting during which
period Internet may completely censored depending of the nature of
specific dictator. Without knowing WHEN is Internet going to be
unsuspended one may need to suspend current jobs. If programming is
good, interrupting job could be better solution, but sometimes
suspending is better one.

Video processing may need days, weeks to finish. I have programmed it
by Emacs Lisp that invokes `ffmpeg' in such a way to process file by
file. Such instance of Emacs may run separately in console, or
terminal. I can then change my graphics environment without having
process interrupted in console. I can suspend the process in terminal
and have it waiting on separate workspace until I unsuspend it during
the night time or my absence from the office.

(defun video2webm-dired ()
  "Converts any video to webm"
  (interactive)
  (let* ((bitrate (read-number "Bitrate: " 300))
         (videos (dired-get-marked-files))
         (videos (mapcar 'video-mime-type-p videos))
         (videos (seq-remove 'null videos))
         (async-shell-command-buffer 'new-buffer)
         (command (format "ffmpeg -y -i `?` -c:v libvpx-vp9 -b:v %sk -pass 1 
-passlogfile `?` -speed 4 -c:a libopus -f webm /dev/null -async 1 -vsync 
passthrough && ffmpeg -y -i `?` -c:v libvpx-vp9 -b:v %sk -pass 2 -passlogfile 
`?` -speed 1 -c:a libopus \`?`.webm -async 1 -vsync passthrough && rm 
`?`-0.log;" bitrate bitrate)))
    (dired-do-async-shell-command command nil videos)))

I could as well use Common Lisp or other programming language, again I
would need suspend option as processing videos from mp4 to webm for
websites takes days or weeks depending of size of videos. Other people
delegate that job to YouTube, I don't and do processing on my
computer.

> I am aware of that capability myself, but never take advantage of it, opting
> instead for an additional split in the terminal emulator. Overall, it seems
> to be like it had been more important in the earlier age when operating
> systems had no real multitasking. Now we have terminal splits, and tmux, and
> so on.

Suspending a job is not same as concurrently running multiple
jobs. It requires more understanding.

Even if I use `screen' or `nohup' I may still like to SIGSTOP the
process. I can do it by using `kill' command or `top' or similar
process manager, but if process is running in the shell I may do it by
using Control-Z and invoking SIGTSTP signal. I resume it either with
`fg' in shell or by using `kill' SIGCONT or other process manager.

SIGTSTP is invoked by Control-Z and may be prevented by application
which I have recently learn that Emacs is basically emulating job
control. SIGSTOP cannot be prevented, so I can suspend even this frame
here I could easily SIGSTOP by using `htop' and SIGCONT to continue.

Majority of people have strong computers and will never reach their
maximum capacities as not everybody is doing parallel tasks, video
processing, database extensive calculations and queries, updates or
database indexing. Of course that this group of people will never
understand it.

`mu4e' is popular Emacs package and it offers indexing option that
invokes the outside process of `mu' command indexing the database of
emails. I have 465691 emails as they are related to customers, so it
is hard to just delete emails as even customer before 10 years may
inquire again and I lose money if I do not know who is that
person. Emails are kept to keep good relations with people and to be
able to follow up on the already established relation. Mailing list
emails I simply delete after reading or answering. Now I have to
invoke `mu index' and I will either do it inside of terminal, or on
console or inside of Emacs.

If I start doing it inside of Emacs, then Emacs becomes not
responsive. Doing it in separate process helps the free Emacs instance
to be usable. Extensive file system harvesting by `mu' tools for mail
indexing may slow down the computer and make it less usable even if it
is separate process. Suspending such jobs helps human to do the human
stuff. Unsuspending them at times of absence of a human is next
logical action.

Myself I use job suspending options in shell for reasons of data
safety, when something is going wrong, for reasons of switching
between two applications when I wish to actually suspend one and
invoke the other,and for reasons of computing extensive processes
where such need to be stopped until later time.

I wish I could be able to index my emails every day, but that is too
expensive, occupies the computer too much, so I don't do that, I do it
every few weeks. I wish I would be able to just invoke video
processing and that computer is free for me, but it is not. Sometimes
I delegate video processing to remote computers in same building. What
if power is soon to be off? Outages are sometimes announced by radio
and known to last for one day or longer. I need to suspend the
computer, not only the job, or battery may not last long, not all
computers have automated sleep mode and not every computer has the
UPS system.

> If it actually matters to the decision makers, I could make a poll or two
> (maybe on Reddit, maybe on my workplace) about whether people know about
> this feature, and whether they use it regularly.

I do believe firmly that not many users use it. But that is case for
the Bash and general computing. Emacs is on top of the Bash, Bash is
fundamental to Emacs and job control is more fundamental to Emacs.

If I do extensive computing in X Window system, then I can still
invoke graphical task manager and send SIGSTOP to stop Emacs, but if I
am in console, and process (Emacs) is already running, I have no other
option but to use Control-Z to suspend it and trust Emacs to do
exactly what I expect.

If it is not dangerous process that maybe causes loss of data, or not
computing extensive process, or not something urgent then I could log
in with SSH again and suspend it from `top', `htop' or similar.

The point is that Control-Z is used when there is emergency, not
without emergency. There is some demand for Control-Z, it will not be
used often. And it will definitely not be used by people who do not
know about Bash job control.

If you are making a poll, then make a poll among people who know what
is job control. You can choose any community for your polls, but that
will not make your survey authentic. If I ask chicks behind my house
they will say pee, pee, but I am sure they will answer negatively on
job control question, as they have never learned about Bash, and many
people who learned about Bash, Korn Shell, dash, zsh, did not learn
about job control. Ask those who KNOW about the job control if they
use it and when and how. That will be authentic information.

But that is normal considering that Bash and other shells are used
mostly by set of power users. There is bunch of other Bash related
features that are mostly not used by majority of users, that means
nothing. Function is important, it is part of POSIX standard and
number of users using it means not that function shall be abandoned or
forgotten.

Especially not so if you have not done research on job
control. Currently you are comparing SIGTSTP/SIGSTOP on process to
running it concurrently in Tmux or Screen, which shows you have
fundamental misunderstanding on what Control-Z actually
does.

Concurrent running of multiple processes is not equal to stopping a
process and being able to continue with it later.

If I suspend a job in bash, I may decide to run it in background, but
not automatically.

1. Control-Z suspends the job, it stops running.

2. fg brings it in foreground

3. bg allows it to run in background, shell is free for other commands
   in parallel

4. Invoking other jobs in meantime is possible without interrupting
   the suspended job to be continual, they can be continued later with
   fg or bg commands in shell

5. nohup, screen and tmux are not job control commands. They help you
   run programs without your direct supervision and without
   interrupting them when you log off. But is not related to job
   control.

See: (info "(bash) Job Control")

Additionally if you think that job control is useless, than start by
sending bug report to bash, dash, ksh and other shells, as that is
where job control is used, in the shell, Emacs being just one of
thousands of possible processes who respect the Control-Z. You could
as well make a proposal to change the POSIX standard.

That terminals are used, this query of newest questions on
Stackoverflow may tell:
https://stackoverflow.com/search?tab=newest&q=terminal

But I cannot make proper query to find only people who relate to
suspending a job:
https://stackoverflow.com/search?tab=newest&q=bash%20suspend

That some people have need for suspending:
https://stackoverflow.com/questions/65936832/how-to-suspend-and-resume-processes-from-a-python-script

Somebody needs to often kill process:
https://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex

People using SIGSTOP in debugging:
https://stackoverflow.com/search?tab=newest&q=SIGSTOP

People using SIGTSTP:
https://stackoverflow.com/search?tab=newest&q=SIGTSTP


Jean



reply via email to

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