summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-04-13 10:16:19 -0500
committerCase Duckworth2022-04-13 10:16:19 -0500
commitd26bfd92e129887fd3cf088db33a0ad0bbd8d300 (patch)
tree7ae4556b097608d883909bf5786da720f9a0a80f
parentConfigure org-mode ... some more (diff)
parentDang ol +shr.el file (diff)
downloademacs-d26bfd92e129887fd3cf088db33a0ad0bbd8d300.tar.gz
emacs-d26bfd92e129887fd3cf088db33a0ad0bbd8d300.zip
Merge branch 'main' of tildegit.org:acdw/emacs
-rw-r--r--init.el32
-rw-r--r--lisp/+ispell.el3
-rw-r--r--lisp/+shr.el51
3 files changed, 75 insertions, 11 deletions
diff --git a/init.el b/init.el index d1e663a..a69081f 100644 --- a/init.el +++ b/init.el
@@ -22,6 +22,7 @@
22 (require (or (car-safe feature) feature) (cdr-safe feature) :noerror))) 22 (require (or (car-safe feature) feature) (cdr-safe feature) :noerror)))
23 23
24(setup (:require +casing) 24(setup (:require +casing)
25 (:global "M-u" #'universal-argument)
25 (+casing-mode +1)) 26 (+casing-mode +1))
26 27
27(setup (:require +emacs) 28(setup (:require +emacs)
@@ -444,6 +445,8 @@
444 445
445(setup ispell 446(setup ispell
446 (:also-load +ispell) 447 (:also-load +ispell)
448 (:option ispell-program-name (or (executable-find "ispell")
449 (executable-find "aspell")))
447 (put 'ispell-buffer-session-localwords 450 (put 'ispell-buffer-session-localwords
448 'safe-local-variable #'+ispell-safe-local-p) 451 'safe-local-variable #'+ispell-safe-local-p)
449 (add-hook 'user-save-hook #'+ispell-move-buffer-words-to-dir-locals-hook)) 452 (add-hook 'user-save-hook #'+ispell-move-buffer-words-to-dir-locals-hook))
@@ -614,7 +617,8 @@
614 "`" #'+org-insert-tilde 617 "`" #'+org-insert-tilde
615 "~" #'+org-insert-backtick) 618 "~" #'+org-insert-backtick)
616 (:global [f8] #'org-clock-in 619 (:global [f8] #'org-clock-in
617 [f9] #'org-clock-out) 620 [f9] #'org-clock-out
621 "C-c l" #'org-store-link)
618 (:hook #'variable-pitch-mode 622 (:hook #'variable-pitch-mode
619 #'turn-off-auto-fill 623 #'turn-off-auto-fill
620 #'org-indent-mode) 624 #'org-indent-mode)
@@ -782,8 +786,12 @@
782 (add-hook 'kill-buffer-query-functions #'+scratch-immortal)) 786 (add-hook 'kill-buffer-query-functions #'+scratch-immortal))
783 787
784(setup shr 788(setup shr
789 (:also-load +shr)
785 (:option shr-width (- fill-column 5) ; pad out for wide letters 790 (:option shr-width (- fill-column 5) ; pad out for wide letters
786 shr-use-fonts t)) 791 shr-use-fonts t)
792 (dolist (mode '(eww-mode
793 elfeed-show-mode))
794 (add-hook (intern (format "%s-hook" mode)) #'+shr-heading-setup-imenu)))
787 795
788(setup tab-bar 796(setup tab-bar
789 (:require +tab-bar) 797 (:require +tab-bar)
@@ -2166,6 +2174,7 @@ See also `crux-reopen-as-root-mode'."
2166 (:option trashed-action-confirmer #'y-or-n-p)) 2174 (:option trashed-action-confirmer #'y-or-n-p))
2167 2175
2168(setup (:straight undo-fu) 2176(setup (:straight undo-fu)
2177 (:option undo-fu-allow-undo-in-region t)
2169 (:global "C-/" #'undo-fu-only-undo 2178 (:global "C-/" #'undo-fu-only-undo
2170 "C-?" #'undo-fu-only-redo)) 2179 "C-?" #'undo-fu-only-redo))
2171 2180
@@ -2173,9 +2182,19 @@ See also `crux-reopen-as-root-mode'."
2173 (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'" 2182 (:option undo-fu-session-incompatible-files '("/COMMIT_EDITMSG\\'"
2174 "/git-rebase-todo\\'") 2183 "/git-rebase-todo\\'")
2175 undo-fu-session-directory (.etc "undo/" t) 2184 undo-fu-session-directory (.etc "undo/" t)
2176 undo-fu-session-compression (executable-find "gzip")) 2185 undo-fu-session-compression (cond
2186 ((executable-find "gzip") 'gz)
2187 ((executable-find "bzip2") 'bz2)
2188 ((executable-find "xz") 'xz)
2189 (t nil)))
2177 (global-undo-fu-session-mode +1)) 2190 (global-undo-fu-session-mode +1))
2178 2191
2192(setup (:straight (undo-hl
2193 :host github
2194 :repo "casouri/undo-hl"))
2195 (:require)
2196 (:hook-into text-mode prog-mode))
2197
2179(setup (:straight unfill)) 2198(setup (:straight unfill))
2180 2199
2181(setup (:straight valign) 2200(setup (:straight valign)
@@ -2250,13 +2269,6 @@ See also `crux-reopen-as-root-mode'."
2250;; (advice-add 'counsel-yank-pop-action :around 2269;; (advice-add 'counsel-yank-pop-action :around
2251;; #'+vterm-counsel-yank-pop-action)) 2270;; #'+vterm-counsel-yank-pop-action))
2252 2271
2253(setup (:straight-when w3m
2254 (executable-find "w3m"))
2255 ;; (+with-ensure-after-init
2256 ;; (:option browse-url-browser-function #'w3m-browse-url
2257 ;; +browse-url-browser-function browse-url-browser-function))
2258 )
2259
2260(setup (:straight web-mode) 2272(setup (:straight web-mode)
2261 (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php" 2273 (setf (alist-get (rx "." (or "htm" "html" "phtml" "tpl.php"
2262 "asp" "gsp" "jsp" "ascx" "aspx" 2274 "asp" "gsp" "jsp" "ascx" "aspx"
diff --git a/lisp/+ispell.el b/lisp/+ispell.el index 697233f..fbfc0f0 100644 --- a/lisp/+ispell.el +++ b/lisp/+ispell.el
@@ -4,7 +4,8 @@
4 4
5;;; Code: 5;;; Code:
6 6
7(require 'cl) 7(require 'cl-lib)
8(require 'seq)
8 9
9;; Utility function TODO: move elsewhere 10;; Utility function TODO: move elsewhere
10(defun +ispell-append-removing-duplicates (&rest lists) 11(defun +ispell-append-removing-duplicates (&rest lists)
diff --git a/lisp/+shr.el b/lisp/+shr.el new file mode 100644 index 0000000..af4bf5b --- /dev/null +++ b/lisp/+shr.el
@@ -0,0 +1,51 @@
1;;; +shr.el --- SHR extras -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;; Code:
6
7;;; [[https://github.com/oantolin/emacs-config/blob/master/my-lisp/shr-heading.el][shr-heading]], by oantolin
8
9(defun +shr-heading-next (&optional arg)
10 "Move forward by ARG headings (any h1-h4).
11If ARG is negative move backwards, ARG defaults to 1."
12 (interactive "p")
13 (unless arg (setq arg 1))
14 (catch 'return
15 (dotimes (_ (abs arg))
16 (when (> arg 0) (end-of-line))
17 (if-let ((match
18 (funcall (if (> arg 0)
19 #'text-property-search-forward
20 #'text-property-search-backward)
21 'face '(shr-h1 shr-h2 shr-h3 shr-h4)
22 (lambda (tags face)
23 (cl-loop for x in (if (consp face) face (list face))
24 thereis (memq x tags))))))
25 (goto-char
26 (if (> arg 0) (prop-match-beginning match) (prop-match-end match)))
27 (throw 'return nil))
28 (when (< arg 0) (beginning-of-line)))
29 (beginning-of-line)
30 (point)))
31
32(defun +shr-heading-previous (&optional arg)
33 "Move backward by ARG headings (any h1-h4).
34If ARG is negative move forwards instead, ARG defaults to 1."
35 (interactive "p")
36 (+shr-heading-next (- (or arg 1))))
37
38(defun +shr-heading--line-at-point ()
39 "Return the current line."
40 (buffer-substring (line-beginning-position) (line-end-position)))
41
42(defun +shr-heading-setup-imenu ()
43 "Setup imenu for h1-h4 headings in eww buffer.
44Add this function to appropriate major mode hooks such as
45`eww-mode-hook' or `elfeed-show-mode-hook'."
46 (setq-local
47 imenu-prev-index-position-function #'+shr-heading-previous
48 imenu-extract-index-name-function #'+shr-heading--line-at-point))
49
50(provide '+shr)
51;;; +shr.el ends here