1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-23 07:18:53 +00:00

Protect the attachment directory from getting a final newline.

This is a first attempt to fix a strange bug reported by Bernt Hansen,
where two attachment directories are created, one of them with a final
newline.
This commit is contained in:
Carsten Dominik 2008-11-05 23:43:04 +01:00
parent 1104da306a
commit a1d457133e
3 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,11 @@
2008-11-05 Carsten Dominik <carsten.dominik@gmail.com>
* org-attach.el (org-attach-dir): Remove duplicate ID creation
code.
* org-id.el (org-id-new): Use `org-trim' to extract the uuid from
shell output.
* org.el (org-link-abbrev-alist): Improve customization type.
* org-attach.el (org-attach-expand-link, org-attach-expand): New

View File

@ -156,11 +156,7 @@ the directory and the corresponding ID will be created."
(let ((uuid (org-id-get (point) create-if-not-exists-p)))
(when (or uuid create-if-not-exists-p)
(unless uuid
(let ((uuid-string (shell-command-to-string "uuidgen")))
(setf uuid-string
(substring uuid-string 0 (1- (length uuid-string))))
(org-entry-put (point) "ID" uuid-string)
(setf uuid uuid-string)))
(error "ID retrieval/creation failed"))
(let ((attach-dir (expand-file-name
(format "%s/%s"
(substring uuid 0 2)

View File

@ -251,7 +251,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
(if (equal prefix ":") (setq prefix ""))
(cond
((eq org-id-method 'uuidgen)
(setq unique (substring (shell-command-to-string "uuidgen") 1 -1)))
(setq unique (org-trim (shell-command-to-string "uuidgen"))))
((eq org-id-method 'org)
(let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
(postfix (if org-id-include-domain