* [PATCH] Escape slashes in ARCHIVE_OLPATH
@ 2012-11-05 13:13 Takafumi Arakaki
2012-11-09 8:57 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Takafumi Arakaki @ 2012-11-05 13:13 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 188 bytes --]
Currently information about tree structure is lost if you have a slash
in node headings. This patch fixes the problem by escaping slashes in
headings before concatenating them.
Takafumi
[-- Attachment #2: archive_olpath.patch --]
[-- Type: application/octet-stream, Size: 701 bytes --]
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index d41a1d3..774443f 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -219,7 +219,12 @@ this heading."
(file (abbreviate-file-name
(or (buffer-file-name (buffer-base-buffer))
(error "No file associated to buffer"))))
- (olpath (mapconcat 'identity (org-get-outline-path) "/"))
+ (olpath (mapconcat
+ (lambda (s)
+ (setq s (replace-regexp-in-string "\\\\" "\\\\\\\\" s))
+ (setq s (replace-regexp-in-string "/" "\\\\/" s))
+ s)
+ (org-get-outline-path) "/"))
(time (format-time-string
(substring (cdr org-time-stamp-formats) 1 -1)
(current-time)))
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Escape slashes in ARCHIVE_OLPATH
2012-11-05 13:13 [PATCH] Escape slashes in ARCHIVE_OLPATH Takafumi Arakaki
@ 2012-11-09 8:57 ` Nicolas Goaziou
2012-11-09 13:26 ` Takafumi Arakaki
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2012-11-09 8:57 UTC (permalink / raw)
To: Takafumi Arakaki; +Cc: emacs-orgmode
Hello,
Takafumi Arakaki <aka.tkf@gmail.com> writes:
> Currently information about tree structure is lost if you have a slash
> in node headings. This patch fixes the problem by escaping slashes in
> headings before concatenating them.
Thanks for your patch.
Would you mind providing a test-case to illustrate the problem? Also,
could you provide a change log entry for the patch (and use git
format-patch if possible)?
> + (olpath (mapconcat
> + (lambda (s)
> + (setq s (replace-regexp-in-string "\\\\" "\\\\\\\\" s))
> + (setq s (replace-regexp-in-string "/" "\\\\/" s))
> + s)
I'd rather nest the `replace-regexp-in-string' instead of setq'ing twice
in a row the same variable. I.e:
(replace-regexp-in-string
"/" "\\\\/" (replace-regexp-in-string "\\\\" "\\\\\\\\" s))
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Escape slashes in ARCHIVE_OLPATH
2012-11-09 8:57 ` Nicolas Goaziou
@ 2012-11-09 13:26 ` Takafumi Arakaki
2012-11-09 13:28 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Takafumi Arakaki @ 2012-11-09 13:26 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
I am not familiar with org-mode test suite but I can try. Could you
tell me where I can find similar test cases which creates archive
entries?
---
Takafumi
On Fri, Nov 9, 2012 at 9:57 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> Takafumi Arakaki <aka.tkf@gmail.com> writes:
>
>> Currently information about tree structure is lost if you have a slash
>> in node headings. This patch fixes the problem by escaping slashes in
>> headings before concatenating them.
>
> Thanks for your patch.
>
> Would you mind providing a test-case to illustrate the problem? Also,
> could you provide a change log entry for the patch (and use git
> format-patch if possible)?
>
>> + (olpath (mapconcat
>> + (lambda (s)
>> + (setq s (replace-regexp-in-string "\\\\" "\\\\\\\\" s))
>> + (setq s (replace-regexp-in-string "/" "\\\\/" s))
>> + s)
>
> I'd rather nest the `replace-regexp-in-string' instead of setq'ing twice
> in a row the same variable. I.e:
>
> (replace-regexp-in-string
> "/" "\\\\/" (replace-regexp-in-string "\\\\" "\\\\\\\\" s))
>
>
> Regards,
>
> --
> Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Escape slashes in ARCHIVE_OLPATH
2012-11-09 13:26 ` Takafumi Arakaki
@ 2012-11-09 13:28 ` Nicolas Goaziou
2012-11-09 14:41 ` Takafumi Arakaki
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2012-11-09 13:28 UTC (permalink / raw)
To: Takafumi Arakaki; +Cc: emacs-orgmode
Takafumi Arakaki <aka.tkf@gmail.com> writes:
> I am not familiar with org-mode test suite but I can try. Could you
> tell me where I can find similar test cases which creates archive
> entries?
We use ERT.
There is no test case related to archive entries yet. Though, if you
write a recipe to reproduce a problem, I can make a test out of it. You
can also try to implement the test directly. It should go to
testing/lisp/test-org-archive.el (to be created). Your call.
Regards,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Escape slashes in ARCHIVE_OLPATH
2012-11-09 13:28 ` Nicolas Goaziou
@ 2012-11-09 14:41 ` Takafumi Arakaki
2012-11-09 15:27 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Takafumi Arakaki @ 2012-11-09 14:41 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
I thought it would be convenient if there was a macro or something to
setup temporal main org file and temporal archive file. If there is
nothing like that, then I will just create by my self or use
unwind-protect or something directly.
I remember there is a way to archive in the same file by specifying a
root tree. This will make test easier, but I guess it is better to
test with a "plain" configuration first.
Takafumi
On Fri, Nov 9, 2012 at 2:28 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Takafumi Arakaki <aka.tkf@gmail.com> writes:
>
>> I am not familiar with org-mode test suite but I can try. Could you
>> tell me where I can find similar test cases which creates archive
>> entries?
>
> We use ERT.
>
> There is no test case related to archive entries yet. Though, if you
> write a recipe to reproduce a problem, I can make a test out of it. You
> can also try to implement the test directly. It should go to
> testing/lisp/test-org-archive.el (to be created). Your call.
>
>
> Regards,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Escape slashes in ARCHIVE_OLPATH
2012-11-09 14:41 ` Takafumi Arakaki
@ 2012-11-09 15:27 ` Nicolas Goaziou
0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2012-11-09 15:27 UTC (permalink / raw)
To: Takafumi Arakaki; +Cc: emacs-orgmode
Takafumi Arakaki <aka.tkf@gmail.com> writes:
> I thought it would be convenient if there was a macro or something to
> setup temporal main org file and temporal archive file. If there is
> nothing like that, then I will just create by my self or use
> unwind-protect or something directly.
>
> I remember there is a way to archive in the same file by specifying a
> root tree. This will make test easier, but I guess it is better to
> test with a "plain" configuration first.
Use something like:
(org-test-with-temp-text "#+ARCHIVE: ::..." ...)
in order to archive in the same file.
Regards,
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-11-09 15:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 13:13 [PATCH] Escape slashes in ARCHIVE_OLPATH Takafumi Arakaki
2012-11-09 8:57 ` Nicolas Goaziou
2012-11-09 13:26 ` Takafumi Arakaki
2012-11-09 13:28 ` Nicolas Goaziou
2012-11-09 14:41 ` Takafumi Arakaki
2012-11-09 15:27 ` Nicolas Goaziou
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.