Live data from Hacker News

Mg: an Emacs-like editor in 160 kb

homepage.boetes.org

41–50 of 84 posts

Re: Mg: an Emacs-like editor in 160 kb

#41
This has been done before, most notably as JOVE, Jonathan's Own Version of EMACS for the PDP-11. JOVE was written by Jonathan Payne while in high school, around 1980. That had to fit in a 16-bit machine, with 128KB of RAM available to the program.

Re: Mg: an Emacs-like editor in 160 kb

#42

> Since it is written completely in C, there is currently _no language in which extensions can be written_; however, keys can be rebound and certain parameters can be changed in startup files. mg seems almost, but not quite, entirely unlike emacs. the thing that makes emacs emacs is not the keybindings or the so-called "modeless" editing (which is a misinterpretation by vim folks, emacs is way more modeful than vim),…

crontab -e Select an editor: 4. /usr/bin/mg there it is, that's why sometimes we need this program.

shouldn't your config management system be doing this ;P

Re: Mg: an Emacs-like editor in 160 kb

#43

> Since it is written completely in C, there is currently _no language in which extensions can be written_; however, keys can be rebound and certain parameters can be changed in startup files. mg seems almost, but not quite, entirely unlike emacs. the thing that makes emacs emacs is not the keybindings or the so-called "modeless" editing (which is a misinterpretation by vim folks, emacs is way more modeful than vim),…

You are missing the point of Mg—it's not to replace Emacs as your development powerhouse, but to give you little binary that acts a lot like Emacs but runs in some tiny vm or embedded device somewhere. You can also cross compile it (which you cannot do to Emacs).

It sounds exactly like all the various attempts people have made over the years to make a vim-alike textarea editor in javascript. They always forget block select mode, or don't implement bookmarks quite right, or something, which ends up in frustration if you're used to using your editor of choice as more than a Notepad.exe-alike.

Re: Mg: an Emacs-like editor in 160 kb

#44
post #35

Earlier quoted context omitted.

Not when I'm on some tiny VM or computer and want something nicer than Nano that has something remotely close to Emacs keybindings. Then it's the keybindings, not the scriptability. I just want a reasonable editor.

Learn about Tramp, and for tasks complex enough to need a proper editor, you can edit those files in the same Emacs session you use for everything else. That's what I do with my RPi, for example -- it can pipe edits over an ssh session, so anything with an SSH server is eligible. (Revisiting this comment, it occurs to me to add that all my editing on my main machine is done this way. I play a game or two sometimes, s…

Tramp is terrible. Sshfs is better. I don't think it's hard to think of situations where those options aren't as practical as popping open an editor on the command line that you're on.

Re: Mg: an Emacs-like editor in 160 kb

#45

> Since it is written completely in C, there is currently _no language in which extensions can be written_; however, keys can be rebound and certain parameters can be changed in startup files. mg seems almost, but not quite, entirely unlike emacs. the thing that makes emacs emacs is not the keybindings or the so-called "modeless" editing (which is a misinterpretation by vim folks, emacs is way more modeful than vim),…

crontab -e Select an editor: 4. /usr/bin/mg there it is, that's why sometimes we need this program.

I'm lost; why wouldn't vim be suitable in this case?

Re: Mg: an Emacs-like editor in 160 kb

#46
My .mg file -

global-set-key "\^h" delete-backward-char

global-set-key "\e[1~" beginning-of-line

global-set-key "\e[4~" end-of-line

set-default-mode fill

set-fill-column 72

Been using it for quite some time and really dig it.

Re: Mg: an Emacs-like editor in 160 kb

#47
post #38

Earlier quoted context omitted.

You cannot, however, install full blown Emacs on your Netgear router running OpenWRT. Mg is heaven sent in cases like that. Tiny linux machines still exist (Raspberry Pi is not tiny, resource-wise).

Emacs should be able to run on 16MB machines without X linked. http://superuser.com/questions/313105/ram-requirements-of-em... A dozen Emacs "clones" already exist for even lower memory machines: https://www.gnu.org/software/zile/ http://www.emacswiki.org/emacs/Jove Anyway, like I mentioned, wouldn't time be better spent creating a high-performance clone rather than a partially functional tiny clone?

> Emacs should be able to run on 16MB machines without X linked.

My point exactly. These little routers have just a few megs of RAM. Emacs also has ~70MB of (compressed!) elisp files. On a machine with single digit MBs of flash, that's just not workable.

And! Even if you do have 70MB of disk and 16MB of RAM available, Emacs isn't necessarily performant. Emacs was dog slow when I had a $5/month prgmr vm, but Mg was blazing fast.

> A dozen Emacs "clones" already exist for even lower memory machines

Mg isn't new, in case that is what you are thinking (it's at least 10 years old).

I tried a bunch of tiny emacs clones a few years ago and Mg was the absolute best. All the rest had weird gratuitous differences or were missing obvious important keys (one of them didn't have M-d). Mg isn't complete (obviously) but it has a surprising number of plain editing keystrokes built in and functions perfectly for editing conf files or crontabs or other small remote tasks.

> Anyway, like I mentioned, wouldn't time be better spent creating a high-performance clone rather than a partially functional tiny clone?

Whose time? And what do you mean by high-performance clone?

Edit: I see, I missed your (way) above comment. To re-answer: Those tasks are orthogonal. Nifty higher level editing junk is certainly a good idea, and people are working on it. I don't see why it would need to be an Emacs clone though, why not just make Emacs itself better? That's the whole point of it in the first place.

Re: Mg: an Emacs-like editor in 160 kb

#48

Earlier quoted context omitted.

crontab -e Select an editor: 4. /usr/bin/mg there it is, that's why sometimes we need this program.

I'm lost; why wouldn't vim be suitable in this case?

Because some of us use Emacs on a daily basis and don't have vi keys seared into our brains. I know the basics, just for these kind of cases, but given the choice I'd use mg any day over vi.

Re: Mg: an Emacs-like editor in 160 kb

#49
Would be even smaller without all the weird quotes in theo.c

    "Stop slacking you lazy bum!",
    "slacker slacker lazy bum bum bum slacker!",
    "I could search... but I'm a lazy bum ;)",
    "sshutup sshithead, ssharpsshooting susshi sshplats ssharking assholes.",
    "Lazy bums slacking on your asses."
etc!

Re: Mg: an Emacs-like editor in 160 kb

#50
post #35

Earlier quoted context omitted.

Learn about Tramp, and for tasks complex enough to need a proper editor, you can edit those files in the same Emacs session you use for everything else. That's what I do with my RPi, for example -- it can pipe edits over an ssh session, so anything with an SSH server is eligible. (Revisiting this comment, it occurs to me to add that all my editing on my main machine is done this way. I play a game or two sometimes, s…

Tramp is terrible. Sshfs is better. I don't think it's hard to think of situations where those options aren't as practical as popping open an editor on the command line that you're on.

I use tramp for minor config file editting, it's not too bad. But when coding remotely, I like to setup 2 copies of code, one local, one remote. I always work on the local copy, then when I need to build, I use rsync to push the local code to the remote server for building remotely (because only the remote server has the os/compiler/cpu resources). It works great😁
Post reply on HN