diff options
author | Bastien Guerry <bzg@altern.org> | 2011-01-18 01:24:12 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-01-18 01:24:12 +0100 |
commit | c8ec337d68073a85747bd2d5600b0d108177c873 (patch) | |
tree | bdd0511e4ffbf6eeda3aa6d37fea2fcb7b93d571 | |
parent | 7b399fe128773999c49fe321fe46c9ec27848727 (diff) | |
download | org-mode-c8ec337d68073a85747bd2d5600b0d108177c873.tar.gz |
org-exp.el: cosmetic change to `org-get-file-contents'
-rw-r--r-- | lisp/org-exp.el | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lisp/org-exp.el b/lisp/org-exp.el index ea81386..7c814cd 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2182,24 +2182,23 @@ TYPE must be a string, any of: If PREFIX is a string, prepend it to each line. If PREFIX1 is a string, prepend it to the first line instead of PREFIX. If MARKUP, don't protect org-like lines, the exporter will -take care of the block they are in. If LINES is a string, -include only the lines specified." +take care of the block they are in. If LINES is a string +specifying a range of lines, include only those lines ." (if (stringp markup) (setq markup (downcase markup))) (with-temp-buffer (insert-file-contents file) (when lines - (let (beg end) - (setq lines (split-string lines "-") - beg (if (string= "" (car lines)) - (point-min) + (let* ((lines (split-string lines "-")) + (lbeg (string-to-number (car lines))) + (lend (string-to-number (cadr lines))) + (beg (if (zerop lbeg) (point-min) (goto-char (point-min)) - (forward-line (1- (string-to-number (car lines)))) - (point)) - end (if (string= "" (cadr lines)) - (point-max) - (goto-char (point-min)) - (forward-line (1- (string-to-number (cadr lines)))) + (forward-line (1- lbeg)) (point))) + (end (if (zerop lend) (point-max) + (goto-char (point-min)) + (forward-line (1- lend)) + (point)))) (narrow-to-region beg end))) (when (or prefix prefix1) (goto-char (point-min)) |