Skip to content

Instantly share code, notes, and snippets.

View clemera's full-sized avatar

Clemens Radermacher clemera

View GitHub Profile
@alanthird
alanthird / svg-text.el
Last active April 10, 2021 09:16
Use SVGs to replace text in Emacs
;; Score out this text
(require 'svg)
(defun replace-text (start end)
(let* ((str (buffer-substring start end))
(scale (cadr (assoc :height (assoc 'default face-remapping-alist))))
(family (face-attribute 'default :family))
(height (* (aref (font-info family) 2) (if scale scale 1)))
(ascent (* (aref (font-info family) 8) (if scale scale 1)))
(img (svg-create (car (window-text-pixel-size nil start end))
@rougier
rougier / Toolbar.el
Created November 30, 2020 12:05
Emacs SVG Toolbar
;; An experiment for an SVG toolbar using icons from material.io
;;
;; Example usage: (toolbar 48 "black" "white" t t)
;; Material icons freely available (Apache 2 license) from
;; - https://material.io/resources/icons/?style=outline
;; - https://github.com/google/material-design-icons
(require 'xml) (require 'svg)
(defun toobar-item (label icon fg-color bg-color size with-icon with-label)
@rougier
rougier / tag.el
Last active March 11, 2024 05:33
Rounded boxed tags for Emacs
;; ---------------------------------------------------------------------
;; Tag minor mode
;; Copyright (C) 2020 Nicolas .P Rougier
;;
;; 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,
@alphapapa
alphapapa / native-comp-convenience.org
Created September 19, 2020 20:01
Emacs native-comp branch convenience c ode

Emacs native-comp Recipes

For lack of a better term.

Update Docker image

  1. Update Andrea’s image.
@rougier
rougier / material-colors.el
Created July 31, 2020 17:54
Emacs year calendar in a dedicated frame
;; Material colors from https://material.io/design/color/
(defconst levels
(list "L50" "L100" "L200" "L300" "L400"
"L500" "L600" "L700" "L800" "L900"
"A100" "A200" "A400" "A700"))
(defconst red
(list "#FFEBEE" "#FFCDD2" "#EF9A9A" "#E57373" "#EF5350"
"#F44336" "#E53935" "#D32F2F" "#C62828" "#B71C1C"
"#FF8A80" "#FF5252" "#FF1744" "#D50000"))
@rougier
rougier / rounded-box.el
Last active October 3, 2020 13:24
SVG Rounded box for Emacs
(require 'svg)
;; Rounded boxes using SVG:
;; This could be made into a function but size of text needs to be computed
(defun tag (text &optional foreground background font-size)
(let* ((font-size (or font-size 12))
;; The char-width ratio depends on the font family
(char-width (* font-size 0.58))
(char-height (+ font-size 1))
@rougier
rougier / bordered-emacs.el
Last active January 16, 2021 22:58
Bordered emacs
;; Copyright 2020 Nicolas Rougier - BSD License
;; Usage: emacs -q -l bordered.el
(set-face-font 'default "Roboto Mono Light 14")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40)
'(vertical-scroll-bars . nil)
'(internal-border-width . 0)
'(font . "Roboto Mono Light 14"))))
(set-frame-parameter (selected-frame)
'internal-border-width 0)
@rougier
rougier / clean.el
Created May 10, 2020 02:43
A very minimal but elegant emacs configuration file
(require 'org)
(setq-default indent-tabs-mode nil)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq default-frame-alist
(append (list '(width . 72) '(height . 40))))
@alphapapa
alphapapa / hide-show-layers.scm
Created October 8, 2019 20:30
GIMP: Hide/Show all layers in current image
;; When editing an image with many layers (e.g. an animated GIF with
;; hundreds of frames), it's impossibly tedious to click hundreds and
;; hundreds of times on small little boxes to hide or show all layers.
;; Since GIMP seems to lack a button to hide/show all of them, and it
;; doesn't allow selection of multiple layers, this script provides
;; menu items to hide/show all layers at once.
;; Who knows if later versions of GIMP than I have provide a way to do
;; this, but this works, and maybe it will be helpful to someone.
@alphapapa
alphapapa / magit.sh
Last active April 5, 2020 10:18
Run a standalone Magit editor!
# Please see the script's new home: https://github.com/alphapapa/magit.sh