Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Emacs is a fine editor to use until you write your own. It's the only way to make your primary interactive tool work exactly the way that you think it should.


That's a hefty endeavor. Care to share more about your experience writing your own?


Live coding environments typically include a text editor. Sometimes as in the case of Praxis, its possible to change the behaviour of the text editor while you use it.

https://github.com/createuniverses/praxis

I wrote it for myself mainly, so a lot of the features are undocumented and hidden away. But you can have a look at fnkeys.lua, editor.lua and keymap.lua to get a general idea. These are in prods/syntax2015continued. You can bring these up in praxis and make whatever changes you like to the live system.

I like the idea of making it keyboard and buffer driven to an extreme, like the Commodore 64. For example, one simple technique I like is to "inject" code into the current buffer to place objects:

  function makeCamPosSaver()
    local x,y,z = getCamPos()
    x = math.floor(x)
    y = math.floor(y)
    z = math.floor(z)
    local s = "setCamPos("..x..","..y..","..z..")"
    print2(s)
  end
Then calling makeCamPosSaver injects a bit of code that will move the camera back where it was when you called it.

Another example: pressing F3 creates a new buffer where you are supposed to fill in a string with what you are searching for. When you run that buffer, it will switch to the old one that spawned it, and move the cursor to the next occurrence of the search string.

There are more creative ways to use this that others could come up with I'm sure.


I think pklausler means that, out of the box, emacs is decent but, over time, you slowly mold it into something that is more truly yours.

That's been my nearly twenty year experience with emacs.


I am glad that you have enjoyed your use of emacs, but no, I was being literal. A text editor is not a complicated piece of software to write from scratch.


I guess 7100 lines of C might sound simple to some, but that sounds pretty complicated to me! :)


Writing a text editor for a POSIX system with an xterm-compatible terminal took up about 7100 lines of C and was entirely straightforward. I made it very easy to interact with shell pipelines so I didn't need any features that are already present in the surrounding environment.

https://code.google.com/archive/p/aoeui/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: