From 3e3f35a67d477e892f8a9e785a2448ed5a56300e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 5 Jun 2020 03:20:51 -0400 Subject: [PATCH] Only recenter following a file or internal org link Rather than browser or external links. --- modules/lang/org/config.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 215ba857d..b51e773a9 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -497,11 +497,13 @@ the exported output (i.e. formatters)." ;; to be performant. (setq-hook! 'org-mode-hook gcmh-high-cons-threshold (* 2 gcmh-high-cons-threshold)) - (add-hook! 'org-follow-link-hook - (defun +org-delayed-recenter-h () - "`recenter', but after a tiny delay. Necessary to prevent certain race -conditions where a window's buffer hasn't changed at the time this hook is run." - (run-at-time 0.1 nil #'recenter))) + (defadvice! +org--recenter-after-follow-link-a (&rest _args) + "Recenter after following a link, but only internal or file links." + :after '(org-footnote-action + org-follow-timestamp-link + org-link-open-as-file + org-link-search) + (recenter)) (defadvice! +org--strip-properties-from-outline-a (orig-fn path &optional width prefix separator) "Remove link syntax and fix variable height text (e.g. org headings) in the