Emacs

2889 readers
8 users here now

Our infinitely powerful editor.

founded 6 years ago
MODERATORS
1
2
 
 

tl:dr I have finally matured enough to say that I'm in love with (mostly) vanilla emacs. And I can't believe my peers didn't force me to learn this properly sooner.


I've used vim/neovim for about a decade. I have spent countless hours adding/removing/writing plugins, tinkering with the config, etc. I was never fully happy with it, but I was content knowing that my vim motions worked very well in most programs and within my editor, and the way I worked tends to look like wizardry to the rest of my team who are still stuck relying on their VSCode, trackpads/mouse etc.

I tried many times to get into emacs. I used doom emacs, spacemacs, just evil mode etc etc. Every time I tried I got frustrated and quicky quit. I even tried going deep into org mode because that's what everybody ever talks about, but it didn't stick.

However, recently I got fed up with my environment in general. Not just vim, but everything. I got fed up of zellij and struggled relearning tmux. I got fed up with fish and zsh and alacritty and kitty and all of the linux ricing nonsense. In particular, I got fed up with having my work laptop be a crappy version of my personal one because I don't have the discipline to commit, push and pull my dotfiles over 10 different apps so that it works in all my machines (I've tried stow, chezmoi and others - I'm just too lazy or too stupid - or both).

