Skip to main content




I just wrote a bunch of #elisp code like this:
(catch :abort
  ;; do something
  (when condition
    (message "A bad thing happened")
    (throw :abort nil))
  ;; do something else
  )

When the functionality I really wanted was:
(progn
  ;; do something
  (when condition
    (user-error "A bad thing happened"))
  ;; do something else
  )

I knew the former felt sketchy, but I couldn't think of a better way to do it until just now.
#emacs #lisp

FOSS Dev reshared this.



One thing I miss in #Lisp coming from #Haskell is the ability to search for functions by their type signature. I hadn't realized how much I relied upon this ability until I lost it.
in reply to Jonathan Lamothe

As a Schemer (and formerly/sometimes still Objective-C), everything is pretty verbose, and my own functions even more so, so I can search by function name knowing the type and parameters. (vector-index vec searchfunc), (draw-rect-with-edge-color rect edge-width color), etc.

There's no excuse for hardcore Lisp functions like (wadsf w q) "wander down stack frames for word query" (fictional but not unlikely).
#lisp

#lisp


#Elisp logic:

All interned symbols can be found in a lookup table. This table is bound to the obarray symbol.

Hang on a minute...

I can only assume that the underlying C code has its own pointer to this table and the obarray symbol is only provided as a convenience for elisp functions that can't see this pointer?
#emacs #lisp

in reply to Jonathan Lamothe

No no, the obarray you see from elisp is the same one used by the reader. Elisp is an old-style Lisp here, and the obarray is a first-class thing: you can make a new one, rebind obarray, etc.

That's the sort of thing people don't do much anymore, but used to do. The documentation covers it reasonably well gnu.org/software/emacs/manual/…



ph: vague

I'm starting to get the impression that my doctor's office is trying to drum up business by giving me repeated heart attacks with vague voicemails about some test results I'm waiting on.

For the record, according to the information I have at this very moment, everything is (probably) fine.



Wrote my first non-trivial #elisp macro yesterday. Macros were the thing that scared me away from #lisp the first time I tried learning it.
#emacs

Shannon Prickett reshared this.

in reply to James Endres Howell

