This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-24
Channels
- # announcements (22)
- # babashka (33)
- # babashka-sci-dev (161)
- # beginners (25)
- # calva (57)
- # cider (6)
- # clara (6)
- # clerk (14)
- # clj-kondo (24)
- # clojars (10)
- # clojure (65)
- # clojure-austin (1)
- # clojure-conj (2)
- # clojure-europe (23)
- # clojure-miami (3)
- # clojure-nl (3)
- # clojure-norway (3)
- # clojure-uk (3)
- # clojurescript (28)
- # cursive (24)
- # datomic (136)
- # emacs (38)
- # graalvm (29)
- # graphql (3)
- # introduce-yourself (8)
- # jackdaw (4)
- # jobs-discuss (9)
- # malli (5)
- # nbb (36)
- # off-topic (11)
- # pathom (58)
- # polylith (2)
- # practicalli (1)
- # re-frame (5)
- # reagent (11)
- # releases (1)
- # remote-jobs (8)
- # sci (15)
- # shadow-cljs (31)
- # slack-help (2)
- # spacemacs (11)
- # sql (7)
- # tools-build (9)
Is there a reasonable way to get Vega Lite autocomplete (and documentation lookup) using their Json schema? https://vega.github.io/schema/vega/v3.0.json
Anyone else finds save-buffer
takes a few seconds to save the file? I wonder if I have to many things hooked up that run when I save or something, but I feel it takes like 4 seconds to save the file.
Check what's on before-save-hook
and after-save-hook
and if there's nothing there it's probably an FS issue. Could maybe be writing to temp files, but 4s if not exaggerating is quite bad
Ok, even with all before and after save hooks, it's still slow. Maybe it's got something to do with me being on WSL2
This is the CPU profiler:
3164 94% - command-execute
3164 94% - call-interactively
3164 94% - funcall-interactively
1758 52% - save-buffer
1758 52% - basic-save-buffer
1758 52% - run-hook-with-args-until-success
1758 52% - undo-tree-save-history-from-hook
1360 40% + undo-tree-save-history
1406 41% + counsel-M-x
65 1% + ...
64 1% + flyspell-post-command-hook
44 1% + which-key--hide-popup
13 0% + timer-event-handler
7 0% + lsp--post-command
I guess there are more hooks: The hooks ‘write-contents-functions’, ‘local-write-file-hooks’ and ‘write-file-functions’ get a chance to do the job of saving; if they do not, then the buffer is saved in the visited file in the usual way.
Ok, the culprit was: undo-tree-auto-save-history which is very slow it seems. Turned that off, and now saving is fast again.
I'm using a simple setup with little customization (Prelude, refactor-nrepl, clj-kondo) and it's quite sufficient for me, but I often miss how I could easily find function usages or do some other stuff static analysis allows in IntelliJ IDEA. refactor-nrepl has such functionality, but it doesn't work with .cljs and .cljc files, so I tried to find some static analyzer for this and found clojure-lsp. It seems to work, but now almost every action I perform in editor takes more time than before. It's not freezing, but is noticeably slower. So my question is, is this normal for clojure-lsp or something might be wrong with my setup? Are there any alternatives to clojure-lsp?
It's not normal. • Check if you are using both clojure-lsp and clj-kondo, which would cause duplicated lint as clojure-lsp calls kondo under the hood • Check lsp-mode tune as suggested https://emacs-lsp.github.io/lsp-mode/tutorials/clojure-guide/
@U043RSZ25HQ, lsp-mode, I think. First time I see word 'eglot'
@UKFSJSM38, thanks, I'll try this
LMK if any issues, I use clojure-lsp with Nubank repos of more than 180k clj lines and work without freezing, slower diagnostics but no freezing
It seems it was because for some reason clojure-lsp formatted code on almost any action I did in editor. With this config everything works fine
{:document-formatting? false
:document-range-formatting? false
:text-document-sync-kind :incremental}
I'm having to poke some proprietary API by sending http requests and I'm dealing with a weird issue. I can send requests via curl, and they work fine. But the same requests, with the same headers and all, sent through ob-restclient
, ob-http
, or verb.el
- they all are failing with the same error:
The server encountered an unexpected internal server error
(generated by waitress)
waitress is a python lib, I recon that's what the API was built with. It looks like I'm missing some additional header (maybe charset related, I dunno). And I can't figure that out. Maybe someone knows what's up?Hopefully you'd be able to make both curl and ob* dump the request headers they send out, and then diff them 🔍
so the differences I see, for example, ob-http delegates its calls to curl. But having done so, it doesn't pipe the content of the block, it does something like:
curl -i -X POST -H Content-Type\:\ application/json -d \@/var/folders/m3/34qjmhdj7px1m3v15w7678_80000gn/T/babel-iUWmb1/http-e3kr4H --verbose --max-time 10 --globoff https\://api-prometheus.xdr.us.blabla-com
I feel that curl can't figure out the encoding of that file, or can't accurately calculate the content-length, maybe there's something else, I dunnoDid you try pasting/running that command into iterm and see what's printed? The request headers should confirm/deny your suspicions
OMG. I'm such an imbecil. I had a tiny typo in the middle of the URL. The URL is too long, and somehow copying and pasting "the correct one" didn't replace it, and stupid API instead of telling that the route is wrong, kept giving me that weird error. I'm so sorry Victor for wasting your time. Thank you for your help.
How to approach learning Emacs? Initially I thought about picking some book to learn vanilla emacs before moving onto any ready to go configs (like Spacemacs or Doom). I thought that even with vanilla I should be able to make some things done and step by step extends both my understanding of the tool and application use cases for my person/work tasks. What do you think about that strategy? Would you recommend a book about Emacs, or maybe you would completely disagree with this approach? Any comments much appreciated.
I learned the basics from just a few blog posts and PDF cheat sheets a few years back. There's a few commands that you need to learn that you can create a personal cheat sheet that you keep with you: • Open/closing files (you can just drag files in from your file editor) • Cancel command (ctrl +g) • Switching buffers • Installing packages (like clojure-mode, cider + paredit) • connecting a clojure repl and executing clojure code • paredit (slurp, barf, split + toggling paredit on/off) • copy/paste/cut • Moving cusor around + selecting text (note you are allowed to use the arrow cursors/page-up/down buttons on your keyboard). It doesn't have to be a major project - if in doubt save your work and reopen it 🙂. BTW emacs has a built in tutorial that you can run. I do encourage the vanilla emacs route - use a GUI version so that it comes with mouse support out of the box)
I learned emacs while using doom-emacs and was way easier for me to understand doing stuff on my running emacs, then later I read the manual when I needed to create some custom elisp stuff. Also, crease packages is a excellent way to learn after you learned the basic stuff
I'd start with a minimalistic but batteries-included template. Spacemacs and Doom are most certainly too big to comprehend. Prelude or, perhaps Corgi? Or any config you hear a Clojurist is using and has < 150 lines (that was a dream 10 years ago but a reality today). Anyway, the most important thing you can adopt is using Emacs to learn about Emacs. Its essence is right there. Every time you have a problem with the basics, don't google the problem, but the meta-problem e.g. "how can I ask Emacs about __?" Use this mindset to also read, write, and eval Elisp code. You don't have to be purist about this during the whole journey, but I'd definitely recommend it during the boostrapping phase :)
one important question: do you already know vi/vim style key bindings? if you do, I think it would be counterproductive to learn emacs using its default bindings. I think the vim-style setups for emacs would give you a nice path in in that case. FWIW, I didn’t know vim bindings when I started with emacs, but IME emacs didn’t really “click” for me until i started using a modal framework (in my case, Spacemacs). Whatever you choose, it will take a while, so give yourself time, and more importantly, patience. 🙂
also, as someone who pruned down my config from spacemacs to doom to corgi, I second the corgi recommendation. it’s very good, and importantly, small.
I started with the built in tutorial (there was no real alternative back then). I am not sure I would advise to go with one of the prebuilt solutions, they tend to be quite opinionated.
it’s quite easy to get going with basically just use-package now (soon a builtin too). The modal vs emacsy editing style is also something I’d leave on the side for now, pick whatever you’re the most familiar with
Do you want to be productive quickly or create a highly personalised workflow? If you want to learn how Emacs works and how to write Elisp (and not in any hurry to add features), then start with Vanilla Emacs and build your own configuration step by step. Use the Emacs tutorial to understand the fundamentals and the https://www.gnu.org/software/emacs/manual/eintr.html There will be a lot of decisions to make about which packages to use and how to organise them, but this allows for a highly customised workflow for yourself. Emacs by itself is a tool for creating a good editing workflow with numerous Emacs packages, so learning which packages are relevant to you is important. A community configuration can make some or all of these choices for you. Assuming you mean learning to use Emacs to get things done, I would not start with Vanilla Emacs unless there is a lot of time available to learn things. Also not everything learned by using Vanilla Emacs with be relevant if using a community distribution such as Spacemacs, Doom or Prelude (as they have their own abstractions). Spacemacs - heavily documented, mnemonic menus, batteries included, simple to be productive, requires some learning to heavily customise Doom Emacs - lightweight, vim-style leanings, basic documentation, easy to configure and extend Prelude - classic Emacs chorded key bindings (C-c C-c), solid Clojure support (its made by the author of Cider), seems simple to work with, probably closest to Vanilla Emacs
This is what I did, years back. I created a single Org-mode file called http://tasks.org. I didn't know anything about Org-mode and in general, was a total noob in Emacs. Whenever I had a question or felt like whatever I'm doing is taking too long or does require repetition, or simply annoyed me for any reason, I would add a new item to that list. Slowly I learned org-capture, which allowed me to add items to the list much faster. The list kept growing, it forced me to learn more efficient ways of finding stuff. Some items, over time, have become irrelevant so I learned how to archive them. Some problems required basic knowledge of Emacs Lisp, I started using org-babel to have source blocks where I would write and play around with tiny (and sometimes bigger) elisp snippets. That forced me to discover indirect buffers and I realized how amazing they are. Then I learned Org-agenda, scheduling, deadlines, etc. That single .org file had become a very important part of my life. I started using it for other things, not just to learn Emacs and Org-mode. By the time I discovered Org-Roam and jumped into Zettelkasten, I was doing pretty much almost everything I do on the computer, in Emacs. Today I read my email, browse articles and blogposts, manage all my files, read books, extract subtitles from videos, and keep my journal - I do all that in Emacs. And everything started with a simple .org file. Eventually, this approach become my personal philosophy, my absolute recipe for any problem in my life - If you need to solve something, start with a simple list --- What I'm saying is that you're asking: "My dream is to get on top of Mount Everest. I don't know much about climbing, but I heard El Capitan is great. Do you think I should try scaling that, or that's a waste of time?"... Note that I don't know anything about rock climbing, it's just the first analogy that came to me. What you should be asking, is not a single question of a specific (bigger) target, it's a bunch of small questions.
My vote goes to https://github.com/lilactown/kitten by @U4YGF4NGM even though it's not "polished" yet :P • Model editing via https://github.com/meow-edit/meow • Corgi style key-to-signal binds via https://github.com/lilactown/kitten/blob/main/lisp/reflex.el • Minimalistic; it's not a framework like Doom, it's Your Own Config® I don't have time to give it a proper sales pitch at the moment, but I feel like it's a nice way to get into Emacs already setup for Clojure, without being a heavily modified framework. Add https://github.com/drym-org/symex.el (https://countvajhula.com/2021/09/25/the-animated-guide-to-symex/) for some really nice structural editing, and you have a winner in my book. :) https://github.com/corgi-emacs/corgi gets a close 2nd.
When it comes to learning emacs, though, chatGPT is... mostly really good for that. Caveats apply, like don't expect much help for any specific emacs packages, and sometimes it's just plain wrong. But it has saved me a lot of internet scouring, even with it's quirks.
My short answer to the question would you recommend a book on Emacs is yes. I found the book https://www.masteringemacs.org/ helpful to set solid foundations and being able to navigate all the random concepts/buzzwords/options/opinion/etc which you are inevitably going to stumble on. At the time I was personalising a basic Emacs config (I started from the one of the Brave Clojure book) but it should be possible to start from scratch and apply the learning as you go. I know not everyone fancy books to learn technical/practical concepts but it's also a matter of personal preference. If this is something that works for you, go for it 🙂