This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-28
Channels
- # asami (1)
- # aws (9)
- # babashka (16)
- # beginners (32)
- # calva (2)
- # clj-kondo (20)
- # cljdoc (6)
- # clojure (35)
- # clojure-dev (25)
- # clojure-europe (11)
- # clojure-india (1)
- # clojure-norway (2)
- # clojure-spec (26)
- # clojure-uk (1)
- # clojurescript (41)
- # conjure (3)
- # css (9)
- # cursive (18)
- # data-oriented-programming (6)
- # data-science (2)
- # emacs (47)
- # events (1)
- # fulcro (15)
- # graalvm (30)
- # gratitude (7)
- # honeysql (27)
- # inf-clojure (4)
- # introduce-yourself (2)
- # lsp (129)
- # malli (7)
- # missionary (21)
- # nbb (17)
- # off-topic (18)
- # re-frame (6)
- # releases (1)
- # shadow-cljs (120)
- # vim (7)
- # xtdb (15)
Consider this org src block
#+begin_src clojure
(with-out-str (pp/print-table [{:foo 10} {:foo 11}]))
#+end_src
#+RESULTS:
: \n| :foo |\n|------|\n| 10 |\n| 11 |\n
any ideas how to insert the string as text, instead of string?after checking ob-clojure.el I determined that
#+begin_src clojure :results pp
(pp/print-table [{:foo 10} {:foo 11}])
#+end_src
automatically does what I want.
It takes out
from the nrepl result instead of value
.
I was considering to add pp-table
next to pp
because I am abusing the pp
a bit and still need the print-table call in the code, but whatever.Mind pasting in the output you got? I've been occasionally frustrated when org tries to interpret everything as a table myself.
#+begin_src clojure :results pp
(pp/print-table [{:foo 10} {:foo 11}])
#+end_src
#+RESULTS:
:
: | :foo |
: |------|
: | 10 |
: | 11 |
:
:
I'm not sure what's up with :
Also there is 1 extra blank line because it says "pp nil" once because of the hack
#+begin_src clojure :results pp table
(pp/print-table [{:foo 10} {:foo 11}])
#+end_src
#+RESULTS:
| :foo |
|------|
| 10 |
| 11 |
now it is a true org tableDo your clojure blocks run against a persistent process (REPL)? I'm curious if it would be possible to execute stuff like that with babashka.
proof of concept:
#+begin_src elisp
(defun org-babel-execute:bb (s params)
"Execute `S` with babashka."
(shell-command-to-string (format "bb -e '%s'" s)))
(add-to-list 'org-src-lang-modes '("bb" . clojure))
#+end_src
#+begin_src bb
(+ 1 2 3)
#+end_src
#+RESULTS:
: 6
Hey, question not related to Clojure I've been using expand-region (best way to select stuff, period), but since upgrading to 28.1, when I run
M-x er/expand-region
I get this error
Wrong type argument: stringp, (require . diff)
Any ideas what could be wrong, or how I could debug this? BTW try out expand-region, it lets you start with a word and then move up to form, enclosing form, function etc, all interactively https://github.com/magnars/expand-region.el
(PS, maybe this is to do with some other package I have installed?)
Huh, after re-installing the package, now I get a different message:
Wrong type argument: stringp, (require . package)
let me see...
Debugger entered--Lisp error: (wrong-type-argument stringp (require . package))
string-match("\\(\\`\\|/\\)text-mode\\(\\.so\\|\\.dylib\\|\\.elc\\|\\.el\\)?\\..." (require . package))
load-history-filename-element("\\(\\`\\|/\\)text-mode\\(\\.so\\|\\.dylib\\|\\.elc\\|\\.el\\)?\\...")
eval-after-load("text-mode" #f(compiled-function () #<bytecode 0x1fc49373f5612>))
byte-code("\300\301\302\"\210\300\303\304\"\210\300\305\306\"\210\300\307\310\"\210\300\311\312\"\210\300\313\314\"\210\300\315\316\"\210\300\317\320\"\210\300\321\322\"\210\300\323\324\"\210..." [eval-after-load clojure-mode #f(compiled-function () #<bytecode 0x1fc4934087f72>) css-mode #f(compiled-function () #<bytecode 0x1fc4934084cd2>) erlang-mode #f(compiled-function () #<bytecode 0x1fc49333ef98e>) feature-mode #f(compiled-function () #<bytecode 0x1fc4933291926>) sgml-mode #f(compiled-function () #<bytecode 0x1fc4933291872>) rhtml-mode #f(compiled-function () #<bytecode 0x1fc4933291872>) nxhtml-mode #f(compiled-function () #<bytecode 0x1fc4933291872>) web-mode #f(compiled-function () #<bytecode 0x1fc4933290c0a>) js #f(compiled-function () #<bytecode 0x1fc4933290dd6>) js2-mode #f(compiled-function () #<bytecode 0x1fc4933290dd6>) #f(compiled-function () #<bytecode 0x1fc4933290ba2>) js3-mode #f(compiled-function () #<bytecode 0x1fc4933290dd6>) latex #f(compiled-function () #<bytecode 0x1fc4933290b6e>) nxml-mode #f(compiled-function () #<bytecode 0x1fc4933290a3a>) octave-mod #f(compiled-function () #<bytecode 0x1fc49332909d2>) octave #f(compiled-function () #<bytecode 0x1fc49332909d2>) python #f(compiled-function () #<bytecode -0xbcec82b8f601688>) python-mode #f(compiled-function () #<bytecode 0x1fc49332938b6>) ruby-mode #f(compiled-function () #<bytecode 0x1fc4934084a6a>) org #f(compiled-function () #<bytecode 0x1fc4933290102>) cc-mode #f(compiled-function () #<bytecode 0x1fc4934087cde>) "text-mode" #f(compiled-function () #<bytecode 0x1fc49373f5612>) cperl-mode #f(compiled-function () #<bytecode 0x1fc493408786e>) sml-mode #f(compiled-function () #<bytecode 0x1fc49373f56de>) enh-ruby-mode #f(compiled-function () #<bytecode 0x1fc49333eca12>) ...] 3)
autoload-do-load((autoload "expand-region" "Increase selected region by semantic units.\n\nWith ..." t nil) er/expand-region)
command-execute(er/expand-region)
It seems that require
expected a string (as usual), but it got other thing.
Maybe try to bisect your config. For example, try using emacs -q
and loading only expand-region
.
The way I read it the problem is with string-match, not require
bisecting the init.el is a good idea
hm, I don't even know how to require the package
ah I figured it out
M-x package-initialize
and sure enough it works with only expand-region
loaded
so now I have to really bisect the init.el I guess?
ok so this is strange
with emacs -q it works
without -q
but with an init.el that only contains (package-initialize)
I get the error message
better yet: emacs -q: works emacs with empty init.el: doesn't work
shouldn't those two be identical?
yeah. strange. not sure what’s going on. maybe wipe out your elpa
folder and reinstall all packages
(you can backup the current emacs.d
first, just in case)
Ok so after much digging I found that the offending line is this https://github.com/magnars/expand-region.el/blob/master/expand-region.el#L188
all other calls to eval-after-load take a symbol, but this one takes "text-mode" as a string
from what I can tell, that odd call (introduced in this pr https://github.com/magnars/expand-region.el/pull/213) seems to break with Emacs 28
Created a PR to fix the problem upstream https://github.com/magnars/expand-region.el/pull/275
Thanks for the help @U976F1AR2
I confess I found it surprising that more users didn’t report it (I suppose), though – AFAIK expand-region
is widely used :thinking_face:
Well, expand-region doesn't accept bug reports anymore, so people don't have a venue where they can report issues
(But I may also be wrong about this, as I know very little about elisp)
> Well, expand-region doesn’t accept bug reports anymore, so people don’t have a venue where they can report issues Oh, got it.
How do I get a backtrace for an error like this?
yup you answered in the other thread