Thursday, May 28, 2026

Using Emacs as editor for SBCL on Ubuntu 26.04

Using Emacs as editor for SBCL on Ubuntu 26.04

Version info:
  • OS: Ubuntu 26.04
  • Emacs: 30.2
  • SBCL: 2.6.0
Install Emacs and SBCL as needed:
$: sudo apt install emacs
$: sudo apt install sbcl


Configure Emacs with SLY (Sylvester the Cat's Common Lisp IDE for Emacs), fire up Emacs and do:
  1. Install Sly package in Emacs
  2. M-x package-refresh-contents
    M-x package-install RET sly RET
    
  3. Create or edit Emacs configuration file
  4. M-: (find-file user-init-file)
    
    My .emacs looks like below
  5. Restart Emacs
  6. Load SLY
  7. M-x sly RET
    


Below shows SLY with SBCL loaded.

Using Emacs as editor for SBCL on Windows 10

Using Emacs as editor for SBCL on Windows 10

Emacs is installed in C:\emacs, using version 30.2. I run it using C:\emacs\bin\runemacs.exe.

SBCL version 2.6.4 (sbcl-2.6.4-x86-64-windows-binary.msi) is installed in C:\Program Files\Steel Bank Common Lisp
  1. Install Sly package in Emacs
  2. M-x package-refresh-contents
    M-x package-install RET sly RET
    
  3. Create or edit ~/.emacs.d/init.el
  4. Edit or replace contents like below
  5. Restart Emacs
  6. Load Sly
  7. M-x sly RET
    
Note: Verify that you are not using ~/.emacs, otherwise it will not load configration from ~/.emacs.d/init.el

Below shows SLY with SBCL loaded.

I am having issues running code below on Windows 10, it seems the input is buffered. Pressing RET does not properly go to the next prompt.
(defun prompt-for-cd ()
  (make-cd
   (prompt-read "Title")
   (prompt-read "Artist")
   (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
   (y-or-n-p "Ripped [y/n]: ")))
There is a workaround for the above bug, see below:
https://github.com/joaotavora/sly/commit/5a05c033197693462e67004549c24e0676eed53b

Wednesday, May 27, 2026

Emacs common commands

Character Operations:
DELETE : Delete character to the left of point (Also marked ROBOUT)
C-d    : Delete character to the right of (or under) point


Word Operations:
M-d    : Delete one word to the right (C-y yanks it back at point)
Cursor movement:
C-p    : Move to the previous line
C-n    : Move to the next line
C-f    : Move forward one char
C-b    : Move backward one char
M-f    : Move forward one word
M-b    : Move backward one word
C-a    : Move cursor beggining of the line
C-e    : Move cursor end of the line
M->    : End of file
M-<    : Beginning of file



Line operations:
M-m       : Move point to the first non-space in the line

Copying Text:
M-w     : Runs command kill-ring-save. This is like copy in Windows editors



Deleting Text:
C-SPC select text C-w Delete selected text
M-d Kill the next word after the cursor


Searching for text:
C-s           : Incremental search forward
C-r           : Incremental search backward


Misc commands
M-: user-init-file Show the configuration file used by Emacs in the echo area
M-: (find-file user-init-file) Edit user configuratin file

Convenience functions:
C-[number][char]
        : Repeat [char] [number] of times. Example C-8-0 1, repeat 1 80 times.

Dictionary:
M-$     : Check and correct spelling for the word at point

Others:
count-lines-region      
        : Count number line and chars for the selected text
untabify
        : Change tabs to space for the currently selected region



Python mode specific shortcuts:
M-/     : Command abbreviation expand
C-M-i   : Complete partial symbol or Intellisense in VS speak 


Links:
Emacs Keyboard keys (link)

Tuesday, January 27, 2026

Zig basic Windows application using win32 API

Zig basic Windows application using win32 API

Info:
OS: Windows 10 IoT LTSC 2021
Zig: 0.15.2

Sample application using zigwin32, Windows API to create basic window that does nothing. It calls the following win32 API functions:
- LoadCursorW
- RegisterClassW
- GetLastError
- CreateWindowExW
- ShowWindow
- GetMessageW
- TranslateMessage
- DispatchMessageW
- DefWindowProcw
And windows WindoProc function for pumping messages.

Create a Zig application, like:
PS C:\prj\> mkdir hellowindow
PS C:\prj\> cd hellowindow
PS C:\prj\hellowindow> zig init
Modify build.zig to add zigwin32. See lines 86-91 in gist below. Update src/main.zig to look like below. Checkout zigwin32 into the root of the project
PS C:\prj\hellowindow> git clone https://github.com/marlersoft/zigwin32 libs/zigwin32
Now do a build:
PS C:\prj\hellowindow> zig build
Or do a release build that produces the smallest binary:
PS C:\prj\hellowindow> zig build -Doptimize=ReleaseSmall

Demo how to use zigwin32 in your zig application

Demo how to use zigwin32 in your zig application

Create a Zig application, like:
PS C:\prj\zigwin32test> zig init
Modify build.zig to add zigwin32. See lines 68-72 in gist below. Update src/main.zig to look like below. Checkout zigwin32 into the root of the project
PS C:\prj\zigwin32test> git clone https://github.com/marlersoft/zigwin32 libs/zigwin32
Now do a build:
PS C:\prj\zigwin32test> zig build run
Reference:
https://github.com/myZig/zigwin32test

Using Emacs as editor for SBCL on Ubuntu 26.04

Using Emacs as editor for SBCL on Ubuntu 26.04 Version info: OS: Ubuntu 26.04 Emacs: 30.2 SBCL: 2.6.0 Install Emacs and SBCL...