mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
prevent update when no backlinks
This commit is contained in:
33
org-roam.el
33
org-roam.el
@ -170,22 +170,23 @@ Valid states are 'visible, 'exists and 'none."
|
|||||||
(defun org-roam-update (file)
|
(defun org-roam-update (file)
|
||||||
"Show the backlinks for given org file `FILE'."
|
"Show the backlinks for given org file `FILE'."
|
||||||
(unless (string= org-roam-current-file file)
|
(unless (string= org-roam-current-file file)
|
||||||
(let ((backlinks (gethash file org-roam-hash-backlinks)))
|
(when org-roam-hash-backlinks
|
||||||
(with-current-buffer org-roam-buffer
|
(let ((backlinks (gethash file org-roam-hash-backlinks)))
|
||||||
(read-only-mode -1)
|
(with-current-buffer org-roam-buffer
|
||||||
(erase-buffer)
|
(read-only-mode -1)
|
||||||
(org-mode)
|
(erase-buffer)
|
||||||
(make-local-variable 'org-return-follows-link)
|
(org-mode)
|
||||||
(setq org-return-follows-link t)
|
(make-local-variable 'org-return-follows-link)
|
||||||
(insert (format "Backlinks for %s:\n\n" file))
|
(setq org-return-follows-link t)
|
||||||
(when backlinks
|
(insert (format "Backlinks for %s:\n\n" file))
|
||||||
(maphash (lambda (link contents)
|
(when backlinks
|
||||||
(insert (format "* [[file:%s][%s]]\n" (expand-file-name link org-roam-directory) link))
|
(maphash (lambda (link contents)
|
||||||
(dolist (content contents)
|
(insert (format "* [[file:%s][%s]]\n" (expand-file-name link org-roam-directory) link))
|
||||||
(insert (format "\n\n%s\n\n" content))))
|
(dolist (content contents)
|
||||||
backlinks))
|
(insert (format "\n\n%s\n\n" content))))
|
||||||
(read-only-mode +1))))
|
backlinks))
|
||||||
(setq org-roam-current-file file))
|
(read-only-mode +1)))
|
||||||
|
(setq org-roam-current-file file))))
|
||||||
|
|
||||||
(defun org-roam ()
|
(defun org-roam ()
|
||||||
"Initialize `org-roam'.
|
"Initialize `org-roam'.
|
||||||
|
Reference in New Issue
Block a user