Showing posts with label Emacs. Show all posts
Showing posts with label Emacs. Show all posts

Wednesday, June 03, 2026

Emacs with SLIME for interactive development with SBCL on Windows 11

Emacs with SLIME for interactive development with SBCL

Version info:
- OS: Windows 11 23H2 (Microsoft Windows [Version 10.0.22631.7079])
- Emacs: 30.2
- SBCL : 2.6.4
- SLIME: 2.32

Prep my work directories
C:\>md c:\emacs-profiles
C:\>md c:\emacs-profiles\work
C:\>copy con c:\emacs-profiles\work\init.el
^Z
        1 file(s) copied.

Run Emacs on my work directory, I have my bin files in c:\lang\emacs-30.2\bin
c:\>cd c:\lang\emacs-30.2\bin
c:\lang\emacs-30.2\bin>runemacs.exe --init-directory c:\emacs-profiles\work

Install SLIME
M-x package-refresh-contents
M-x package-install RET slime RET

Update init.el to use SBCL
Restart Emacs and load SLIME
M-x slime RET

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 


Saturday, April 24, 2010

Emacs common commands and configuration

Some of my .emacs customization:

Hide Emacs toolbar:
;;hide emacs toolbar (tool-bar-mode 0)
Highlight selection:
;;highlight selection (transient-mark-mode t)
Set major mode to shell scripting
M-x shell-script-mode
Run an emacs lisp program in the *scratch* buffer
In *scratch*, type (+ 1 1 ) Then, do: C-x C-e

~ts

CPP Quick Guide

Basics Hello world User input While loop If statement For loop Switch statement Read file using ifstream Write to a file using ofstr...