RSSAmplifier

Blog

emacs on oylenshpeegul

Recent content in emacs on oylenshpeegul

oylenshpeegul.gitlab.ioRSS feed ↗32 posts

Latest posts

Ziglings

I just completed Ziglings! It's wicked fun! Zig is a programming language and Ziglings is a collection of fun exercises to help you learn it. I heard about if from this interview with Andrew Kelley. He is the creator of Zig (but not the creator of Ziglings, that's Dave Gauer). Zig is still under development (it has yet to release version 1.0), so it's changing a lot and Ziglings is changing right…

Computing Days Until with Perl and Rust

The other day Charles Choi wrote about Computing Days Until with Emacs. I decided to try it in Perl and Rust. Perl In Perl, we could do it with just the standard library like so. #!/usr/bin/env perl use v5.42; use POSIX qw(ceil); use Time::Piece; use Time::Seconds; my $target_date = shift // die '\nUsage: $0 YYYY-MM-DD\n'; my $target = Time::Piece->strptime($target_date, '%Y-%m-%d'); my $today =…

Hy PyO3!

Lately, I've been messing with Codelist Tools, a Rust library for working with medical codelists. Among other things, it uses PyO3 to provide bindings that enable its use from Python. I had not tried this before. It's fun! It occurred to me that it should also work from Hy, a Lisp dialect for Python. So, I gave it a try…and it does! Running either of these produces

Go to definition in Emacs

Today, I was reading Why Use Structured Errors in Rust Applications? and one of the issues discussed is jumping away from the code you're working on to look at the definition of the error. On the one hand, rust-analyzer makes it really easy to jump to the error, but on the other hand they felt that they sometimes had to do so unnecessarily. In the comments on lobste.rs, matklad mentioned that he…

R programming in Emacs

