Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Bastien Guerry 2013-02-13 14:29:36 +01:00
commit 977412f468
3 changed files with 67 additions and 49 deletions

View File

@ -3011,7 +3011,7 @@ Assume point is at the beginning of the link."
;; targets, radio targets and name affiliated keywords ;; targets, radio targets and name affiliated keywords
;; cannot contain any. ;; cannot contain any.
link (org-link-unescape link (org-link-unescape
(replace-regexp-in-string "\n" " " raw-link))) (replace-regexp-in-string "\n[ \t]*" " " raw-link)))
;; Determine TYPE of link and set PATH accordingly. ;; Determine TYPE of link and set PATH accordingly.
(cond (cond
;; File type. ;; File type.

View File

@ -8632,9 +8632,11 @@ buffer. It will also recognize item context in multiline items."
(key-description binding))))) (key-description binding)))))
(let ((key (lookup-key orgstruct-mode-map binding))) (let ((key (lookup-key orgstruct-mode-map binding)))
(when (or (not key) (numberp key)) (when (or (not key) (numberp key))
(condition-case nil
(org-defkey orgstruct-mode-map (org-defkey orgstruct-mode-map
binding binding
(orgstruct-make-binding f binding))))))) (orgstruct-make-binding f binding))
(error nil)))))))
(run-hooks 'orgstruct-setup-hook)) (run-hooks 'orgstruct-setup-hook))
(defun orgstruct-make-binding (fun key) (defun orgstruct-make-binding (fun key)
@ -8672,7 +8674,8 @@ should be checked in for a command to execute outside of tables."
'item-body))) 'item-body)))
(org-run-like-in-org-mode ',fun) (org-run-like-in-org-mode ',fun)
t)) t))
(let ((binding (let ((orgstruct-mode)) (key-binding ,key)))) (let* ((orgstruct-mode)
(binding (key-binding ,key)))
(if (keymapp binding) (if (keymapp binding)
(set-temporary-overlay-map binding) (set-temporary-overlay-map binding)
(call-interactively (call-interactively

View File

@ -72,6 +72,7 @@
(horizontal-rule . org-ascii-horizontal-rule) (horizontal-rule . org-ascii-horizontal-rule)
(inline-src-block . org-ascii-inline-src-block) (inline-src-block . org-ascii-inline-src-block)
(inlinetask . org-ascii-inlinetask) (inlinetask . org-ascii-inlinetask)
(inner-template . org-ascii-inner-template)
(italic . org-ascii-italic) (italic . org-ascii-italic)
(item . org-ascii-item) (item . org-ascii-item)
(keyword . org-ascii-keyword) (keyword . org-ascii-keyword)
@ -882,25 +883,16 @@ INFO is a plist used as a communication channel."
(when (org-string-nw-p date) (concat "\n\n\n" date)) (when (org-string-nw-p date) (concat "\n\n\n" date))
"\n\n\n") text-width 'center))))) "\n\n\n") text-width 'center)))))
(defun org-ascii-template (contents info) (defun org-ascii-inner-template (contents info)
"Return complete document string after ASCII conversion. "Return complete document string after ASCII conversion.
CONTENTS is the transcoded contents string. INFO is a plist CONTENTS is the transcoded contents string. INFO is a plist
holding export options." holding export options."
(org-element-normalize-string (org-element-normalize-string
(org-ascii--indent-string (org-ascii--indent-string
(let ((text-width (- org-ascii-text-width org-ascii-global-margin)))
;; 1. Build title block.
(concat (concat
(org-ascii-template--document-title info) ;; 1. Document's body.
;; 2. Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth
(concat
(org-ascii--build-toc info (and (wholenump depth) depth))
"\n\n\n")))
;; 3. Document's body.
contents contents
;; 4. Footnote definitions. ;; 2. Footnote definitions.
(let ((definitions (org-export-collect-footnote-definitions (let ((definitions (org-export-collect-footnote-definitions
(plist-get info :parse-tree) info)) (plist-get info :parse-tree) info))
;; Insert full links right inside the footnote definition ;; Insert full links right inside the footnote definition
@ -916,6 +908,7 @@ holding export options."
(length title) (length title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_)))) (if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))))
"\n\n" "\n\n"
(let ((text-width (- org-ascii-text-width org-ascii-global-margin)))
(mapconcat (mapconcat
(lambda (ref) (lambda (ref)
(let ((id (format "[%s] " (car ref)))) (let ((id (format "[%s] " (car ref))))
@ -933,20 +926,42 @@ holding export options."
(concat id "\n" (org-export-data def info)) (concat id "\n" (org-export-data def info))
(push id (nthcdr 2 first)) (push id (nthcdr 2 first))
(org-export-data def info))) (org-export-data def info)))
;; Fill paragraph once footnote ID is inserted in ;; Fill paragraph once footnote ID is inserted
;; order to have a correct length for first line. ;; in order to have a correct length for first
;; line.
(org-ascii--fill-string (org-ascii--fill-string
(concat id (org-export-data def info)) (concat id (org-export-data def info))
text-width info)))))) text-width info))))))
definitions "\n\n")))) definitions "\n\n"))))))
;; 5. Creator. Ignore `comment' value as there are no comments in org-ascii-global-margin)))
(defun org-ascii-template (contents info)
"Return complete document string after ASCII conversion.
CONTENTS is the transcoded contents string. INFO is a plist
holding export options."
(concat
;; 1. Build title block.
(org-ascii--indent-string
(concat (org-ascii-template--document-title info)
;; 2. Table of contents.
(let ((depth (plist-get info :with-toc)))
(when depth
(concat
(org-ascii--build-toc info (and (wholenump depth) depth))
"\n\n\n"))))
org-ascii-global-margin)
;; 3. Document's body.
contents
;; 4. Creator. Ignore `comment' value as there are no comments in
;; ASCII. Justify it to the bottom right. ;; ASCII. Justify it to the bottom right.
(let ((creator-info (plist-get info :with-creator))) (org-ascii--indent-string
(let ((creator-info (plist-get info :with-creator))
(text-width (- org-ascii-text-width org-ascii-global-margin)))
(unless (or (not creator-info) (eq creator-info 'comment)) (unless (or (not creator-info) (eq creator-info 'comment))
(concat (concat
"\n\n\n" "\n\n\n"
(org-ascii--fill-string (org-ascii--fill-string
(plist-get info :creator) text-width info 'right)))))) (plist-get info :creator) text-width info 'right))))
org-ascii-global-margin))) org-ascii-global-margin)))
(defun org-ascii--translate (s info) (defun org-ascii--translate (s info)
@ -1805,8 +1820,8 @@ first.
When optional argument VISIBLE-ONLY is non-nil, don't export When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements. contents of hidden elements.
When optional argument BODY-ONLY is non-nil, strip title, table When optional argument BODY-ONLY is non-nil, strip title and
of contents and footnote definitions from output. table of contents from output.
EXT-PLIST, when provided, is a property list with external EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to parameters overriding Org default settings, but still inferior to
@ -1855,8 +1870,8 @@ first.
When optional argument VISIBLE-ONLY is non-nil, don't export When optional argument VISIBLE-ONLY is non-nil, don't export
contents of hidden elements. contents of hidden elements.
When optional argument BODY-ONLY is non-nil, strip title, table When optional argument BODY-ONLY is non-nil, strip title and
of contents and footnote definitions from output. table of contents from output.
EXT-PLIST, when provided, is a property list with external EXT-PLIST, when provided, is a property list with external
parameters overriding Org default settings, but still inferior to parameters overriding Org default settings, but still inferior to