Skip to content

Instantly share code, notes, and snippets.

View alphapapa's full-sized avatar

Adam Porter alphapapa

  • USA
View GitHub Profile
@alphapapa
alphapapa / org-kbd.el
Created December 16, 2018 10:24
Org mode: Add syntax to export HTML KBD elements
;;; org-kbd
;; (setq org-emphasis-alist '(("%" org-kbd verbatim)
;; ("*" bold)
;; ("/" italic)
;; ("_" underline)
;; ("=" org-verbatim verbatim)
;; ("~" org-code verbatim)
;; ("+"
;; (:strike-through t))))
@alphapapa
alphapapa / fitness.org
Last active April 6, 2024 04:33
An Emacs food/weight/workout tracker self-contained in a single Org file

Plots

/home/me/org/double-plot.png

Tasks

@alphapapa
alphapapa / org-tree-view.el
Last active October 1, 2019 13:02
Show Org outline tree in a side buffer
;; NOTE: This has been superseded by `org-sidebar-tree': https://github.com/alphapapa/org-sidebar#org-sidebar-tree-command
(defun ap/open-tree-view ()
"Open a clone of the current buffer to the left, resize it to
30 columns, and bind <mouse-1> to jump to the same position in
the base buffer."
;; http://emacs.stackexchange.com/questions/9530/how-can-i-get-an-org-mode-outline-in-a-2nd-buffer-as-a-dynamic-table-of-contents
;; TODO: Make this use navi-mode, which handles most of this already
(interactive)
(let ((new-buffer-name (concat "<tree>" (buffer-name))))
@alphapapa
alphapapa / elfeed-config.el
Created September 13, 2018 10:41
Elfeed config
;;; elfeed configuration
(use-package elfeed
;;;; Keymaps
:general
(:keymaps '(shr-map)
"a" 'pocket-reader-shr-add-link)
(:keymaps '(elfeed-show-mode-map elfeed-search-mode-map)
@alphapapa
alphapapa / emacs-raise-or-run
Last active February 11, 2020 18:06
emacs-raise-or-run and org-git-add-commit
#!/bin/bash
# ** Vars
# *** Emacs version
if type emacs26 &>/dev/null
then
emacs="emacs26"
emacsclient="emacsclient26"
emacsWindowClass="Emacs"
@alphapapa
alphapapa / ap-helm-find-files.el
Created May 31, 2018 04:03
Custom Helm find-files command
(defun ap/helm-find-files ()
(interactive)
(helm :sources '(ap/helm-source-ivy-views
ap/helm-source-current-file-other-buffers
helm-source-buffers-list
ap/helm-source-files-in-current-dir
helm-source-org-recent-headings
helm-source-bookmarks
ap/helm-source-recentf
ap/helm-source-bindir
@felipeochoa
felipeochoa / pp-debug.el
Last active November 19, 2021 19:59
Pretty print emacs debug frames
;;; pp-debug.el --- Pretty-printing debugger -*- lexical-binding: t -*-
;; Copyright (C) 2018 Felipe Ochoa
;; Author: Felipe Ochoa
;; Created: 5 Dec 2017
;; License: GPLv3
;;; Commentary:
;;; Pretty-print debugger frames.
@alphapapa
alphapapa / helm-swish.el
Created December 1, 2017 08:47
Like helm-swoop, but faster (bare-bones featurewise, so not a replacement)
;;; Code:
;;;; Requirements
(require 'helm)
;;;; Commands
;;;###autoload
(defun helm-swish ()
@alphapapa
alphapapa / dash-dollar.el
Created September 7, 2017 08:23
Emacs Lisp: -$ macro
(defmacro -$ (&rest body)
(cl-labels ((collect-vars
(&rest forms)
(cl-loop for form in forms
append (cl-loop for atom in form
if (and (symbolp atom)
(string-match (rx bos "$")
(symbol-name atom)))
collect atom
else if (consp form)
@alphapapa
alphapapa / replace-words-randomly.el
Created July 24, 2017 22:40
Emacs: Replace all words in buffer with random words of the same length
;; This function replaces all words in a buffer with words of the same length,
;; chosen at random from /usr/share/dict/words. Words are replaced consistently,
;; so e.g. "A" is always replaced with "Z". The mapping changes when Emacs is
;; restarted or when the cache buffer is killed. If all unique words of a certain
;; length are exhausted, random strings are used.
(defun ap/replace-words-randomly (&optional buffer)
"Replace all words in BUFFER or current buffer with randomly selected words from the dictionary.
Every time a new word is found, it is mapped to a replacement
word, so every instance of word A will be replaced with word Z."