[HN Gopher] How to open a file in Emacs: a story about Lisp, tec...
___________________________________________________________________
How to open a file in Emacs: a story about Lisp, technology, and
human progress
Author : mpereira
Score : 146 points
Date : 2021-01-03 16:32 UTC (6 hours ago)
(HTM) web link (www.murilopereira.com)
(TXT) w3m dump (www.murilopereira.com)
| abhinav22 wrote:
| Wowsers! That was a long read, I skimmed through a bit of it.
|
| Kudos for dedicating time and effort to high quality long form
| articles - this is something that online needs to revert to.
|
| That said, can you give us a TL;DR if you have a moment :D
| chrisdone wrote:
| I read all of it. It was very interesting, while I can see the
| author knows what they're talking about, something about it
| rankles me. I've used Emacs since I was a teenager and now I have
| grey hairs I'm entitled to indulgences like mocking this author's
| 4 years of using Emacs. I won't, however.
|
| My only real critique is that due to the power of Emacs's
| extensibility -- notably, differently to other editors, it has
| its own real language, not Python or some separately controlled
| language -- all claims of the form "X editor de jour has X
| features and Y population of users" fall on deaf ears.
|
| I'm using still using Elisp that I wrote in 2008. It still works
| the same. Do you remember what editor was popular in 2008? Me
| neither. I use Emacs for the long haul. Every bit of investment I
| make into it has paid dividends. I'm using a package that one of
| my colleagues wrote in the 90s (aligning by regexp).
|
| In particular, if your admiration of Emacs consists in listing
| its "killer app" packages (Org, Magit), then you are one of the
| flaky users who will jump ship when something more shiny comes
| along. Emacs isn't for you. You have to think about why Emacs is
| such a great incubator for such packages.
|
| People are always coming to Emacs wanting to "fix" it by changing
| standard keybindings or making more "modern". An sdl/OpenGL
| renderer would sure be neat and all, but it's nowhere near a
| priority for me. These are superficial things and Emacs doesn't
| have to be popular to be successful. It's past the point of
| needing heavy maintainership.
|
| I don't even remember what version of Emacs I'm running. It
| doesn't matter, it works the same. I pin all my Elisp packages by
| putting them all in a git repo so that my environment never, ever
| breaks.
|
| I don't recommend Emacs to people, so I don't "have a hard time
| recommending it". Emacs is more wonderful when there is lots of
| Elisp around on the wiki, and the more recent phenomenon of
| "packages" is also wonderful. But you don't need to "market" or
| "sell" Emacs, as long as there are hackers who like full control
| and freedom over their environment, there will be Emacs users.
| Did I have an easy time learning it? No, it was hard work. But
| here I am in 2021 still loving it.
|
| Finally, and this point is more of an addition than a critique:
| Emacs may be the singular, unique, piece of software out there
| that truly satisfies the spirit of "free" software. Most GNU/FSF
| software falls short of their own ideals, because it is not
| modifiable by the users who use it. Linux the kernel is free, but
| could I modify it? Heck, getting it to compile is a step in
| itself. Understanding the C to achieve what I want? Give me a
| week. With Emacs, I can change almost anything and I can do it in
| a few minutes. Either via hooks, or just editing the Elisp code
| directly and evaluating it. Heck, I patched C-s the built-in
| search feature. Not only that, I can save that file and it'll
| still be working in 10 years. What other OS can you name that
| gives you this power?
| radarsat1 wrote:
| I use emacs but tend to just find another way to do things (e.g.
| grep, & other shell things) when I run into a stumbling block
| like this; believe it or not, not everyone wants to start
| debugging their text editor when they run into trouble.
|
| Admittedly I wish I would spend a bit of time in emacs internals
| sometimes just so I could learn to approach similar issues, but
| it's just never much of a priority when I'm trying to work on
| what I'm actually working on. I rarely get distracted by trying
| to optimize my config, as a result I use almost the vanilla
| defaults and I'm mostly happy with that. TRAMP is pretty great, I
| wish it would not make a new connection for every network
| interaction though. Setting ControlMaster on ssh helps a bit but
| it's still not as fast/transparent as I'd like. There are far too
| many "blocking" operations in emacs, as much as I love working in
| it, there is the non-zero times that it locks up on me and it
| drives me crazy when that happens.
|
| If it was ever the case that I had to wait 30 seconds to open a
| file, I'm sure I would abandon emacs instead of trying to debug
| it. That said I can't imagine working on a 70,000-file repo. That
| sounds like a terrible idea.
| bambataa wrote:
| I always wonder how people evolve from fiddling with package
| configurations to using emacs at this level.
|
| My stunbling block is not so much knowing Elisp (I'm sure I can
| stumble through that) but just knowing the internal architecture
| and how emacs works overall.
|
| Has anyone come across a good guide for hacking emacs? I know
| there is the manual. Perhaps I just need to look at that again
| and get going.
| mlang23 wrote:
| Being able to open remote files with Tramp is convenient.
| However, whats even cooler is that Tramp can execute remote
| commands. IOW, if you edit a file in a remote directory, you can
| also use M-x compile RET to run a remote build process and see
| the output in your Emacs _Compilation_ buffer. If the paths
| pritned are relative, you can even use M-x next-error RET to jump
| to a build error location.
| macintux wrote:
| Running remote commands is almost entirely what that part of
| the article is about.
| humanistbot wrote:
| When I was first getting into programming and computer science as
| a student, I was so into these kinds of super-customizable rabbit
| holes. My whole life pretty much centered around the keyboard and
| terminal. I was all in on knowing everything about the entire
| stack and making it do whatever it was I wanted. I'd spend hours
| to save a few keystrokes. That wasn't so much about the
| productivity trade-off as it was about an almost ideological
| drive I had to make the machine do exactly whatever it was I
| wanted. Nothing commercial off the shelf, only things I could
| customize down to the source code.
|
| A couple decades later, I just find it all so exhausting.
| agumonkey wrote:
| As you grow your brain optimizes off fruitless ideas. You think
| total control of one part will be the ultimate because younger
| your perspective is narrow and you focus all on it.
|
| When I was in college I thought being a flawless typist would
| make me a better programmer.. (mind you I had trouble mastering
| dynamic programming, advanced abstractions or semantic
| subtleties).
|
| I find these exhausting too now, and actually that's why I'm
| jaded by tech. The vast majority of things in the late 10 years
| felt like a planet scale tweak (phone has tilting backgrounds,
| css animations, ..). Deep inside I knew it was just marketing
| and nothing substantial.
| erikbye wrote:
| > The vast majority of things in the late 10 years felt like
| a planet scale tweak (phone has tilting backgrounds, css
| animations, ..)
|
| Sounds like you are in a very small bubble if that is your
| take on the last decade's tech inventions/evolution. What
| about autonomous vehicles/dock yards/warehouses and reusable
| rockets?
| agumonkey wrote:
| SDV are not there yet, reusable rockets are not mainstream.
|
| Yeah my bubble was mostly about consumer computing and
| network. CRISPR wasn't included in my rant.
| bjeds wrote:
| In no way do I want to come off as rude with this comment, but
| to me what you are saying is not at all different from
|
| "when I was young I used to work out and eat healthy... a
| couple of decades later, I just fund it all so exhausting".
|
| Customizing your computer environment is good. Eating healthy
| is good. None of those need to end up in a "rabbit hole".
|
| Everyone can be tired of life and give up due to exhaustion,
| but greatness requires discipline. This is also true with the
| craft and art of programming.
| nn3 wrote:
| A super customized system is more like a pet. A mostly
| standard system with very limited tweaks is more cattle.
|
| Like the OP I used to be in the having "pets" category
| (including gigantic ~/.emacs), but these days I prefer cattle
| (defaults as much as possible)
| Thrymr wrote:
| It feels a little closer to "when I was young, I used to
| spend so much time arranging my kitchen gadgets [or exercise
| equipment]". Not doing the useful part of it, but frittering
| around the edges.
| brandonmenc wrote:
| I'm not going to die younger if I don't waste a bunch of time
| customizing my computer.
| oblio wrote:
| Or you can, you know, just use VSCode, have fun coding what
| you actually want to code and use that spare time:
|
| a) learning Spanish to talk to that hot chick/dude
|
| b) traveling around the world
|
| c) doing whatever else you love to do besides coding
| bmitc wrote:
| Exactly my thoughts. In the context of the posted article,
| one just installs the Remote - SSH extension and moves on
| with life.
| coldtea wrote:
| > _Customizing your computer environment is good. Eating
| healthy is good._
|
| One is a practical endeavor of great importance for mind
| function, body function, longevity, performance, etc.
|
| The other is something between slightly better ergonomics (in
| a non-scientific ad-hoc way), tinkering, and bike-shedding.
|
| People have found again and again that "customizing your
| computer environment" is not a good in itself, but a means to
| an end, with quite narrow diminishing returns.
|
| > _Everyone can be tired of life and give up due to
| exhaustion, but greatness requires discipline._
|
| This includes first and foremost the disclipline of avoiding
| tinkering and bike-shedding with your tools, and doing real
| work on real problems instead (which is not a false
| dichotomy: many people fixate on the former to the detriment
| of the latter).
|
| > _This is also true with the craft and art of programming._
|
| Which has as little to do with a focus on customizing of
| tools, as a hi-fi hobby has with being a music lover...
| bjeds wrote:
| Did we read the same article?
|
| The author of the article customized his environment so
| opening a file no longer froze his editor.
|
| I wouldn't classify that either as "slightly better
| ergonomics" nor "tinkering" nor "bike shedding".
|
| He had the discipline to improve his favorite editor. Good
| for him.
|
| Emacs is obviously a very powerful environment for people
| who know how to use it. I applaud the author for
| documenting how he fixed this.
|
| The only difference between emacs and many other open
| source software is here you can easily solve bugs in your
| config file, instead of filing a pull request or submitting
| a patch to some git repo. The first you call "tinkering"
| and look down upon. The other I assume you approve of? But
| why the double standard?
| coldtea wrote:
| > _Did we read the same article?_
|
| I didn't respond to the article, I responded to your
| particular comment, which seemed to imply that
| customizing your programming environment in general is
| something great and necessary.
|
| > _The author of the article customized his environment
| so opening a file no longer froze his editor._
|
| That doesn't clarify as "customizing my environment" is
| more like "fixing fundamentally broken shit".
| dan-robertson wrote:
| A lot of emacs customisation ought to be unnecessary. And I
| think the yak shaving on one's config isn't really a great
| use of time (if you want it as a hobby then I guess that's
| fine).
|
| Some examples of unnecessary customisation is the fact that
| the defaults of emacs so often ought to be changed. E.g. why
| does M-SPC do just-one-space instead of the strictly more
| powerful cycle-spacing (answer: probably a combination of
| history, neglect, and a fear of breaking existing saved
| keyboard macros), why use upcase-word instead of upcase-dwim?
| Why does autocomplete require so much customisation?
|
| If emacs had better defaults there would be much less reason
| for spacemacs or doom to exist.
|
| One person I work with will (drastically) customise the key
| bindings for each new mode before using it, making it hard to
| use new modes. Another gave up on customising emacs and
| switched to spacemacs to no longer have to think about
| customisation.
| mainstreemm wrote:
| I'm too young to have used it, but I bet Borland C++ was
| nice, too. And I bet it was more work to configure Emacs to
| write C++ in the 90s than it was to just use Borland. But
| which one is still around?
|
| I wonder if it's more time wasted when you have to change
| editors every few years because of changes in the funding
| model of the corporate patron of the product and relearn
| how to use the entire environment with "sane defaults"
| versus creating some custom keybindings that you like
| essentially one time and then using them for 30 years in an
| editor that has a license and community that makes it
| unlikely to suddenly cease to exist.
|
| People act like there's all this extra work to using
| software like Emacs over corporate IDEs, or GNU+Linux over
| corporate OSes, but I contend that it is merely different
| and better-documented work. The corporate environments just
| make more promises, and then everyone is surprised when the
| promises are broken.
| krbzsq wrote:
| I don't think this is fair. Eating healthy and working out is
| objectively good. Whereas for plenty of people, these
| customisations are just that, a "rabbit hole" that was
| interesting when they were younger but then it got tedious.
| Now they've found a setup they like, be that intensely
| customised or a fresh macOS install with VSCode. I wouldn't
| consider either indicative of greatness. A lot of people just
| want their computing environment to get out of their way.
| stirner wrote:
| I had the exact same experience, but I feel grateful since it's
| what got me into programming. I first learned C in order to
| customize the dwm tiling window manager on Linux. Over time, my
| priority became simplicity and overall cohesive design over
| customization, though still in an entirely impractical way (I
| moved to BSD and briefly Plan 9/9front). Now I've settled on a
| dead-stock macOS setup and spend zero mental bandwidth on
| customization, but I think going down the customization rabbit
| hole taught me a lot about software design, UI/UX, and even
| philosophy in a weird way.
| entropie wrote:
| I absolutely know what you mean.
|
| > I was so into these kinds of super-customizable rabbit holes
|
| I did this too. I spend _days_ customizing my xmonad (I dont
| speak haskell), but thats nothing in comparison to the time I
| spend tuning my emacs.
|
| On the other hand, i pretty much use the same environment like
| a decade ago. My same .emacs, my same xmonad.hs. I was looking
| at my WM and if there is a way to get rid of ghc on my machines
| (I use gentoo, updating ghc is an expensive task, especially on
| older machines) but every other WM felt like a downgrade so I
| went back to xmonad, to my old config.
|
| I feel home everytime I open my notebook or booting linux on my
| desktop.
| opan wrote:
| >I'm not aware of similar functionality in Vim,
|
| Vim can open remote files by putting scp:// at the start. Check
| the vim wiki or similar for exact syntax. Works with your ssh
| config aliases and keys and such, so can be pretty smooth.
|
| What I don't know is if he knows of this feature and declares it
| not-equivalent, or if he's never seen it. TRAMP is likely more
| powerful, in part due to emacs itself. Like, you can view a
| remote dir in dired and open an image and see it inside your
| emacs. I don't know if gvim can view images, I only use regular
| vim or neovim, but I typically use a graphical emacs.
|
| Mostly unrelated, you can open a web url in neovim like it's a
| file. I've done this to read a page with a bad layout before. A
| bit like w3m, but then you can easily delete chunks or save parts
| to another file if you want. You are just seeing the raw html,
| but usually the paragraph tags are fairly readable.
| coldtea wrote:
| > _What I don 't know is if he knows of this feature and
| declares it not-equivalent, or if he's never seen it._
|
| I know it, but it's not even close. Almost every editor can do
| something like that over SCP/SSH/SFTP.
| macintux wrote:
| It's a shame that most of the discussion is about the first part
| of the essay, impressive as the troubleshooting is.
|
| His discussion of core values is quite interesting, in that it's
| both relatively obvious in retrospect yet something I've not
| given conscious thought to.
|
| I've certainly thought about programming languages as expressions
| of intent, and how some attempt to be what I call "kitchen sink"
| languages, like C++, Java, or JavaScript, while others are much
| more opinionated about their purpose, like Erlang, Forth or APL.
|
| Also reminds me of the old description of UNIX as user-friendly,
| just picky about who its friends are.
| oblio wrote:
| Cute. If I'd have to guess, that's at least 200 hours put into
| learning Emacs, probably more.
| guenthert wrote:
| 200h is a lot if you think of Emacs as a tool to turn
| keystrokes into source code of your current project. I don't
| think it's a lot if you think of Emacs as a tool to help
| realize the ideas of your lifetime.
| oblio wrote:
| Summarizing: everything you do takes time and this time has
| an associated opportunity cost.
|
| If you can configure another tool in 2-5-10 hours to achieve
| 90% of the efficiency Emacs gives you and you can use the
| other 190-195-198 hours to actually realize those "ideas of
| your lifetime", it is a lot of time spent (and maybe wasted).
| Also: https://xkcd.com/1205/ + tinkering isn't necessarily
| productivity. If anything, it's more often procrastination.
|
| Finally, I'm not sure how you could prove that Emacs it the
| only thing that allows you to achieve those "ideas of your
| lifetime", I don't think that's even a falsifiable statement,
| it's just your personal opinion.
| bmitc wrote:
| Articles like this really trigger the imposter syndrome for me. I
| just have no patience for these type of things, and seeing
| others' both ability and patience to power through issues like
| this one, I just feel like an imposter.
|
| But these types of issues are why I've always given up on
| learning Emacs. When I can just install Visual Studio Code and
| the Remote - SSH extension and whatever else extension that I
| want to work remotely and get on with life, it's really hard to
| justify the time one needs to spend with Emacs to bend it to your
| will.
| PaulDavisThe1st wrote:
| You appear utterly convinced that VSCode will never demonstrate
| an obscure bug like the one discussed in TFA, or alternatively
| that if it does you'll be able to jump ship to some other tool.
| I don't share your confidence, and would prefer to know that
| such issues can be fixed with or without vendor participation.
| macintux wrote:
| That seems an ungenerous and quite broad interpretation of a
| fairly simple assertion.
|
| Even as much as I love Emacs, I would never fault someone for
| choosing a more productive tool now even if there's a non-
| zero risk of something breaking in the future...because
| there's always something that will break on any platform.
| Time spent being productive _now_ is usually worth that risk.
| guenthert wrote:
| "I've recently joined a company that for security reasons doesn't
| allow their source code on laptops. Development happens strictly
| on workstations inside their private networks, with some using
| their text editor's support for remote file editing and others
| running editors on those machines via SSH."
|
| I think using TRAMP or similar technologies is bypassing, if not
| the letter, then the spirit of that companies' security policy.
| Sure, not the whole repository is lost when the laptop is, but
| having an (ephemeral) copy of the files one is working on outside
| the security perimeter is kind of defeating its purpose. Why is
| that company granting access to remote file transfer? I'd think
| they would be better off restricting access to some form of
| desktop virtualization (the old SunRays were nice) if they must
| offer remote access.
| helmut_hed wrote:
| This really captures the power of Emacs for people with Lisp
| skills. For coders with strong habits of high-level thinking it's
| a real force multiplier. Why shouldn't we apply the same analysis
| and effort to our productivity tools we do to our "output"?
| mark_l_watson wrote:
| Nice write up, thanks.
|
| I often mosh + tmux on remote servers slso, and even though I do
| nothing fancy, with Emacs it all works for me.
___________________________________________________________________
(page generated 2021-01-03 23:00 UTC)