Skip to content

Instantly share code, notes, and snippets.

;; -*- lexical-binding: t -*-
;; timeline-mode minor mode records and shows a timeline of buffer
;; changes
;;
;; Buffer changes are stored after using complex commands and after
;; every save
;;
;; Changes are processed after 5 seconds of idleness, so that
;;; Iniline refined diff
;; Copyright (C) 2022
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;;; Iniline refined git diff with live update
;; Copyright (C) 2022
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
@codecoll
codecoll / complex-undo.el
Created April 7, 2021 04:17
Complex undo for Emacs
(require 'cl)
(require 'diff)
;; changes with less than this many characters are ignored to avoid
;; having too many little undos stored
(setq complex-undo-minimum-change-length 20)
;; number of complex undos stored for a file
(setq complex-undo-max-stored-diffs 50)
@codecoll
codecoll / getidleseconds.ps1
Last active April 21, 2020 15:40
Get idle seconds of computer with powershell script
# from https://stackoverflow.com/questions/15845508/get-idle-time-of-machine
Add-Type @'
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace PInvoke.Win32 {
public static class UserInput {
@codecoll
codecoll / convert.el
Created April 8, 2020 07:44
Conversion of seconds to hours minutes seconds string in elisp
(let* ((secs 100)
(hours (/ secs 3600))
(minutes (/ (% secs 3600) 60))
(seconds (% secs 60)))
(format "%s%s%s"
(if (> hours 0)
(format "%sh " hours)
"")
(if (> minutes 0)
(format "%sm " minutes)
@codecoll
codecoll / org-expand-search.el
Created March 23, 2020 15:34
Expand org search matches into a separate buffer
(defun org-expand-search-matches ()
(interactive)
(let (markers)
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(if (org-get-at-bol 'org-marker)
(push (org-get-at-bol 'org-marker) markers))
(forward-line 1)))
(switch-to-buffer "*orgnotes*")
@codecoll
codecoll / paren.el
Created March 15, 2020 20:15
Emacs - Always highlight matching parent (use inline overlay if out of screen)
(defun my-show-paren-for-line-start ()
(interactive)
(add-hook 'post-command-hook 'my-show-paren-for-line-setup-overlay t t))
(defun my-show-paren-for-line-stop ()
(interactive)
(remove-hook 'post-command-hook 'my-show-paren-for-line-setup-overlay t))
@codecoll
codecoll / paren.el
Created March 15, 2020 20:14
Emacs - Always highlight matching parent (use echo area if out of screen)
(defun my-show-paren-for-line-start ()
(interactive)
(add-hook 'post-command-hook 'my-show-paren-for-line-setup-overlay t t))
(defun my-show-paren-for-line-stop ()
(interactive)
(remove-hook 'post-command-hook 'my-show-paren-for-line-setup-overlay t))
test