summaryrefslogtreecommitdiff
path: root/.config/emacs/init.el
blob: 762e5b185cea56225b0583696d7e0c430183ddd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
;; -*- lexical-binding: t; -*-


;; reduce the frequency of garbage collection by making it happen on
;; each 50MB of allocated data (the default is on every 0.76MB)
(setopt gc-cons-threshold 50000000)

(load (expand-file-name "$HOME/.config/emacs/bd-essential.el"))

(defun request-sudo ()
  "Uses TRAMP to edit currently opened file as root."
  (interactive)
  (when buffer-file-name
    (find-alternate-file
     (concat "/sudo:root@localhost:"
             buffer-file-name))))

(defun match-buffer-name (name)
  "Returns non-nil if NAME matches the name of an existing buffer"
  (try-completion name (mapcar #'buffer-name (buffer-list))))

(defun rip-video ()
  "If region, open SEARCH with mpv in --full-screen. Else,
open URL at point."
  (interactive)
  (let ((URL-OR-SEARCH
         (if (use-region-p)
             (buffer-substring (mark) (point))
           (shr-url-at-point nil))))
    (message "Ludu %s" URL-OR-SEARCH)
    (start-process-shell-command "rip-video" nil (concat "rip-video " URL-OR-SEARCH))))

(defun clamp (lower-bound upper-bound value)
  (max lower-bound (min value upper-bound)))

(load (expand-file-name "$HOME/.config/emacs/bd-org.el"))
(load (expand-file-name "$HOME/.config/emacs/bd-emms.el"))
(load (expand-file-name "$HOME/.config/emacs/bd-development.el"))

(use-package newsticker
  :demand t
  :bind (("C-z C-n" . newsticker-show-news)
         :map newsticker-treeview-item-mode-map
         ("C-j" . rip-video))
  :custom
  (newsticker-url-list-defaults nil)
  (newsticker-automatically-mark-items-as-old nil)
  (newsticker-url-list '(("Ambrose and Elsewhere" "https://jamesenge.com/engeblog/feed" nil nil nil)
                         ("James Enge Mastodon" "https://mastodon.sdf.org/@jamesenge.rss" nil nil nil)
                         ("Book Reviews | Tales From the Magician's Skull" "https://goodman-games.com/tftms/category/book-reviews/feed" nil nil nil)
                         ("Arch Linux: Recent news updates" "https://archlinux.org/feeds/news/" nil nil nil)
                         ("Parabola GNU/Linux-libre: Recent news updates" "https://www.parabola.nu/feeds/news/" nil nil nil)
                         ("suckless.org news" "https://suckless.org/atom.xml" nil nil nil)
                         ("Mental Outlaw" "https://vid.puffyan.us/feed/channel/UC7YOGHUfC1Tb6E4pudI9STA" nil nil nil)
                         ("Luke Smith" "https://vid.puffyan.us/feed/channel/UC2eYFnH61tmytImy1mTYvhA" nil nil nil)
                         ("Brent Westbrook" "https://yewtu.be/feed/channel/UC0PBefyEK7qQ7HN325nUamQ" nil nil nil)
                         ("Bugswriter" "https://yewtu.be/feed/channel/UCngn7SVujlvskHRvRKc1cTw" nil nil nil)
                         ("Protesilaos Stravrou" "https://yewtu.be/feed/playlist/PL8Bwba5vnQK14z96Gil86pLMDO2GnOhQ6" nil nil nil)))
  ;; may require ./newsticker/groups to be cleared
  (newsticker-groups '("Feeds"
                       ("READING" "Ambrose and Elsewhere" "James Enge Mastodon" "Book Reviews | Tales From the Magician's Skull")
                       ("TECH" ("GNU/Linux" "Arch Linux: Recent news updates" "Parabola GNU/Linux-libre: Recent news updates") "suckless.org news")
                       ("VIDEO" "Mental Outlaw" "Luke Smith" "Brent Westbrook" "Bugswriter" "Protesilaos Stravrou"))))

(setopt erc-server "irc.libera.chat"
	erc-nick "Isaz"
	erc-user-full-name "bd"
	erc-kill-buffer-on-part t
	erc-autojoin-channels-alist '(("irc.libera.char" "#parabola" "#emacs")))
(defalias 'erc 'erc-tls)

;; dired
(setopt dired-listing-switches "-alh")

(use-package vertico
  :init
  (vertico-mode)
  :custom
  (vertico-cycle t))

;; dired
(global-set-key (kbd "C-z d") 'dired-jump)

(load (expand-file-name "$HOME/.config/emacs/bd-wm.el"))
(load (expand-file-name "$HOME/.config/emacs/bd-mode-and-themes.el"))

(setopt gc-cons-threshold 800000)