aboutsummaryrefslogtreecommitdiff
path: root/config/emacs/emacs.d/emacs.org
diff options
context:
space:
mode:
authorKenny Ballou <kb@devnulllabs.io>2024-04-03 10:09:57 -0600
committerKenny Ballou <kb@devnulllabs.io>2024-04-03 10:10:31 -0600
commit34c823dc4369b16a6c2894070fba184acb598ab1 (patch)
tree5c16a6754c2f633b23ea559b4ee5476cfa3b23aa /config/emacs/emacs.d/emacs.org
parent60f513ccfb8354ca7503cad76887b0bf8526a606 (diff)
downloaddotfiles-34c823dc4369b16a6c2894070fba184acb598ab1.tar.gz
dotfiles-34c823dc4369b16a6c2894070fba184acb598ab1.tar.xz
config: emacs: use new advice-add
Remove usage of deprecated defadvice syntax. Signed-off-by: Kenny Ballou <kb@devnulllabs.io>
Diffstat (limited to 'config/emacs/emacs.d/emacs.org')
-rw-r--r--config/emacs/emacs.d/emacs.org21
1 files changed, 11 insertions, 10 deletions
diff --git a/config/emacs/emacs.d/emacs.org b/config/emacs/emacs.d/emacs.org
index 1ed49ad8..acb1f6d7 100644
--- a/config/emacs/emacs.d/emacs.org
+++ b/config/emacs/emacs.d/emacs.org
@@ -2150,30 +2150,30 @@ https://blog.jmthornton.net/p/emacs-project-override"
"The last buffer in which compilation took place.")
(with-eval-after-load 'compile
- (defadvice compilation-start (after sanityinc/save-compilation-buffer activate)
+ (defun sanityinc/save-compilation-buffer (&rest _)
"Save the compilation buffer to find it later."
(setq sanityinc/last-compilation-buffer next-error-last-buffer))
+ (advice-add 'compilation-start :after #'sanityinc/save-compilation-buffer)
- (defadvice recompile (around sanityinc/find-prev-compilation (&optional edit-command) activate)
+ (defun sanityinc/find-prev-compilation (orig &optional edit-command)
"Find the previous compilation buffer, if present, and recompile there."
(if (and (null edit-command)
(not (derived-mode-p 'compilation-mode))
sanityinc/last-compilation-buffer
(buffer-live-p (get-buffer sanityinc/last-compilation-buffer)))
(with-current-buffer sanityinc/last-compilation-buffer
- ad-do-it)
- ad-do-it)))
+ (funcall orig edit-command))
+ (funcall orig edit-command)))
+ (advice-add 'recompile :around #'sanityinc/find-prev-compilation))
(global-set-key [f6] 'recompile)
-(defadvice shell-command-on-region
- (after sanityinc/shell-command-in-view-mode
- (start end command &optional output-buffer &rest other-args)
- activate)
+(defun sanityinc/shell-command-in-view-mode (start end command &optional output-buffer replace &rest other-args)
"Put \"*Shell Command Output*\" buffers into view-mode."
- (unless output-buffer
+ (unless (or output-buffer replace)
(with-current-buffer "*Shell Command Output*"
(view-mode 1))))
+(advice-add 'shell-command-on-region :after #'sanityinc/shell-command-in-view-mode)
(with-eval-after-load 'compile
(require 'ansi-color)
@@ -2331,13 +2331,14 @@ https://blog.jmthornton.net/p/emacs-project-override"
;; advice
;; https://github.com/Fuco1/.emacs.d/blob/master/site-lisp/my-advices.el
;; from simple.el
-(defadvice kill-line (before kill-line-autoreindent activate)
+(defun kill-line-autoreindent (&rest _)
"Kill excess whitespace when joining lines.
If the next line is joined to the current line, kill the extra indent whitespace in front of the next line."
(when (and (eolp) (not (bolp)))
(save-excursion
(forward-char 1)
(just-one-space 1))))
+(advice-add 'kill-line :before #'kill-line-autoreindent)
#+end_src
**** Hide Async shell command output