@James Endres Howell
I'm a little self-conscious about it as non-trivial is relative, but...
(defmacro lambdamoo-chatter-interact
    (func-name to msg docstring fmtstr &rest vals)
  "Define a function for interacting with another player"
  (let ((proc (gensym))
        (str (gensym)))
    `(defun ,func-name (,proc ,str)
       ,docstring
       (let ((,to lambdamoo-chatter)
             (,msg (substring-no-properties (lambdamoo-command-text ,str))))
         (if ,to
             (funcall lambdamoo-send-line ,proc
                      (format ,fmtstr . ,vals))
           (message "No chatter specified"))))))
in reply to Jonathan Lamothe

That's awesome. I need to hear my own advice, of course, but don't be inhibited to share something that isn't finished. It's the Fediverse! We're all anarchists! The kind sort, I mean.

Lisp macros are just so powerful.

in reply to James Endres Howell

@James Endres Howell They really are. They're a little bit of a mind bender until you really get them, but once you do they're such a game changer.
in reply to Jonathan Lamothe

Wait, how do you get the awesome code formatting? Anybody know how to configure this on fediscience.org?

AM I GOING TO HAVE TO SPIN UP MY OWN INSTANCE AGAIN

in reply to James Endres Howell

@James Endres Howell Frendica has a markdown add-on.

I just typed:

```lisp
...code...
```

Typing that however was trickier.


RIP Sterrance (my #sourdough starter) who met a tragic end in his glass jar at the hands of gravity and the kitchen floor.

Also, happy birthday to Stella who is going to take a bunch of work to make into another viable starter.

reshared this

in reply to Jonathan Lamothe

when Stella is good and bubbly and produces good loaves, dry a bit and store it in a jar.
in reply to Jonathan Lamothe

it is a way of preserving viable starter in case life happens. It will be much faster to restart.
in reply to Jonathan Lamothe

No backup, no mercy. As an IT-guy you know that of course. ;)


I'm finally MOOing from #Emacs. I've still got a bunch of work to do to port my customizations over from my old client, but it's Emacs... I'm sure it can do that.
#LambdaMOO #moo #mud


@screwlisp @Judy Anderson
I've been looking to migrate more of my workflow into emacs, in this particular case I'm looking to moo via emacs which I believe you both do?

I believe @screwlisp has mentioned using rmoo, but the only repo I found for that hasn't been updated in over a decade. Is there something more recent I'm not aware of?

in reply to Roger Crew✅❌☑🗸❎✖✓✔

@Roger Crew✅❌☑🗸❎✖✓✔ @Judy Anderson @screwlisp I've got this one working, though I had do a little finessing to get it to installed. Now I need to see if my elisp knowledge is sufficient to customize it in a manner similar to how I'd customized TF.
in reply to Jonathan Lamothe

> had do a little finessing to get it to installed

out of curiosity: what was the problem?

Is it that I didn't make a (M)ELPA package out of it? (nobody just drops things in their ./emacs directory anymore?)

or some other issue?

screwlisp reshared this.

in reply to Jonathan Lamothe

ok, so the answer is indeed
"nobody just drops things in their ./emacs directory anymore"

(really, that's all it's supposed to be.

well okay, that plus
M-x load-library mud-mcp

which is the old-school way of doing things)

(wRog needs to learn MELPA. Film at 11.)

screwlisp reshared this.

in reply to Roger Crew✅❌☑🗸❎✖✓✔

@Roger Crew✅❌☑🗸❎✖✓✔ @Judy Anderson @screwlisp It essentially already was a valid ELPA package with the mentioned exception.

I'm currently in the process of adding my own custonizations. I've added a rudimebtary shim that processes lines entered bu the user so that it can support commands that get processed on the client side.

Here's an excerpt:

(require 'mud-mcp)
                                                                                 (defun lambdamoo ()
  "Connect to LambdaMOO"
  (interactive)
  (mud-mcp-connect "LambdaMOO" "lambda.moo.mud.org" 8888)
  (setq lambdamoo-send-line comint-input-sender
        comint-input-sender #'lambdamoo-process-line))

(defconst lambdamoo-commands
  '(("send" . lambdamoo-send)
    ("test" . lambdamoo-test))
  "Command functions")

(defvar lambdamoo-send-line nil
  "The function that is called to send a line to the server")

(defun lambdamoo-process-line (proc str)
  "Process input sent by the user"
  (if (string-prefix-p "/" str)
      (lambdamoo-process-command proc str)
    (funcall lambdamoo-send-line proc str)))

(defun lambdamoo-process-command (proc str)
  "Process a command"
  (let* ((words (split-string str))
         (command (string-trim-left (car words) "/"))
         (found (assoc (downcase command)
                       lambdamoo-commands
                       #'string=))
         (func (and found (cdr found))))
    (if func
        (funcall func proc str)
      (message "Command '%s' not found." command))))

After I wrote all this, I found comments in the file detailing how to add functionality.

Is there a more "proper" way I could've done this?

Shannon Prickett reshared this.



I've got to stop writing code on my phone. The combination of a touchscreen keyboard and tiny screen allows stupid typos to make their way into my code that I would be much more likely to catch on a proper computer.
in reply to Jonathan Lamothe

I gotta ask... What motivated you to write choice on a phone in the first place?
in reply to Darcy Casselman

@Darcy Casselman It was mostly written properly. They were just little edits that I was too lazy to go over to the computer to make.
in reply to Jonathan Lamothe

I strongly prefer being able to write code on my phone when I need to but I try to keep it to code that I plan to run once immediately and discard.



I am dangerously close to unleashing my first #emacs package on the public. It's nothing fancy and still relatively niche, but I deem it potentially useful enough to be worth publishing.

There are a couple small features I want to add and a few things that still need some polish, but it's almost ready for a version 0.1 release.

It's not anything ground breaking or anything. I'm still pretty much an #elisp novice, but I'm proud of it anyway.

More details when it's released.

in reply to Jonathan Lamothe

We can never have too many elisp packages out there! Almost welcome to the club! ;)
in reply to Álvaro R.

@Álvaro R. At this point all I need to add is a README and two features (which will mostly reuse code I've already written just in a slightly different way).

Surprisingly enough, the hardest part of the whole project was getting it to display numbers with thousands separators. That code might exist in the bowels of the calc package, but it was easier to just roll my own.

in reply to Jonathan Lamothe

your package, your rules! Sometimes rolling your own is more fun and you get exactly the UX you wanted.
in reply to Jonathan Lamothe

Okay, my first #Emacs package is officially released. It was strongly inspired by @Soroban Exam Website's work, providing practice tools for the #soroban. This is the first Emacs package I've ever released. It's probably not perfect, but I welcome feedback on how it can be improved.

I wonder if there is an overlap of more than say five people who are both soroban and emacs users. 🙃

Anyhow, it can be found at: codeberg.org/jlamothe/soroban

reshared this

in reply to Jonathan Lamothe

vim guy here. happy to see I inspire others...

May be you could post on our forum. Not sure you will get more users, though

in reply to Soroban Exam Website

@Soroban Exam Website Might as well. I wrote it mainly for myself, partly because I don't own a printer and this makes it easier to practice when working from a computer screen, but also just to see if I could.

Still, if someone else is going to find it useful, that's probably the place I'll find them.

in reply to Jonathan Lamothe

May be you didn't see you that you can generate an interactive HTML output, on the site.
That was designed for people who don't want to print.

Should I make it more visible?

This entry was edited (1 week ago)
in reply to Soroban Exam Website

@Soroban Exam Website Yeah, that's what I'd been using. I just wanted sonething that worked offline. It's also got some tweaks that make it easier to see what line I'm on when doing additions since I can't slide my soroban over the page.


Whenever Katy tells me "I have an idea but you're not going to like it" she's usually right.
in reply to Jonathan Lamothe

In other news, my workspace is moving to another room in the apartment.

Shannon Prickett reshared this.

in reply to Jonathan Lamothe

Well, everything's mostly set up. Cable management needs some definite work, but at least the layout of my desk is more or less unchanged.

The new arrangement makes more logistical sense, but will require some getting used to. Just about every room in the apartment's been rearranged.



So, I've made the typo "tje" enough times now that my phone's keyboard has stopped correcting it (and even on occasion correcting to it).

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.