I'm also fed up of browsers. I know we can't live without them, and V8 and co are probably engineering marvels, but the fact that the browser is neither a document renderer nor a distributed application runtime, but a mishmash of both just hurts my soul (and let's not talk about privacy and security).

And then I got fed up of my languages. Nothing much wrong with Go, but nothing much exciting about it either, but lord help me if I have to compile a Rust program. Let's not talk about npm crap show that's now even infected pypi. And finally there's lua. Lua is a great language. But it just never clicked with me when writing plugins for neovim.

And then there was lisp. I love lisp. And for years I've kept asking myself, can I replace everything with lisp? And for whatever reason it never occurred to me that this was the main reason to go with emacs. I just needed to learn how to use emacs better. And it turns out, every single thing I got fed up with... emacs solves, and it solves it beautifully. I guess only now am I mature enough to realise that.

All this massive rant just to say, I bought Mastering Emacs by Mickey Petersen and I've been sticking with emacs from vanilla. I wrote every single line in my emacs init.el and it's only about 252 lines long at the time of writing. No evil mode, no spacemacs or doom, just as vanilla as I possibly can (emacs 30 anyway). It's week 2, and as I was writing some code and running some eshell commands I kept feeling more comfortable with remembering the motions and commands and keybindings, and it felt great. I don't think I'll ever leave emacs anymore. I've just touched the tip of the iceberg, and I'm now addicted. (p.s. I'm writing this in my browser , I know - the horror. I haven't had time to set everything up in emacs yet, but I look forward to writing these, and more, in my emacs client)

3
4
 
 

Guidelines used to populate this list:

  • No packages, stock Emacs only.

  • No steep learning curves. Learn each feature in under two minutes or bust.

  • No gimmicks. No doctor, tetris, snake, dunnet, zone or butterfly.

  • Just the deltas. No commonly mentioned packages like flymake, doc-view, outline-minor-mode or eww/w3m. Nothing that Emacs brings up automatically or a nonspecific Google search gets you.

  • Assume a modern Emacs, 26.3+.

5
6
 
 

While working on some projects involving things like (sometimes unknown) binary protocols via a TTY, or dealing with small binary protocol chunks in other protocol streams I realised that once I can pretty print decoded protocol frames I have half of the emacs implementation ready - and the other way round.

I built a debug framework around that, noticed how useful it'd be to use the same code to sniff and pretty-print communication between the device and the closed client - and added the option to run helpers that forward packets at linespeed, and make them available to emacs at its own pace. At that point I realised that this could be useful as a standalone package, and started ripping it out of that codebase to form lempo as a standalone package.

The screenshot is a pcap bridge helper I've added as simple demonstration of the concept - it's pretty easy to have that as self contained module. The setup in the scratch buffer is because the interactive path for doing that broke a bit when ripping the code out - I should be able to fix that over the next few days, though.

While this currently heavily focuses on binary protocols (and with that, mostly nicely printed hex dumps) doing helper bridges decoding higher level protocols should be easily doable as well.

The current code (with the "I'm still fixing the bits I broke by making it standalone" warning) is at https://github.com/aardsoft/lempo/

7
8
 
 

cross-posted from: https://programming.dev/post/48790323

I'd like to announce ghostel, a terminal emulator for Emacs that uses libghostty-vt - the same VT parsing engine behind the Ghostty terminal - as a native Zig module.

It's inspired by vterm and follows the same general approach (native module does terminal emulation, Elisp handles the Emacs integration), but uses a more modern engine that supports newer terminal protocols. Ghostel is a superset of vterm's feature set - everything vterm can do, ghostel can too, plus a lot more on top.

Feature comparison with vterm

Feature ghostel vterm
True color (24-bit) Yes Yes
OSC 4/10/11 color queries Yes No
Bold / italic / faint Yes Yes
Underline styles (5 types) Yes No
Underline color Yes No
Strikethrough Yes Yes
Cursor styles 4 types 3 types
OSC 8 hyperlinks Yes No
Plain-text URL/file detection Yes No
Kitty keyboard protocol Yes No
Mouse passthrough (SGR) Yes No
Bracketed paste Yes Yes
Alternate screen Yes Yes
Shell integration auto-inject Yes No
Prompt navigation (OSC 133) Yes Yes
Elisp eval from shell Yes Yes
TRAMP remote terminals Yes Yes
OSC 52 clipboard Yes Yes
Copy mode Yes Yes
Drag-and-drop Yes No
Auto module download Yes No
Scrollback default ~5,000 1,000
PTY throughput (plain ASCII) 65 MB/s 29 MB/s
Default redraw rate ~30 fps ~10 fps

Key differences

Terminal engine. libghostty-vt comes from Ghostty, a modern GPU-accelerated terminal, and supports Kitty keyboard/mouse protocols, rich underline styles, and OSC 8 hyperlinks. libvterm targets VT220/xterm emulation and is more conservative in protocol support.

Mouse handling. Ghostel encodes mouse events (press, release, drag) and passes them through to the terminal via SGR mouse protocol. TUI apps like htop or lazygit receive full mouse input. vterm intercepts mouse clicks for Emacs point movement and does not forward them to the terminal.

Rendering. Both use text properties (not overlays) and batch consecutive cells with identical styles. Ghostel's engine provides three-level dirty tracking (none / partial / full) with per-row granularity. vterm uses damage-rectangle callbacks and redraws entire invalidated rows. Ghostel defaults to ~30 fps redraw; vterm defaults to ~10 fps.

Shell integration. Ghostel auto-injects shell integration scripts for bash, zsh, and fish - no shell RC changes needed. vterm requires manually sourcing scripts in your shell configuration. Both support Elisp eval from the shell and TRAMP-aware remote directory tracking.

Performance. In PTY throughput benchmarks (5 MB streamed through cat, both backends configured with ~1,000 lines of scrollback), ghostel is roughly 2x faster than vterm on plain ASCII data (65 vs 29 MB/s). On URL-heavy output ghostel still comes out ahead (42 vs 24 MB/s); with link detection disabled ghostel reaches 65 MB/s regardless of input.

Color auto-detection. Thanks to OSC 4/10/11 support, TUI programs like duf, btop, and delta can query Emacs for its foreground/background colors and automatically adapt to your light or dark theme - no COLORFGBG hacks needed.

Installation. Ghostel can automatically download a pre-built native module or compile from source with Zig. vterm uses CMake with a single C dependency (libvterm) and can auto-compile on first load from Elisp.

Installation

ghostel is available on MELPA:

(use-package ghostel :ensure t)

Or with Emacs 30+ built-in vc-use-package:

(use-package ghostel :vc (:url "https://github.com/dakra/ghostel" :rev :newest))

The native module is downloaded automatically on first use. If you prefer to build from source, you'll need Zig 0.15.2+.

Requires Emacs 27.1+ with dynamic module support on macOS or Linux.

Feedback, bug reports, and contributions very welcome.

9
10
11
 
 

I "live in Emacs", like most of us (atleast at work). It has been getting slower release on release, async support doesn't seem to have been picked up by most packages and native-comp has made it more brittle.

Over this time, we moved from running the OS on hardware to running in VMs, so fractional slowdown was expected. But what I have is a few X slower Emacs. I had never seen Emacs take a minute to indent a few thousand lines, for example. Maybe some modes have slower code.

12
 
 

I didn't know how to title this one, and it is such an esoteric thing but this set of tools I think actually makes a really compelling mobile text editing/task tracking solution allowing full use of org mode in emacs with file syncing capability naturally and easily accessible through termux's straightforward ability to add the filepath of a syncthing folder share to the termux app and thus for emacs/spacemacs and org mode.

Cursed? I mean yeah... but also consider that you can still mainly use something like orgro or orgzly revived to access your org files and use this crazed method as a backup for edge cases where you are stuck on mobile!

https://termux.dev/en/

This use of termux gets all the great touchscreen controls for terminal interaction (like swipe to scroll, pinch to "zoom"/change text size, esc ctrl keyboard arrows etc..) AND dodges one of the biggest issues with the way sandboxing is implemented in Android by naturally connecting both your file sharing/syncing app and your text editing/task tracking app in a way that is simple and resilient to the nonsense of Android.

...but the big elephant in the room is that emacs and spacemacs are keyboard driven right.. so... how could this not be a nightmare on a smartphone????

That is where 8vim comes in! It is a really fluid and natural touchscreen keyboard that allows precise input of the core keyboard letters in a very easy but precise fashion. Somewhat unexpectedly the modal editing and space leader key command system that Spacemacs is centered around works perfectly with a touchscreen keyboard like 8vim.

https://f-droid.org/packages/inc.flide.vi8

https://lmd-jazzededtech.gitlab.io/fdroid-website/en/packages/inc.flide.vi8/

https://github.com/8VIM/8VIM

8vim works this way, there are four lines that intersect a circle. Starting with your finger in the circle you can input a letter by drawing a line out of the circle and then passing through one of the four lines in a loop around the circle, the letter inputted is determined by how many additional lines (if any) you pass through before returning to inside the circle. In the following example to make an "r" is just the same as to make a "c" but in reverse.

Above is an example of inputting a "c", if you wanted to keep typing "cat" as opposed to "c " instead of lifting your finger after finishing the "c" keep drawing an "a" and then "t" in one continuous motion as below image illustrates.

Other essential Spacemacs keys are accessible in one tap from the main 8vim letter input screen

8vims style of input is decidedly strange at first glance, but once you understand the basic way you input letters, consider a couple of basic spacemacs evil commands like "file save" "quit", "org-insert-heading", "org-narrow-to-subtree" and "widen" or any number of routine operations and most of them map out quite naturally to 8vim. Far more than you might expect given neither tool was designed for the other.

spacemacs running in termux

editing spacemacs dotfile "spc f e d"

editing and viewing an org mode file

browsing spacemacs documentation, full terminal height can be given to termux/emacs without sacrificing a big uncramped keyboard

The square shape of 8vim naturally works well in termux in landscape orientation too.

Pinch to zoom in an org mode file works great in termux, a natural view for indepth editing can be quickly transformed into an extremely clear color coded pocket-note style task list to glance at while working.

basic example

ranger file manager inside emacs termux session

This is in conjunction with the spacemacs ranger layer and is opened with...

spc a t r r

...another surprisingly natural and easy to remember input sequence with the 8vim touchscreen keyboard.

Of course, if I am going to type a lot I use a bluetooth keyboard and transition to typing with a hardware keyboard, but for simple todo list and task tracking type uses of org mode (what I almost exclusively use it for) 8vim works great.


The reason I suggest Syncthing is that both Syncthing and Termux can so easily access the same folder locations on Android that it makes file syncing a breeze compared to how much of a silo'd corporate "somebody else's computer" headache it is for other solutions that work for Android or iOS for that matter.

https://syncthing.net/

https://f-droid.org/packages/com.github.catfriend1.syncthingandroid/

Edit I realize I didn't explicitly explain but you can install git with termux in two seconds...

pkg install git

...and then just install spacemacs with git like normal.

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

https://www.spacemacs.org/


Edit 2 Note pandoc can be installed with termux so emacs and spacemacs integration also works right out of the box with pandoc which is kind of mindblowing even though I guess it is obvious given both emacs and pandoc can be installed with termux. If you aren't aware, pandoc integration with emacs lets you export an org mode document to pretty much any format you want... webpage html.. word document.. slideshow.. what would you like? It is a VERY powerful way to take org notes and turn them into things other people can interact with and view in a variety of contexts.

https://pandoc.org/

https://www.spacemacs.org/layers/+tools/pandoc/README.html

Pandoc running in emacs in termux with the spacemacs pandoc layer


*Cross-post from !spacemacs@lemmy.ml

13
 
 

In SLIME/Sly when compiling a file with 'slime-compile-and-load-file' (C-c C-k) I can navigate between notes with M-n and M-p. Is there also something like that for compiling #asdf systems or do I have to compile files manually?

#lisp #commonlisp #emacs
@emacs

14
 
 

Recently found about tramp-mode. I'm trying to use it as primary way to work. My previous workflow was: VNC to VM, open emacs for editing and shell-pop for issuing run commands etc. My shell-pop config is: '(shell-pop-full-span t) '(shell-pop-shell-type '("eshell" "*eshell*" (lambda nil (eshell shell-pop-term-shell)))) '(shell-pop-universal-key "C-t") '(shell-pop-window-position "bottom") '(shell-pop-window-size 30)

