emacs: Add transmission mode.
This commit is contained in:
parent
6987397142
commit
bf80718916
2 changed files with 50 additions and 0 deletions
|
@ -30,9 +30,12 @@ with lib;
|
||||||
# "emacs::powerline"
|
# "emacs::powerline"
|
||||||
"emacs::nix-mode"
|
"emacs::nix-mode"
|
||||||
"emacs::magit"
|
"emacs::magit"
|
||||||
|
"emacs::mu4e"
|
||||||
"emacs::org"
|
"emacs::org"
|
||||||
"emacs::elpy"
|
"emacs::elpy"
|
||||||
|
"emacs::transmission"
|
||||||
# "emacs::rust"
|
# "emacs::rust"
|
||||||
|
# "emacs::lsp"
|
||||||
"extra"
|
"extra"
|
||||||
"cpp"
|
"cpp"
|
||||||
"haskell"
|
"haskell"
|
||||||
|
|
47
pkgs/pkgsets/emacs/transmission.nix
Normal file
47
pkgs/pkgsets/emacs/transmission.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{ 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))))
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue