Live data from Hacker News

Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

news.ycombinator.com

121–130 of 340 posts

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#121
post #109

Earlier quoted context omitted.

Most of the text on the web for example is in a proportional-pitch typeface. Does your Emacs usually use a proportional-pitch typeface? If so and you're on Linux, I'll install the font you are using. I've tried using proportional typefaces in Emacs (on Mac), but there was something off, so I went back to monospaced. I could try again now that I have a Linux machine. The text in my Emacs looks almost exactly like the…

Pardon me if you're ahead of me on this, but it sounds like you might be using a proportional typeface as the default or fixed-pitch face. You should get nice-looking proportional type if you set the variable-pitch face to your desired typeface and enter variable-pitch-mode in the buffer. E.g., (custom-set-faces '(variable-pitch ((t :family "Verdana" :height 180)))) And then in the buffer you wish to view with propor…

I use IBM Plex Sans (proportional) as my default Emacs font, with variable-pitch as a no-op (i.e., defined as "(variable-pitch ((t nil)))" in custom.el), and use IBM Plex Mono as fixed-pitch.

Tips for using a variable pitch font as the default:

0. Choose default fixed and variable pitch fonts with identical baseline-to-baseline heights for a given size; this makes everything described below work better (e.g., this is true for all fonts in the IBM Plex family across all platforms I regularly run GUI Emacs on [Linux, Mac, Windows]).

1. Define a fixed-pitch-mode by copy-pasting the built-in variable-pitch-mode and making the obvious changes (both are trivial applications of buffer-face-mode).

2. Add fixed-pitch-mode to hooks for modes that don't play nicely with variable-pitch fonts (calc, dired, hexl, magit, terminal and shell modes, etc.), or where you just prefer fixed-pitch modes (hint: define your fixed-pitch-mode in a package so you can use use-package's ":hook ((foo-mode bar-mode … baz-mode) . function)" syntax to manage this).

3. Some modes that pop up windows (frames in Emacs parlance) within editing buffers require extensions (e.g., company-posframe-mode for company-mode) to work properly in variable pitch buffers.

4. Last, but certainly not least: assign a convenient key binding to toggle fixed-pitch-mode. I can't emphasize this enough! In fact, I've found that variable pitch is fantastic for coding in most languages if and only if fixed pitch can be quickly toggled on and off with a keystroke, iff this setting is per file rather than global (and iff both fonts have identical line heights, but this is a feature of font families rather than editors).

For this reason alone, I'd argue that Emacs supports variable pitch fonts better than most text editors.

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#122
This will fall to the curse of most people answering didn't write emacs.

That is, rewrites can work sometimes. You typically need someone who was involved in the last two for it to work, though.

If you haven't written it once, you have no real idea on any compromises that were made.

If you haven't tried to do it without a compromise, you don't know which compromises were unexpectedly vital.

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#123
post #8
post #3

- Use Common Lisp instead of Emacs Lisp. - Design a more modular architecture to make it easier to extend and maintain different components. - Design a more robust plugin system for development and distribution of extensions. - Implement better sandboxing and security measures for extensions. - Better APIs for extension developers. - better multi-threading support baked into the editor.

> Use Common Lisp instead of Emacs Lisp. Interesting, why not a scheme? Is it because the popularity in the industry? I don't know much about Emacs or lisps and looking to understand better

elisp is more like CL than it is like Scheme; RMS was aware of CL when he was working on emacs, but was suspicious of some of its new features (like lexical binding).

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#124
More to the point, emacs already has been rewritten substantially. There’s the initial rewrite from TECO to lisp, there’s the 80s implementations like uemacs (famously used by Linus), we had a major fork with xemacs in the 90s, there’s guile emacs (ready any day now), lem is almost but not quite a Common Lisp emacs, and it’s been making a lot of progress recently. So go ahead with your rewrite, you’re in fine company!

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#125
Almost all the comments here are about things that really possible to do in current Emacs i.e. 'feature-requests' and not "fundamental pitfalls of this foundational application". For me, it would be just:

- Redesigned with concurrency in mind.

- Common Lisp, Scheme, or anything else other than Elisp. [Just the same way Neovim adapted Lua instead of VimScript]

- More sane defaults for new users.

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#126
post #42

Earlier quoted context omitted.

Well, if there's no further info then I'm going to speculate you've misconfigured something ;)

Ok then, "make it harder to hold it wrong". :)

I'm not holding it wrong.

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#127
post #109

Earlier quoted context omitted.

Pardon me if you're ahead of me on this, but it sounds like you might be using a proportional typeface as the default or fixed-pitch face. You should get nice-looking proportional type if you set the variable-pitch face to your desired typeface and enter variable-pitch-mode in the buffer. E.g., (custom-set-faces '(variable-pitch ((t :family "Verdana" :height 180)))) And then in the buffer you wish to view with propor…

I use IBM Plex Sans (proportional) as my default Emacs font, with variable-pitch as a no-op (i.e., defined as "(variable-pitch ((t nil)))" in custom.el), and use IBM Plex Mono as fixed-pitch. Tips for using a variable pitch font as the default: 0. Choose default fixed and variable pitch fonts with identical baseline-to-baseline heights for a given size; this makes everything described below work better (e.g., this is…

I use IBM Plex across the board and I was trying to understand the font issue because I do not have it. I default to fixed-pitch mode for everything, and use variable pitch for UI elements.

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#128
post #92

I like emacs for its flexibility and its ability to be a platform for people to build just about any extension. So for this you'd need a solid scripting language. I was never sold on Lisp but it's fine. I'd prefer to see lua; it just makes more sense. The repo-reference stuff works pretty well all things considered. If it were python it would be hell. Crazy side of me would like to see it fully written in a safe(r) l…

> Crazy side of me would like to see it fully written in a safe(r) language like rust, swift or zig.

Emacs Lisp is a very safe language. Even though the Emacs core is written in C, that is immaterial and impalpable to Emacs users as they only interact with Emacs Lisp. What benefits would Rust / Swift / Zig bring to an average Emacs user?

> Basically your config would be a recompiled subsystem, loaded at runtime, or you'd recompile the whole editor.

elisp -> bytecode compilation in Emacs… predates humanity?

https://www.gnu.org/software/emacs/manual/html_node/elisp/By...

The entire stash of Emacs packages compiles into the byte code at the package installation time, anyway. Personally, I even byte-compile-file my ~/.emacs to eke out an imperceptible speed improvement at the startup time, which is slightless less than entirely useless but it warms my heart that I can do it.

Recent versions of Emacs can also compile Elisp into the native code:

https://www.gnu.org/software/emacs/manual/html_node/elisp/Na...

> Better key handling and none c-x nonsense.

Perhaps you do not need Emacs then.

Re: Ask HN: If you were rewriting Emacs from scratch, what would you do differently?

#130

The core should be in rust, verfied in lean, and the runtime should be in guile. Literate programming in org-mode should be a hard requirement. Package management should require patch algebra. Macros should be submitted to a leaderboard in a blockchain and yield flair in EUDC. M-x measure-beard-length should require 10000 hours of logged usage and unlock the major mode infinity-categorization. Tongue-no-longer-in-che…

When I saw “should be in rust” my instinct was to flame like nobody’s business, glad I kept reading. Lmao. Good slow burn.

Though, not to put too fine a point on it, I know it was in jest, but the core implementation language is the least of my concerns. As long as it is extremely portable, compiles fast, and runs on virtually anything, then whatever the core is, doesn’t matter much to me.

Post reply on HN