Changes and shit

This commit is contained in:
Case Duckworth 2021-12-19 22:11:39 -06:00
parent 1d7690e977
commit cf0ae4b20c
3 changed files with 68 additions and 22 deletions

43
init.el
View File

@ -106,10 +106,10 @@
"gitlab.com"
"google.com"
"imgur.com"
"pixelfed"
"reddit.com"
"pixelfed" "instagram.com" "bibliogram.art"
"reddit.com" "teddit.net"
"taskiq"
"twitter.com" "nitter.com"
"twitter.com" "nitter.net"
))
browse-url-secondary-browser-function)
(cons "." ; everything else
@ -117,7 +117,16 @@
;; Transform URLs before passing to `browse-url'
(:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
"youtu.be"))
. "//yewtu.be")))
. "//yewtu.be")
("twitter\\.com"
. "nitter.net")
("instagram\\.com"
. "bibilogram.art")
(,(rx (or "reddit.com"
"old.reddit.com"))
. "teddit.net")
("medium\\.com"
. "scribe.rip")))
(+browse-url-transform-url-global-mode +1))
(setup calendar
@ -257,10 +266,8 @@
[remap query-replace-regexp] 'anzu-query-replace-regexp)
(global-anzu-mode +1)
(:bind-into isearch
[remap isearch-query-replace]
'anzu-isearch-query-replace
[remap isearch-query-replace-regexp]
'anzu-isearch-query-replace-regexp))
[remap isearch-query-replace] 'anzu-isearch-query-replace
[remap isearch-query-replace-regexp] 'anzu-isearch-query-replace-regexp))
(setup (:straight avy)
(:also-load +avy)
@ -374,7 +381,11 @@
visual-fill-column-extra-text-width
(cons +circe-left-margin 0)))
(add-hook 'modus-themes-after-load-theme-hook 'circe-nick-color-reset)
(with-eval-after-load 'topsy
(:option (append topsy-mode-functions)
'(circe-channel-mode . +circe-current-topic)))
(add-hook 'circadian-after-load-theme-hook 'circe-nick-color-reset)
(add-hook 'kill-emacs-hook '+circe-quit-all@kill-emacs))
(setup (:straight consult)
@ -460,7 +471,6 @@
(setup (:straight crux)
(:+key "C-o" 'crux-smart-open-line
"M-o" 'crux-other-window-or-switch-buffer
"C-x 4 t" 'crux-transpose-windows)
(el-patch-feature crux)
@ -508,9 +518,6 @@ See also `crux-reopen-as-root-mode'."
(setup (:straight electric-cursor)
(electric-cursor-mode +1))
(setup (:straight electric-cursor)
(electric-cursor-mode +1))
(setup (:straight elfeed)
(:also-load +elfeed)
(:option elfeed-use-curl t
@ -586,6 +593,9 @@ See also `crux-reopen-as-root-mode'."
(:option hungry-delete-chars-to-skip " \t"
hungry-delete-join-reluctantly nil)
(:bind-into paredit
;; I define these functions here because they really require both packages
;; to make any sense. So, would I put them in `+hungry-delete' or
;; `+paredit' ? There's no satisfactory answer.
[remap paredit-backward-delete]
(defun acdw/paredit-hungry-delete-backward (arg)
(interactive "P")
@ -810,13 +820,6 @@ See also `crux-reopen-as-root-mode'."
(setup (:straight smartscan)
(smartscan-mode +1))
(setup (:straight (sophomore
:host github
:repo "duckwork/sophomore.el"))
(:option disabled-command-function 'sophomore-dispatch
sophomore-dispatch-alist '((fatfinger . sophomore-fat-finger)))
(put 'save-buffers-kill-terminal 'disabled 'fatfinger))
(setup (:straight ssh-config-mode)
(:file-match (rx "/.ssh/config" eos)
(rx "/ssh" (? "d") "_config" eos))

View File

@ -48,7 +48,21 @@
(defun +circe-current-topic (&optional message)
"Return the topic of the current channel.
When called with optional MESSAGE non-nil, or interactively, also
message the current topic.")
message the current topic."
(interactive "p")
(let ((topic
(save-excursion
(goto-char (point-max))
(or (re-search-backward
(rx (group "*** "
(or "Topic" "topic" "TOPIC")
(* (not ":")) ": ")
(group (+ nonl)))))
(buffer-substring-no-properties
(match-beginning 2) (match-end 2)))))
(when message
(message "%s" topic))
topic))
;;; Formatting messages

View File

@ -120,7 +120,8 @@ Do this only if the buffer is not visiting a file."
(when (version< emacs-version "28")
(fset 'yes-or-no-p 'y-or-n-p))
;; Encoding -- UTF-8 everywhere
;;; Encodings
(setq-default locale-coding-system 'utf-8-unix
coding-system-for-read 'utf-8-unix
coding-system-for-write 'utf-8-unix
@ -174,8 +175,36 @@ Do this only if the buffer is not visiting a file."
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
(add-hook 'minibuffer-setup-hook 'cursor-intangible-mode)
;;; Better-default functions
(defun +cycle-spacing (&optional n preserve-nl-back mode)
"Negate N argument on `cycle-spacing'.
That is, with a positive N, deletes newlines as well, leaving -N
spaces. If N is negative, it will not delete newlines and leave
N spaces. See docstring of `cycle-spacing' for the meaning of
PRESERVE-NL-BACK and MODE."
(interactive "*p")
(cycle-spacing (- n) preserve-nl-back mode))
(defun +save-buffers-quit (&optional arg)
"Silently save each buffer, then kill the current connection.
If the current frame has no client, kill Emacs itself using
`save-buffers-kill-emacs' after confirming with the user.
With prefix ARG, silently save all file-visiting buffers, then
kill without asking."
(interactive "P")
(save-some-buffers t)
(if (and (not (frame-parameter nil 'client))
(and (not arg)))
(when (yes-or-no-p "Sure you want to quit? ")
(save-buffers-kill-emacs))
(server-save-buffers-kill-terminal nil)))
;;; Bindings
(global-set-key (kbd "C-x C-c") '+save-buffers-quit)
(global-set-key (kbd "M-SPC") '+cycle-spacing)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "M-=") 'count-words)
(global-set-key (kbd "C-x C-b") 'ibuffer)