Monday, November 23, 2020

macOS: Brew emacs 27.1 keeps crashing on Big Sur 11.0.1

[Edit] Updated way to compile emacs on macOS 12: https://github.com/jimeh/build-emacs-for-macos

Version: macOS v11.0.1
Constant crashes of Emacs v27.1 installed from Brew for no reason.
As a workaround, let's compile the latest version locally (bleeding edge).
source: Transitioning to GUI'd Emacs on macOS
$ git clone https://git.savannah.gnu.org/git/emacs.git
$ cd emacs
Check out the native compilation branch.
$ git checkout feature/native-comp
Let's make it.
$ export LIBXML2_CFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2"
$ ./autogen.sh
$ ./configure --without-makeinfo
$ make
$ make install
Then, replace the Brew version.
$ brew cask remove emacs
$ mv nextstep/Emacs.app/ /Applications/

Tuesday, November 10, 2020

jq: keep array values

 [jerome@jeroboam] > echo '["foo", "bar", "Baz"]' | jq '.[] | select(test("b"; "i"))'

"bar"

"Baz"


Wednesday, November 4, 2020

Clojure: destructuring map without naming key

Source: Destructuring map of map with unknown keys
user> (let [[[k {:keys [pim pam]}]] (seq {:basic {:pim 2 :pam 3}})] [k pim pam])
[:basic 2 3]
But no need of seq if we iterate with for.
user> (into {} (for [[k {:keys [pim pam]}] {:basic {:pim 2 :pam 3} :simple {:pim 20 :pam 30}}] [k {:pam pim :pim pam}]))
{:basic {:pam 2, :pim 3}, :simple {:pam 20, :pim 30}}