If you want to do statistical calculations with your computer, you probably want to use some sort of package to help you. When I was in school, we used Minitab (a 'mini' version of OMNITAB— now there's a great name!), but I guess most statisticians used either S or SAS at the time. Later, R came along as an alternative to S. I may want to use extendr to access a Rust library from R, so I thought I…

Magic completions in rust-analyzer

Today I learned rust-analyzer magic completions include tmod (test module) and tfn (test function). We get these from cargo when we start a new library, but we can stick them in anytime! Here I am typing tmod TAB and and then tfn TAB in Emacs. If your editor is configured to use rust-analyzer, it probably works similarly. Neat!

Typst

Typst is a typesetting system, so an alternative to TeX, LaTeX, &c. It's free and open source software (FOSS), but if you visit typst.app it looks like you're meant to sign up for something then use it on the web. But you can download and install it locally, just like any good FOSS product. If you're fortunate enough to click on the github link, you'll find instructions for installing it locally…

Emacs 30

It's official; Emacs 30 has been released! Let's try it! If you've never compiled Emacs before, make sure you have the dependencies first. ❯ cd ~/Downloads ❯ wget https://ftpmirror.gnu.org/emacs/emacs-30.1.tar.xz ❯ wget https://ftpmirror.gnu.org/emacs/emacs-30.1.tar.xz.sig ❯ wget https://ftp.gnu.org/gnu/gnu-keyring.gpg ❯ gpgv --keyring ./gnu-keyring.gpg emacs-30.1.tar.xz.sig emacs-30.1.tar.xz…

Roc programming

I finally decided to give Roc a try (Roc is a new-ish programming language from Richard Feldman, who you may know from the Software Unscripted podcast). I found an Emacs mode for it, so it must be time. It was really easy to install. mkdir roc cd roc tar xf ~/Downloads/roc_nightly-linux_x86_64-latest.tar.gz That includes binaries for both roc and the roc_language_server. I made links to them from…

Linen Layout

Today's Advent of Code was so fun, I couldn't stop re-implementing it! (spoiler alert: if you haven't done the 2024-12-19 puzzle yet, stop reading now!) Here it is in Perl #!/usr/bin/env perl use v5.40; use List::Util qw(sum); use Path::Tiny; my $filename = shift @ARGV // 'example'; my $contents = path($filename)->slurp; my @paragraphs = split /\n\n/, $contents; my @towels = split /, /,…

Hy 1.0 Released

Hey, I see that Hy has released version 1.0…neat! We can install it with uv. ❯ uv tool list No tools installed ❯ uv tool install hy Resolved 2 packages in 339ms Built hy==1.0.0 Prepared 2 packages in 2.60s Installed 2 packages in 1ms + funcparserlib==1.0.1 + hy==1.0.0 Installed 3 executables: hy, hy2py, hyc ❯ uv tool list hy v1.0.0 - hy - hy2py - hyc ❯ which hy /home/tim/.

Rust generics are nice

I just did the Triangle exercise in Rust on Exercism. First I did it as written so that it only handled 64-bit integers. Then I changed it for the 'extra credit' so that it also handled floating-point numbers or whatever else. I'm not suggesting this is the best way to do this, but I was pleased that all of the changes were in the first few lines. Here is an ediff with the non-generic on the left…

Color palettes

I love the Libby app on my phone, which allows me to listen to audiobooks from the library. Not only does it work really well, it's beautiful to look at. And it changes color to match the book cover! The background is sort of a blurry version of the book cover, but then the whole area at the top as well as the main control buttons at the bottom are a color taken from the book cover.

Gleam

I see today they released Gleam version 1. Let's try it! Gleam is a BEAM language. That is, it runs on the Erlang abstract machine (the BEAM). I've already got that installed because Elixir needs it too. ❯ iex Erlang/OTP 25 [erts-13.1.5] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns] Interactive Elixir (1.14.0) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> Note…

Prime Dijkstra

Recently, I heard something about Dijkstra's algorithm for finding primes. The details were hidden behind a Patreon, but I determined they referenced this article from 1976. That article is hidden behind an IEEE paywall, but it references E. W. Dijkstra, 'Structured programming', 1969. I'm not certain, but I think that means EWD249. Edsger W. Dijkstra (1930 - 2002) was a programmer back before…

BunsenLabs Linux

Today, I watched Veronica Explains install BunsenLabs Linux. It looked like fun, so I tried it on an old laptop. Worked great! Indeed, I'm not even sure why I'm blogging about it because the install went without a hitch. I had to reboot after partitioning, which shouldn't have been necessary, but everything worked perfectly. The current release of BunsenLabs Linux is called Boron and it's based on…

Emacs 29.2

Hey, Emacs 29.2 was released yesterday! Let's install it! First, make sure we have all the dependencies. ❯ sudo apt build-dep emacs Emacs 28+ includes native compilation. We definitely want that, so make sure we have libgccjit. ❯ gcc --version gcc (Debian 12.2.0-14) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO…

Lisp syntax

Over on Exercism, they have something called The #48in24 Challenge. I'm not exactly sure what it's about, but it started this week with the leap year problem. This is a fun little problem. A leap year in the Gregorian calendar is a year that is divisible by 4, unless it's divisible by 100, in which case it's only a leap year if it's also divisible by 400. 2023 was not a leap year (not divisible by…

Emacs configuration

The other day, I talked about Fennel and incidentally how to configure Emacs for it. In particular, since Fennel is a Lisp, I enabled parinfer for it. Here is the fennel.el file I showed. (add-hook 'fennel-mode-hook 'parinfer-rust-mode) (add-hook 'fennel-mode-hook 'eglot-ensure) (with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(fennel-mode . ('fennel-ls')))) Later, I realized that…

Fennel

Yesterday, System Crafters did a live episode on Fennel, a Clojure-inspired Lisp that compiles to Lua. What fun! Fennel is easy to install because it's just one file. Here's what I did on my Debian 12 box. Lua If you don't already have Lua installed, start with that. There isn't a Debian package called lua, there are several different versions. The latest is called lua5.4. sudo apt install lua5.

A Murder at the End of the World

I just watched the first episode of 'A Murder at the End of the World' on Hulu. Really fun! It was created by Brit Marling and Zal Batmanglij (creators of 'The OA'). They also wrote it, directed it (Marling directed the first episode, either Marling or Batmanglij directed each of the other six), and executive produced it. Marling is also in it, though not in the starring role. It stars Emma…

Emacs 29 and Eglot!

