Skip to content

Instantly share code, notes, and snippets.

@heikkil
heikkil / fill-or-unfill.el
Created August 28, 2018 16:09
Version of #'endless/fill-or-unfill and key bindings that work in org-mode
(defun endless/fill-or-unfill ()
"Like `fill-paragraph', but unfill if used twice."
(interactive)
(let ((fill-column
(if (eq last-command #'endless/fill-or-unfill)
(progn (setq this-command nil)
(point-max))
fill-column)))
(if (eq major-mode 'org-mode)
(call-interactively #' org-fill-paragraph)
@heikkil
heikkil / org-clock-merge.el
Last active September 24, 2019 19:14
Merge the org CLOCK line with the next CLOCK line
(defun org-clock-merge (arg)
"Merge the org CLOCK line with the next CLOCK line.
Requires that the time ranges in two lines overlap, i.e. the
start time of the first line and the second time of the second
line are identical.
If the testing fails, move the cursor one line down.
Universal argument ARG overrides the test and merges
@heikkil
heikkil / org-duplicate-heading.el
Last active October 4, 2020 16:54
Report org headings with duplicate names in the *Messages* buffer. Reveal them and move to the last duplicate. Run after saving the buffer.
(require 'dash)
(defun org-duplicate-heading ()
"Move to duplicate heading in the current org buffer."
(interactive)
(let ((header-list '()))
(org-element-map (org-element-parse-buffer) 'headline
(lambda (x)
(let ((header (org-element-property :raw-value x))
(begin (org-element-property :begin x)))
(when (-contains? header-list header)
@heikkil
heikkil / elfeed-link-and-note
Last active May 1, 2021 15:05
Elfeed configuration for emacs focusing on functions and bindings to copy and link to web pages