* Bug: org-element-fixed-width-interpreter fails when given an empty string [8.0.1 (release_8.0.1-40-g38051c @ /home/david/git/home-common/emacs/foreign/org-mode/lisp/)]
@ 2013-04-25 6:30 David Beswick
2013-04-26 10:06 ` Nicolas Goaziou
0 siblings, 1 reply; 3+ messages in thread
From: David Beswick @ 2013-04-25 6:30 UTC (permalink / raw)
To: emacs-orgmode
Hi, I encountered this problem when trying out org-sync with
Redmine. That package uses org-element to create "fixed-width" type
elements to contain the bug descriptions. When a bug had no description,
this problem would occur. In that case, org-element-property returns the
empty string for the ":value" property of the fixed-width element, and
the call to "substring" fails.
I also encountered the problem with org version [7.9.2
(release_7.9.2-1-ge003bd @
/home/david/git/home-common/emacs/foreign/org-mode/lisp/)]
As far as I can see, org-element.el head still has the problem. Here's
a patch for the issue.
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 73d0b46..bfc35a7 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -1834,8 +1834,11 @@ Assume point is at the beginning of the fixed-width area.
(defun org-element-fixed-width-interpreter (fixed-width contents)
"Interpret FIXED-WIDTH element as Org syntax.
CONTENTS is nil."
- (replace-regexp-in-string
- "^" ": " (substring (org-element-property :value fixed-width) 0 -1)))
+ (let ((value (org-element-property :value fixed-width)))
+ (if (not (= (length value) 0))
+ (replace-regexp-in-string
+ "^" ": " (substring value 0 -1))
+ ": ")))
;;;; Horizontal Rule
Emacs : GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.12)
of 2012-09-23 on allspice, modified by Debian
Package: Org-mode version 8.0.1 (release_8.0.1-40-g38051c @
/home/david/git/home-common/emacs/foreign/org-mode/lisp/)
current state:
==============
(setq
org-agenda-clockreport-parameter-plist '(:link nil :maxlevel 3)
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-clock-heading-function '(lambda nil (concat (buffer-name) " "
(org-clock-heading-function-default)))
org-after-todo-statistics-hook '(org-summary-todo)
org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-confirm-shell-link-function 'yes-or-no-p
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-hide-inline-tasks
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-mode-hook '((lambda nil (local-unset-key (kbd "<C-tab>"))
(org-indent-mode 1) (visual-line-mode 1))
#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook
org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-occur-hook '(org-first-headline-recenter)
org-from-is-user-regexp "\\<David\\>"
org-clock-report-include-clocking-task t
org-metadown-hook '(org-babel-pop-to-session-maybe)
)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Bug: org-element-fixed-width-interpreter fails when given an empty string [8.0.1 (release_8.0.1-40-g38051c @ /home/david/git/home-common/emacs/foreign/org-mode/lisp/)]
2013-04-25 6:30 Bug: org-element-fixed-width-interpreter fails when given an empty string [8.0.1 (release_8.0.1-40-g38051c @ /home/david/git/home-common/emacs/foreign/org-mode/lisp/)] David Beswick
@ 2013-04-26 10:06 ` Nicolas Goaziou
2013-04-26 10:14 ` David Beswick
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2013-04-26 10:06 UTC (permalink / raw)
To: David Beswick; +Cc: emacs-orgmode
Hello,
David Beswick <dlbeswick@gmail.com> writes:
> Hi, I encountered this problem when trying out org-sync with
> Redmine. That package uses org-element to create "fixed-width" type
> elements to contain the bug descriptions. When a bug had no description,
> this problem would occur. In that case, org-element-property returns the
> empty string for the ":value" property of the fixed-width element, and
> the call to "substring" fails.
This should be fixed. Thanks for the report and the patch (although
I used a different one).
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug: org-element-fixed-width-interpreter fails when given an empty string [8.0.1 (release_8.0.1-40-g38051c @ /home/david/git/home-common/emacs/foreign/org-mode/lisp/)]
2013-04-26 10:06 ` Nicolas Goaziou
@ 2013-04-26 10:14 ` David Beswick
0 siblings, 0 replies; 3+ messages in thread
From: David Beswick @ 2013-04-26 10:14 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Sure thing, thanks for that.
On 26 April 2013 20:06, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> David Beswick <dlbeswick@gmail.com> writes:
>
>> Hi, I encountered this problem when trying out org-sync with
>> Redmine. That package uses org-element to create "fixed-width" type
>> elements to contain the bug descriptions. When a bug had no description,
>> this problem would occur. In that case, org-element-property returns the
>> empty string for the ":value" property of the fixed-width element, and
>> the call to "substring" fails.
>
> This should be fixed. Thanks for the report and the patch (although
> I used a different one).
>
>
> Regards,
>
> --
> Nicolas Goaziou
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-26 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-25 6:30 Bug: org-element-fixed-width-interpreter fails when given an empty string [8.0.1 (release_8.0.1-40-g38051c @ /home/david/git/home-common/emacs/foreign/org-mode/lisp/)] David Beswick
2013-04-26 10:06 ` Nicolas Goaziou
2013-04-26 10:14 ` David Beswick
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).