summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-01-10 23:43:28 -0500
committerKyle Meyer <kyle@kyleam.com>2016-01-12 22:16:24 -0500
commit6986e295b461b726d513c5e192cfe039c1f7f24e (patch)
tree21609368b605dfa9bd5dd3b9763be73cd660375d
parent8d97d1f2063f19c0c679e54fc082691a495c9303 (diff)
downloademacs.d-6986e295b461b726d513c5e192cfe039c1f7f24e.tar.gz
Replace defadvice with advise-add
-rw-r--r--init.el39
1 files changed, 21 insertions, 18 deletions
diff --git a/init.el b/init.el
index 5fb4bdb..4f7a45d 100644
--- a/init.el
+++ b/init.el
@@ -134,8 +134,10 @@
(emacs-lisp . t)
(latex . t)))
- (defadvice org-open-file (after km/org-open-add-to-recentf activate)
- (recentf-add-file path))
+ (advice-add
+ 'org-open-file :after
+ (lambda (path &rest _) (recentf-add-file path))
+ '((name . "recentf-add")))
(put 'org-goto-max-level 'safe-local-variable #'integerp)
@@ -874,10 +876,10 @@
(magit-change-popup-key 'magit-branch-popup :action
?s ?v)
- (defadvice magit-merge-editmsg (around km/magit-merge-editmsg-no-ff activate)
- "Set '--no-ff' flag when running `magit-merge-editmsg'."
- (let ((args '("--no-ff")))
- ad-do-it)))
+ (advice-add
+ 'magit-merge-editmsg :around
+ (lambda (f rev &rest _) (funcall f rev "--no-ff"))
+ '((name . "no-ff"))))
(use-package km-magit
:defer t
@@ -1299,18 +1301,19 @@
("c" . compile)
("g" . recompile))
:config
- (defadvice compile (around prevent-duplicate-compilation-windows activate)
- "Pop to compilation buffer only if it isn't visible.
-This is useful for using multiple frames (e.g., with a two
-monitor setup)."
- (if (get-buffer-window (km/compilation-name-by-directory)
- 'visible)
- (save-window-excursion ad-do-it)
- ad-do-it))
-
- (defadvice recompile (around prevent-window-on-compilation activate)
- "Prevent recompiling from spawning new windows."
- (save-window-excursion ad-do-it)))
+ (advice-add
+ 'compile :around
+ (lambda (f &rest args)
+ (if (get-buffer-window (km/compilation-name-by-directory)
+ 'visible)
+ (save-window-excursion (apply f args))
+ (apply f args)))
+ '((name . "prevent-duplicate-window")))
+
+ (advice-add
+ 'recompile :around
+ (lambda (f &rest args) (save-window-excursion (apply f args)))
+ '((name . "prevent-window"))))
(use-package km-compile
:after compile