meh
This commit is contained in:
parent
02addc0aff
commit
dd3afe747e
|
@ -18,6 +18,7 @@ transient/
|
|||
var/
|
||||
eshell/*
|
||||
!eshell/aliases
|
||||
url/
|
||||
|
||||
# put random stuff in here
|
||||
scratch.el
|
||||
|
|
182
init.el
182
init.el
|
@ -45,8 +45,9 @@
|
|||
"C-c v" #'visible-mode
|
||||
"C-M-;" #'+lisp-comment-or-uncomment-sexp
|
||||
"M-j" nil
|
||||
"C-x o" (lambda () (interactive) (switch-to-buffer nil))
|
||||
"C-x C-o" #'+open-paragraph
|
||||
"C-x C-o" #'+switch-to-last-buffer
|
||||
"C-x o" #'+switch-to-last-buffer
|
||||
"C-x C-l" #'+open-paragraph ; original: downcase-region
|
||||
"C-w" #'+kill-word-backward-or-region
|
||||
"C-x C-m" #'execute-extended-command ; original: coding systems
|
||||
"C-<backspace>" #'+backward-kill-word
|
||||
|
@ -63,7 +64,7 @@
|
|||
;; Hooks
|
||||
(add-hook 'prog-mode-hook #'turn-on-auto-fill)
|
||||
(add-hook 'prog-mode-hook #'font-lock-todo-insinuate)
|
||||
(add-hook 'text-mode-hook #'turn-on-auto-fill)
|
||||
(add-hook 'text-mode-hook #'turn-on-auto-fill) ; XXX: do I want this ??
|
||||
(add-hook 'special-mode-hook #'turn-off-auto-fill)
|
||||
;; Advice
|
||||
(advice-add #'completing-read-multiple :filter-args #'+crm-indicator)
|
||||
|
@ -153,7 +154,7 @@
|
|||
save-abbrevs 'silent)
|
||||
(with-eval-after-load 'user-save
|
||||
(:with-mode edit-abbrevs-mode
|
||||
(:hook #'turn-off-user-save-mode)))
|
||||
(:hook #'user-save-mode-disable)))
|
||||
(:hook-into text-mode
|
||||
circe-chat-mode))
|
||||
|
||||
|
@ -293,7 +294,8 @@
|
|||
dired-dwim-target t)
|
||||
(:local-set truncate-lines t)
|
||||
(:bind "<backspace>" #'dired-up-directory
|
||||
"j" #'+dired-goto-file)
|
||||
"j" #'+dired-goto-file
|
||||
"C-j" #'dired-up-directory)
|
||||
(:hook #'dired-hide-details-mode
|
||||
#'hl-line-mode
|
||||
#'lin-mode
|
||||
|
@ -528,21 +530,33 @@
|
|||
(advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags)
|
||||
(:option notmuch-saved-searches (list
|
||||
(list :name "inbox"
|
||||
:query (+notmuch-query-concat "tag:inbox"
|
||||
"NOT tag:Spam")
|
||||
:query (+notmuch-query-concat
|
||||
"tag:inbox"
|
||||
"tag:unread"
|
||||
"NOT tag:Spam")
|
||||
:key "i")
|
||||
(list :name "lists"
|
||||
:query (+notmuch-query-concat "tag:/List/"
|
||||
"tag:unread")
|
||||
:query (+notmuch-query-concat
|
||||
"tag:/List/"
|
||||
"tag:unread")
|
||||
:key "l")
|
||||
(list :name "unread"
|
||||
:query (+notmuch-query-concat "tag:unread"
|
||||
"NOT tag:Spam")
|
||||
:query (+notmuch-query-concat
|
||||
"tag:unread"
|
||||
"NOT tag:Spam")
|
||||
:key "u")
|
||||
(list :name "flagged" :query "tag:flagged" :key "f")
|
||||
(list :name "sent" :query "tag:sent" :key "t")
|
||||
(list :name "drafts" :query "tag:draft" :key "d")
|
||||
(list :name "all mail" :query "*" :key "a"))))
|
||||
(list :name "flagged"
|
||||
:query "tag:flagged"
|
||||
:key "f")
|
||||
(list :name "sent"
|
||||
:query "tag:sent"
|
||||
:key "t")
|
||||
(list :name "drafts"
|
||||
:query "tag:draft"
|
||||
:key "d")
|
||||
(list :name "all mail"
|
||||
:query "*"
|
||||
:key "a"))))
|
||||
(:+leader "m" #'+notmuch-goto "C-m" #'+notmuch-goto
|
||||
"n" #'notmuch "C-n" #'notmuch)
|
||||
;; For `focus'
|
||||
|
@ -582,7 +596,7 @@
|
|||
org-confirm-babel-evaluate nil
|
||||
org-cycle-separator-lines 0
|
||||
org-directory (sync/ "org/" t)
|
||||
org-ellipsis truncate-string-ellipsis
|
||||
org-ellipsis (or truncate-string-ellipsis "…")
|
||||
org-fontify-done-headline t
|
||||
org-fontify-quote-and-verse-blocks t
|
||||
org-fontify-whole-heading-line t
|
||||
|
@ -614,7 +628,7 @@
|
|||
org-src-window-setup 'current-window
|
||||
org-startup-truncated nil
|
||||
org-startup-with-inline-images t
|
||||
org-tags-column 1 ;; (- (- fill-column (length org-ellipsis)))
|
||||
org-tags-column (- (- fill-column (length org-ellipsis)))
|
||||
org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "ONGOING(o@)"
|
||||
"|" "DONE(d!)")
|
||||
(sequence "|" "CANCELED(k@)")
|
||||
|
@ -672,7 +686,6 @@
|
|||
;; (let ((ch (string-to-char (car emph))))
|
||||
;; (cons ch ch)))
|
||||
;; org-emphasis-alist))
|
||||
;;+modeline-position-function #'+org-count-words-stupidly
|
||||
)
|
||||
(:local-hook user-save-hook #'+org-before-save@prettify-buffer)
|
||||
(advice-add #'org-delete-backward-char :override #'+org-delete-backward-char)
|
||||
|
@ -920,6 +933,11 @@
|
|||
(widen)
|
||||
(string-equal (buffer-substring 1 10) ";; Emacs:")))))))
|
||||
|
||||
(setup whitespace
|
||||
(:option whitespace-line-column nil
|
||||
whitespace-style '(face trailing tabs tab-mark))
|
||||
(:hook-into text-mode prog-mode))
|
||||
|
||||
(setup (:straight 0x0)
|
||||
(:option 0x0-default-server 'ttm)
|
||||
(with-eval-after-load 'embark
|
||||
|
@ -986,7 +1004,8 @@
|
|||
(:bind-into isearch
|
||||
"M-j" #'avy-isearch)
|
||||
(:when-loaded
|
||||
(setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)))
|
||||
(setf (alist-get ?. avy-dispatch-alist) #'avy-action-embark)
|
||||
(+avy-buffer-face-mode +1)))
|
||||
|
||||
(setup (:straight bbdb)
|
||||
(:straight bbdb-vcard)
|
||||
|
@ -1228,7 +1247,8 @@
|
|||
(:hook #'visual-line-mode
|
||||
#'enable-lui-track
|
||||
#'visual-fill-column-mode
|
||||
#'enable-lui-autopaste)
|
||||
#'enable-lui-autopaste
|
||||
)
|
||||
(:local-set fringes-outside-margins t
|
||||
right-margin-width (length lui-time-stamp-format)
|
||||
scroll-margin 0
|
||||
|
@ -1478,8 +1498,9 @@
|
|||
(setup (:straight edit-server)
|
||||
(:option edit-server-url-major-mode-alist `(("github\\.com" . ,(if (fboundp 'gfm-mode)
|
||||
#'gfm-mode
|
||||
#'markdown-mode))))
|
||||
(add-hook 'edit-server-done-hook (lambda () (unfill-region (point-min) (point-max))))
|
||||
#'markdown-mode))
|
||||
("reddit\\.com" . markdown-mode)
|
||||
("notabug\\.org" . markdown-mode)))
|
||||
(+with-ensure-after-init
|
||||
(edit-server-start)))
|
||||
|
||||
|
@ -1643,6 +1664,7 @@
|
|||
(setup (:straight (fill-sentences-correctly
|
||||
:host github
|
||||
:repo "duckwork/fill-sentences-correctly.el"))
|
||||
(:quit "I don't think this works like how I want.")
|
||||
(fill-sentences-correctly-mode +1))
|
||||
|
||||
(setup (:straight (filldent
|
||||
|
@ -2034,41 +2056,59 @@
|
|||
"Prog-mode major mode face.")
|
||||
(modus-themes-with-colors
|
||||
(custom-set-faces
|
||||
`(font-lock-builtin-face ((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-comment-delimiter-face ((,class :inherit font-lock-comment-face)))
|
||||
`(font-lock-comment-face ((,class :inherit variable-pitch
|
||||
:slant italic
|
||||
:foreground ,fg-docstring)))
|
||||
`(font-lock-constant-face ((,class :inherit underline
|
||||
:foreground unspecified)))
|
||||
`(font-lock-doc-face ((,class :inherit modus-themes-slant
|
||||
:foreground ,fg-docstring)))
|
||||
`(font-lock-function-name-face ((,class :foreground unspecified)))
|
||||
`(font-lock-keyword-face ((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-negation-char-face ((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-preprocessor-face ((,class :foreground unspecified)))
|
||||
`(font-lock-regexp-grouping-backslash ((,class :foreground ,fg-escape-char-backslash)))
|
||||
`(font-lock-regexp-grouping-construct ((,class :foreground ,fg-escape-char-construct)))
|
||||
`(font-lock-string-face ((,class :inherit modus-themes-slant
|
||||
:foreground unspecified)))
|
||||
`(font-lock-type-face ((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-variable-name-face ((,class :foreground unspecified)))
|
||||
`(font-lock-warning-face ((,class :inherit modus-themes-bold
|
||||
:foreground ,red-nuanced-fg)))
|
||||
`(font-lock-todo-face ((,class :inherit font-lock-comment-face
|
||||
:foreground ,fg-header
|
||||
:background ,yellow-intense-bg)))
|
||||
`(+modeline-text-mode-face ((,class :foreground ,blue
|
||||
:inherit modus-themes-bold)))
|
||||
`(+modeline-prog-mode-face ((,class :foreground ,magenta
|
||||
:inherit modus-themes-bold))))
|
||||
(:option +modeline-major-mode-faces `((text-mode . +modeline-text-mode-face)
|
||||
(prog-mode . +modeline-prog-mode-face)
|
||||
(t . bold))))))
|
||||
`(font-lock-builtin-face
|
||||
((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-comment-face
|
||||
((,class :inherit variable-pitch
|
||||
:foreground ,fg-comment-yellow)))
|
||||
`(font-lock-comment-delimiter-face
|
||||
((,class :inherit font-lock-comment-face)))
|
||||
`(font-lock-constant-face
|
||||
((,class :inherit underline
|
||||
:foreground unspecified)))
|
||||
`(font-lock-doc-face
|
||||
((,class :inherit modus-themes-slant
|
||||
:foreground ,fg-docstring)))
|
||||
`(font-lock-function-name-face
|
||||
((,class :foreground unspecified
|
||||
:slant italic)))
|
||||
`(font-lock-keyword-face
|
||||
((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-negation-char-face
|
||||
((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-preprocessor-face
|
||||
((,class :foreground unspecified)))
|
||||
`(font-lock-regexp-grouping-backslash
|
||||
((,class :foreground ,fg-escape-char-backslash)))
|
||||
`(font-lock-regexp-grouping-construct
|
||||
((,class :foreground ,fg-escape-char-construct)))
|
||||
`(font-lock-string-face
|
||||
((,class :foreground ,fg-special-warm)))
|
||||
`(font-lock-type-face
|
||||
((,class :inherit modus-themes-bold
|
||||
:foreground unspecified)))
|
||||
`(font-lock-variable-name-face
|
||||
((,class :foreground unspecified)))
|
||||
`(font-lock-warning-face
|
||||
((,class :inherit modus-themes-bold
|
||||
:foreground ,red-nuanced-fg)))
|
||||
`(font-lock-todo-face
|
||||
((,class :inherit font-lock-comment-face
|
||||
:foreground ,fg-header
|
||||
:background ,yellow-intense-bg)))
|
||||
`(+modeline-text-mode-face
|
||||
((,class :foreground ,blue
|
||||
:inherit modus-themes-bold)))
|
||||
`(+modeline-prog-mode-face
|
||||
((,class :foreground ,magenta
|
||||
:inherit modus-themes-bold))))
|
||||
(:option +modeline-major-mode-faces
|
||||
`((text-mode . +modeline-text-mode-face)
|
||||
(prog-mode . +modeline-prog-mode-face)
|
||||
(t . bold))))))
|
||||
|
||||
(require 'dawn)
|
||||
(dawn-schedule #'modus-themes-load-operandi
|
||||
|
@ -2235,10 +2275,22 @@
|
|||
(setup (:straight pdf-tools
|
||||
(or (executable-find "gcc")
|
||||
(executable-find "g++")))
|
||||
(:also-load +pdf-tools)
|
||||
(:with-mode pdf-view-mode
|
||||
(:local-set +modeline-position-function #'+pdf-view-position))
|
||||
(setf (alist-get "\\.pdf\\'" auto-mode-alist nil nil #'equal)
|
||||
#'pdf-view-mode)
|
||||
(pdf-tools-install :no-query))
|
||||
|
||||
(setup (:straight persistent-scratch)
|
||||
(:require)
|
||||
(:option persistent-scratch-save-file (sync/ "emacs/scratch")
|
||||
persistent-scratch-backup-directory (sync/ "emacs/scratch.d/" t)
|
||||
persistent-scratch-backup-file-name-format "%Y-%m-%dT%H:%M_%s")
|
||||
(persistent-scratch-autosave-mode +1)
|
||||
(+mapc-some-buffers (lambda () (persistent-scratch-mode +1))
|
||||
persistent-scratch-scratch-buffer-p-function))
|
||||
|
||||
(setup (:straight (plancat
|
||||
:host github
|
||||
:repo "duckwork/plancat.el"
|
||||
|
@ -2310,7 +2362,7 @@
|
|||
+modeline-narrowed
|
||||
+modeline-text-scale
|
||||
+modeline-input-method)
|
||||
",")
|
||||
" ")
|
||||
+modeline-major-mode
|
||||
+modeline-spacer)))
|
||||
(simple-modeline-mode +1))
|
||||
|
@ -2356,12 +2408,14 @@
|
|||
#'view-hello-file
|
||||
#'describe-gnu-project
|
||||
#'suspend-frame)
|
||||
(sophomore-disable-with 'confirm
|
||||
#'+save-buffers-quit
|
||||
#'save-buffers-kill-terminal)
|
||||
(sophomore-mode +1))
|
||||
|
||||
(setup (:straight (spongebob-case
|
||||
:host github
|
||||
:repo "duckwork/spongebob-case.el"))
|
||||
(define-key +casing-map (kbd "M-s") #'spongebob-case-dwim))
|
||||
:repo "duckwork/spongebob-case.el")))
|
||||
|
||||
(setup (:straight ssh-config-mode)
|
||||
(:file-match (rx "/.ssh/config" eos)
|
||||
|
@ -2388,10 +2442,12 @@
|
|||
:host github
|
||||
:repo "duckwork/titlecase.el"
|
||||
:files ("*")))
|
||||
(:require titlecase)
|
||||
(:require titlecase +titlecase)
|
||||
(:with-map +casing-map
|
||||
(:bind "t" #'titlecase-dwim
|
||||
"M-t" #'titlecase-dwim)))
|
||||
"M-t" #'titlecase-dwim
|
||||
"s" #'+titlecase-sentence-style-dwim
|
||||
"M-s" #'+titlecase-sentence-style-dwim)))
|
||||
|
||||
(setup (:straight topsy)
|
||||
(:hook-into ;;prog-mode
|
||||
|
@ -2448,6 +2504,8 @@
|
|||
:host github
|
||||
:repo "casouri/undo-hl"))
|
||||
(:require)
|
||||
(:face 'undo-hl-delete '((t :strikethrough t))
|
||||
'undo-hl-insert '((t :underline t)))
|
||||
(:hook-into text-mode prog-mode))
|
||||
|
||||
(setup (:straight unfill))
|
||||
|
|
60
lisp/+avy.el
60
lisp/+avy.el
|
@ -17,5 +17,65 @@
|
|||
(cdr (ring-ref avy-ring 0))))
|
||||
t)
|
||||
|
||||
|
||||
;;; Remove `buffer-face-mode' when avy is active.
|
||||
|
||||
(defcustom +avy-buffer-face-functions '(avy-goto-char
|
||||
avy-goto-char-in-line
|
||||
avy-goto-char-2
|
||||
avy-goto-char-2-above
|
||||
avy-goto-char-2-below
|
||||
avy-goto-word-0
|
||||
avy-goto-whitespace-end
|
||||
avy-goto-word-0-above
|
||||
avy-goto-word-0-below
|
||||
avy-goto-whitespace-end-above
|
||||
avy-goto-whitespace-end-below
|
||||
avy-goto-word-1
|
||||
avy-goto-word-1-above
|
||||
avy-goto-word-1-below
|
||||
avy-goto-symbol-1
|
||||
avy-goto-symbol-1-above
|
||||
avy-goto-symbol-1-below
|
||||
avy-goto-subword-0
|
||||
avy-goto-subword-1
|
||||
avy-goto-word-or-subword-1
|
||||
avy-goto-line
|
||||
avy-goto-line-above
|
||||
avy-goto-line-below
|
||||
avy-goto-end-of-line
|
||||
avy-goto-char-timer)
|
||||
"Functions to disable `buffer-face-mode' during.")
|
||||
|
||||
(defvar-local +avy-buffer-face-mode-face nil
|
||||
"The state of `buffer-face-mode' before calling `avy-with'.")
|
||||
|
||||
(defun +avy@un-buffer-face (&rest _)
|
||||
"BEFORE advice on `avy-with' to disable `buffer-face-mode'."
|
||||
(when buffer-face-mode
|
||||
(setq +avy-buffer-face-mode-face buffer-face-mode-face)
|
||||
(buffer-face-mode -1)))
|
||||
|
||||
(defun +avy@re-buffer-face (&rest _)
|
||||
"AFTER advice on `avy-with' to re-enable `buffer-face-mode'."
|
||||
(when +avy-buffer-face-mode-face
|
||||
(setq buffer-face-mode-face +avy-buffer-face-mode-face)
|
||||
(buffer-face-mode +1)))
|
||||
|
||||
(define-minor-mode +avy-buffer-face-local-mode
|
||||
"Turn off `buffer-face-mode' before doing Avy selections.
|
||||
Restore the mode after the selection."
|
||||
:lighter ""
|
||||
:global t
|
||||
(setq +avy-buffer-face-mode-face nil)
|
||||
(cond
|
||||
(+avy-buffer-face-mode
|
||||
(dolist (fn +avy-buffer-face-functions)
|
||||
(advice-add fn :before #'+avy@un-buffer-face))
|
||||
(advice-add 'avy--done :after #'+avy@re-buffer-face))
|
||||
(t (dolist (fn +avy-buffer-face-functions)
|
||||
(advice-remove fn #'+avy@un-buffer-face))
|
||||
(advice-remove 'avy--done #'+avy@re-buffer-face))))
|
||||
|
||||
(provide '+avy)
|
||||
;;; avy.el ends here
|
||||
|
|
|
@ -73,8 +73,6 @@ Do this only if the buffer is not visiting a file."
|
|||
(executable-find "gm")
|
||||
(executable-find "ffmpeg"))
|
||||
indent-tabs-mode nil
|
||||
indicate-buffer-boundaries 'left
|
||||
indicate-empty-lines nil
|
||||
inhibit-startup-screen t
|
||||
initial-buffer-choice t
|
||||
kept-new-versions 6
|
||||
|
@ -98,9 +96,11 @@ Do this only if the buffer is not visiting a file."
|
|||
native-comp-deferred-compilation nil
|
||||
read-answer-short t
|
||||
read-buffer-completion-ignore-case t
|
||||
;; read-extended-command-predicate (when (fboundp
|
||||
;; read-extended-command-predicate
|
||||
;; (when (fboundp
|
||||
;; 'command-completion-default-include-p)
|
||||
;; 'command-completion-default-include-p)
|
||||
read-process-output-max (+bytes 1 :mib) ; We’re in the future man. Set that to at least a megabyte
|
||||
recenter-positions '(top middle bottom)
|
||||
regexp-search-ring-max 100
|
||||
regexp-search-ring-max 200
|
||||
|
|
|
@ -393,9 +393,9 @@ to a function in the current buffer, call that function instead."
|
|||
;; adapted from https://github.com/seagle0128/doom-modeline
|
||||
(when (and (boundp 'text-scale-mode-amount)
|
||||
(/= text-scale-mode-amount 0))
|
||||
(format (if (> text-scale-mode-amount 0) "%s(%+d)" "%s(%-d)")
|
||||
(or spacer +modeline-default-spacer)
|
||||
text-scale-mode-amount)))
|
||||
(+modeline-spacer nil spacer
|
||||
(concat (if (> text-scale-mode-amount 0) "+" "-")
|
||||
(number-to-string text-scale-mode-amount)))))
|
||||
|
||||
(defun +modeline-ace-window-display (&optional spacer)
|
||||
"Display `ace-window-display-mode' information in the modeline."
|
||||
|
|
|
@ -26,7 +26,7 @@ format the list item as an Org link."
|
|||
"mailto")))
|
||||
(current-kill 0))
|
||||
(string-trim (current-kill 0))
|
||||
(read-string "URL: ")))
|
||||
(read-string "Resource URL: ")))
|
||||
(url-title (let ((clipboard-headings
|
||||
(+org-insert--get-title-and-headings clipboard-url)))
|
||||
(read-string "title (edit): "
|
||||
|
@ -34,8 +34,14 @@ format the list item as an Org link."
|
|||
"title: " clipboard-headings
|
||||
nil nil nil nil (car clipboard-headings))))))
|
||||
(list clipboard-url url-title)))
|
||||
(org-drawer-list-add +org-drawer-list-resources-drawer
|
||||
(org-link-make-string url title)))
|
||||
(let (current-visible-mode visible-mode)
|
||||
;; XXX: This is not the "proper" way to fix the issue I was having --- I've
|
||||
;; isolated the bug to somewhere in `org-insert-item', but this fix works
|
||||
;; well enough™ for now.
|
||||
(visible-mode +1)
|
||||
(org-drawer-list-add +org-drawer-list-resources-drawer
|
||||
(org-link-make-string url title))
|
||||
(visible-mode (if current-visible-mode +1 -1))))
|
||||
|
||||
(provide '+org-drawer-list)
|
||||
;;; +org-drawer-list.el ends here
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
(defcustom +org-wc-update-after-funcs '(org-narrow-to-subtree
|
||||
org-narrow-to-block
|
||||
org-narrow-to-element
|
||||
org-capture-narrow
|
||||
org-taskwise-narrow-to-task)
|
||||
org-capture-narrow)
|
||||
"Functions after which to update the word count."
|
||||
:type '(repeat function))
|
||||
|
||||
|
@ -32,6 +31,16 @@
|
|||
"Number of characters that constitute a \"huge\" insertion."
|
||||
:type 'number)
|
||||
|
||||
(defcustom +org-wc-huge-buffer 10000
|
||||
"Number of words past which we're not going to try to count."
|
||||
:type 'number)
|
||||
|
||||
(defvar +org-wc-correction -5
|
||||
"Number to add to `+org-wc-word-count', for some reason?
|
||||
`+org-wc-word-count' seems to consistently be off by 5. Thus
|
||||
this correction. (At some point I should correct the underlying
|
||||
code... probably).")
|
||||
|
||||
(defvar-local +org-wc-update-timer nil)
|
||||
|
||||
(defun +org-wc-delayed-update (&rest _)
|
||||
|
@ -48,7 +57,7 @@
|
|||
(+org-wc-update)
|
||||
(message "Counting words...done"))
|
||||
|
||||
(defun +org-wc-update ()
|
||||
(defun +org-wc-update (&rest _) ; Needs variadic parameters, since it's advice
|
||||
(dlet ((+org-wc-counting t))
|
||||
(+org-wc-buffer)
|
||||
(force-mode-line-update)
|
||||
|
@ -59,9 +68,14 @@
|
|||
|
||||
(defun +org-wc-buffer ()
|
||||
"Count the words in the buffer."
|
||||
(when (derived-mode-p 'org-mode)
|
||||
(when (and (derived-mode-p 'org-mode)
|
||||
(not (eq +org-wc-word-count 'huge)))
|
||||
(setq +org-wc-word-count
|
||||
(org-word-count-aux (point-min) (point-max)))))
|
||||
(cond
|
||||
((> (count-words (point-min) (point-max))
|
||||
+org-wc-huge-buffer)
|
||||
'huge)
|
||||
(t (org-word-count-aux (point-min) (point-max)))))))
|
||||
|
||||
(defvar +org-wc-counting nil
|
||||
"Are we currently counting?")
|
||||
|
@ -71,8 +85,9 @@
|
|||
(+org-wc-update)))
|
||||
|
||||
(defun +org-wc-modeline ()
|
||||
(when +org-wc-word-count
|
||||
(format " %sw" +org-wc-word-count)))
|
||||
(cond
|
||||
((eq +org-wc-word-count 'huge) "huge")
|
||||
(+org-wc-word-count (format " %sw" (max 0 (+ +org-wc-word-count +org-wc-correction))))))
|
||||
|
||||
(define-minor-mode +org-wc-mode
|
||||
"Count words in `org-mode' buffers in the mode-line."
|
||||
|
|
|
@ -669,7 +669,7 @@ and POST-PROCESS are passed to `org-export-to-file'."
|
|||
"Advice to run `org-mode-hook' when entering org-mode.
|
||||
This should only fire when switching to a buffer from `org-agenda'."
|
||||
(unless +org-hook-has-run-p
|
||||
(run-hooks 'org-mode-hook)
|
||||
(run-mode-hooks 'org-mode-hook)
|
||||
(setq +org-hook-has-run-p t)))
|
||||
|
||||
(define-minor-mode +org-agenda-inhibit-hooks-mode
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
;;; +pdf-tools.el --- Extras for the excellent pdf-tools' -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; XXX: The way I'm dispatching browsers here is /very/ down-and-dirty. It
|
||||
;; needs to be much improved.
|
||||
|
||||
(defun +pdf-view-open-all-pagelinks (&optional browse-url-func)
|
||||
"Open all the links on this page of a PDF.
|
||||
BROWSE-URL-FUNC overrides the default `browse-url'."
|
||||
(interactive)
|
||||
(let ((links (pdf-info-pagelinks (pdf-view-current-page)))
|
||||
(browse-url-func (or browse-url-func #'browse-url))
|
||||
(seen))
|
||||
(dolist (link links)
|
||||
(when-let* ((uri (alist-get 'uri link))
|
||||
(_ (not (member uri seen))))
|
||||
(push uri seen)
|
||||
(funcall browse-url-func uri)))))
|
||||
|
||||
(defun +pdf-view-open-links-in-chrome ()
|
||||
"Open all links on this PDF page in Chrome.
|
||||
See also `+pdf-view-open-all-pagelinks'."
|
||||
(interactive)
|
||||
(+pdf-view-open-all-pagelinks #'browse-url-chrome))
|
||||
|
||||
(defun +pdf-view-position (&optional spacer)
|
||||
"Return the page we're on for the modeline."
|
||||
(when (derived-mode-p 'pdf-view-mode)
|
||||
(format "%sp.%s/%s"
|
||||
(or spacer (bound-and-true-p +modeline-default-spacer) " ")
|
||||
(pdf-view-current-page)
|
||||
(pdf-info-number-of-pages))))
|
||||
|
||||
(provide '+pdf-tools)
|
||||
;;; +pdf-tools.el ends here
|
|
@ -35,18 +35,33 @@ For `kill-buffer-query-functions'."
|
|||
"ABANDON ALL HOPE YE WHO ENTER HERE"))))
|
||||
(concat (replace-regexp-in-string "^" ";; " s)
|
||||
"\n\n")))
|
||||
|
||||
|
||||
;; [[https://old.reddit.com/r/emacs/comments/ui1q41/weekly_tips_tricks_c_thread/i7ef4xg/][u/bhrgunatha]]
|
||||
(defun +scratch-text-scratch ()
|
||||
"Create a \"*text*\" scratch buffer in Text mode."
|
||||
(with-current-buffer (get-buffer-create "*text*")
|
||||
(text-mode)))
|
||||
|
||||
(defcustom +scratch-buffers '("*text*" "*scratch*")
|
||||
"Scratch buffers.")
|
||||
|
||||
(defvar +scratch-last-non-scratch-buffer nil
|
||||
"Last buffer that wasn't a scratch buffer.")
|
||||
|
||||
(defun +scratch-toggle (buffer)
|
||||
"Switch to BUFFER, or to the previous buffer."
|
||||
(switch-to-buffer (unless (eq (current-buffer)
|
||||
(get-buffer buffer))
|
||||
buffer)))
|
||||
"Switch to BUFFER, or to the previous (non-scratch) buffer."
|
||||
(if (or (null +scratch-last-non-scratch-buffer)
|
||||
(not (member (buffer-name (current-buffer)) +scratch-buffers)))
|
||||
;; Switch to a scratch buffer
|
||||
(progn
|
||||
(setq +scratch-last-non-scratch-buffer (current-buffer))
|
||||
(switch-to-buffer buffer))
|
||||
;; Switch away from scratch buffer ...
|
||||
(if (equal (get-buffer-create buffer) (current-buffer))
|
||||
;; to the original buffer
|
||||
(switch-to-buffer +scratch-last-non-scratch-buffer)
|
||||
;; to another scratch
|
||||
(switch-to-buffer buffer))))
|
||||
|
||||
(defun +scratch-switch-to-scratch ()
|
||||
"Switch to scratch buffer."
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
;;; +titlecase.el --- Titlecase extras -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defun +titlecase-sentence-style-dwim ()
|
||||
"Titlecase a sentence."
|
||||
(interactive)
|
||||
(titlecase-dwim 'sentence))
|
||||
|
||||
(defun +titlecase-org-headings ()
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
;; See also `org-map-tree'. I'm not using that function because I want to
|
||||
;; skip the first headline. A better solution would be to patch
|
||||
;; `titlecase-line' to ignore org-mode metadata (TODO cookies, tags, etc).
|
||||
(let ((level (funcall outline-level)))
|
||||
(while (and (progn (outline-next-heading)
|
||||
(> (funcall outline-level) level))
|
||||
(not (eobp)))
|
||||
(titlecase-line)))))
|
||||
|
||||
(provide '+titlecase)
|
||||
;;; +titlecase.el ends here
|
26
lisp/acdw.el
26
lisp/acdw.el
|
@ -282,7 +282,8 @@ always nil; this function is mostly intended for use in init."
|
|||
|
||||
(defcustom chat-functions '(+irc
|
||||
jabber-connect-all
|
||||
slack-start)
|
||||
;; slack-start
|
||||
)
|
||||
"Functions to start when calling `chat'."
|
||||
:type '(repeat function)
|
||||
:group 'applications)
|
||||
|
@ -292,16 +293,17 @@ always nil; this function is mostly intended for use in init."
|
|||
(interactive)
|
||||
(+with-progress "Quitting circe..."
|
||||
(ignore-errors
|
||||
(circe-command-GQUIT "☮ 🫀 🍞")
|
||||
(circe-command-GQUIT "peace love bread")
|
||||
(cancel-timer (irc-connection-get conn :flood-timer))))
|
||||
(+with-progress "Quitting jabber..."
|
||||
(ignore-errors
|
||||
(jabber-disconnect)))
|
||||
(+with-progress "Quitting-slack..."
|
||||
(dolist (team +slack-teams)
|
||||
(ignore-errors
|
||||
(slack-team-disconnect team)))
|
||||
(ignore-errors (slack-ws-close)))
|
||||
(when (boundp '+slack-teams)
|
||||
(+with-progress "Quitting-slack..."
|
||||
(dolist (team +slack-teams)
|
||||
(ignore-errors
|
||||
(slack-team-disconnect team)))
|
||||
(ignore-errors (slack-ws-close))))
|
||||
(+with-progress "Killing buffers..."
|
||||
(ignore-errors
|
||||
(+mapc-some-buffers (lambda () "Remove the buffer from tracking and kill it unconditionally."
|
||||
|
@ -496,6 +498,9 @@ sort order."
|
|||
(lambda ()
|
||||
(message "%S-second timer DONE!" secs)
|
||||
(setq +timer-string +timer-done-string)
|
||||
(let ((visible-bell t)
|
||||
(ring-bell-function nil))
|
||||
(ding))
|
||||
(ding))))))
|
||||
|
||||
(defun +timer-cancel ()
|
||||
|
@ -508,5 +513,12 @@ sort order."
|
|||
(message "Timer canceled.")))
|
||||
(setq +timer-string nil))
|
||||
|
||||
|
||||
|
||||
(defun +switch-to-last-buffer ()
|
||||
"Switch to the last-used buffer in this window."
|
||||
(interactive)
|
||||
(switch-to-buffer nil))
|
||||
|
||||
(provide 'acdw)
|
||||
;;; acdw.el ends here
|
||||
|
|
Loading…
Reference in New Issue