Skip to content

Latest commit

 

History

History
293 lines (218 loc) · 8.17 KB

wal-bridge.org

File metadata and controls

293 lines (218 loc) · 8.17 KB

Bridge

This is a collection of my own packages that are sourced from GitHub[fn:1].

Header

;;; wal-bridge.el --- Integration of my own packages. -*- lexical-binding: t -*-

;;; Commentary:
;;
;; Set up my own packages.

;;; Code:

(eval-when-compile
  (require 'wal-useful nil t))

(declare-function junk-setup-use-package "ext:junk.el")
(declare-function whale-line-mode "ext:whale-line.el")
(declare-function wal-insert "wal-useful.el")
(declare-function partial-recall-mode "ext:partial-recall.el")

(defvar marginalia-annotator-registry)
(defvar marginalia-command-categories)
(defvar whale-line-animation-key-frames)

(defgroup wal-bridge nil
  "Change settings for bridge packages."
  :group 'wal
  :tag "Bridge")

Packages

harpoon

This is a use-package-like macro to define a function that hooks into and sets up bindings, completion, modes, ligatures, LSP, indentation and any custom things for major modes.

Extensive usage of this package can be seen in Languages. Also have a look at the repository for more info.

(use-package harpoon
  :demand t
  :wal-ways t

  :custom
  (harpoon-bind-key (wal-key-combo-for-leader 'major))
  (harpoon-bind-name-suffix "-major")
  (harpoon-whitespace 'delete)

  (harpoon-lsp-completion-styles '(orderless partial-completion basic)))

partial-recall

Enhances tab-bar-mode to create short-term-memory workspaces.

Significant buffers opened in a tab belong to that tab. Management like (permanently) adding and removing such buffers is based on their usage over time (continually re-visiting, keeping it visible during a split, keeping it focused for a while).

The package provides a consult buffer source that is inserted and used by default when switching buffers. The various buffer-related commands are annotated with marginalia and the command map is bound in ambassador.

See the repository for more information.

(use-package partial-recall
  :defer 1

  :config
  (partial-recall-mode)
  (partial-recall-concentration-mode)
  (partial-recall-plasticity-of-memory-mode)
  (partial-recall-plasticity-of-moment-mode)

  (that-key "partial-recall" :user-key "M-u")

  (with-eval-after-load 'consult
    (wal-insert
     'consult-buffer-sources
     'consult--source-buffer
     'partial-recall-x-consult-buffer-source
     :quiet t))

  :wal-bind
  (("u" . partial-recall-switch-to-buffer))

  :wal-bind-keymap
  ("M-u" . partial-recall-command-map))

whale-line

My own “fancy” mode line. It has segments for all default mode-line constructs as well as segments for vc, project, tab-bar-mode, multiple-cursors, org, minions, lsp-mode and dap-mode.

Which segments are shown is based on window selection state and priority considerations (say if there isn’t enough space to display all segments).

See the repository for more info.

(use-package whale-line
  :defer 1
  :after wal-config

  :config
  (setq mode-line-position-column-line-format '(" %l:%c"))

  (whale-line-mode 1)
  (whale-line-iconify-mode 1)

  :custom
  (whale-line-segments-animation-key-frames wal-config-animation--blue-whale-key-frames)

  :defines (whale-line-segments-animation-key-frames)

  :functions (whale-line-iconify-mode))

junk

Provides a macro to define package groups and optional packages for that group. You can use junk-install (bound in whaler) to install such packages. It uses marginalia to provide annotations that indicate which packages are already installed.

See the repository for more information.

(use-package junk
  :config
  (junk-setup-use-package)

  (with-eval-after-load 'marginalia
    (add-to-list 'marginalia-annotator-registry '(expansion-pack junk-annotate builtin none))
    (add-to-list 'marginalia-command-categories '(junk-install . expansion-pack))))

bydi

Provides macros to mock and spy on functions as well as watch variables in ert tests. This package is generally not needed unless you want to run tests interactively.

See the repository for more information and usage or check out the various tests using the macro.

(use-package bydi)

parallel

Provides two macros.

One to compose two commands into one while retaining their consumption of prefix arguments. When calling the composition, the first command is executed unless it is called with a numeric prefix argument. The first command always uses the normal C-u, the second C-<number>.

The other inverts conditional functions.

See the repository for more information.

(use-package parallel
  :wal-ways t

  :custom
  (parallel-custom-namespace "wal-"))

ship-mate

Provides macros to create project-scoped compilation commands.

The package configuration defines ship-mate-{build,install,clean,execute,test} commands. Each of these commands have their own per-project history that can be pre-filled through defaults and dir-local variables. The commands are provided through a prefix map bound to C-c p.

These command as well as project-compile and recompile are advised to be bounded to project files. This means that running them will not prompt to save unsaved files outside of the project.

(use-package ship-mate
  :wal-ways t

  :demand t

  :config
  (ship-mate-mode)
  (ship-mate-dinghy-global-mode)
  (ship-mate-edit-setup-bindings)
  (ship-mate-submarine-mode)

    ;; Create common commands.
  (ship-mate-create-command build :default "make")
  (ship-mate-create-command install :default "make install")
  (ship-mate-create-command clean :default "make clean")
  (ship-mate-create-command execute :prompt t)
  (ship-mate-create-command test :default '("make test" "make coverage"))

  (wdb-faraway "\\*ship-mate")

  (that-key "ship-mate" :user-key "M-p")

  :wal-bind
  (("p" . ship-mate-rerun-command))

  :wal-bind-keymap
  ("M-p" . ship-mate-command-map))

Footer

(defvar harpoon--stumps nil)
(defvar junk--stumps nil)
(defvar parallel--stumps nil)

;; Guard against missing macros.
(unless (featurep 'harpoon)
  (defmacro harpoon (name &rest _args)
    "Push message that mode NAME would have been skewered."
    `(push ',name harpoon--stumps)))

(unless (featurep 'junk)
  (defmacro junk-expand (name &rest _args)
    "Push message that mode NAME would create junk."
    `(push ',name junk--stumps)))

(unless (featurep 'parallel)
  (defmacro parallel (a b)
    "Push message that A and B would have been parallelized."
    `(push ',(intern (concat (symbol-name a) (symbol-name b))) parallel--stumps))

  (defmacro parallel-mirror (a &rest _r)
    "Push message that A would have been mirrored."
    `(push ',(intern (concat (symbol-name a) "-mirror")) parallel--stumps)))

(provide 'wal-bridge)

;;; wal-bridge.el ends here

Footnotes

[fn:1] Using package-vc-install, see Packages.