(fix): widen before title extraction (#1232)

Prevent renaming file and changing links incorrectly due to using (org-narrow-to-subtree) and saving.
This commit is contained in:
Herbert Jones
2020-11-03 23:34:40 -06:00
committed by GitHub
parent 7c83a84db3
commit bc5c41d212
2 changed files with 14 additions and 12 deletions

View File

@ -14,6 +14,7 @@
- [#1199](https://github.com/org-roam/org-roam/issues/1199) make Org-roam link insertions respect `org-roam-link-title-format` everywhere. - [#1199](https://github.com/org-roam/org-roam/issues/1199) make Org-roam link insertions respect `org-roam-link-title-format` everywhere.
- [#1201](https://github.com/org-roam/org-roam/issues/1201) fix `org-roam-db-build-cache` failing in scenarios involving duplicate IDs and deleted files. - [#1201](https://github.com/org-roam/org-roam/issues/1201) fix `org-roam-db-build-cache` failing in scenarios involving duplicate IDs and deleted files.
- [#1226](https://github.com/org-roam/org-roam/issues/1226) only update relative path of file links - [#1226](https://github.com/org-roam/org-roam/issues/1226) only update relative path of file links
- [#1232](https://github.com/org-roam/org-roam/issues/1232) fix incorrect title extractions from narrowed buffers
## 1.2.2 (06-10-2020) ## 1.2.2 (06-10-2020)

View File

@ -669,18 +669,19 @@ Reads from the \"roam_alias\" property."
(defun org-roam--extract-titles (&optional sources nested) (defun org-roam--extract-titles (&optional sources nested)
"Extract the titles from current buffer using SOURCES. "Extract the titles from current buffer using SOURCES.
If NESTED, return the first successful result from SOURCES." If NESTED, return the first successful result from SOURCES."
(let (coll res) (org-with-wide-buffer
(cl-dolist (source (or sources (let (coll res)
org-roam-title-sources)) (cl-dolist (source (or sources
(setq res (if (symbolp source) org-roam-title-sources))
(funcall (intern (concat "org-roam--extract-titles-" (symbol-name source)))) (setq res (if (symbolp source)
(org-roam--extract-titles source t))) (funcall (intern (concat "org-roam--extract-titles-" (symbol-name source))))
(when res (org-roam--extract-titles source t)))
(if (not nested) (when res
(setq coll (nconc coll res)) (if (not nested)
(setq coll res) (setq coll (nconc coll res))
(cl-return)))) (setq coll res)
coll)) (cl-return))))
coll)))
(defun org-roam--extract-tags-all-directories (file) (defun org-roam--extract-tags-all-directories (file)
"Extract tags from using the directory path FILE. "Extract tags from using the directory path FILE.