diff options
-rw-r--r-- | content-org/cool-emacs.org | 35 | ||||
-rw-r--r-- | content/cool-emacs/multi-process-emacs.md | 81 |
2 files changed, 99 insertions, 17 deletions
diff --git a/content-org/cool-emacs.org b/content-org/cool-emacs.org index 3d165e8..4235d32 100644 --- a/content-org/cool-emacs.org +++ b/content-org/cool-emacs.org @@ -692,7 +692,8 @@ So, when you look at it this way, Emacs makes a lot of sense: You can replace your window manager with Emacs, but you need some sort of kernel. - You can live entirely inside Emacs, just like you can live entirely inside a terminal. -*** DONE Multi process Emacs environment + +*** DONE Multiprocess Emacs environment CLOSED: [2024-06-17 Mon 17:46] :PROPERTIES: :EXPORT_FILE_NAME: multi-process-emacs @@ -701,26 +702,26 @@ CLOSED: [2024-06-17 Mon 17:46] The more you move into Emacs, the happier you may become. But at the same time, Emacs is not a *real* shell, but a text editor. -This means there is no real way to manage functionality in a similiar way one would manage applications. +This means there is no real way to manage functionality similarly one would manage applications. It's all a buffer - the file you opened, each IRC channel, email list, and so on. There are ways to manage it, like dedicated "workspace" plugins[fn:perspective] or simple tabs. But all those don't fit my mental model. -I am "Editing a file" or "chatting" or "writing a webpage". +I am "Editing a file" or "chatting" or "writing a web page". Those are separate concerns, so I want to have dedicated spaces for them. -At the same time I want them in emacs, as it gives me a unified interface. +At the same time I want them in Emacs, as it gives me a unified interface. I don't need to think how to change IRC channel, how to spell check, or how to actually write in my selected keybindings. **** Dedicated Emacs instances -This lead me to use multiple, dedicated Emacs instances. +This led me to use multiple, dedicated Emacs instances. This way, I've a got a dedicated IRC client, Code editor, Notepad, Email client, and so on. -I have unified interace, but at the same time it's still akin to dedicated programs. +I have unified interface, but at the same time it's still akin to dedicated programs. -This has the addeed benefit of fault protection. -Tramp session hunging entire Emacs doesn't disconnect me from IRC, as those are separate processes. +This has the added benefit of fault protection. +Tramp session hanging entire Emacs doesn't disconnect me from IRC, as those are separate processes. -Therefore, I have functions which I call /ultimate modes/[fn:music] to configure Emacs for given usecase. +Therefore, I have functions which I call /ultimate modes/[fn:music] to configure Emacs for given use case. A simple ultimate mode for IRC would look like: @@ -739,26 +740,26 @@ A simple ultimate mode for IRC would look like: #+end_src -This simple fuction: -- loads a dedicated theme, so I won't get lost. IRC is a happy palce, therefore green. -- connects me to my servers +This simple function: +- Loads a dedicated theme, so I won't get lost. IRC is a happy place, therefore green. +- Connects me to my servers ERC is configured elsewhere, so all auto-joins are there, just redacted, but nothing limits the number of things the ultimate mode setup up. Want to defer loading of bigger package? -Want to preconfigure ispell language? +Want to reconfigure Ispell language? Or maybe you want to load parts of Emacs configurations only when they make sense? Shy is the limit! -Now, I can eiter run =emacs= and call =mms-irc-mode= or have a dedicated OS level key binding to run emacs in this mode via: +Now, I can either run =Emacs= and call =mms-irc-mode= or have a dedicated OS level key binding to run Emacs in this mode via: #+begin_src shell emacs --eval='(mms-irc-mode)' #+end_src -This method could easily be expanded to run dedicated =emacs servers= and connected clients, but I wanted a simplier way. +This method could easily be expanded to run dedicated =emacs servers= and connected clients, but I wanted a simpler way. [fn:perspective] Like [[https://github.com/nex3/perspective-el][perspective.el]] [fn:music] Yes, it breaks the musical theory naming scheme. -I could have used "tonic" there to run the =erc= and pla play with the wordplay, bit I decided aganist it. -Damnit Jim, I'm an engineer, not a musican! +I could have used "tonic" there to run the =erc= and pla play with the wordplay, but I decided against it. +Dammit Jim, I'm an engineer, not a musician! Also, diatonic modes don't fit the "larger than major" mode. diff --git a/content/cool-emacs/multi-process-emacs.md b/content/cool-emacs/multi-process-emacs.md new file mode 100644 index 0000000..97d7ee6 --- /dev/null +++ b/content/cool-emacs/multi-process-emacs.md @@ -0,0 +1,81 @@ ++++ +title = "Multiprocess Emacs environment" +author = ["MichaĆ Sapka"] +date = 2024-06-17T17:46:00+02:00 +categories = ["emacs"] +draft = false +weight = 3002 +image_dir = "cool-emacs" +image_max_width = 480 +primary_menu = "cool-emacs-appendix" +abstract = "Running dedicated Emacs processes" +[menu] + [menu.cool-emacs-appendix] + weight = 3002 + identifier = "multiprocess-emacs-environment" ++++ + +The more you move into Emacs, the happier you may become. +But at the same time, Emacs is not a **real** shell, but a text editor. +This means there is no real way to manage functionality similarly one would manage applications. +It's all a buffer - the file you opened, each IRC channel, email list, and so on. +There are ways to manage it, like dedicated "workspace" plugins[^fn:1] or simple tabs. +But all those don't fit my mental model. +I am "Editing a file" or "chatting" or "writing a web page". +Those are separate concerns, so I want to have dedicated spaces for them. + +At the same time I want them in Emacs, as it gives me a unified interface. +I don't need to think how to change IRC channel, how to spell check, or how to actually write in my selected keybindings. + + +## Dedicated Emacs instances {#dedicated-emacs-instances} + +This led me to use multiple, dedicated Emacs instances. +This way, I've a got a dedicated IRC client, Code editor, Notepad, Email client, and so on. +I have unified interface, but at the same time it's still akin to dedicated programs. + +This has the added benefit of fault protection. +Tramp session hanging entire Emacs doesn't disconnect me from IRC, as those are separate processes. + +Therefore, I have functions which I call _ultimate modes_[^fn:2] to configure Emacs for given use case. + +A simple ultimate mode for IRC would look like: + +```emacs-lisp +(defun mms-irc-mode() + "use this instance of Emacs for IRC" + (interactive) + + (load-theme 'ef-bio) + + (erc-tls :server "irc.tilde.chat" :port "6697" + :nick "mms" :full-name "https://michal.sapka.me") + (erc-tls :server "irc.libera.chat" :port "6697" + :nick "mms" :full-name "https://michal.sapka.me") + ) +``` + +This simple function: + +- Loads a dedicated theme, so I won't get lost. IRC is a happy place, therefore green. +- Connects me to my servers + +ERC is configured elsewhere, so all auto-joins are there, just redacted, but nothing limits the number of things the ultimate mode setup up. +Want to defer loading of bigger package? +Want to reconfigure Ispell language? +Or maybe you want to load parts of Emacs configurations only when they make sense? +Shy is the limit! + +Now, I can either run `Emacs` and call `mms-irc-mode` or have a dedicated OS level key binding to run Emacs in this mode via: + +```shell +emacs --eval='(mms-irc-mode)' +``` + +This method could easily be expanded to run dedicated `emacs servers` and connected clients, but I wanted a simpler way. + +[^fn:1]: Like [perspective.el](https://github.com/nex3/perspective-el) +[^fn:2]: Yes, it breaks the musical theory naming scheme. + I could have used "tonic" there to run the `erc` and pla play with the wordplay, but I decided against it. + Dammit Jim, I'm an engineer, not a musician! + Also, diatonic modes don't fit the "larger than major" mode. |