(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.
#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
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/…
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"))))))
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.
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
@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
Jonathan Lamothe likes this.
@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?
> 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.
M-x package-install-file, it didn't like that the file didn't end with:;;; mud-mcp.el ends hereI just had to add that and it was all good.
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.
@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.
like this
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.
like this
@Á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.
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
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
@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.
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?
like this
Shannon Prickett reshared this.
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.
format to use a thousands separator? That'd be nifty, but it doesn't look like there is a way.
Katy's been down a YouTube rabbit hole on $medical_condition lately. Today we watched a yoga video that purported to relieve one of the symptoms. Cool cool, yoga can have benefits. Let's give it a go. Some of the instructions in this video were oddly specific but whatever, that's fine. Then we read the comments and my cult alarm started blaring.
This was a video with millions of views and an untold number of comments. Some of them were downright scary in their praise for this guy* and there wasn't a single remotely negative comment to be found.
Not one. I looked.
Someone is really dedicated to sliencing dissent on this video, and I can't imagine that being anything shy of a full-time job. That is probably one of the most massive red flags there is.
* e.g.: "Who needs western medicine? $youtuber is always the answer."
They told me no spicy foods until tomorrow, but the curry in my fridge is beckoning...
It's not that spicy. Should I?
I probably shouldn't, right?
like this
while the recursive name certainly helps, pizza developers use proprietary ingredients while mac and cheese development is fully free. The source code is in the name!
Although you could argue that Kraft Dinner is proprietary, but that's like a proprietary version of UNIX. People just go to it for nostalgia knowing it's way outdated, and any attempt to replicate it will give a better result.
Jonathan Lamothe likes this.
So the procedire in question is a colonoscopy. In addition to the diet they've also prescribed laxatives. I just took the first dose a short while ago. Apparently these things work fast.
It's going to be an interesting night.
The original keyboards used long ago had Ctrl, Super, Hyper, Meta, and ALT keys. We now map Meta (i.e. ESC) to the Alt key on our keyboards as a convenience. I do not believe there is a way, on modern keyboards, to have both META and ALT mapped to a key. We can have Super, and Meta. I can't recall if I was able to map Hyper on a modern keyboard.
Jonathan Lamothe likes this.
your auntifa liza 🇵🇷 🦛 🦦 reshared this.
I've been playing around with keymaps. Apparently they can be used to create menus that give the user a visual list of options. The canonical way to make them is aparently with make-sparse-keymap to create the menu and define-key to add options to it, but this causes some confusing behaviour.
Take the following example:
(let ((menu (make-sparse-keymap "My menu")))
(define-key menu "a"
'(menu-item "Foo" foo))
(define-key menu "b"
'(menu-item "Bar" bar))
menu)Yields the following:
(keymap (98 menu-item "Bar" bar) (97 menu-item "Foo" foo) "My menu")Each new entry is added to the top of the list, so when the menu is displayed, they're listed in reverse order. This is very counter intuitive.
Now, I understand that the nature of lists in lisp make inserting an element at the top of the list less computationally expensive, but when you've already got to walk the whole list anyway to ensure the key binding isn't already present, this no longer feels like an adequate excuse.
Am I missing something?
like this
reshared this
Define key is my least favorite way to make a keymap.
I like defvar-keymap, bind-keys, if you've got a map create already. Like a sparce map.
General is nice too. But then you have to have that installed.
Jonathan Lamothe likes this.
M-x function calls because I had such a hard time finding key sequences that weren't used by something else. Since learning that C-c /[A-Za-z]/ is reserved for user-defined keybindings, I've gone mad with power.reshared this
C-z suspends Emacs and drops me back to the terminal until I issue the fg command to bring it back. I use this for issuing git commands. I could probably do this from within Emacs, but I haven't bothered to figure it out.
Justin To #НетВойне reshared this.
@Zenie That's an option, but my concern is that the reason they might be vague in the docs is because the specific error might change in future versions.
Perhaps I'm just being overly paranoid.
Usually errors are obvious and for very specific reasons. You can just catch them and print the message so if anything does change you will know.
I don't think it's worth worrying about.
I've long known that certain ASCII control sequences could be mimicked by holding control and pressing a key, e.g.: backspace is CTRL-H, newline is CTRL-J, but I was today years old when I learned that the ASCII control code is just the ASCII value of the key being pressed along with control bitwise and-ed with 0x1f.
It feels weird that I hadn't caught onto this sooner.
Welp, it looks like our Instacart account is probably cooked. We need to find a replacement for that income quickly.
Fortunately, we were already in the process of trying to do that because of the wear and tear it was putting on the car. I have a few irons in the fire, but nothing concrete yet. We need something we can do on an on-demand basis so that we can work when our mental health permits.
I'm notoriously bad at interviewing for jobs. It always involves some element of exaggerating the truth (a.k.a. lying) which I suck at. It turns out for instance that the honest answer to "why do you want to work here?" (so I don't starve and end up homeless) isn't a good answer. 🙃
Looks like we've officially been fired from Instacart. It was the customer's word against ours. In the long run, this is probably a good thing as it was slowly killing our car with all the mileage it was putting on it. It was never meant to be a permanent solution anyway.
Edit: typo
My partner has been dealing with $condition for a very long time. In that time we have tried many therapies and medications without much success. We have found $medication_a which actually helps, but causes $side_effect which is not sustainable. Fortunately, we've found $medication_b which makes $side_effect tolerable.
She's been on a waiting list to see a specialist for a while and finally had her first appointment today. After a single 30 minute appointment, his solution was to increase $medication_a while completely stopping $medication_b. When she objected about $side_effect (which she'd already told him was the reason for $medication_b) he said to just do $obvious_thing as though we hadn't tried that already.
What's worse is that he faxed the order to our pharmacy canceling her previous prescriptions.
Of course, I am not a doctor but what the hell is this guy thinking??
I think I've been able to pin down what it is that I like about #Emacs so much. When I first started using computers, I was using a TRS-80. If you didn't have a cartridge inserted, It'd boot directly into BASIC where you could program the machine directly. That wasn't a bug, it was a feature.
Modern computing seems to do its best to hide all that stuff away. Everything is treated more like a simple (albeit specialized) appliance, not a powerful machine that can be made to do literally anything you want. Instead, it's about what the various software vendors want it to do.
Emacs by contrast not only gives you all the tools you need to modify it in any way you want, but actively encourages you to do so. It feels a lot more like the computing systems of old. Perhaps that's not for everyone. There's a reason computers were so niche back in the early days. Most people just didn't care to learn what was going on under the hood, and that's valid. There's something to be said for a tool that just works effortlessly out of the box. Also, to be clear, you don't strictly speaking need to dig into the internals to use Emacs, but I prefer for my technology to serve me, and I'm willing to put the effort in to make that happen.
That's why it's a good fit for me.
reshared this
(roll m3tti)
in reply to Jonathan Lamothe • • •CLHS: Function APROPOS, APROPOS-LIST
www.lispworks.comMarce Coll
in reply to (roll m3tti) • • •dziban
dziban.netBjörn Gohla
in reply to Jonathan Lamothe • • •well, there is hoogle for that.
Although I agree, it should be possible to search by signature in GHCi for all modules in scope, without building an index first.
Jonathan Lamothe
in reply to Björn Gohla • •Björn Gohla
in reply to Jonathan Lamothe • • •Jonathan Lamothe
in reply to Björn Gohla • •Dave Tenny
in reply to Jonathan Lamothe • • •FYI in case it's useful to you.
If you use generic functions (via `defgeneric` or `defmethod`) the resulting methods specialize on classes (and other things, but it isn't the same as all types). The slime inspector will show you all the method signatures for different methods, and you could no doubt write tools though I don't know if the method type signatures are available via standard API (it might be, I just haven't tried).
Jonathan Lamothe
in reply to Dave Tenny • •Digital Mark λ ☕️ 🕹 👽
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
Jonathan Lamothe
in reply to Digital Mark λ ☕️ 🕹 👽 • •