forked from mirrors/org-mode
Blocks: Apply Erics patch for indented blocks in org-exp-blocks.el
This commit is contained in:
parent
0cd85674a5
commit
5406183319
|
@ -180,7 +180,7 @@ specified in BLOCKS which default to the value of
|
||||||
(blocks org-export-blocks-witheld)
|
(blocks org-export-blocks-witheld)
|
||||||
(case-fold-search t)
|
(case-fold-search t)
|
||||||
(types '())
|
(types '())
|
||||||
type func start end)
|
indentation type func start end)
|
||||||
(flet ((interblock (start end type)
|
(flet ((interblock (start end type)
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(when (setf func (cadr (assoc type org-export-interblocks)))
|
(when (setf func (cadr (assoc type org-export-interblocks)))
|
||||||
|
@ -188,16 +188,22 @@ specified in BLOCKS which default to the value of
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(setf start (point))
|
(setf start (point))
|
||||||
(while (re-search-forward
|
(while (re-search-forward
|
||||||
"^#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)#\\+end_\\S-+.*" nil t)
|
"^\\([ \t]*\\)#\\+begin_\\(\\S-+\\)[ \t]*\\(.*\\)?[\r\n]\\([^\000]*?\\)[\r\n][ \t]*#\\+end_\\S-+.*" nil t)
|
||||||
(save-match-data (setf type (intern (match-string 1))))
|
(save-match-data (setq indentation (length (match-string 1))))
|
||||||
|
(save-match-data (setf type (intern (match-string 2))))
|
||||||
(unless (memq type types) (setf types (cons type types)))
|
(unless (memq type types) (setf types (cons type types)))
|
||||||
(setf end (save-match-data (match-beginning 0)))
|
(setf end (save-match-data (match-beginning 0)))
|
||||||
(interblock start end type)
|
(interblock start end type)
|
||||||
(if (setf func (cadr (assoc type org-export-blocks)))
|
(if (setf func (cadr (assoc type org-export-blocks)))
|
||||||
|
(progn
|
||||||
(replace-match (save-match-data
|
(replace-match (save-match-data
|
||||||
(if (memq type blocks)
|
(if (memq type blocks)
|
||||||
""
|
""
|
||||||
(apply func (match-string 3) (split-string (match-string 2) " ")))) t t))
|
(apply func (save-match-data (org-remove-indentation (match-string 4)))
|
||||||
|
(split-string (match-string 3) " ")))) t t)
|
||||||
|
;; indent the replaced match
|
||||||
|
(indent-region (match-beginning 0) (match-end 0) indentation)
|
||||||
|
))
|
||||||
(setf start (save-match-data (match-end 0))))
|
(setf start (save-match-data (match-end 0))))
|
||||||
(mapcar (lambda (type)
|
(mapcar (lambda (type)
|
||||||
(interblock start (point-max) type))
|
(interblock start (point-max) type))
|
||||||
|
|
Loading…
Reference in New Issue