nixos/pkgsets/emacs/transmission.nix
derped ad76922338
Move pkgsets folder into project root to conform with option naming.
Add simple package filter to auto remove broken packages.
2020-03-27 13:41:24 +01:00

47 lines
1.6 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
mkIf (elem "emacs::transmission" config.machine.pkgs) {
programs.emacs.init.usePackage = {
transmission = {
enable = true;
defer = true;
command = [ "transmission" ];
bindLocal = {
transmission-mode-map = {
"A" = ''(lambda ()
(interactive)
(transmission-add (read-string "Magnet URI: ")))'';
};
};
config = ''
;; Auto refresh for all transmission buffers
(setq transmission-refresh-modes '(transmission-mode
transmission-files-mode
transmission-info-mode
transmission-peers-mode))
(defun transmission ()
"Open a `transmission-mode' buffer."
(interactive)
(let* ((name "*transmission*")
(buffer (or (get-buffer name)
(generate-new-buffer name))))
(transmission-turtle-poll)
(unless (eq buffer (current-buffer))
(with-current-buffer buffer
(unless (eq major-mode 'transmission-mode)
(condition-case e
(progn
(transmission-mode)
(transmission-draw)
(goto-char (point-min)))
(error
(kill-buffer buffer)
(signal (car e) (cdr e))))))
(switch-to-buffer buffer))))
'';
};
};
}