Skip to content

Instantly share code, notes, and snippets.

View ajchemist's full-sized avatar
🕶️

ajchemist

🕶️
  • Korean Peninsula
View GitHub Profile
Now, glorious hacking has begun.

(let ((default-directory eil-fstorms-dir)) (unless (member eil-fstorms-dir load-path) (add-to-list ‘load-path default-directory)) (normal-top-level-add-to-load-path ‘(“auto-complete” “dired-fstorm” “frame-fstorm” “org-fstorm” “slime”)))

2 down vote
I don't have uptime on my system, so I can't test this for you. But it should give you an idea. Seems to work on my system with ps substituted for uptime.
Perhaps someone else will offer a simpler or cleaner solution. You might also look at call-process or start-process instead of shell-command-to-string --- start-process is async. You might also want to consider using an idle timer --- the code here can slow Emacs down considerably, since it calls uptime each time the mode line is updated.
(setq-default
mode-line-format
(list " " 'mode-line-modified

Using Clojure with org-babel and nREPL

When I first made the switch to nREPL, I just modified the code from my from Using Clojure with org-babel and inferior-lisp post, replacing lisp-eval-string with nrepl-interactive-eval, did a quick test and assumed it was all working fine.

Couple of days ago I had to go back and fix a literate program, that’s when I figured out there are couple of problems with using nREPL with org-babel. nREPL does not respect :main from project.clj so unless the first thing you evaluate in the org file is a ns declaration it will evaluate all blocks in user namespace, to fix this we have to create a buffer local variable called nrepl-buffer-ns that points to the main namespace.

When you try to edit the source block using C-c ’ (org-edit-src-code), new buffer org-mode creates does not inherit the namespace so any expression evaluated there again goes to user namespace to fix this below snippet adds a hook that will grab the value

Associate code edit buffer with babel comint session, if one exists.
author Dan Davison <davison@stats.ox.ac.uk>
Tue, 17 Aug 2010 00:55:24 +0000 (20:55 -0400)
committer Dan Davison <davison@stats.ox.ac.uk>
Tue, 17 Aug 2010 21:32:23 +0000 (17:32 -0400)
* org-src.el (org-edit-src-code): If at src block, store babel
info as buffer local variable.
(org-src-associate-babel-session): New function to associate
code edit buffer with comint session. Does nothing
unless a language-specific function named
@ajchemist
ajchemist / org-latex-classes
Last active November 21, 2018 06:07
ox-latex-lisp-macro
(eval-after-load "ox-latex"
'(eval `(progn
(let ((latex-div-struct
'(("\\book{%s}" . "\\book*{%s}")
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
@ajchemist
ajchemist / scratch1.org
Last active December 25, 2015 00:09
org-export

TEST at Midnight

이거슨 파트

이거슨 촵터

\documentclass[nanum,amsmath,adjustmath,kosection]{oblivoir}
\usepackage{expl3}
\usepackage{l3regex}
\ExplSyntaxOn
\tl_new:N \l_demo_tl
\cs_new:Npn \demo #1 {
\tl_set:Nn \l_demo_tl {#1}
\regex_replace_all:nnN { ==(.*?)== } { \c{subsection}\cB\{ \1 \cE\} } \l_demo_tl
\regex_replace_all:nnN { =(.*?)= } { \c{section}\cB\{ \1 \cE\} } \l_demo_tl
\regex_replace_all:nnN { \*\*(.*?)\*\* } { \c{textbf}\cB\{ \1 \cE\} } \l_demo_tl
unamestr=$(uname -s)
if [[ "$unamestr" == 'Linux' ]]; then
systemtype='linux'
elif [[ "$unamestr" == 'FreeBSD' ]]; then
systemtype='freebsd'
elif [[ "$unamestr" == 'Darwin' ]]; then
systemtype='darwin'
fi
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; OLD
(add-to-list 'auto-mode-alist
'(".+/\\.?emacs.d/theme/"
lambda nil (emacs-lisp-mode) (rainbow-mode 1)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; NEW