Emacs 29 will be released later this year, but it's already got a couple of neat additions. Let's try it! I already ran these when I compiled Emacs 28. sudo apt build-dep emacs gcc --version # mine is... 12 sudo apt install libgccjit-12-dev There's a branch for Emacs 29 in the git repository. We can check out just that branch. git clone --single-branch --branch=emacs-29…

Context menus in Emacs 28!

Today I learned that Emacs 28 added context-menu-mode so that we can easily add context menus. This is a minor mode which you can toggle with M-x context-menu-mode RET but I added hooks to enable it for text mode and a couple others (add-hook 'text-mode-hook 'context-menu-mode) (add-hook 'shell-mode-hook 'context-menu-mode) (add-hook 'dired-mode-hook 'context-menu-mode) I did not hook prog mode…

Emacs 28.2

Now that I have Debian bookworm up to date, I can install Emacs 28.2! sudo apt build-dep emacs sudo apt install libgccjit-12-dev sudo apt install libjansson-dev cd ~/Downloads gpg --verify emacs-28.2.tar.xz.sig cd tar xf ~/Downloads/emacs-28.2.tar.xz cd emacs-28.2 ./autogen.sh ./configure --with-native-compilation make -j16 make check sudo make install Okay, I think all is well! ❯ which emacs…

Agda

In preparation for the HoTTEST Summer School, I installed Agda. Prerequisites Debian provides all the Haskell packages required. I had already installed haskell-platform, which includes ghc cabal-install alex happy And, of course, I had already installed Emacs! I also installed these other libraries ❯ sudo apt install zlib1g-dev libncurses5-dev ❯ sudo apt install libicu-dev I tried installing agda…

Dictionaries

If you're interested in American English, then you are probably familiar with Webster's Revised Unabridged Dictionary from 1913. Noah Webster started his American Dictionary a century earlier and I think 1913 is the most recent one that is in the public domain. It has been digitized and you can download it from places like Project Gutenberg and access it online at places like webster's 1913. You…

blogpost

This blog is generated by Hugo, a static site generator. It works great! One of the things I like best about it is that it supports Org. That is, I can write posts in org-mode instead of markdown. Normally, you would create a new post with something like ❯ hugo new posts/foo.org /home/tim/blog/content/posts/foo.org created The file created has a Hugo header already in it. ❯ cat…

Zig

Zig is a fairly new (they haven't even reached 1.0 yet) language. Like Rust and Swift, it uses LLVM for the final stage. The latest release is 0.8.1, but it seems they recommend installing nightly. wget https://ziglang.org/builds/zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz sha256sum zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz tar xf zig-linux-x86_64-0.9.0-dev.1083+9fa723ee5.tar.xz rm…

Clojure

I haven't done a whole lot of Clojure lately, but that's no reason not to install it. It officially supports Java LTS releases (currently, Java 11). I skipped 11 and installed OpenJDK 17 the other day. That's not an LTS, but I think it will be okay. It also says, 'Ensure that the following dependencies are installed: bash, curl, rlwrap, and Java.' I think I have bash, curl, and Java, but I still…

Haskell

Debian supplies lots of packages for Haskell. Bullseye supplies version 8.8.4 of the compiler, which is new enough for me, so I'm just going to install haskell-platform. sudo apt install haskell-platform sudo apt install haskell-platform-doc haskell-platform-prof It suggested the docs and profiling tools too. ❯ ghc --version The Glorious Glasgow Haskell Compilation System, version 8.8.4 Now I want…

Debian bullseye

I got a new desktop computer a couplafew years ago and partitioned the hard drives and installed Debian 10 alongside the proprietary OS that came with it. Now Debian 11 has been released, but rather than upgrade I did a reinstall. I hadn't used the other OS much (at all?), so I decided to reclaim that disk space. Here are the things I did to install and configure Debian bullseye.

Emacs, Emacs, Emacs!

I've been using Emacs daily for many years. I don't often think about it, it's just always there. But lately, it's been popping up everywhere! First, I saw a great post from Karthik Chikmagalur on Batteries included with Emacs, which talked about several things we can do in Emacs without any external packages. It assumes a modern Emacs, by which it means version 26.3 or newer. The desktop computer…