Merge branch 'maint'

This commit is contained in:
Bastien Guerry 2012-12-23 17:20:51 +01:00
commit 9f1f0535be
7 changed files with 177 additions and 201 deletions

View File

@ -230,10 +230,7 @@ in this way, it will be wrapped."
; print above and below all body parts
:body-text-prefix "<p>\n"
:body-text-suffix "</p>\n"
)
:body-text-suffix "</p>\n")
;;
;; ascii exporter
;;
@ -290,9 +287,8 @@ in this way, it will be wrapped."
; :body-text-suffix "</t>\n"
:body-bullet-list-prefix (?* ?+ ?-)
:body-bullet-list-prefix (?* ?+ ?-))
; :body-bullet-list-suffix (?* ?+ ?-)
)
;;
;; wikipedia
@ -327,8 +323,7 @@ in this way, it will be wrapped."
:body-list-format "* %s\n"
:body-number-list-format "# %s\n"
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** ")
)
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** "))
;;
;; mediawiki
;;
@ -370,10 +365,7 @@ in this way, it will be wrapped."
:body-table-cell-start "|"
:body-table-cell-end "\n"
:body-table-last-cell-end "|-"
:body-table-hline-start ""
)
:body-table-hline-start "")
;;
;; internet-draft .xml for xml2rfc exporter
;;
@ -437,9 +429,7 @@ in this way, it will be wrapped."
:body-list-prefix "<list style=\"symbols\">\n"
:body-list-suffix "</list>\n"
:body-list-format "<t>%s</t>\n"
)
:body-list-format "<t>%s</t>\n")
("trac-wiki"
:file-suffix ".txt"
:key-binding ?T
@ -474,8 +464,7 @@ in this way, it will be wrapped."
;; :body-list-suffix "LISTEND"
;; this is ignored! [2010/02/02:rpg]
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** ")
)
:body-bullet-list-prefix ("* " "** " "*** " "**** " "***** "))
("tikiwiki"
:file-suffix ".txt"
:key-binding ?U
@ -517,11 +506,8 @@ in this way, it will be wrapped."
:underline-format "===%s==="
:strikethrough-format "--%s--"
:code-format "-+%s+-"
:verbatim-format "~pp~%s~/pp~"
)
)
"A assoc list of property lists to specify export definitions"
)
:verbatim-format "~pp~%s~/pp~"))
"A assoc list of property lists to specify export definitions")
(setq org-generic-export-type "demo")
@ -538,24 +524,23 @@ export definitions."
(defvar org-export-generic-keywords nil)
(defmacro* def-org-export-generic-keyword (keyword
&key documentation
type)
type)
"Define KEYWORD as a legitimate element for inclusion in
the body of an org-set-generic-type definition."
;; TODO: push the documentation and type information
;; somewhere where it will do us some good.
`(progn
(pushnew ,keyword org-export-generic-keywords)
;; TODO: push the documentation and type information
;; somewhere where it will do us some good.
))
(pushnew ,keyword org-export-generic-keywords)))
(def-org-export-generic-keyword :body-newline-paragraph
:documentation "Bound either to NIL or to a pattern to be
:documentation "Bound either to NIL or to a pattern to be
inserted in the output for every blank line in the input.
The intention is to handle formats where text is flowed, and
newlines are interpreted as significant \(e.g., as indicating
preformatted text\). A common non-nil value for this keyword
is \"\\n\". Should typically be combined with a value for
:body-line-format that does NOT end with a newline."
:type string)
:type string)
;;; fontification keywords
(def-org-export-generic-keyword :bold-format)
@ -565,15 +550,11 @@ is \"\\n\". Should typically be combined with a value for
(def-org-export-generic-keyword :code-format)
(def-org-export-generic-keyword :verbatim-format)
(defun org-export-generic-remember-section (type suffix &optional prefix)
(setq org-export-generic-section-type type)
(setq org-export-generic-section-suffix suffix)
(if prefix
(insert prefix))
)
(insert prefix)))
(defun org-export-generic-check-section (type &optional prefix suffix)
"checks to see if type is already in use, or we're switching parts
@ -583,7 +564,7 @@ suffix a later change time."
(when (not (equal type org-export-generic-section-type))
(if org-export-generic-section-suffix
(insert org-export-generic-section-suffix))
(insert org-export-generic-section-suffix))
(setq org-export-generic-section-type type)
(setq org-export-generic-section-suffix suffix)
(if prefix
@ -640,7 +621,7 @@ underlined headlines. The default is 3."
(list
(plist-get (cdr x) :key-binding)
(car x)))
org-generic-alist)
org-generic-alist)
(list (list ? "default"))))
r1 r2 ass
@ -700,7 +681,7 @@ underlined headlines. The default is 3."
(email (plist-get opt-plist :email))
(language (plist-get opt-plist :language))
(quote-re0 (concat "^[ \t]*" org-quote-string "\\>"))
; (quote-re (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
; (quote-re (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
(todo nil)
(lang-words nil)
(region
@ -881,81 +862,80 @@ underlined headlines. The default is 3."
(if tocprefix
(push tocprefix thetoc))
(mapc '(lambda (line)
(if (string-match org-todo-line-regexp line)
;; This is a headline
(progn
(setq have-headings t)
(setq level (- (match-end 1) (match-beginning 1)
level-offset)
level (org-tr-level level)
txt (match-string 3 line)
todo
(or (and org-export-mark-todo-in-toc
(match-beginning 2)
(not (member (match-string 2 line)
org-done-keywords)))
(mapc #'(lambda (line)
(if (string-match org-todo-line-regexp line)
;; This is a headline
(progn
(setq have-headings t)
(setq level (- (match-end 1) (match-beginning 1)
level-offset)
level (org-tr-level level)
txt (match-string 3 line)
todo
(or (and org-export-mark-todo-in-toc
(match-beginning 2)
(not (member (match-string 2 line)
org-done-keywords)))
; TODO, not DONE
(and org-export-mark-todo-in-toc
(= level umax-toc)
(org-search-todo-below
line lines level))))
(setq txt (org-html-expand-for-generic txt))
(and org-export-mark-todo-in-toc
(= level umax-toc)
(org-search-todo-below
line lines level))))
(setq txt (org-html-expand-for-generic txt))
(while (string-match org-bracket-link-regexp txt)
(setq txt
(replace-match
(match-string (if (match-end 2) 3 1) txt)
t t txt)))
(while (string-match org-bracket-link-regexp txt)
(setq txt
(replace-match
(match-string (if (match-end 2) 3 1) txt)
t t txt)))
(if (and (not tagsintoc)
(if (and (not tagsintoc)
(string-match
(org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$")
txt))
(setq txt (replace-match "" t t txt))
; include tags but formated
(if (string-match
(org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$")
txt)
(progn
(setq
toctags
(org-export-generic-header
(match-string 1 txt)
export-plist :toc-tags-prefix
:toc-tags-format :toc-tags-suffix))
(string-match
(org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$")
txt))
(setq txt (replace-match "" t t txt))
; include tags but formated
(if (string-match
(org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$")
txt)
(progn
(setq
toctags
(org-export-generic-header
(match-string 1 txt)
export-plist :toc-tags-prefix
:toc-tags-format :toc-tags-suffix))
(string-match
(org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$")
txt)
(setq txt (replace-match "" t t txt)))
(setq toctags tocnotagsstr)))
txt)
(setq txt (replace-match "" t t txt)))
(setq toctags tocnotagsstr)))
(if (string-match quote-re0 txt)
(setq txt (replace-match "" t t txt)))
(if (string-match quote-re0 txt)
(setq txt (replace-match "" t t txt)))
(if (<= level umax-toc)
(progn
(push
(concat
(if (<= level umax-toc)
(progn
(push
(concat
(make-string
(* (max 0 (- level org-min-level)) tocdepth)
tocindentchar)
(make-string
(* (max 0 (- level org-min-level)) tocdepth)
tocindentchar)
(if tocsecnums
(format tocsecnumform
(org-section-number level))
"")
(if tocsecnums
(format tocsecnumform
(org-section-number level))
"")
(format
(if todo tocformtodo tocformat)
txt)
(format
(if todo tocformtodo tocformat)
txt)
toctags)
toctags)
thetoc)
(setq org-last-level level))
))))
thetoc)
(setq org-last-level level))))))
lines)
(if tocsuffix
(push tocsuffix thetoc))
@ -1075,8 +1055,7 @@ underlined headlines. The default is 3."
listcheckdoneend)))
((string-match "^\\(\\[/\\]\\)[ \t]*" line)
(setq line (concat (replace-match listcheckhalf nil nil line)
listcheckhalfend)))
)
listcheckhalfend))))
(insert (format listformat (org-export-generic-fontify line))))
((string-match "^\\([ \t]+\\)\\([0-9]+\\.[ \t]*\\)" line)
@ -1101,8 +1080,7 @@ underlined headlines. The default is 3."
listcheckdoneend)))
((string-match "\\(\\[/\\]\\)[ \t]*" line)
(setq line (concat (replace-match listcheckhalf nil nil line)
listcheckhalfend)))
)
listcheckhalfend))))
(insert (format numlistformat (org-export-generic-fontify line))))
@ -1221,20 +1199,18 @@ REVERSE means to reverse the list if the plist match is a list
(if (stringp subtype)
subtype
(concat (make-string len subtype) "\n")))
(t ""))
))
(t ""))))
(defun org-export-generic-header (header export-plist
prefixprop formatprop postfixprop
&optional n reverse)
prefixprop formatprop postfixprop
&optional n reverse)
"convert a header to an output string given formatting property names"
(let* ((formatspec (plist-get export-plist formatprop))
(len (length header)))
(concat
(org-export-generic-format export-plist prefixprop len n reverse)
(format (or formatspec "%s") header)
(org-export-generic-format export-plist postfixprop len n reverse))
))
(org-export-generic-format export-plist postfixprop len n reverse))))
(defun org-export-generic-preprocess (parameters)
"Do extra work for ASCII export"
@ -1242,7 +1218,7 @@ REVERSE means to reverse the list if the plist match is a list
(goto-char (point-min))
(while (re-search-forward org-verbatim-re nil t)
(goto-char (match-end 2))
(backward-delete-char 1) (insert "'")
(delete-backward-char 1) (insert "'")
(goto-char (match-beginning 2))
(delete-char 1) (insert "`")
(goto-char (match-end 2)))
@ -1269,9 +1245,9 @@ REVERSE means to reverse the list if the plist match is a list
(while (> len where)
(catch 'found
(loop for i from where downto (/ where 2) do
(and (equal (aref line i) ?\ )
(setq pos i)
(throw 'found t))))
(and (equal (aref line i) ?\ )
(setq pos i)
(throw 'found t))))
(if pos
(progn
(setq result
@ -1323,22 +1299,18 @@ REVERSE means to reverse the list if the plist match is a list
(insert
(org-export-generic-format export-plist :body-section-prefix 0
(+ old-level counter)))
(setq counter (1+ counter))
))
(setq counter (1+ counter))))
;; going up
((< level old-level)
(while (> (- old-level counter) (1- level))
(insert
(org-export-generic-format export-plist :body-section-suffix 0
(- old-level counter)))
(setq counter (1+ counter))
))
(setq counter (1+ counter))))
;; same level
((= level old-level)
(insert
(org-export-generic-format export-plist :body-section-suffix 0 level))
)
)
(org-export-generic-format export-plist :body-section-suffix 0 level))))
(insert
(org-export-generic-format export-plist :body-section-prefix 0 level))
@ -1464,31 +1436,31 @@ conversions.")
(defun org-export-generic-fontify (string)
"Convert fontification according to generic rules."
(if (string-match org-emph-re string)
;; The match goes one char after the *string*, except at the end of a line
(let ((emph (assoc (match-string 3 string)
org-export-generic-emphasis-alist))
(beg (match-beginning 0))
(end (match-end 0)))
(unless emph
(message "`org-export-generic-emphasis-alist' has no entry for formatting triggered by \"%s\""
(match-string 3 string)))
;; now we need to determine whether we have strikethrough or
;; a list, which is a bit nasty
(if (and (equal (match-string 3 string) "+")
(save-match-data
(string-match "\\`-+\\'" (match-string 4 string))))
;; a list --- skip this match and recurse on the point after the
;; first emph char...
(concat (substring string 0 (1+ (match-beginning 3)))
(org-export-generic-fontify (substring string (match-beginning 3))))
(concat (substring string 0 beg) ;; part before the match
(match-string 1 string)
(org-export-generic-emph-format (second emph)
(match-string 4 string)
(third emph))
(or (match-string 5 string) "")
(org-export-generic-fontify (substring string end)))))
string))
;; The match goes one char after the *string*, except at the end of a line
(let ((emph (assoc (match-string 3 string)
org-export-generic-emphasis-alist))
(beg (match-beginning 0))
(end (match-end 0)))
(unless emph
(message "`org-export-generic-emphasis-alist' has no entry for formatting triggered by \"%s\""
(match-string 3 string)))
;; now we need to determine whether we have strikethrough or
;; a list, which is a bit nasty
(if (and (equal (match-string 3 string) "+")
(save-match-data
(string-match "\\`-+\\'" (match-string 4 string))))
;; a list --- skip this match and recurse on the point after the
;; first emph char...
(concat (substring string 0 (1+ (match-beginning 3)))
(org-export-generic-fontify (substring string (match-beginning 3))))
(concat (substring string 0 beg) ;; part before the match
(match-string 1 string)
(org-export-generic-emph-format (second emph)
(match-string 4 string)
(third emph))
(or (match-string 5 string) "")
(org-export-generic-fontify (substring string end)))))
string))
(defun org-export-generic-emph-format (format-varname string protect)
"Return a string that results from applying the markup indicated by
@ -1497,10 +1469,10 @@ FORMAT-VARNAME to STRING."
(let ((string-to-emphasize
(if protect
string
(org-export-generic-fontify string))))
(org-export-generic-fontify string))))
(if format
(format format string-to-emphasize)
string-to-emphasize))))
string-to-emphasize))))
(provide 'org-generic)
(provide 'org-export-generic)

View File

@ -567,7 +567,7 @@ publishing directory."
(while (re-search-forward org-verbatim-re nil t)
(org-if-unprotected-at (match-beginning 4)
(goto-char (match-end 2))
(backward-delete-char 1) (insert "'")
(delete-backward-char 1) (insert "'")
(goto-char (match-beginning 2))
(delete-char 1) (insert "`")
(goto-char (match-end 2))))

View File

@ -2442,7 +2442,7 @@ from the dynamic block definition."
)))))
;; When exporting subtrees or regions the region might be
;; activated, so let's disable ̀delete-active-region'
(let ((delete-active-region nil)) (backward-delete-char 1))
(let ((delete-active-region nil)) (delete-backward-char 1))
(if (setq formula (plist-get params :formula))
(cond
((eq formula '%)

View File

@ -1353,7 +1353,7 @@ numbered sections and lower levels as unnumbered sections."
(insert (org-export-latex-content content))
(cond ((stringp subcontent) (insert subcontent))
((listp subcontent)
(while (org-looking-back "\n\n") (backward-delete-char 1))
(while (org-looking-back "\n\n") (delete-backward-char 1))
(org-export-latex-sub subcontent)))
(when (and end (string-match "[^ \t]" end))
(let ((hook (org-get-text-property-any 0 'org-insert-hook end)))

View File

@ -210,7 +210,7 @@ edited version. An optional argument CONTEXT is used by \\[org-edit-src-save]
when calling this function. See `org-src-window-setup' to configure
the display of windows containing the Org buffer and the code buffer."
(interactive)
(if (not (org-in-src-block-p))
(if (not (org-in-block-p '("src" "example" "verbatim")))
(user-error "Not in a source code block")
(unless (eq context 'save)
(setq org-edit-src-saved-temp-window-config (current-window-configuration)))

View File

@ -3590,7 +3590,7 @@ With prefix ARG, apply the new formulas to the table."
(beginning-of-line 1)
(insert ind))
(goto-char (point-max))
(backward-delete-char 1)))
(delete-backward-char 1)))
(goto-char beg))
(t nil))))
@ -4245,7 +4245,7 @@ overwritten, and the table is not marked as requiring realignment."
(looking-at "[^|\n]* +|"))
(let (org-table-may-need-update)
(goto-char (1- (match-end 0)))
(backward-delete-char 1)
(delete-backward-char 1)
(goto-char (match-beginning 0))
(self-insert-command N))
(setq org-table-may-need-update t)

View File

@ -1303,7 +1303,7 @@ do the following:
TAB or RET are pressed to move to another field. With optimization this
happens only if changes to a field might have changed the column width.
Optimization requires replacing the functions `self-insert-command',
`delete-char', and `backward-delete-char' in Org-mode buffers, with a
`delete-char', and `delete-backward-char' in Org-mode buffers, with a
slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
very good at guessing when a re-align will be necessary, but you can always
force one with \\[org-ctrl-c-ctrl-c].
@ -7307,7 +7307,7 @@ This is important for non-interactive uses of the command."
(insert head) (just-one-space)
(setq pos (point))
(end-of-line 1)
(unless (= (point) pos) (just-one-space) (backward-delete-char 1))
(unless (= (point) pos) (just-one-space) (delete-backward-char 1))
(when (and org-insert-heading-respect-content hide-previous)
(save-excursion
(goto-char previous-pos)
@ -11465,8 +11465,7 @@ This function can be used in a hook."
" +" t)))
(defcustom org-structure-template-alist
'(
("s" "#+BEGIN_SRC ?\n\n#+END_SRC"
'(("s" "#+BEGIN_SRC ?\n\n#+END_SRC"
"<src lang=\"?\">\n\n</src>")
("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE"
"<example>\n?\n</example>")
@ -11474,6 +11473,8 @@ This function can be used in a hook."
"<quote>\n?\n</quote>")
("v" "#+BEGIN_VERSE\n?\n#+END_VERSE"
"<verse>\n?\n</verse>")
("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM"
"<verbatim>\n?\n</verbatim>")
("c" "#+BEGIN_CENTER\n?\n#+END_CENTER"
"<center>\n?\n</center>")
("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX"
@ -11489,8 +11490,7 @@ This function can be used in a hook."
("i" "#+INDEX: ?"
"#+INDEX: ?")
("I" "#+INCLUDE: %file ?"
"<include file=%file markup=\"?\">")
)
"<include file=%file markup=\"?\">"))
"Structure completion elements.
This is a list of abbreviation keys and values. The value gets inserted
if you type `<' followed by the key and then press the completion key,
@ -12529,7 +12529,7 @@ nil."
(replace-match "")
(if (and (string-match "\\S-" (buffer-substring (point-at-bol) (point)))
(equal (char-before) ?\ ))
(backward-delete-char 1)
(delete-backward-char 1)
(if (string-match "^[ \t]*$" (buffer-substring
(point-at-bol) (point-at-eol)))
(delete-region (point-at-bol)
@ -18598,7 +18598,7 @@ overwritten, and the table is not marked as requiring realignment."
(looking-at "[^|\n]* |"))
(let (org-table-may-need-update)
(goto-char (1- (match-end 0)))
(backward-delete-char 1)
(delete-backward-char 1)
(goto-char (match-beginning 0))
(self-insert-command N)))
(t
@ -18672,31 +18672,32 @@ The detailed reaction depends on the user option `org-catch-invisible-edits'."
(org-align-tags-here org-tags-column)))
(defun org-delete-backward-char (N)
"Like `delete-backward-char', insert whitespace at field end in tables.
"Like `delete-backward-char', but insert whitespace at field end in tables.
When deleting backwards, in tables this function will insert whitespace in
front of the next \"|\" separator, to keep the table aligned. The table will
still be marked for re-alignment if the field did fill the entire column,
because, in this case the deletion might narrow the column."
(interactive "p")
(org-check-before-invisible-edit 'delete-backward)
(if (and (org-table-p)
(eq N 1)
(string-match "|" (buffer-substring (point-at-bol) (point)))
(looking-at ".*?|"))
(let ((pos (point))
(noalign (looking-at "[^|\n\r]* |"))
(c org-table-may-need-update))
(backward-delete-char N)
(if (not overwrite-mode)
(progn
(skip-chars-forward "^|")
(insert " ")
(goto-char (1- pos))))
;; noalign: if there were two spaces at the end, this field
;; does not determine the width of the column.
(if noalign (setq org-table-may-need-update c)))
(backward-delete-char N)
(org-fix-tags-on-the-fly)))
(save-match-data
(org-check-before-invisible-edit 'delete-backward)
(if (and (org-table-p)
(eq N 1)
(string-match "|" (buffer-substring (point-at-bol) (point)))
(looking-at ".*?|"))
(let ((pos (point))
(noalign (looking-at "[^|\n\r]* |"))
(c org-table-may-need-update))
(delete-backward-char N)
(if (not overwrite-mode)
(progn
(skip-chars-forward "^|")
(insert " ")
(goto-char (1- pos))))
;; noalign: if there were two spaces at the end, this field
;; does not determine the width of the column.
(if noalign (setq org-table-may-need-update c)))
(delete-backward-char N)
(org-fix-tags-on-the-fly))))
(defun org-delete-char (N)
"Like `delete-char', but insert whitespace at field end in tables.
@ -18706,24 +18707,25 @@ still be marked for re-alignment if the field did fill the entire column,
because, in this case the deletion might narrow the column."
(interactive "p")
(org-check-before-invisible-edit 'delete)
(if (and (org-table-p)
(not (bolp))
(not (= (char-after) ?|))
(eq N 1))
(if (looking-at ".*?|")
(let ((pos (point))
(noalign (looking-at "[^|\n\r]* |"))
(c org-table-may-need-update))
(replace-match (concat
(substring (match-string 0) 1 -1)
" |"))
(goto-char pos)
;; noalign: if there were two spaces at the end, this field
;; does not determine the width of the column.
(if noalign (setq org-table-may-need-update c)))
(delete-char N))
(delete-char N)
(org-fix-tags-on-the-fly)))
(save-match-data
(if (and (org-table-p)
(not (bolp))
(not (= (char-after) ?|))
(eq N 1))
(if (looking-at ".*?|")
(let ((pos (point))
(noalign (looking-at "[^|\n\r]* |"))
(c org-table-may-need-update))
(replace-match (concat
(substring (match-string 0) 1 -1)
" |"))
(goto-char pos)
;; noalign: if there were two spaces at the end, this field
;; does not determine the width of the column.
(if noalign (setq org-table-may-need-update c)))
(delete-char N))
(delete-char N)
(org-fix-tags-on-the-fly))))
;; Make `delete-selection-mode' work with org-mode and orgtbl-mode
(put 'org-self-insert-command 'delete-selection t)
@ -19360,7 +19362,9 @@ Otherwise, return a user error."
(beginning-of-line 1)
(let ((case-fold-search )) (looking-at "[ \t]*#\\+tblfm:"))))
(call-interactively 'org-table-edit-formulas))
((or (org-in-src-block-p) (org-at-table.el-p)) (org-edit-src-code))
((or (org-in-block-p '("src" "example" "verbatim"))
(org-at-table.el-p))
(org-edit-src-code))
((org-in-fixed-width-region-p) (org-edit-fixed-width-region))
((org-at-regexp-p org-any-link-re) (call-interactively 'ffap))
(t (user-error "No special environment to edit here"))))