With tramp-mode I would like to follow similar approach. I can get shell-pop to come up with ctrl-t and it opens current working directory. However .cshrc related to VM is not loaded and I don't have access to correct VM shell commands / tools.

is there way to source RC file (from VM) before invoking eshell?

15
16
13
Emacs: Org mode basics (www.youtube.com)
submitted 11 months ago* (last edited 11 months ago) by paequ2@lemmy.today to c/emacs@lemmy.ml
 
 

I'm trying to learn Emacs again. This time it's going better! I'm starting to learn the nitty gritty details about Org mode. This video is great!

Previously, my only experience with Org mode was watching my coworker do cool magic stuff with it.

Also this video on TODO: https://www.youtube.com/watch?v=L0EJeN1fCYw

17
 
 

I've always been curious about Emacs, but haven't been able to learn it.

This playlist looks promising, but ufff each video is like 1 hour and most of the video is just random chatting because it's a live stream...

Does anyone know any better video series? Something structured and to the point?

18
 
 

I explain what I dislike about which-key and what I think people should use instead.

19
20
 
 

Charles Choi (of Casual fame) explains how he came around to appreciate Eshell.

21
22
 
 

I keep finding it in my code, in areas I am not working in or in areas I just completed. Is there some sort of autocomplete or spell checker that thinks it knows better than me?

