mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(fix): set-global-prop: prefer lowercase (#1352)
Prefer lower-case version of Org properties. Fixed bug where adding/deleting props will alter the original case of the Org property. Addresses #1342
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
- [#1270](https://github.com/org-roam/org-roam/pull/1270) capture: create OLP if it does not exist. Removes need for OLP setup in `:head`.
|
- [#1270](https://github.com/org-roam/org-roam/pull/1270) capture: create OLP if it does not exist. Removes need for OLP setup in `:head`.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- [#1352](https://github.com/org-roam/org-roam/pull/1352) prefer lower-case for roam_tag and roam_alias in interactive commands
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- [#1281](https://github.com/org-roam/org-roam/pull/1281) fixed idle-timer not instantiated on `org-roam-mode`
|
- [#1281](https://github.com/org-roam/org-roam/pull/1281) fixed idle-timer not instantiated on `org-roam-mode`
|
||||||
@ -13,6 +14,7 @@
|
|||||||
- [#1327](https://github.com/org-roam/org-roam/pull/1327) preserve existing link description during automatic replacement
|
- [#1327](https://github.com/org-roam/org-roam/pull/1327) preserve existing link description during automatic replacement
|
||||||
- [#1346](https://github.com/org-roam/org-roam/pull/1346) prevent malformed path to `org-roam-index-file`
|
- [#1346](https://github.com/org-roam/org-roam/pull/1346) prevent malformed path to `org-roam-index-file`
|
||||||
- [#1347](https://github.com/org-roam/org-roam/pull/1347) allow use of `%a` element in regular Org-roam captures
|
- [#1347](https://github.com/org-roam/org-roam/pull/1347) allow use of `%a` element in regular Org-roam captures
|
||||||
|
- [#1352](https://github.com/org-roam/org-roam/pull/1352) fixed org-roam-{tag/alias}-{add/delete} altering the original case of the Org property
|
||||||
|
|
||||||
## 1.2.3 (13-11-2020)
|
## 1.2.3 (13-11-2020)
|
||||||
|
|
||||||
|
35
org-roam.el
35
org-roam.el
@ -882,20 +882,19 @@ whose title is 'Index'."
|
|||||||
"Set a file property called NAME to VALUE.
|
"Set a file property called NAME to VALUE.
|
||||||
|
|
||||||
If the property is already set, it's value is replaced."
|
If the property is already set, it's value is replaced."
|
||||||
(save-excursion
|
(org-with-point-at 1
|
||||||
(widen)
|
(let ((case-fold-search t))
|
||||||
(goto-char (point-min))
|
(if (re-search-forward (concat "^#\\+" name ":\\(.*\\)") (point-max) t)
|
||||||
(if (re-search-forward (concat "^#\\+" name ": \\(.*\\)") (point-max) t)
|
(replace-match (concat " " value) 'fixedcase nil nil 1)
|
||||||
(replace-match (concat "#+" name ": " value) 'fixedcase)
|
(while (and (not (eobp))
|
||||||
(while (and (not (eobp))
|
(looking-at "^[#:]"))
|
||||||
(looking-at "^[#:]"))
|
(if (save-excursion (end-of-line) (eobp))
|
||||||
(if (save-excursion (end-of-line) (eobp))
|
(progn
|
||||||
(progn
|
(end-of-line)
|
||||||
(end-of-line)
|
(insert "\n"))
|
||||||
(insert "\n"))
|
(forward-line)
|
||||||
(forward-line)
|
(beginning-of-line)))
|
||||||
(beginning-of-line)))
|
(insert "#+" name ": " value "\n")))))
|
||||||
(insert "#+" name ": " value "\n"))))
|
|
||||||
|
|
||||||
;;;; org-roam-find-ref
|
;;;; org-roam-find-ref
|
||||||
(defun org-roam--get-ref-path-completions (&optional arg filter)
|
(defun org-roam--get-ref-path-completions (&optional arg filter)
|
||||||
@ -1708,7 +1707,7 @@ Return added alias."
|
|||||||
(when (string-empty-p alias)
|
(when (string-empty-p alias)
|
||||||
(user-error "Alias can't be empty"))
|
(user-error "Alias can't be empty"))
|
||||||
(org-roam--set-global-prop
|
(org-roam--set-global-prop
|
||||||
"ROAM_ALIAS"
|
"roam_alias"
|
||||||
(combine-and-quote-strings
|
(combine-and-quote-strings
|
||||||
(seq-uniq (cons alias
|
(seq-uniq (cons alias
|
||||||
(org-roam--extract-titles-alias)))))
|
(org-roam--extract-titles-alias)))))
|
||||||
@ -1723,7 +1722,7 @@ Return added alias."
|
|||||||
(if-let ((aliases (org-roam--extract-titles-alias)))
|
(if-let ((aliases (org-roam--extract-titles-alias)))
|
||||||
(let ((alias (completing-read "Alias: " aliases nil 'require-match)))
|
(let ((alias (completing-read "Alias: " aliases nil 'require-match)))
|
||||||
(org-roam--set-global-prop
|
(org-roam--set-global-prop
|
||||||
"ROAM_ALIAS"
|
"roam_alias"
|
||||||
(combine-and-quote-strings (delete alias aliases)))
|
(combine-and-quote-strings (delete alias aliases)))
|
||||||
(org-roam-db--update-file (buffer-file-name (buffer-base-buffer))))
|
(org-roam-db--update-file (buffer-file-name (buffer-base-buffer))))
|
||||||
(user-error "No aliases to delete")))
|
(user-error "No aliases to delete")))
|
||||||
@ -1741,7 +1740,7 @@ Return added tag."
|
|||||||
(when (string-empty-p tag)
|
(when (string-empty-p tag)
|
||||||
(user-error "Tag can't be empty"))
|
(user-error "Tag can't be empty"))
|
||||||
(org-roam--set-global-prop
|
(org-roam--set-global-prop
|
||||||
"ROAM_TAGS"
|
"roam_tags"
|
||||||
(combine-and-quote-strings (seq-uniq (cons tag existing-tags))))
|
(combine-and-quote-strings (seq-uniq (cons tag existing-tags))))
|
||||||
(org-roam-db--insert-tags 'update)
|
(org-roam-db--insert-tags 'update)
|
||||||
tag))
|
tag))
|
||||||
@ -1754,7 +1753,7 @@ Return added tag."
|
|||||||
(tags (org-roam--extract-tags-prop file)))
|
(tags (org-roam--extract-tags-prop file)))
|
||||||
(let ((tag (completing-read "Tag: " tags nil 'require-match)))
|
(let ((tag (completing-read "Tag: " tags nil 'require-match)))
|
||||||
(org-roam--set-global-prop
|
(org-roam--set-global-prop
|
||||||
"ROAM_TAGS"
|
"roam_tags"
|
||||||
(combine-and-quote-strings (delete tag tags)))
|
(combine-and-quote-strings (delete tag tags)))
|
||||||
(org-roam-db--insert-tags 'update))
|
(org-roam-db--insert-tags 'update))
|
||||||
(user-error "No tag to delete")))
|
(user-error "No tag to delete")))
|
||||||
|
Reference in New Issue
Block a user