Read an #Emacs #org file to #HTML then to #DOM? It's simple! #EmacsLisp #Elisp #DeadSwitchWisdom
Read an #Emacs #org file to #HTML then to #DOM? It's simple! #EmacsLisp #Elisp #DeadSwitchWisdom
#Emacs question: How does one load (or include or import or however the proper terminology is) a elisp file relative to the current elisp file? I can only find load
and load-file
, but these seem to always load stuff relative to the load path or the CWD of Emacs itself, not the file.
Edit: It's solved: (load (expand-file-name "myfoo.el" (file-name-directory (macroexp-file-name))))
What brought you to #Emacs?
@myTerminal I was using Tmux, Vim, Bash, AWK, and FZF, and I kept trying to write scripts for all of these programs that would allow me more coordination between them. For example, I once wanted to launch a process from Vim in a second terminal in a Tmux split-screen, capture it’s output into a temporary file, then when the process exited, use AWK to select symbols from the file that I could later feed into FZF. Or I would write a little wrapper Bash script that would run a build process and send a notification and trigger Tmux to automatically switch to the shell when the process completed.
I was always thinking to myself how I wished all of these separate tools, which were all doing one just thing and doing it well (the Unix philosophy), could be connected together without needing to use pipes or complicated message passing through temporary files or through DBus. And I also wished they were all written in the same programming language, instead of having a different language for Bash, AWK, VimScript, and the config languages for Tmux, or using long chains of CLI options stored into partial script files.
Then it hit me one day that this thing that I was wishing for, which coordinated between the terminal multiplexer, command shell, editor, and auto-completion framework and was all scripted with just one programming language, this thing already existed and it was called Emacs.
Then I finally understood what all the fuss was about, and switched to Emacs forever.
This took me three months (a month longer than I had hoped), but I finally have merged it into the main branch!
This patch rewrites the Emacs Lisp lexer and parser in Scheme using Scheme code that is 100% compliant with the #R7RS standard, so it should now work across all compliant Scheme implementations. Previously the old parser relied on #Guile -specific regular expressions.
This patch also implements a new feature where a stack trace is printed when an error occurs. This of course makes debugging much, much easier. Previously the old parser did not keep track of where code evaluation was happening, it simply produced lists without source location information. The new parser constructs an abstract syntax tree (AST) and source locations are attached to the branches of the tree which can be used in error reporting and stack traces.
Next I will make whatever minor tweaks might be necessary to get my Emacs Lisp interpreter run on other Scheme implementations, in particular MIT Scheme, Gambit, Stklos, and Gauche. I would also like to try to get it running on Chicken and Chez, although these are going to be a bit more tricky.
Then I will continue with the task of implementing a new declarative GUI library.
TURNS OUT that if you look carefully at the debugger in the *Backtrace* buffer after you make a mistake in Emacs lisp, it TURNS OUT that you can find your dumb mistake where you used the wrong goddam type
@me I guess you could fairly easily write a macro that automatically created a lexical scope and added some prefixes to variable used within its body - Doug Hoyte's "Let over lambda" book has #CommonLisp examples of this kind of approach as way to cut down the syntactic overhead of using gensym in macros. Without much thought, I'd assume something similar could be done in #EmacsLisp
As a sort of codicil to my last "Wall Clock" video, here is one where I demonstrate how to fix two small bugs in the code as it exists on Ramin Honary's github repository:
""You don't have to like Emacs to like it" - this seemingly paradoxical statement is the secret of GNU Emacs. The plain, 'out of the box' Emacs is a generic tool. Most people who use it, customize it to suit themselves."
— Robert J. Chassell: Emacs Lisp - An Introduction, p. 185
Ok, I've read all chapters, but I'm not setting this book as read until I finish some exercises (and read appendixes). I'm especially interested in the plain text graphs library since I enjoy data visualization whenever I can work on it.
Another note to myself. I've used yank-pop first time today. I knew of kill-ring but never bothered to delve deeper since no other software I'm using implements it in a way to store more elements on the clipboard.
And I have my eyes on the next goals as well: The Emacs Lisp Elements by Protesilaos Stavrou. I'll try to read it on my e-ink screen, because I'm not utilizing it enough (it would be so nice to have touch screen gestures to scroll working on my #debian with #i3).
And after that, I'll check if there are any simple packages that need co-mainteners. #EmacsLisp
I'm loving the gentleness of introduction that this book provides. It goes slowly through the code examples and shows you how to read the #EmacsLisp code.
And a spoiler: Here is my attempt for the Chapter 8 exercise: (defun test-search (string) "Search for string and left a point there if it is found." (interactive "sSearch for: ") (let ((found) (current (point)) (len (length string))) (save-excursion (while (and (< (+ len current) (point-max)) (not found)) ;; why complicate? just whole string on each position. (if (string-equal string (buffer-substring-no-properties (point) (+ (point) len))) ;; we found the string (progn (message "Found!") (setq found t) ) (progn ;; else (setq current (+ 1 current)) (forward-char) ) ) ) ) (when found ;; we found the string so we move the point. (goto-char (+ current len)) ) ) )
(comment on Emacs Lisp - An Introduction)
Anyone wanna write a small #GNU #Emacs mode that handles #LispM #LispMachine fontified files? #EmacsLisp #elisp
Behold, the divine opus on Emacs Lisp Elements by #Prot, the #Guru of All Things Unrelated to Actual Programming.
For the low, low price of your sanity, immerse yourself in a stable version time travel tale set in 2025.
Because why wouldn't you want private lessons on "Life" from someone named after an ancient Greek hero?
https://protesilaos.com/emacs/emacs-lisp-elements #EmacsLisp #TimeTravel #LifeLessons #HackerNews #ngated
I’m an amateur lisper, mostly #Guile and #EmacsLisp, but if someone wants to team up for this #GameJam, I’d be interested!
I also do some basic art, game design, sound, and music. I wouldn’t want to be the sole programmer for this jam but could definitely contribute there and would love to learn more #Lisp.
I am once again faced with the bleak irony of people who like to code in the terminal with Vim or Nano, but also install onto their computer some 5 or 10 apps via FlatPak or Docker, including VSCode, each installed with their own entire copies of Node.js and Electron.js (differing only in their minor revision number), while also complaining about Emacs being “bloated” because it ships with a miniature web browser and fully-featured e-mail client.
So, aspiring Emacs Lisp wizards, you've dreamt of a #blogging utopia where you can puzzle over one.el for days just to avoid using WordPress?
Because nothing screams "user-friendly" like cramming HTML and CSS into your favorite text editor and calling it a site generator.
Good luck explaining this to your non-Emacs friends!
https://one.tonyaldon.com/ #EmacsLisp #WordPress #Alternatives #DeveloperHumor #CodingCommunity #HackerNews #ngated
Static Site Generator for Emacs Lisp Programmers — https://one.tonyaldon.com/
#HackerNews #StaticSiteGenerator #EmacsLisp #Programming #Community #TechNews
“This idea of “glueing” together utilities via elisp for me is at the core of what makes #Emacs attractive for knowledge workers. All of my projects draw on command line tools (rg, fd, wget, mpv etc) to process information of various kinds. As someone with no formal background in programming, I found elisp easier (and more useful) than bash and way more stable & reliable than Python (dependency hell).“
@laotang Absolutely. This is a big reason why I switched to Emacs. I used to subscribe to the “Unix philosophy” of every tool does one thing and one thing well, and Emacs seemed like the opposite of that. But I started to realize that I was hacking together a bunch of disparate tools with Unix pipes, tools like Vim, Tmux, Bash, Sed, Grep, my window manager, my file manager… and none of these tools spoke the same language so it was incredibly difficult to get them to all to work together with just Unix pipes.
When I realized that Emacs is not a tool but an app platform and a programming language, I realized that Emacs actually follows the Unix philosophy even better than Unix itself does. In Emacs, every “Mode” (Major Mode, or Minor Mode) is a tool that does one thing and does it well, and you compose tools together with text buffers rather than with pipes. And Emacs Lisp, as old as it is, is a much, much better programming language than Bash.
I wrote my own blog post about it not too long ago.
A blog post by @xenodium . Here is an excerpt:
As you become more accustomed to Emacs, you may find yourself wishing you could navigate other tasks just as efficiently. But this doesn’t happen right away. The editor starts moulding to your needs, initially as you copy others’s code/configurations, but this can only take you so far. Emacs truly does mould to your own needs, once you start learning a little elisp.
When comparing elisp to modern languages, one may be tempted to dismiss it as a niche language from another era. While both of those things may be true, its moulding and glueing capabilities remain just as relevant and powerful today, even in the LLM era.
Readings shared December 30, 2024. https://jaalonso.github.io/vestigium/posts/2024/12/30-readings_shared_12-30-24 #ITP #Coq #Rocq #FunctionalProgramming #Haskell #CommonLisp #EmacsLisp #Emacs #Logic #Math #CategoryTheory #AI
I use Emacs with a modified inferior Lisp to access uLisp over serial on my Cardputer uLisp Machine. Any idea why I get extra ^Ms in the inferior Lisp?
The code of the modified mode and the full context is in this uLisp forum thread. Calling comint-strip-ctrl-m doesn't seem to help.
A roundup of the major new features of and changes to Emacs over the past decade. A handy resource as I haven't been keeping up with its development for several years and I'm only recently picking it up again.