1. 30
  1.  

  2. 6

    I love and use emacs every day as a text editor. Tools like org mode and just general emacs customization is great!

    However, outside of the text editing sphere, the emacs implementation of thing such as shell, email, and a window manager always seem “almost there” but unfortunately not useable. This saddens me because I would love to never leave emacs.

    That being said, things like TRAMP completely shifted my ideas on how to manage remote files, so who knows. I am optimistic about the continued progress of the emacs ecosystem.

    1. 8

      Yes, I agree! For the shell environment, the brawback of emacs buffers becomes apparent. Most shell emulations (emacs has several) work fine as long as the executed programs do not produce much text, like cating a large file. When that happens, the shell becomes sluggish or freezes up, which in turn increases the cognitive burden, i. e. “May I execute this line or will this stop my workflow?” This is a major reason why I do not use the shell within Emacs. In general st feels much more resonsive than Emacs and that saddens me.

      For mail, I simply do not have that much mail that I consider the elaborate mail configurations necessary. Mostly I just do IMAP searches to find a messge I’m looking for and that works well enough for me. But I still find the approach with offline mailboxes quite nice; but there are still some smaller corners.

      As far as I understand it, when exwm is used, the window manager will freeze up, if emacs hangs and that is something that I do not want to experience, hence I’ve tried to make emacs play nicer with the window manager by mostly opening new Emacs frames instead of the internally managed windows. I’m satisfied with that setup.

      TRAMP is almost there. I wish it had a mosh-like connection to the remote server, but I understand that this is actually quite hard to implement. But still ssh editing via tramp works quite nicely, especially once you configure ssh aliases and keys properly.

      1. 4

        As a heavy Emacs in terminal user I’m pretty happy with the ability to just bg emacs and run cat and less when needed. And having a terminal multiplexer helps too of course.

        But I realize that if you’re in a windowing environment having everything in Emacs becomes more desirable.

        As an aside, isn’t a “normal” terminal emulator like rxvt already much faster than Emacs? What does st bring to the table?

        1. 3

          bg

          May I ask you how you put a emacs (in terminal mode, i.e. emacs -nw) in the background? I am running emacs with spacemacs + evil configuration (mostly for org-mode) and C-z messes the state completely up, the key-bindings don’t work as usual, but doesn’t put emacs in the background. Maybe it’s spacemacs’ fault. Just wondering.

          1. 2

            I use vanilla emacs, running under tmux. I just hit Ctrl-Z and it’s in the background, visible in the output of jobs. fg brings it back.

            I think it’s your specific configuration in this case.

            1. 1

              Thank you! Then indeed it’s probably the spacemacs configuration in the terminal mode. Will have to look there.

              1. 3

                Ctrl-z is the default toggle key for evil. You can set evil-toggle-key to some other shortcut:

                https://askubuntu.com/questions/99160/how-to-remap-emacs-evil-mode-toggle-key-from-ctrl-z

                1. 1

                  Many thanks! It helped indeed and I learned something.

                  I find it so strange, that Ctrl-Z has been chosen for this toggle mode, if this is the combination that is used in terminals to send programs to the background. Maybe there are not many people using emacs in the terminal with evil mode.

                  1. 1

                    The dude in the answers who modified the source to fix this really doesn’t understand the Emacs mindset ;)

            2. 3

              Yeah, I prefer the window environment, especially for writing TeX documents and using pdf-tools to view it. Most of the time I have a terminal around somewhere, so I use both simultanously. For example, I have three windows open with the TeX code in one emacs frame, the pdf in another an then the terminal that runs latexmk -pvc.

              As an aside, isn’t a “normal” terminal emulator like rxvt already much faster than Emacs? What does st bring to the table?

              Yes, I used urxvt before but switched to st at some point. The differnces between those two are minor compared to a shell inside emacs. The blog post by Dan Luu showed that st performed quite well, and further highlights the point about throughput of the emacs shells. But yeah, the preference for st is mostly personal.

              1. 2

                Alright, that’s giving me LaTeX flashbacks from uni, I know just what you mean!

            3. 1

              Most shell emulations (emacs has several) work fine as long as the executed programs do not produce much text, like cating a large file. When that happens, the shell becomes sluggish or freezes up, which in turn increases the cognitive burden, i. e. “May I execute this line or will this stop my workflow?” This is a major reason why I do not use the shell within Emacs. In general st feels much more resonsive than Emacs and that saddens me.

              I’ve found it’s long lines that cause Emacs to freeze. I tried working around this by having a comint filter insert newlines every 1000 characters, which worked but with really long lines that filter itself would slow down Emacs. One day I got fed up, and now I pipe the output of bash through a hacked version of GNU fold to do this newline insertion more efficiently. Unfortunately bash behaves differently when part of a pipe, so I use expect to trick it into thinking it’s not. Convoluted, but WorksForMe(TM)!

              (The code for this is in the fold.c and wrappedShell files at http://chriswarbo.net/git/warbo-utilities/git/branches/master ).

            4. 2

              However, outside of the text editing sphere, the emacs implementation of thing such as shell, email, and a window manager always seem “almost there” but unfortunately not useable. This saddens me because I would love to never leave emacs.

              Shell depends, as @jnb mentions, for a lot of text it’s cumbersome, but especially with eshell, if you alias find-file and find-file-other-window (eg. ff and ffo) then you get something you can get very used to, very quickly.

              Maybe it’s not universal, but I’ve been using Gnus for a while now, and I just can’t change to anything else ^^. Integration to org-mode is great, the only thing that’s lacking imo is good integrated search with IMAP.

              Honestly, I can’t say anything about window managers. I use Mate, and it works.

              1. 1

                The search in Gnus and various other quirks (like locking up sometimes when getting new mail) caused me to finally switch to notmuch recently. I miss some of the splitting power, but notmuch gets enough of what I need to be content. The search in notmuch is really good, although it has a potentially serious hinderance, so I can’t recommend it without reservations.

                find-file from eshell is why I’ve been making a serious effort to try it out. I also implemented a /dev/log virtual target (M-x describe-variable <RET> eshell-virtual-targets) so I could redirect output to a new buffer easily.

              2. 2

                Regarding the shell. I also had shell issues but now use the shell exclusively in emacs. I work over ssh/tmux into a remote machine and only use the emacs term. I made a little ansi-term wrapper to allow the benefits of eshell (well the scrolling, yanking, etc) but it uses ansi-term still so it can use full screen stuff like htop. I’ve been using it for years now. Might help be worth checking out.

                plug: https://github.com/adamrt/sane-term

                1. 1

                  Oh my God. Not only that is beautiful and perfectly suits what I was aiming to do, it also solves a couple of tangent problems I had with the section about loading the environment variables from .profile. Thank you so much!

                  1. 1

                    definitely will! I always run into issues with curses programs in emacs shell modes, which is the only thing that keeps me from using emacs shell exclusively,

                2. 3

                  I use Emacs for writing, development, and pretty much anything text-based, as well as mail, a directory browser and sometimes file manager. I’ve been using it for over 20 years and I’m starting to force myself to use things like M-x find-dired and M-x rgrep more to find out if I can ditch the shell for that sort of thing. It’s showing promise. I use it even more than I used to, although I have no plans to use it as a window manager. (emacs -nw forever!)

                  But I think the author is being remarkably charitable in some respects. I tried EMMS. It was bad. (Is it still bad?) And as has been mentioned in this thread, the shell emulation is okay, but falls down when there is a lot of output. If you read the author’s Eshell companion piece, there is a lot more overselling. The lack of input redirection in Eshell is a killer. Throwing large amounts of output into a buffer is incredibly slow and saying you don’t need to use grep in a pipeline means you don’t know what grep is for. If you have really large files to work with, Emacs is not suitable. Sure, M-x grep is great, but good luck to you if the file it’s in is, say, a 1GB+ log file from your build. And less almost works in M-x ansi-term for these cases. Almost.

                  I love Emacs, I’ll continue to use it, but I’m not going to say use it for everything. Terminals and shell interaction is still better in some cases.

                  1. 2

                    If emacs makes you nutty, try Acme. I use it to edit everything except files I’m editing with nano. BSD mail works inside it, and it runs whatever programs you want, and when I switch machines I never really move much config around. I could transfer the plumber files if I really cared. most of the time I run commands from window tags.

                    1. 4

                      I have Acme installed on my laptop, but I never could seriously use it. Simple things like “go to end of line” or “kill word”, “kill and remember region” just seem to cumbersome. But maybe I’m missing something, just like Emacs is pretty weird when you don’t know that M-x something-mode changes the major mode and minor modes exist too.

                      If I’m not wrong, Acme always inserts text into a buffer, which is the opposite of what Emacs does – Emacs always has a little layer of lisp in between a key-event and the buffer, thus acting not as a “text editor” in the simple sense, but more like some kind of an input transformer, depending on {major,minor}-modes and their keymaps. I’ve got used to it, and Acme just doesn’t seem like an alternative in this category, imo.

                      1. 1

                        Well, “go to end of line” is still “Ctrl-e”. Kill word is select and cut, and then paste. Paste it in a temporary buffer if you need to, or the window tag. You sound a little misinformed - Acme does a lot more than just put text into new and different buffers. Did you watch Russ Cox’s video on it? It might help you get accustomed to the editor. This github resource has some useful information, too.

                        1. 3

                          Well, “go to end of line” is still “Ctrl-e”.

                          Uhh, my bad, I mean next-line (C-n in Emacs), while staying in the same column.

                          Kill word is select and cut, and then paste.

                          That’s my point, it seems far too cumbersome. I constantly use the kill-ring in Emacs, and while I have and idea how it could be implemented in Acme, I don’t think it would be as “intuitive” and “native”. Especially when I don’t have a proper mouse on my laptop.

                          You sound a little misinformed - Acme does a lot more than just put text into new and different buffers.

                          My point is that you (to my knowledge) can’t rebind a, left-mouse-key or something like that to any arbitrary function? Pressing A always just enters A, doesn’t it?

                          Did you watch Russ Cox’s video on it? It might help you get accustomed to the editor. This github resource has some useful information, too.

                          I’ve watched the video and seen the collection, and I’ve read Pike’s paper. Nevertheless, while I admit that I haven’t used it to work for longer periods, I am at least capable of using it to do what I would want to do – it’s just that Emacs, not by being an alternative in the same category, but taking a different approach to begin with, has been more satisfying.

                    2. 1

                      I’ve tried and left emacs several times. Most recently it was because I couldn’t get <Tab> to do what I’m used to (add spaces until the next tab stop). Any Vim refugees ever figure that one out?

                      1. 1

                        Do you mean something like

                        (setq-default indent-tabs-mode nil)
                        

                        But I thing one shouldn’t try to “force” one editor to behave like another. I use vi/vim on servers, and it would be chaotic and counter-productive to try and make it emulate my emacs setup. If you have a genuine interest in using Emacs, try either to understand or accept the way it wants to suggest you do things – there’s probably a reason that the hackers behind it set some behavior to be default (be it maybe that it was only a simpler compromise that you’re free to change!).

                        1. 1

                          Yeah, I’m aware of that. indent-tabs-mode is certainly part of the problem; replacing runs of 8 spaces with \x9 characters is certainly a stupid default to be immediately killed :) But my question was about the <Tab> keycode rather than the character code in display.

                          I’m definitely not trying to turn Emacs into Vim. I’m willing to leave all my Vim packages behind for new equivalents, and even learn the default chorded keybindings. But switching <Tab> from “indent selection” to “insert spaces to next multiple of 8” seems like such a trivial bit of configuration!

                          Imagine I’m trying to edit a file, and I hit <Tab> and it does nothing. It feels like a heavyweight operation to figure out what mode and minor mode I’m in and debug my configuration to get smart indentation to work for the right minor mode just so I can get back the ability to press a specific key. I just want to insert a few spaces. I’m happy to add an elisp fragment into my .emacs to get back that ability, but I’m not going to go learn about minor modes and whatnot. At this point I’m just not ready for that kind of commitment :)

                          1. 1

                            Maybe something like this, then?:

                            (define-key global-map [tab]
                              (lambda () (interactive) (insert "\t")))
                            
                            1. 2

                              Ah, thanks. That may be enough to get me started. (I want to insert spaces rather than a literal tab character.)

                              1. 1

                                In that case, (insert-tab) ought to do the trick when combined with the indent-tabs-mode setting above.

                                1. 1

                                  That seems to work with x.txt. Unfortunately it doesn’t work with x.c or x.lisp. So I have to fight minor modes again :/

                                  Thanks for these suggestions! Here’s my .emacs at the moment:

                                  (setq-default indent-tabs-mode nil)  ; to insert a tab anyway: C-q TAB
                                  (define-key global-map [tab]
                                    (lambda ()
                                      (interactive)
                                      (insert-tab)))
                                  

                                  Oh, I also remembered another issue I had with indentation, this time with RET: https://news.ycombinator.com/item?id=12264376#12276605

                                  Edit: The RET issue may be solvable with one of the suggestions at http://ergoemacs.org/emacs/emacs_tabs_space_indentation_setup.html

                                  Edit 2: Hmm, some more googling got me to https://emacs.stackexchange.com/questions/352/how-to-override-major-mode-bindings, and I finally learned how to install Melpa in the process. But bind-key* doesn’t seem to help. Once again my binding works in x.txt but not in x.c. Here’s my .emacs now, after installing use-package:

                                  ...Package/Melpa-related stuff...
                                  (setq-default indent-tabs-mode nil)  ; to insert a tab anyway: C-q TAB
                                  (bind-key* "Tab" 'insert-tab)
                                  
                      2. 1

                        I would actually prefer the opposite of this. i would rather have some sort of Emacs buffer be embedded into all other places where I’m working with text (browsers, chat apps, terminals etc.). I like having GUIs and I like having different programs for different things, but I also like my Emacs key-bindings for navigating text. I think there are some browser extensions that allow for this, but I would like it everywhere there is a place to input text.