about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-29 19:47:54 -0500
committerCase Duckworth2021-04-29 19:47:54 -0500
commit07d3f8a3ee5205b188c80c22c5e2b86a013b9267 (patch)
tree124b3a2f9d84def15a85c8ced26723f523006777
parentChange upgrade-packages-and-restart to emacs-upgrade (diff)
downloademacs-07d3f8a3ee5205b188c80c22c5e2b86a013b9267.tar.gz
emacs-07d3f8a3ee5205b188c80c22c5e2b86a013b9267.zip
Change some `defun'+`advice-add' to `define-advice'
-rw-r--r--init.el29
1 files changed, 12 insertions, 17 deletions
diff --git a/init.el b/init.el index eb7964e..8b9a086 100644 --- a/init.el +++ b/init.el
@@ -237,11 +237,9 @@
237 (:hook-into emacs-lisp-mode)) 237 (:hook-into emacs-lisp-mode))
238 238
239 ;; Add advice to pulse evaluated regions 239 ;; Add advice to pulse evaluated regions
240 (defun acdw/elisp-eval-region-advice (fn start end &rest args) 240 (define-advice eval-region (:around (fn start end &rest args) pulse-region)
241 (pulse-momentary-highlight-region start end) 241 (pulse-momentary-highlight-region start end)
242 (apply fn start end args)) 242 (apply fn start end args)))
243
244 (advice-add 'eval-region :around #'acdw/elisp-eval-region-advice))
245 243
246(setup encoding 244(setup encoding
247 (:option locale-coding-system 'utf-8-unix 245 (:option locale-coding-system 'utf-8-unix
@@ -380,12 +378,11 @@
380 ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'. 378 ;; `acdw/kill-line-and-join-advice' cribs from `crux-kill-and-join-forward'.
381 ;; I can't simply advise `kill-line' with an override from crux because crux 379 ;; I can't simply advise `kill-line' with an override from crux because crux
382 ;; itself calls `kill-line', leading to a infinite nesting situation. 380 ;; itself calls `kill-line', leading to a infinite nesting situation.
383 (advice-add 'kill-line :around 381 (define-advice kill-line (:around (fn &rest args) join-killed-line)
384 (defun acdw/kill-line-and-join-advice (orig &rest args) 382 (if (and (eolp)
385 "If at end of line, join with following; otherwise kill line." 383 (not (bolp)))
386 (if (and (eolp) (not (bolp))) 384 (delete-indentation 1)
387 (delete-indentation 1) 385 (apply fn args))))
388 (apply orig args)))))
389 386
390(setup minibuffer 387(setup minibuffer
391 (:option minibuffer-prompt-properties 388 (:option minibuffer-prompt-properties
@@ -742,13 +739,11 @@ if ripgrep is installed, otherwise `consult-grep'."
742 (autoload 'elpher-go "elpher" nil t) 739 (autoload 'elpher-go "elpher" nil t)
743 740
744 ;; Make `eww' gemini/gopher aware. From Emacswiki. 741 ;; Make `eww' gemini/gopher aware. From Emacswiki.
745 (advice-add 'eww-browse-url :around 742 (define-advice eww-browse-url (:around (fn url &rest args) gemini-elpher)
746 (defun elpher:eww-browse-url (original url &optional new-window) 743 (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url)
747 "Handle gemini and gopher links." 744 (require 'elpher)
748 (cond ((string-match-p "\\`\\(gemini\\|gopher\\)://" url) 745 (elpher-go url))
749 (require 'elpher) 746 (t (apply fn url args))))
750 (elpher-go url))
751 (t (funcall original url new-window)))))
752 747
753 (:when-loaded 748 (:when-loaded
754 (setup (:straight (gemini-write 749 (setup (:straight (gemini-write