org-roam-up-heading-or-point-min: fix case where there is no heading

This commit is contained in:
Jethro Kuan
2021-03-25 03:01:38 +08:00
parent e19c3d6273
commit 47c3b024d7

View File

@ -63,14 +63,14 @@
(defun org-roam-up-heading-or-point-min () (defun org-roam-up-heading-or-point-min ()
"Fixed version of Org's `org-up-heading-or-point-min'." "Fixed version of Org's `org-up-heading-or-point-min'."
(when (ignore-errors (org-back-to-heading t)) (ignore-errors (org-back-to-heading t))
(let ((p (point))) (let ((p (point)))
(if (< 1 (funcall outline-level)) (if (< 1 (funcall outline-level))
(progn (progn
(org-up-heading-safe) (org-up-heading-safe)
(when (= (point) p) (when (= (point) p)
(goto-char (point-min)))) (goto-char (point-min))))
(unless (= (point) (point-min)) (goto-char (point-min))))))) (unless (bobp) (goto-char (point-min))))))
(defun org-roam-message (format-string &rest args) (defun org-roam-message (format-string &rest args)
"Pass FORMAT-STRING and ARGS to `message' when `org-roam-verbose' is t." "Pass FORMAT-STRING and ARGS to `message' when `org-roam-verbose' is t."