Gah, so many changes
This commit is contained in:
parent
04a90b906c
commit
9360a54e62
62
init.el
62
init.el
|
@ -115,6 +115,7 @@
|
|||
(:global "C-c C-r" #'reading-mode))
|
||||
|
||||
(setup (:require user-save)
|
||||
(add-hook 'user-save-hook #'+clean-empty-lines)
|
||||
(user-save-mode +1))
|
||||
|
||||
(setup +key
|
||||
|
@ -176,9 +177,9 @@
|
|||
browse-url-secondary-browser-function)
|
||||
args)))
|
||||
(cons (+browse-url-secondary-browser-regexps-combine) ; non-text websites
|
||||
browse-url-secondary-browser-function)
|
||||
browse-url-secondary-browser-function)
|
||||
(cons "." ; everything else
|
||||
+browse-url-browser-function)))
|
||||
+browse-url-browser-function)))
|
||||
;; Transform URLs before passing to `browse-url'
|
||||
(:option +browse-url-transformations `((,(rx "//" (or "youtube.com"
|
||||
"youtu.be"))
|
||||
|
@ -463,9 +464,14 @@
|
|||
"<S-return>" #'+org-table-copy-down
|
||||
"C-c C-l" #'+org-insert-link-dwim
|
||||
"C-c C-n" #'+org-next-heading-widen
|
||||
"C-c C-p" #'+org-previous-heading-widen)
|
||||
"C-c C-p" #'+org-previous-heading-widen
|
||||
"C-c C-o" #'+org-open-at-point-dwim)
|
||||
(:local-hook user-save-hook #'+org-before-save@prettify-buffer)
|
||||
(advice-add #'org-delete-backward-char :override #'+org-delete-backward-char)
|
||||
;; (define-advice org-open-at-point (:around (fn &rest r) open-external)
|
||||
;; "Open links from org externally."
|
||||
;; (let ((browse-url-browser-function browse-url-secondary-browser-function))
|
||||
;; (apply fn r)))
|
||||
(with-eval-after-load 'org
|
||||
(org-clock-persistence-insinuate)
|
||||
(org-link-set-parameters "tel" :follow #'+org-tel-open))
|
||||
|
@ -504,15 +510,18 @@
|
|||
(+org-capture-templates-setf "tt"
|
||||
`("Today!" entry (file "todo.org")
|
||||
,(concat "* TODO %^{Title}\n"
|
||||
"DEADLINE: %t\n"
|
||||
"\n%?")))
|
||||
"DEADLINE: %t\n"
|
||||
"\n%?")))
|
||||
(+org-capture-templates-setf "ts"
|
||||
`("Someday..." entry (file "todo.org")
|
||||
,(concat "* TODO %^{Title}\n"
|
||||
":PROPERTIES:\n"
|
||||
":CREATED: [%<%F %T>]\n"
|
||||
":END:\n"
|
||||
"\n%?")))
|
||||
":PROPERTIES:\n"
|
||||
":CREATED: [%<%F %T>]\n"
|
||||
":END:\n"
|
||||
"\n%?")))
|
||||
(+org-capture-templates-setf "l"
|
||||
`("Link" entry (file "links.org")
|
||||
"* %(+org-insert-link-dwim) %^g\n\n"))
|
||||
(+org-capture-sort))
|
||||
|
||||
(setup org-contacts
|
||||
|
@ -533,6 +542,10 @@
|
|||
";; ABANDON ALL HOPE YE WHO ENTER HERE\n\n")
|
||||
(add-hook 'kill-buffer-query-functions #'+scratch-immortal))
|
||||
|
||||
(setup shr
|
||||
(:option shr-width (- fill-column 5) ; pad out for wide letters
|
||||
shr-use-fonts t))
|
||||
|
||||
(setup text
|
||||
(:hook #'turn-on-auto-fill))
|
||||
|
||||
|
@ -544,7 +557,8 @@
|
|||
(setup (:straight ace-window)
|
||||
(:require +ace-window)
|
||||
(:option aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
||||
aw-display-mode-overlay nil)
|
||||
aw-display-mode-overlay nil
|
||||
aw-scope 'frame)
|
||||
(:+key "M-o" #'+ace-window-or-switch-buffer)
|
||||
(:face aw-mode-line-face ((t (:foreground "red"))))
|
||||
(+ace-window-display-mode +1))
|
||||
|
@ -914,13 +928,19 @@ See also `crux-reopen-as-root-mode'."
|
|||
(:bind "SPC" #'+elfeed-scroll-up-command
|
||||
"S-SPC" #'+elfeed-scroll-down-command)
|
||||
(:hook #'reading-mode)
|
||||
(define-advice elfeed-show-entry (:after (&rest _))
|
||||
"Re-flow the entry a short time after showing it."
|
||||
(run-at-time 0.1 nil #'elfeed-show-refresh))))
|
||||
;; (define-advice elfeed-show-entry (:after (&rest _))
|
||||
;; "Re-flow the entry a short time after showing it."
|
||||
;; (run-at-time 0.1 nil #'elfeed-show-refresh))
|
||||
))
|
||||
|
||||
(setup (:straight elfeed-org)
|
||||
(:also-load +org-capture)
|
||||
(:option rmh-elfeed-org-files (list (elfeed/ "elfeed.org" t)))
|
||||
(elfeed-org))
|
||||
(elfeed-org)
|
||||
(+org-capture-templates-setf "f"
|
||||
`("Feed" entry
|
||||
(file+olp ,(car rmh-elfeed-org-files) "Feeds")
|
||||
"* %? %^g")))
|
||||
|
||||
(setup (:straight elpher))
|
||||
|
||||
|
@ -990,7 +1010,7 @@ See also `crux-reopen-as-root-mode'."
|
|||
(:+key "M-q" #'filldent-dwim))
|
||||
|
||||
(setup (:straight flyspell-correct)
|
||||
(:+also-load +flyspell-correct )
|
||||
(:also-load +flyspell-correct)
|
||||
(:option flyspell-correct--cr-key ";")
|
||||
(:bind-into flyspell
|
||||
"C-;" #'flyspell-correct-wrapper
|
||||
|
@ -1041,11 +1061,12 @@ See also `crux-reopen-as-root-mode'."
|
|||
|
||||
(setup (:straight god-mode)
|
||||
(setq god-mode-enable-function-key-translation nil)
|
||||
(:also-load +god-mode)
|
||||
(:+key "C-M-g" #'god-local-mode)
|
||||
(:require god-mode
|
||||
+god-mode)
|
||||
(:+key "C-M-g" #'god-mode-all)
|
||||
(:with-mode god-local-mode
|
||||
(:bind "i" #'+god-mode-insert
|
||||
"a" #'+god-mode-append)))
|
||||
"a" nil)))
|
||||
|
||||
(setup (:straight helpful)
|
||||
(run-with-idle-timer 0.5 nil
|
||||
|
@ -1260,6 +1281,7 @@ See also `crux-reopen-as-root-mode'."
|
|||
(setup (:straight (sophomore
|
||||
:host github
|
||||
:repo "duckwork/sophomore.el"))
|
||||
(sophomore-enable #'narrow-to-region)
|
||||
(sophomore-disable #'view-hello-file)
|
||||
(sophomore-mode +1))
|
||||
|
||||
|
@ -1288,8 +1310,8 @@ See also `crux-reopen-as-root-mode'."
|
|||
(:bind "t" #'titlecase-dwim)))
|
||||
|
||||
(setup (:straight topsy)
|
||||
(:hook-into prog-mode
|
||||
circe-chat-mode)
|
||||
(:hook-into ;;prog-mode
|
||||
circe-chat-mode)
|
||||
(:when-loaded
|
||||
(:option
|
||||
topsy-header-line-format
|
||||
|
|
|
@ -37,41 +37,43 @@ are sorted lexigraphically."
|
|||
nil
|
||||
;; Sort function
|
||||
(lambda (s1 s2)
|
||||
(let ((s1 (cdr s1)) (s2 (cdr s2)))
|
||||
(cond
|
||||
(let ((s1 (cdr s1)) (s2 (cdr s2)))
|
||||
(cond
|
||||
;; Sort everything /not/ `setup' /before/ `setup'
|
||||
((and (+init--sexp-setup-p s1)
|
||||
(not (+init--sexp-setup-p s2)))
|
||||
(not (+init--sexp-setup-p s2)))
|
||||
nil)
|
||||
((and (+init--sexp-setup-p s2)
|
||||
(not (+init--sexp-setup-p s1)))
|
||||
(not (+init--sexp-setup-p s1)))
|
||||
t)
|
||||
;; otherwise...
|
||||
(t (let ((s1-straight (+init--sexp-setup-p s1 :straight))
|
||||
(s2-straight (+init--sexp-setup-p s2 :straight))
|
||||
(s1-require (+init--sexp-setup-p s1 :require))
|
||||
(s2-require (+init--sexp-setup-p s2 :require)))
|
||||
(cond
|
||||
;; `:straight' setups have extra processing
|
||||
((and s1-straight s2-straight)
|
||||
(let* ((r (rx (: ":straight" (? "-when") (* space) (? "("))))
|
||||
(s1 (replace-regexp-in-string r "" s1))
|
||||
(s2 (replace-regexp-in-string r "" s2)))
|
||||
(cond
|
||||
;; `:straight' setups have extra processing
|
||||
((and s1-straight s2-straight)
|
||||
(let* ((r (rx (: ":straight" (? "-when") (* space) (? "("))))
|
||||
(s1 (replace-regexp-in-string r "" s1))
|
||||
(s2 (replace-regexp-in-string r "" s2)))
|
||||
(string< s1 s2)))
|
||||
;; `:require' setups go first
|
||||
((and s1-require (not s2-require)) t)
|
||||
((and s2-require (not s1-require)) nil)
|
||||
;; `:straight' setups go last
|
||||
((and s1-straight (not s2-straight)) nil)
|
||||
((and s2-straight (not s1-straight)) t)
|
||||
;; otherwise, sort lexigraphically
|
||||
(t (string< s1 s2))))))))))))
|
||||
;; `:require' setups go first
|
||||
((and s1-require (not s2-require)) t)
|
||||
((and s2-require (not s1-require)) nil)
|
||||
;; `:straight' setups go last
|
||||
((and s1-straight (not s2-straight)) nil)
|
||||
((and s2-straight (not s1-straight)) t)
|
||||
;; otherwise, sort lexigraphically
|
||||
(t (string< s1 s2))))))))))))
|
||||
|
||||
(defun +init-sort-then-save ()
|
||||
"Sort init.el, then save it."
|
||||
(interactive)
|
||||
(+init-sort)
|
||||
(save-buffer))
|
||||
(if (fboundp #'user-save-buffer)
|
||||
(user-save-buffer)
|
||||
(save-buffer)))
|
||||
|
||||
;;; Add `setup' forms to `imenu-generic-expression'
|
||||
|
||||
|
@ -79,11 +81,11 @@ are sorted lexigraphically."
|
|||
"Recognize `setup' forms in `imenu'."
|
||||
;; `imenu-generic-expression' automatically becomes buffer-local when set
|
||||
(setf (alist-get "Setup" imenu-generic-expression nil nil 'string-equal)
|
||||
(list
|
||||
(rx (: bol (* space)
|
||||
"(setup" (+ space)
|
||||
(group (? "(") (* nonl))))
|
||||
1)))
|
||||
(list
|
||||
(rx (: bol (* space)
|
||||
"(setup" (+ space)
|
||||
(group (? "(") (* nonl))))
|
||||
1)))
|
||||
|
||||
;;; Major mode
|
||||
|
||||
|
|
74
lisp/+org.el
74
lisp/+org.el
|
@ -253,9 +253,9 @@ instead of the true count."
|
|||
|
||||
;;; org-insert-link-dwim - https://xenodium.com/emacs-dwim-do-what-i-mean/
|
||||
|
||||
(defun +org-insert-link-dwim ()
|
||||
(defun +org-insert-link-dwim (&optional interactivep)
|
||||
"Like `org-insert-link' but with personal dwim preferences."
|
||||
(interactive)
|
||||
(interactive '(t))
|
||||
(let* ((point-in-link (org-in-regexp org-link-any-re 1))
|
||||
(clipboard-url (when (string-match-p
|
||||
(rx (sequence bos
|
||||
|
@ -266,25 +266,30 @@ instead of the true count."
|
|||
(current-kill 0)))
|
||||
(region-content (when (region-active-p)
|
||||
(buffer-substring-no-properties (region-beginning)
|
||||
(region-end)))))
|
||||
(cond ((and region-content clipboard-url (not point-in-link))
|
||||
(delete-region (region-beginning) (region-end))
|
||||
(insert (org-link-make-string clipboard-url region-content)))
|
||||
((and clipboard-url (not point-in-link))
|
||||
(insert (org-link-make-string
|
||||
clipboard-url
|
||||
(read-string "title: "
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
clipboard-url)
|
||||
(dom-text
|
||||
(car
|
||||
(dom-by-tag (libxml-parse-html-region
|
||||
(point-min)
|
||||
(point-max))
|
||||
'title))))))))
|
||||
(t
|
||||
(call-interactively 'org-insert-link)))))
|
||||
(region-end))))
|
||||
(org-link (when clipboard-url
|
||||
(org-link-make-string
|
||||
clipboard-url
|
||||
(or region-content
|
||||
(read-string "title: "
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
clipboard-url)
|
||||
(dom-text
|
||||
(car
|
||||
(dom-by-tag (libxml-parse-html-region
|
||||
(point-min)
|
||||
(point-max))
|
||||
'title))))))))))
|
||||
(if interactivep
|
||||
(cond ((and region-content clipboard-url (not point-in-link))
|
||||
(delete-region (region-beginning) (region-end))
|
||||
(insert org-link))
|
||||
((and clipboard-url (not point-in-link))
|
||||
(insert org-link))
|
||||
(t
|
||||
(call-interactively 'org-insert-link)))
|
||||
org-link)))
|
||||
|
||||
;;; Navigate headings with widening
|
||||
|
||||
|
@ -409,5 +414,32 @@ the deletion might narrow the column."
|
|||
(dotimes (_ fill-column)
|
||||
(insert "-")))
|
||||
|
||||
;; Follow links, DWIM style
|
||||
|
||||
(defun +org-open-at-point-dwim (&optional arg)
|
||||
"Open thing at point, or if there isn't something, list things."
|
||||
(interactive "P")
|
||||
(save-excursion
|
||||
(let* ((this-char-type (org-element-type (org-element-context)))
|
||||
(prev-char-type (save-excursion
|
||||
(backward-char)
|
||||
(org-element-type (org-element-context))))
|
||||
(types '(citation citation-reference clock comment comment-block
|
||||
footnote-definition footnote-reference headline
|
||||
inline-src-block inlinetask keyword link
|
||||
node-property planning src-block timestamp))
|
||||
(type this-char-type))
|
||||
(when (and (memq this-char-type types) (memq prev-char-type types))
|
||||
(backward-char)
|
||||
(setq type prev-char-type)) ; what the fuckckckckck
|
||||
(if (memq type types)
|
||||
(progn (org-open-at-point arg))
|
||||
(while (not
|
||||
(progn
|
||||
(org-back-to-heading)
|
||||
(car (org-offer-links-in-entry (current-buffer) (point) 1))))
|
||||
(org-up-heading-all 1))
|
||||
(org-open-at-point arg)))))
|
||||
|
||||
(provide '+org)
|
||||
;;; +org.el ends here
|
||||
|
|
19
lisp/acdw.el
19
lisp/acdw.el
|
@ -143,7 +143,7 @@ within a `with-current-buffer' form."
|
|||
(let ((pred (or predicate t)))
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(when (funcall pred buf)
|
||||
(when (if (fboundp pred) (funcall pred buf) pred)
|
||||
(funcall func))))))
|
||||
|
||||
;; https://github.com/cstby/emacs.d/blob/main/init.el#L67
|
||||
|
@ -176,14 +176,15 @@ surrounded by empty lines, so opening a paragraph means to make
|
|||
three blank lines, then place the point on the second one."
|
||||
(interactive "*")
|
||||
(unless (derived-mode-p 'special-mode 'lui-mode 'comint-mode)
|
||||
;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because
|
||||
;; that's weird with org, and I'm guessing other modes too.
|
||||
(while (not (looking-at "^$"))
|
||||
(forward-line 1))
|
||||
(newline)
|
||||
(delete-blank-lines)
|
||||
(newline 2)
|
||||
(previous-line)))
|
||||
;; Go to next blank line. This /isn't/ `end-of-paragraph-text' because
|
||||
;; that's weird with org, and I'm guessing other modes too.
|
||||
(while (and (not (looking-at "^$"))
|
||||
(< (point) (point-max)))
|
||||
(forward-line 1))
|
||||
(newline)
|
||||
(delete-blank-lines)
|
||||
(newline 2)
|
||||
(previous-line)))
|
||||
|
||||
(defun +split-window-then (&optional where arg)
|
||||
"Split the window into a new buffer.
|
||||
|
|
Loading…
Reference in New Issue