I tried searching for : space = but it found := (no space)

23
 
 

This uses the tool support from gptel to let any LLM with tool support

  • search my bbdb for contact info
  • perform a bbdb search for all contacts with an anniversary field
  • use gnus to compose an email

plus a few helper functions to make it useful (like giving it the ability to query the current date).

The tool definition it used in the above screenshot are:

(defun gptel-tool--get-date ()
  "Return the current date"
  (format-time-string "%Y-%m-%d"))

(defun gptel-tool--compose-email (to-address subject text)
  "Open an email compose buffer '*new message*' to to-address with subject subject."
  (gnus-setup-message 'message (message-mail to-address subject))
  (insert (concat "\n" text)))

(defun gptel-tool--bbdb-search (name)
  "Search bbdb for NAME"
  (bbdb-search (bbdb-records) :name name))

(defun gptel-tool--bbdb-search-anniversary (anniversary-type)
  "Search bbdb for anniversary with ANNIVERSARY-TYPE"
  (let ((bbdb-default-xfield 'anniversary))
    (bbdb-search (bbdb-records) :xfield anniversary-type)))

And they get registered with the following code:

      (gptel-make-tool
       :function #'gptel-tool--get-date
       :name  "gptel-tool--get-date"
       :description "Use to get the current date in %Y-%m-%d format. After calling this tool, stop. Then continue fulfilling user's request."
       :category "emacs")

      (gptel-make-tool
       :function #'gptel-tool--compose-email
       :name  "gptel-tool--compose-email"
       :description "Open an email compose buffer and set subject, to-address and body. After calling this tool, stop. Then continue fulfilling user's request."
       :args (list '(:name "to-address"
                           :type string
                           :description "The address to send to")
                   '(:name "subject"
                           :type string
                           :description "The mail subject")
                   '(:name "body"
                           :type string
                           :description "The body text of the email"))
       :category "emacs")

      (gptel-make-tool
       :function #'gptel-tool--bbdb-search
       :name  "gptel-tool--bbdb-search"
       :description "Return a bbdb entry for name, or nil if not found. After calling this tool, stop. Then continue fulfilling user's request."
       :args (list '(:name "name"
                           :type string
                           :description "The name to search for"))
       :category "emacs")

      (gptel-make-tool
       :function #'gptel-tool--bbdb-search-anniversary
       :name  "gptel-tool--bbdb-search-anniversary"
       :description "Return or a specific anniversary type. After calling this tool, stop. Then continue fulfilling user's request."
       :args (list '(:name "anniversary-type"
                           :type string
                           :description "The anniversary to search for, for example 'birthday' for birthdays"))
       :category "emacs")
24
 
 

cross-posted from: https://lemmy.ml/post/28996611

v0.1.6 release - Wikimusic

https://codeberg.org/jjba23/wikimusic

stability improved, add ASCII size settings for web and become more EWW friendly (eased also thanks to SSR from #lisp )

visit my instance at : https://wikimusic.jointhefreeworld.org/

25
 
 

I wanted to share Spiral, a package I wrote inspired by R's Swirl package. Spiral is used to learn elisp by interacting with it.

With Spiral, you can learn elisp by answering questions in "lessons". You can design, modify and share a lesson, to learn about a particular topic.

Take a look and share your lesson files, so we all can improve our elisp!

https://codeberg.org/pavodive/spiral

view more: next ›