Skip to content

Instantly share code, notes, and snippets.

View wroyca's full-sized avatar
💭
I may be slow to respond.

William Roy wroyca

💭
I may be slow to respond.
  • Canada
  • 22:44 (UTC -04:00)
View GitHub Profile
@wroyca
wroyca / dotemacs-modeline.el
Created June 3, 2026 21:17
Minimal custom mode line
;;; dotemacs-modeline.el --- Minimal custom mode line -*- lexical-binding: t -*-
;;; Commentary:
;;
;; This library installs a small mode line built on Emacs' standard
;; `mode-line-format' machinery. It intentionally avoids external rendering
;; packages. Consult and Magit are used when available, but the mode line
;; remains usable with built-in libraries only.
;;
;; The installed format is:
@wroyca
wroyca / dotemacs-keymaps.el
Created June 3, 2026 20:58
Declarative prefix keymap definitions
;;; dotemacs-keymaps.el --- Declarative prefix keymap definitions -*- lexical-binding: t -*-
;;; Commentary:
;;
;; This library provides a small declarative layer for prefix keymaps.
;;
;; `dotemacs|define-prefix-keymap' creates named prefix keymaps, binds
;; top-level prefixes in `global-map', installs nested prefix maps through
;; symbols, and records readable labels for Which-Key.
;;
@wroyca
wroyca / dotemacs-theme.el
Created June 3, 2026 20:42
Persist themes and follow system appearance with Emacs
;;; dotemacs-theme.el --- Persist themes and follow system appearance -*- lexical-binding: t -*-
;;; Commentary:
;; Persist the last selected Emacs theme, remember separate light and dark
;; theme choices, and optionally follow the freedesktop appearance portal.
;;
;; Theme selection is tracked by advising `load-theme'. Plain `load-theme'
;; has no light/dark intent, so external loads are associated with the
;; currently known scheme rather than guessed from face colors. Use
@wroyca
wroyca / dotemacs-context-menu.el
Last active June 3, 2026 21:11
Emacs context menu handler that respects inhibition.
;;; dotemacs-context-menu.el --- Inhibition-aware context menu setup -*- lexical-binding: t -*-
;;; Commentary:
;;
;; This library installs a small inhibition layer around Emacs context menu
;; creation.
;;
;; The context menu is normally produced by `context-menu-map'. Some commands
;; and completion annotations can accidentally trigger context menu generation
;; while they are trying to inspect a mouse event or annotate a candidate. This
@wroyca
wroyca / conceal_comment.lua
Last active August 10, 2025 23:24
Hide and show comments in code.
---@class ConcealComment
local M = {}
---@alias BufferHandle number
---@alias LineNumber number
---@alias ColumnNumber number
---@alias ExtmarkId number
---@alias NamespaceId number
---@class CommentNode
@wroyca
wroyca / document_link.lua
Last active July 20, 2025 21:07
Creates clickable extmarks for document link ranges
@wroyca
wroyca / inactive_regions.lua
Last active May 12, 2026 16:52
Dims inactive code regions in C/C++ buffers as reported by Clangd's inactiveRegion
---@class InactiveRegionsModule
---@field config InactiveRegionsConfig
---@field ns integer Namespace ID for highlights
---@field _state InactiveRegionsState Internal state
local InactiveRegions = {}
---@class InactiveRegionsConfig
---@field opacity number Opacity level for inactive regions (0.0-1.0)
---@field namespace string? Custom namespace name
---@field debounce_ms integer Debounce delay for updates in milliseconds
@wroyca
wroyca / build2-ci-bindist-snapshot.yml
Last active May 13, 2025 17:10
Create snapshot release on GitHub when using build2 GitHub CI integration with bbot.bindist.upload.
name: snapshot
run-name: snapshot pre-release from build2 CI bindist
on:
# Trigger on completion of any check suite.
#
# This triggering mechanism enables the workflow to automatically detect when
# a potential new build might be available on the CI server. That is, we
# avoid having to periodically poll the CI server.
check_suite:
@wroyca
wroyca / dotemacs-mouse.el
Created May 7, 2025 17:49
Emacs overlay-based selection model
;;; dotemacs-mouse.el --- Persistent selections -*- lexical-binding: t -*-
;;; Commentary:
;;
;; Architectural Overview
;;
;; Overlay-Based Selection Model
;;
;; Represent selections using overlays instead of the point/mark pair:
;;
@wroyca
wroyca / which-key-prefix-descriptions.el
Created May 3, 2025 23:39 — forked from mmarshall540/which-key-prefix-descriptions.el
Missing Which-key Prefix descriptions
;; By default, Which-key doesn't give much help for prefix-keys. It
;; either shows the generic description, "+prefix", or the name of a
;; prefix-command, which usually isn't as descriptive as we'd like.
;;
;; Here are some descriptions for the default bindings in `global-map'
;; and `org-mode-map'.
(which-key-add-key-based-replacements
"<f1> 4" "help-other-win"
"<f1>" "help"