emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Beswick <dlbeswick@gmail.com>
To: emacs-orgmode@gnu.org
Subject: 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/)]
Date: Thu, 25 Apr 2013 16:30:40 +1000	[thread overview]
Message-ID: <CAKqScUs-82v8Yb_pFJg7cYPWtiR=mn5OMkDdTSQU1TFf5Uq6Tg@mail.gmail.com> (raw)

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 @

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 @

current state:
 org-agenda-clockreport-parameter-plist '(:link nil :maxlevel 3)
 org-speed-command-hook '(org-speed-command-default-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-after-todo-statistics-hook '(org-summary-todo)
 org-tab-first-hook '(org-hide-block-toggle-maybe
 org-src-mode-hook '(org-src-babel-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-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-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)

             reply	other threads:[~2013-04-25  6:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25  6:30 David Beswick [this message]
2013-04-26 10:06 ` 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/)] Nicolas Goaziou
2013-04-26 10:14   ` David Beswick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKqScUs-82v8Yb_pFJg7cYPWtiR=mn5OMkDdTSQU1TFf5Uq6Tg@mail.gmail.com' \
    --to=dlbeswick@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).