Skip to content

Instantly share code, notes, and snippets.

Emacs as an Org capture server

The Concept

The general idea is to run an Emacs server as a daemon which clients can quickly connect to via a bash script. The client executes org-capture and the frame closes upon finalizing or aborting the capture.

Running a server daemon

The first step is to get an Emacs daemon running as a server with your name of choice. For this example, I’m going to use “capture” as the server name.

@ursulogalvan
ursulogalvan / cite-init.el
Created October 3, 2021 12:42 — forked from bdarcus/cite-init.el
org-cite testing init, instructions
;; to test org-cite-new branch:
;;
;; 1. run 'make' from the org-mode repo wip-cite-new branch root
;;
;; 2. run ...
;;
;; ... this for basic citation testing:
;;
;; emacs -Q -l cite-init.el
;;
@ursulogalvan
ursulogalvan / org-refile-hydra.el
Created September 29, 2021 10:10 — forked from mm--/org-refile-hydra.el
Hydra for quickly refiling Org mode entries
;; Adapted from https://emacs.stackexchange.com/questions/8045/org-refile-to-a-known-fixed-location
(defun my/refile (file headline &optional arg)
"Refile to a specific location.
With a 'C-u' ARG argument, we jump to that location (see
`org-refile').
Use `org-agenda-refile' in `org-agenda' mode."
(let* ((pos (with-current-buffer (or (get-buffer file) ;Is the file open in a buffer already?
(find-file-noselect file)) ;Otherwise, try to find the file by name (Note, default-directory matters here if it isn't absolute)
@ursulogalvan
ursulogalvan / ec
Created September 23, 2021 06:38 — forked from alexmurray/ec
Start Emacs Client in GUI (and launch Emacs server if not already running)
#!/bin/bash
# Shamelessly taken from http://mjwall.com/blog/2013/10/04/how-i-use-emacs/
# This script starts emacs daemon if it is not running, opens whatever file
# you pass in and changes the focus to emacs. Without any arguments, it just
# opens the current buffer or *scratch* if nothing else is open. The following
# example will open ~/.bashrc
# ec ~/.bashrc