Tag: emacs
One of the things I want to do now that I have some time is get my head around all the modern AI stuff. I'm starting with a review or things I've already done by going through Andrew Ng's Coursera ML class. I'll probably continue with his courses but I'm certainly open to any suggestions (specifically for a CS guy who's not so strong on the math side).
This means diving back into Python even though Clojure is usually my weapon of choice.
# COMMENTSWhen we last left our heroes we had made the API call to dictionaryapi.com, gotten the response and coverted the json string into elisp data. Specifically an array that contained a hash table.
Today's video will take us the rest of the way to our thesaurus mode - run the function and we'll get a list of synonyms for the word we're currently at.
First, we had to pull out the synonyms from the response.
# COMMENTSSorry for the long break. Once December started, I spent the first few weeks spending my coding time on Advent of Code, then just got sidetracked but now it's time to get going again.
This is the last elisp topic I specifically wanted to cover so this and the next video mmight be the end of this series, we'll see.
What are we doing today? Using a web API. Basically, if we want to use some external data source or facility a typical way to make that happen is through a web API.
# COMMENTSToday we're finishing off our emoji project. This video covers two quick things.
The first is how we can make the mode use either of our replacement methods - one that actually replaces the text with the emoji and the other that uses text properties to overlay the emoji without changing the text.
This is done with a variable that we can set telling us which function to call. We used one named emoji-replace-by-insert.
# COMMENTSAnother short one today. We're taking the code we already wrote and making a minor mode out of it.
In Emacs, a minor mode is a set of functionality that you can turn on (or off) in a buffer (or globally). For example, the built in auto-fill-mode can be turned on in a buffer will automatically add newlines when your line gets "too long." You can see the modes that you currently have on using the describe-mode function, usually bound to C-h m.
# COMMENTSToday's a short 10 minute video as we continue to work on the emoji project.
In the last episode we replaced text in the form :emoji-name: with the emoji. This time, we're doing it a little differently - we're going to overlay the text with the emoji. This way we see the emoji but the underlying text is still present. This is kind of like when programming in a language that supports lambda, in many editors you can type lambda but it appears as the symbol: λ (note that the previous symbol is not an emoji but was entered using the RFC1345 input method).
# COMMENTSHere's the next part of our emoji project. In this video, we make the magic automatically happen. That is, when the user types an emoji in quotes - like 🐘, Emacs will automatically replace it with the emoji, 🐘.
Now, mind you, the way we're doing it isn't the best way. In fact, after I posted the previous video, Micky Peterson linked to an article he wrote on using input methods to insert emoji.
# COMMENTSBack from my trip and ready to continue the elisp series.
Today we're starting our emoji project. When we're done we'll have a minor mode where we can type in something like 🐘 in a buffer and Emacs will replace it with the elephant emoji 🐘. That's part one. We'll then learn how to overlay the emoji over the text so that while it will appear as the emoji (🐘) the actual text of 🐘 will still be in the buffer and file if you save it.
# COMMENTSI'm leaving our next elisp project for when I get back from my vacation but realized I could make a short video with some preliminaries - some elisp tools that we'll need that we can get out of the way.
Specifically, elisp's built in data structures. We've already used the list data structure and in this video we go a bit more in depth.
Lists are great for, well, list processing but they're not great for random access.
# COMMENTSIn this video, we're finally putting everything together for the function-header project.
for the most part, it's just putting a function wrapper (defun) around code we've already written but there area a few new things.
In order to parse the parameter string we use a few interesting functions. The parameter string might look something like this "int a, double d, int something, char c" - type name pairs separate by a comma and space.
# COMMENTS