                        (setq file (help-C-file-name (indirect-function fun) 'fun)))
                      (let ((location
                             (find-function-search-for-symbol fun nil file)))
-                       (switch-to-buffer-other-window (car location))
+                       (doom/popup-save
+                        (switch-to-buffer (car location)))
                        (if (cdr location)
                            (goto-char (cdr location))
                          (message "Unable to find location in file"))))


(after! help-mode
  ;; So that help buffer links do not open in the help popup, we need to redefine these
  ;; three button types to use `switch-to-buffer-other-window' rather than
  ;; `pop-to-buffer'. Instead of lambas these help-functions should be function symbols,
  ;; so that we could advise those instead of clumsify redefine these button types.
  (define-button-type 'help-function-def
    :supertype 'help-xref
    'help-function (lambda (fun file)

                     (when (eq file 'C-source)
                       (setq file (help-C-file-name var 'var)))
                     (let ((location (find-variable-noselect var file)))
                       (doom/popup-save
                        (switch-to-buffer (car location)))
                       (if (cdr location)
                           (goto-char (cdr location))
                         (message "Unable to find location in file"))))
