* [RFC] Make QUOTE an export keyword instead of an element type
@ 2014-01-26 13:57 Nicolas Goaziou
2014-01-26 15:41 ` Thomas S. Dye
` (2 more replies)
0 siblings, 3 replies; 31+ messages in thread
From: Nicolas Goaziou @ 2014-01-26 13:57 UTC (permalink / raw)
To: Org Mode List
[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]
Hello,
Quote sections are special sections triggered when their headline
container has the "QUOTE" keyword in it:
* QUOTE Headline
This is a quote section.
They are inherited (as many other things) from the previous export
framework. The behaviour of this keyword in undocumented in Org manual,
but, judging by old sources, it means that contents of such an headline
should be exported verbatim (i.e. as an /example/ block, not a /quote/
block).
At the moment, they are parsed specially by Org Elements, but I think it
is a mistake. Like "COMMENT" keyword in headlines, "QUOTE" is more an
instruction for the export framework. Therefore, they should be parsed
as regular sections, and treated specially during export. The following
patches permit it, in 3 steps:
1. Remove special parsing from "org-element.el",
2. Turn section contents into a big example block.
3. Remove quote section translators from export back-ends (contrib
directory handled separately)
This change implies that any quote-section translator and filter is
ignored (but it will not generate an error if present). It also means
that an export back-end cannot tell the difference between an example
block and a quote section.
Since quote sections were treated as example blocks (except in
ox-ascii.el), the export behaviour will remain unchanged (except in
ox-ascii.el).
Alternatives:
- Treat their contents as `quote-blocks' instead of `example-block'
- Remove them altogether, since they don't bring anything new.
As a side note, if they are here to stay, it would be good to document
them.
WDYT?
Regards,
--
Nicolas Goaziou
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-element-Do-not-parse-quote-sections-specially.patch --]
[-- Type: text/x-diff, Size: 7962 bytes --]
From 0b156539b8a0b050b6848be89926a10ce983bc83 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sun, 26 Jan 2014 14:09:45 +0100
Subject: [PATCH 1/4] org-element: Do not parse quote sections specially
To: n.goaziou@gmail.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.5.3"
This is a multi-part message in MIME format.
--------------1.8.5.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
* lisp/org-element.el (org-element-quote-section-parser,
org-element-quote-section-interpreter): Remove functions.
(org-element--current-element, org-element--parse-elements): Do not
handle quote sections at all.
* testing/lisp/test-org-element.el (test-org-element/quote-section-parser):
Remove test.
Like COMMENT keyword, QUOTE is only an export instruction, which has
to be handled at the export framework level, not at the parser's.
---
lisp/org-element.el | 67 +++++++++-------------------------------
testing/lisp/test-org-element.el | 14 ---------
2 files changed, 15 insertions(+), 66 deletions(-)
--------------1.8.5.3
Content-Type: text/x-patch; name="0001-org-element-Do-not-parse-quote-sections-specially.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="0001-org-element-Do-not-parse-quote-sections-specially.patch"
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 0027f1f..92eff3a 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -31,13 +31,12 @@
;;
;; An element always starts and ends at the beginning of a line. With
;; a few exceptions (`clock', `headline', `inlinetask', `item',
-;; `planning', `node-property', `quote-section' `section' and
-;; `table-row' types), it can also accept a fixed set of keywords as
-;; attributes. Those are called "affiliated keywords" to distinguish
-;; them from other keywords, which are full-fledged elements. Almost
-;; all affiliated keywords are referenced in
-;; `org-element-affiliated-keywords'; the others are export attributes
-;; and start with "ATTR_" prefix.
+;; `planning', `node-property', `section' and `table-row' types), it
+;; can also accept a fixed set of keywords as attributes. Those are
+;; called "affiliated keywords" to distinguish them from other
+;; keywords, which are full-fledged elements. Almost all affiliated
+;; keywords are referenced in `org-element-affiliated-keywords'; the
+;; others are export attributes and start with "ATTR_" prefix.
;;
;; Element containing other elements (and only elements) are called
;; greater elements. Concerned types are: `center-block', `drawer',
@@ -48,10 +47,9 @@
;; Other element types are: `babel-call', `clock', `comment',
;; `comment-block', `diary-sexp', `example-block', `export-block',
;; `fixed-width', `horizontal-rule', `keyword', `latex-environment',
-;; `node-property', `paragraph', `planning', `quote-section',
-;; `src-block', `table', `table-row' and `verse-block'. Among them,
-;; `paragraph' and `verse-block' types can contain Org objects and
-;; plain text.
+;; `node-property', `paragraph', `planning', `src-block', `table',
+;; `table-row' and `verse-block'. Among them, `paragraph' and
+;; `verse-block' types can contain Org objects and plain text.
;;
;; Objects are related to document's contents. Some of them are
;; recursive. Associated types are of the following: `bold', `code',
@@ -178,7 +176,7 @@ is not sufficient to know if point is at a paragraph ending. See
dynamic-block example-block export-block fixed-width
footnote-definition headline horizontal-rule inlinetask item
keyword latex-environment node-property paragraph plain-list
- planning property-drawer quote-block quote-section section
+ planning property-drawer quote-block section
special-block src-block table table-row verse-block)
"Complete list of element types.")
@@ -2295,37 +2293,6 @@ CONTENTS is nil."
" "))
-;;;; Quote Section
-
-(defun org-element-quote-section-parser (limit)
- "Parse a quote section.
-
-LIMIT bounds the search.
-
-Return a list whose CAR is `quote-section' and CDR is a plist
-containing `:begin', `:end', `:value' and `:post-blank' keywords.
-
-Assume point is at beginning of the section."
- (save-excursion
- (let* ((begin (point))
- (end (progn (org-with-limited-levels (outline-next-heading))
- (point)))
- (pos-before-blank (progn (skip-chars-backward " \r\t\n")
- (forward-line)
- (point)))
- (value (buffer-substring-no-properties begin pos-before-blank)))
- (list 'quote-section
- (list :begin begin
- :end end
- :value value
- :post-blank (count-lines pos-before-blank end))))))
-
-(defun org-element-quote-section-interpreter (quote-section contents)
- "Interpret QUOTE-SECTION element as Org syntax.
-CONTENTS is nil."
- (org-element-property :value quote-section))
-
-
;;;; Src Block
(defun org-element-src-block-parser (limit affiliated)
@@ -3812,7 +3779,7 @@ CONTENTS is nil."
;; are activated for fixed element chaining (i.e. `plain-list' >
;; `item') or fixed conditional element chaining (i.e. `headline' >
;; `section'). Special modes are: `first-section', `item',
-;; `node-property', `quote-section', `section' and `table-row'.
+;; `node-property', `section' and `table-row'.
(defun org-element--current-element
(limit &optional granularity special structure)
@@ -3833,8 +3800,8 @@ nil), secondary values will not be parsed, since they only
contain objects.
Optional argument SPECIAL, when non-nil, can be either
-`first-section', `item', `node-property', `quote-section',
-`section', and `table-row'.
+`first-section', `item', `node-property', `section', and
+`table-row'.
If STRUCTURE isn't provided but SPECIAL is set to `item', it will
be computed.
@@ -3860,7 +3827,6 @@ element it has to parse."
(org-element-headline-parser limit raw-secondary-p))
;; Sections (must be checked after headline).
((eq special 'section) (org-element-section-parser limit))
- ((eq special 'quote-section) (org-element-quote-section-parser limit))
((eq special 'first-section)
(org-element-section-parser
(or (save-excursion (org-with-limited-levels (outline-next-heading)))
@@ -4296,8 +4262,7 @@ looking into captions:
"Parse elements between BEG and END positions.
SPECIAL prioritize some elements over the others. It can be set
-to `first-section', `quote-section', `section' `item' or
-`table-row'.
+to `first-section', `section' `item' or `table-row'.
When value is `item', STRUCTURE will be used as the current list
structure.
@@ -4347,9 +4312,7 @@ Elements are accumulated into ACC."
cbeg (org-element-property :contents-end element)
;; Possibly switch to a special mode.
(case type
- (headline
- (if (org-element-property :quotedp element) 'quote-section
- 'section))
+ (headline 'section)
(plain-list 'item)
(property-drawer 'node-property)
(table 'table-row))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 7bf0c43..39bb1e5 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1712,20 +1712,6 @@ Outside list"
(= (org-element-property :end (org-element-at-point)) (point-max)))))
-;;;; Quote Section
-
-(ert-deftest test-org-element/quote-section-parser ()
- "Test `quote-section' parser."
- (should
- (let ((org-quote-string "QUOTE"))
- (org-test-with-temp-text "* QUOTE Headline\nBody"
- (org-element-map (org-element-parse-buffer) 'quote-section 'identity))))
- (should-not
- (let ((org-quote-string "TEST"))
- (org-test-with-temp-text "* QUOTE Headline\nBody"
- (org-element-map (org-element-parse-buffer) 'quote-section 'identity)))))
-
-
;;;; Radio Target
(ert-deftest test-org-element/radio-target-parser ()
--------------1.8.5.3--
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ox-Handle-quote-sections-internally.patch --]
[-- Type: text/x-diff, Size: 5018 bytes --]
From 1e53a35cadcdd209fc779da0c26563938bc8a1ad Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sun, 26 Jan 2014 14:19:22 +0100
Subject: [PATCH 2/4] ox: Handle quote sections internally
To: n.goaziou@gmail.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.5.3"
This is a multi-part message in MIME format.
--------------1.8.5.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
* lisp/ox.el (org-export--remove-uninterpreted-data-1): Handle quote
sections.
(org-export-filter-quote-section-functions): Remove variable.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.
---
lisp/ox.el | 30 +++++++++++++++++++-----------
testing/lisp/test-ox.el | 11 +++++++++++
2 files changed, 30 insertions(+), 11 deletions(-)
--------------1.8.5.3
Content-Type: text/x-patch; name="0002-ox-Handle-quote-sections-internally.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="0002-ox-Handle-quote-sections-internally.patch"
diff --git a/lisp/ox.el b/lisp/ox.el
index 28aed70..ad2780b 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -221,7 +221,6 @@ way they are handled must be hard-coded into
(:filter-planning . org-export-filter-planning-functions)
(:filter-property-drawer . org-export-filter-property-drawer-functions)
(:filter-quote-block . org-export-filter-quote-block-functions)
- (:filter-quote-section . org-export-filter-quote-section-functions)
(:filter-radio-target . org-export-filter-radio-target-functions)
(:filter-section . org-export-filter-section-functions)
(:filter-special-block . org-export-filter-special-block-functions)
@@ -2314,8 +2313,8 @@ DATA is a parse tree or a secondary string. INFO is a plist
containing export options. It is modified by side effect and
returned by the function."
(org-element-map data
- '(entity bold italic latex-environment latex-fragment strike-through
- subscript superscript underline)
+ '(entity bold italic latex-environment latex-fragment section
+ strike-through subscript superscript underline)
#'(lambda (blob)
(let ((new
(case (org-element-type blob)
@@ -2348,6 +2347,11 @@ returned by the function."
((latex-environment latex-fragment)
(and (eq (plist-get info :with-latex) 'verbatim)
(list (org-export-expand blob nil))))
+ ;; ... quote sections...
+ (section
+ (and (org-element-property :quotedp
+ (org-export-get-parent blob))
+ 'section))
;; ... sub/superscripts...
((subscript superscript)
(let ((sub/super-p (plist-get info :with-sub-superscript))
@@ -2367,10 +2371,20 @@ returned by the function."
(make-string
(org-element-property :post-blank blob)
?\s)))))))))))
- (when new
+ (cond
+ ((eq new 'section)
+ ;; Treat quote sections specially: replace their contents
+ ;; with a single example block.
+ (let ((example (list 'example-block nil)))
+ (org-element-put-property example :parent blob)
+ (org-element-put-property
+ example :value
+ (org-element-interpret-data (org-element-contents blob)))
+ (org-element-set-contents blob example)))
+ (new
;; Splice NEW at BLOB location in parse tree.
(dolist (e new) (org-element-insert-before e blob))
- (org-element-extract-element blob))))
+ (org-element-extract-element blob)))))
info)
;; Return modified parse tree.
data)
@@ -2654,12 +2668,6 @@ data, as a string, the back-end, as a symbol, and the
communication channel, as a plist. It must return a string or
nil.")
-(defvar org-export-filter-quote-section-functions nil
- "List of functions applied to a transcoded quote-section.
-Each filter is called with three arguments: the transcoded data,
-as a string, the back-end, as a symbol, and the communication
-channel, as a plist. It must return a string or nil.")
-
(defvar org-export-filter-section-functions nil
"List of functions applied to a transcoded section.
Each filter is called with three arguments: the transcoded data,
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 78347af..168dc24 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -642,6 +642,17 @@ Paragraph <2012-03-29 Thu>[2012-03-29 Thu]"
(paragraph . (lambda (p c i) c))
(section . (lambda (s c i) c))))
nil nil nil '(:with-latex verbatim)))))
+ ;; Quote sections.
+ (should
+ (equal "Success!\n"
+ (org-test-with-temp-text "* QUOTE Headline\na *b* c"
+ (org-export-as
+ (org-export-create-backend
+ :transcoders '((bold . (lambda (b c i) "Failure."))
+ (headline . (lambda (h c i) c))
+ (paragraph . (lambda (p c i) c))
+ (section . (lambda (s c i) c))
+ (example-block . (lambda (e c i) "Success!"))))))))
;; Sub/superscript.
(should
(equal "adummy\n"
--------------1.8.5.3--
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Export-back-ends-Remove-quote-section-translators.patch --]
[-- Type: text/x-diff, Size: 9534 bytes --]
From 4d50d999b6bda3d904d41cc03b941bf0ba87cc17 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sun, 26 Jan 2014 14:23:32 +0100
Subject: [PATCH 3/4] Export back-ends: Remove quote section translators
To: n.goaziou@gmail.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.5.3"
This is a multi-part message in MIME format.
--------------1.8.5.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
* lisp/ox-ascii.el (org-ascii--current-text-width): Remove
`quote-section' reference.
(org-ascii-quote-section): Remove function.
* lisp/ox-html.el (org-html-quote-section): Remove function.
* lisp/ox-man.el (org-man-quote-section): Remove function.
* lisp/ox-md.el (org-md-quote-section): Remove function.
* lisp/ox-odt.el (org-odt-quote-section): Remove function.
* lisp/ox-org.el (org-org-quote-section): Remove function.
* lisp/ox-texinfo.el (org-texinfo-quote-section): Remove function.
---
lisp/ox-ascii.el | 26 +++-----------------------
lisp/ox-html.el | 10 ----------
lisp/ox-latex.el | 11 -----------
lisp/ox-man.el | 10 ----------
lisp/ox-md.el | 1 -
lisp/ox-odt.el | 11 -----------
lisp/ox-org.el | 1 -
lisp/ox-texinfo.el | 10 ----------
8 files changed, 3 insertions(+), 77 deletions(-)
--------------1.8.5.3
Content-Type: text/x-patch; name="0003-Export-back-ends-Remove-quote-section-translators.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="0003-Export-back-ends-Remove-quote-section-translators.patch"
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el
index 5247156..2c62bb8 100644
--- a/lisp/ox-ascii.el
+++ b/lisp/ox-ascii.el
@@ -78,7 +78,6 @@
(planning . org-ascii-planning)
(property-drawer . org-ascii-property-drawer)
(quote-block . org-ascii-quote-block)
- (quote-section . org-ascii-quote-section)
(radio-target . org-ascii-radio-target)
(section . org-ascii-section)
(special-block . org-ascii-special-block)
@@ -504,11 +503,11 @@ INFO is a plist used as a communication channel."
(if low-level-rank (* low-level-rank 2)
org-ascii-inner-margin))))))))
(- total-width
- ;; Each `quote-block', `quote-section' and `verse-block' above
- ;; narrows text width by twice the standard margin size.
+ ;; Each `quote-block' and `verse-block' above narrows text
+ ;; width by twice the standard margin size.
(+ (* (loop for parent in genealogy
when (memq (org-element-type parent)
- '(quote-block quote-section verse-block))
+ '(quote-block verse-block))
count parent)
2 org-ascii-quote-margin)
;; Text width within a plain-list is restricted by
@@ -1511,25 +1510,6 @@ holding contextual information."
(org-ascii--indent-string contents org-ascii-quote-margin))
-;;;; Quote Section
-
-(defun org-ascii-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to ASCII.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((width (org-ascii--current-text-width quote-section info))
- (value
- (org-export-data
- (org-remove-indentation (org-element-property :value quote-section))
- info)))
- (org-ascii--indent-string
- value
- (+ org-ascii-quote-margin
- ;; Don't apply inner margin if parent headline is low level.
- (let ((headline (org-export-get-parent-headline quote-section)))
- (if (org-export-low-level-p headline info) 0
- org-ascii-inner-margin))))))
-
-
;;;; Radio Target
(defun org-ascii-radio-target (radio-target contents info)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 2aad8cb..5ceea71 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -79,7 +79,6 @@
(planning . org-html-planning)
(property-drawer . org-html-property-drawer)
(quote-block . org-html-quote-block)
- (quote-section . org-html-quote-section)
(radio-target . org-html-radio-target)
(section . org-html-section)
(special-block . org-html-special-block)
@@ -3050,15 +3049,6 @@ CONTENTS holds the contents of the block. INFO is a plist
holding contextual information."
(format "<blockquote>\n%s</blockquote>" contents))
-;;;; Quote Section
-
-(defun org-html-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to HTML.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (format "<pre>\n%s</pre>" value))))
-
;;;; Section
(defun org-html-section (section contents info)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index cad80c9..5815874 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -72,7 +72,6 @@
(planning . org-latex-planning)
(property-drawer . org-latex-property-drawer)
(quote-block . org-latex-quote-block)
- (quote-section . org-latex-quote-section)
(radio-target . org-latex-radio-target)
(section . org-latex-section)
(special-block . org-latex-special-block)
@@ -2097,16 +2096,6 @@ holding contextual information."
(format "\\begin{quote}\n%s\\end{quote}" contents)))
-;;;; Quote Section
-
-(defun org-latex-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to LaTeX.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (format "\\begin{verbatim}\n%s\\end{verbatim}" value))))
-
-
;;;; Radio Target
(defun org-latex-radio-target (radio-target text info)
diff --git a/lisp/ox-man.el b/lisp/ox-man.el
index e4e37e5..a3f6490 100644
--- a/lisp/ox-man.el
+++ b/lisp/ox-man.el
@@ -83,7 +83,6 @@
(planning . org-man-planning)
(property-drawer . org-man-property-drawer)
(quote-block . org-man-quote-block)
- (quote-section . org-man-quote-section)
(radio-target . org-man-radio-target)
(section . org-man-section)
(special-block . org-man-special-block)
@@ -750,15 +749,6 @@ holding contextual information."
quote-block
(format ".RS\n%s\n.RE" contents)))
-;;; Quote Section
-
-(defun org-man-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to Man.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (format ".RS\\fI%s\\fP\n.RE\n" value))))
-
;;; Radio Target
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 53f883d..e725ef9 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -90,7 +90,6 @@ This variable can be set to either `atx' or `setext'."
(plain-text . org-md-plain-text)
(property-drawer . org-md-property-drawer)
(quote-block . org-md-quote-block)
- (quote-section . org-md-example-block)
(section . org-md-section)
(src-block . org-md-example-block)
(template . org-md-template)
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index f920fc8..9b28168 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -66,7 +66,6 @@
(planning . org-odt-planning)
(property-drawer . org-odt-property-drawer)
(quote-block . org-odt-quote-block)
- (quote-section . org-odt-quote-section)
(radio-target . org-odt-radio-target)
(section . org-odt-section)
(special-block . org-odt-special-block)
@@ -2998,16 +2997,6 @@ holding contextual information."
contents)
-;;;; Quote Section
-
-(defun org-odt-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to ODT.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (org-odt-do-format-code value))))
-
-
;;;; Section
(defun org-odt-format-section (text style &optional name)
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index c976eb3..cd5bf20 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -86,7 +86,6 @@ setting of `org-html-htmlize-output-type' is 'css."
(planning . org-org-identity)
(property-drawer . org-org-identity)
(quote-block . org-org-identity)
- (quote-section . org-org-identity)
(radio-target . org-org-identity)
(section . org-org-identity)
(special-block . org-org-identity)
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index ca7e891..2075bea 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -96,7 +96,6 @@
(planning . org-texinfo-planning)
(property-drawer . org-texinfo-property-drawer)
(quote-block . org-texinfo-quote-block)
- (quote-section . org-texinfo-quote-section)
(radio-target . org-texinfo-radio-target)
(section . org-texinfo-section)
(special-block . org-texinfo-special-block)
@@ -1437,15 +1436,6 @@ holding contextual information."
(format " %s" title)))))
(format "%s\n%s@end quotation" start-quote contents)))
-;;; Quote Section
-
-(defun org-texinfo-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to Texinfo.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (format "@verbatim\n%s@end verbatim" value))))
-
;;; Radio Target
(defun org-texinfo-radio-target (radio-target text info)
--------------1.8.5.3--
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-ox-groff-Remove-quote-section-translator.patch --]
[-- Type: text/x-diff, Size: 1944 bytes --]
From 2c7179c43596d02130f49de9ca367be6568967ec Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sun, 26 Jan 2014 14:29:25 +0100
Subject: [PATCH 4/4] ox-groff: Remove quote section translator
To: n.goaziou@gmail.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.8.5.3"
This is a multi-part message in MIME format.
--------------1.8.5.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
* contrib/lisp/ox-groff.el (org-groff-quote-section): Remove function.
---
contrib/lisp/ox-groff.el | 10 ----------
1 file changed, 10 deletions(-)
--------------1.8.5.3
Content-Type: text/x-patch; name="0004-ox-groff-Remove-quote-section-translator.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="0004-ox-groff-Remove-quote-section-translator.patch"
diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el
index 249e254..f74bb14 100644
--- a/contrib/lisp/ox-groff.el
+++ b/contrib/lisp/ox-groff.el
@@ -77,7 +77,6 @@
(planning . org-groff-planning)
(property-drawer . org-groff-property-drawer)
(quote-block . org-groff-quote-block)
- (quote-section . org-groff-quote-section)
(radio-target . org-groff-radio-target)
(section . org-groff-section)
(special-block . org-groff-special-block)
@@ -1457,15 +1456,6 @@ holding contextual information."
quote-block
(format ".DS I\n.I\n%s\n.R\n.DE" contents)))
-;;; Quote Section
-
-(defun org-groff-quote-section (quote-section contents info)
- "Transcode a QUOTE-SECTION element from Org to Groff.
-CONTENTS is nil. INFO is a plist holding contextual information."
- (let ((value (org-remove-indentation
- (org-element-property :value quote-section))))
- (when value (format ".DS L\n\\fI%s\\fP\n.DE\n" value))))
-
;;; Radio Target
(defun org-groff-radio-target (radio-target text info)
--------------1.8.5.3--
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 13:57 [RFC] Make QUOTE an export keyword instead of an element type Nicolas Goaziou
@ 2014-01-26 15:41 ` Thomas S. Dye
2014-01-26 16:58 ` Rasmus
2014-01-26 22:03 ` Bastien
2 siblings, 0 replies; 31+ messages in thread
From: Thomas S. Dye @ 2014-01-26 15:41 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List
Aloha Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> At the moment, they are parsed specially by Org Elements, but I think it
> is a mistake. Like "COMMENT" keyword in headlines, "QUOTE" is more an
> instruction for the export framework. Therefore, they should be parsed
> as regular sections, and treated specially during export. The following
> patches permit it, in 3 steps:
>
> 1. Remove special parsing from "org-element.el",
> 2. Turn section contents into a big example block.
> 3. Remove quote section translators from export back-ends (contrib
> directory handled separately)
>
> This change implies that any quote-section translator and filter is
> ignored (but it will not generate an error if present). It also means
> that an export back-end cannot tell the difference between an example
> block and a quote section.
>
> Since quote sections were treated as example blocks (except in
> ox-ascii.el), the export behaviour will remain unchanged (except in
> ox-ascii.el).
>
> Alternatives:
>
> - Treat their contents as `quote-blocks' instead of `example-block'
> - Remove them altogether, since they don't bring anything new.
I didn't know about this undocumented feature. Since it doesn't bring
anything new, I'm fine with removing it altogether.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 13:57 [RFC] Make QUOTE an export keyword instead of an element type Nicolas Goaziou
2014-01-26 15:41 ` Thomas S. Dye
@ 2014-01-26 16:58 ` Rasmus
2014-01-26 21:07 ` Nick Dokos
2014-01-26 22:03 ` Bastien
2 siblings, 1 reply; 31+ messages in thread
From: Rasmus @ 2014-01-26 16:58 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Alternatives:
>
> - Treat their contents as `quote-blocks' instead of `example-block'
> - Remove them altogether, since they don't bring anything new.
>
> As a side note, if they are here to stay, it would be good to document
> them.
>
> WDYT?
I'd be happy to see it go. I'm happy to reserve the space before the
"section-name" for TODO-like words (that is COMMENT can also go IMO).
–Rasmus
--
May contains speling mistake
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 16:58 ` Rasmus
@ 2014-01-26 21:07 ` Nick Dokos
2014-01-26 21:42 ` Samuel Wales
0 siblings, 1 reply; 31+ messages in thread
From: Nick Dokos @ 2014-01-26 21:07 UTC (permalink / raw)
To: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Alternatives:
>>
>> - Treat their contents as `quote-blocks' instead of `example-block'
>> - Remove them altogether, since they don't bring anything new.
>>
>> As a side note, if they are here to stay, it would be good to document
>> them.
>>
>> WDYT?
>
> I'd be happy to see it go. I'm happy to reserve the space before the
> "section-name" for TODO-like words (that is COMMENT can also go IMO).
>
I agree. Getting rid of COMMENT also sounds reasonable to me although
that might produce more backward compatibility problems since it's more
likely to have been used. But since the functionality is easily
achievable (through :noexport: tags and #+BEGIN_COMMENT/#+END_COMMENT
blocks e.g. - one can even add a :comment: tag to the EXCLUDE set if so
desired), it should be possible to deprecate it for a while, and then get
rid of it. As an added bonus, we can then get rid of one of the (iirc)
"questionable" keydefs: C-c ; won't have anything to do.
--
Nick
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 13:57 [RFC] Make QUOTE an export keyword instead of an element type Nicolas Goaziou
2014-01-26 15:41 ` Thomas S. Dye
2014-01-26 16:58 ` Rasmus
@ 2014-01-26 22:03 ` Bastien
2014-01-26 23:42 ` Nick Dokos
2014-01-27 5:46 ` Carsten Dominik
2 siblings, 2 replies; 31+ messages in thread
From: Bastien @ 2014-01-26 22:03 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List
Hi Nicolas,
I think removing QUOTE won't hurt that much.
PS: Removing COMMENT would be more problematic, as it is very handy
to temporarily prevent a section from being exported or tangled.
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 22:03 ` Bastien
@ 2014-01-26 23:42 ` Nick Dokos
2014-01-27 1:29 ` Rasmus
2014-01-27 10:06 ` Sebastien Vauban
2014-01-27 5:46 ` Carsten Dominik
1 sibling, 2 replies; 31+ messages in thread
From: Nick Dokos @ 2014-01-26 23:42 UTC (permalink / raw)
To: emacs-orgmode
Bastien <bzg@gnu.org> writes:
> PS: Removing COMMENT would be more problematic, as it is very handy
> to temporarily prevent a section from being exported or tangled.
Doesn't a :noexport: tag do exactly that? (not sure about tangling
actually, but that should be not be a big problem.) Why are two
mechanisms needed?
--
Nick
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 23:42 ` Nick Dokos
@ 2014-01-27 1:29 ` Rasmus
2014-01-27 10:06 ` Sebastien Vauban
1 sibling, 0 replies; 31+ messages in thread
From: Rasmus @ 2014-01-27 1:29 UTC (permalink / raw)
To: emacs-orgmode
Nick Dokos <ndokos@gmail.com> writes:
> Bastien <bzg@gnu.org> writes:
>
>> PS: Removing COMMENT would be more problematic, as it is very handy
>> to temporarily prevent a section from being exported or tangled.
>
> Doesn't a :noexport: tag do exactly that? (not sure about tangling
> actually, but that should be not be a big problem.) Why are two
> mechanisms needed?
My thought exactly. You could even bind whatever keybinding COMMENT
is on to toggle a noexport tag.
Anyway, COMMENT discussions are slightly off topic.
Rasmus
--
The Kids call him Billy the Saint
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 23:42 ` Nick Dokos
2014-01-27 1:29 ` Rasmus
@ 2014-01-27 10:06 ` Sebastien Vauban
2014-01-27 10:20 ` Thorsten Jolitz
1 sibling, 1 reply; 31+ messages in thread
From: Sebastien Vauban @ 2014-01-27 10:06 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Nick Dokos wrote:
> Bastien <bzg-mXXj517/zsQ@public.gmane.org> writes:
>
>> PS: Removing COMMENT would be more problematic, as it is very handy
>> to temporarily prevent a section from being exported or tangled.
>
> Doesn't a :noexport: tag do exactly that? (not sure about tangling
> actually, but that should be not be a big problem.) Why are two
> mechanisms needed?
There a some differences, as a COMMENT section will never execute any
Babel code block inside it (it's like it did not exist at all),
while :noexport: still will.
Of course, we can wonder whether that particularity of COMMENT couldn't
or shouldn't be transported to :noexport: as well (or something extra,
such a :donothing:).
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-27 10:06 ` Sebastien Vauban
@ 2014-01-27 10:20 ` Thorsten Jolitz
0 siblings, 0 replies; 31+ messages in thread
From: Thorsten Jolitz @ 2014-01-27 10:20 UTC (permalink / raw)
To: emacs-orgmode
"Sebastien Vauban" <sva-news@mygooglest.com>
writes:
> Of course, we can wonder whether that particularity of COMMENT couldn't
> or shouldn't be transported to :noexport: as well (or something extra,
> such a :donothing:).
A :donothing tag or property seems more logical to me than a COMMENT
keyword that is somehow a special case in the syntax.
--
cheers,
Thorsten
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-26 22:03 ` Bastien
2014-01-26 23:42 ` Nick Dokos
@ 2014-01-27 5:46 ` Carsten Dominik
2014-01-27 11:12 ` Nicolas Goaziou
1 sibling, 1 reply; 31+ messages in thread
From: Carsten Dominik @ 2014-01-27 5:46 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Nicolas Goaziou
On 26 Jan 2014, at 23:03, Bastien <bzg@gnu.org> wrote:
> Hi Nicolas,
>
> I think removing QUOTE won't hurt that much.
I agree. I would also like to see it removed.
>
> PS: Removing COMMENT would be more problematic, as it is very handy
> to temporarily prevent a section from being exported or tangled.
Well, I am one person who does use COMMENT, and some of my COMMENT sections contain remarks and that should never make it into an exported file. My preference would be to keep this, for reasons of backward compatibility.
- Carsten
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-27 5:46 ` Carsten Dominik
@ 2014-01-27 11:12 ` Nicolas Goaziou
2014-01-27 11:21 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-01-27 11:12 UTC (permalink / raw)
To: Carsten Dominik; +Cc: Bastien, Org Mode List
Hello,
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On 26 Jan 2014, at 23:03, Bastien <bzg@gnu.org> wrote:
>
>> I think removing QUOTE won't hurt that much.
>
> I agree. I would also like to see it removed.
There seems to be a consensus around it. The last question is: master or
maint?
It's not a bugfix, more like a spring clean, but there's a risk of
having an obsolete feature in the wild for some time. FWIW I lean
towards the "master" side, since it is undocumented.
WDYT?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-27 11:12 ` Nicolas Goaziou
@ 2014-01-27 11:21 ` Bastien
2014-01-27 20:45 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-01-27 11:21 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> There seems to be a consensus around it. The last question is: master or
> maint?
I'm for pushing the change to master and documenting this feature in
maint as being obsolete.
> It's not a bugfix, more like a spring clean, but there's a risk of
> having an obsolete feature in the wild for some time. FWIW I lean
> towards the "master" side, since it is undocumented.
... and unused. I don't think there is a risk that users suddenly use
this feature if it's undocumented, and documenting it as obsolete can
count as a bugfix for later Emacs merge.
2 cents,
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-27 11:21 ` Bastien
@ 2014-01-27 20:45 ` Nicolas Goaziou
2014-01-28 8:52 ` Bastien
2014-01-31 15:44 ` Bastien
0 siblings, 2 replies; 31+ messages in thread
From: Nicolas Goaziou @ 2014-01-27 20:45 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Hello,
Bastien <bzg@gnu.org> writes:
> I'm for pushing the change to master
Done
> and documenting this feature in maint as being obsolete.
I added a few notes in ORG-NEWS. Feel free to complete them.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-27 20:45 ` Nicolas Goaziou
@ 2014-01-28 8:52 ` Bastien
2014-01-31 15:44 ` Bastien
1 sibling, 0 replies; 31+ messages in thread
From: Bastien @ 2014-01-28 8:52 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> I'm for pushing the change to master
>
> Done
Thanks!
>> and documenting this feature in maint as being obsolete.
>
> I added a few notes in ORG-NEWS. Feel free to complete them.
I will review ORG-NEWS before the next release, thanks.
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-27 20:45 ` Nicolas Goaziou
2014-01-28 8:52 ` Bastien
@ 2014-01-31 15:44 ` Bastien
2014-02-01 13:24 ` Nicolas Goaziou
1 sibling, 1 reply; 31+ messages in thread
From: Bastien @ 2014-01-31 15:44 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> I'm for pushing the change to master
>
> Done
I don't think `org-toggle-fixed-width-section' should be deleted
entirely, as fixed-width text is still supported in this form:
: Some text
and using C-c : is very handy.
What do you think?
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-01-31 15:44 ` Bastien
@ 2014-02-01 13:24 ` Nicolas Goaziou
2014-02-01 22:43 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-01 13:24 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Hello,
Bastien <bzg@gnu.org> writes:
> I don't think `org-toggle-fixed-width-section' should be deleted
> entirely, as fixed-width text is still supported in this form:
>
> : Some text
>
> and using C-c : is very handy.
>
> What do you think?
I tend to use rectangular regions for that.
Anyway, I removed it because, even if we want to keep it, it needs to be
rewritten, using parser and unit tests. It also needs to be renamed.
If we don't need C-c : binding, it is possible to re-implement it.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-01 13:24 ` Nicolas Goaziou
@ 2014-02-01 22:43 ` Bastien
2014-02-02 21:40 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-02-01 22:43 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Anyway, I removed it because, even if we want to keep it, it needs to be
> rewritten, using parser and unit tests. It also needs to be renamed.
>
> If we don't need C-c : binding, it is possible to re-implement it.
Yes, that'd be nice, thanks.
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-01 22:43 ` Bastien
@ 2014-02-02 21:40 ` Nicolas Goaziou
2014-02-02 22:20 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-02 21:40 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Hello,
Bastien <bzg@gnu.org> writes:
> Yes, that'd be nice, thanks.
Then it would be good to define precise specifications for it.
For example, without a region, and not at an example block, it would
probably turn the current line into a fixed-width area line. But that
doesn't make sense if the line is in a verbatim area, e.g., an example
block. An error could be returned then.
Region handling is a bit more complex. What happens if the region
doesn't start or end at the beginning of a line ? What happens if the
region contains both a fixed-width area and regular lines ?
Would you have any ideas about it?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-02 21:40 ` Nicolas Goaziou
@ 2014-02-02 22:20 ` Bastien
2014-02-03 11:20 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-02-02 22:20 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> For example, without a region, and not at an example block, it would
> probably turn the current line into a fixed-width area line.
Yes.
> But that doesn't make sense if the line is in a verbatim area, e.g.,
> an example block. An error could be returned then.
Yes, a user-error.
> Region handling is a bit more complex. What happens if the region
> doesn't start or end at the beginning of a line ?
Then we fix the region to start at the beginning of line before the
beginning (or point), and at the beginning of line before the end (or
point).
> What happens if the
> region contains both a fixed-width area and regular lines ?
The same than when there is no fixed-width area: we convert the region
into fixed-width. Then converting back to a regular area will be easy
enough, and users are more likely to want this IMHO.
> Would you have any ideas about it?
Here you go. Thanks in advance for your work on this!
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-02 22:20 ` Bastien
@ 2014-02-03 11:20 ` Nicolas Goaziou
2014-02-03 14:59 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-03 11:20 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Hello,
Bastien <bzg@gnu.org> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> What happens if the region contains both a fixed-width area and
>> regular lines ?
>
> The same than when there is no fixed-width area: we convert the region
> into fixed-width. Then converting back to a regular area will be easy
> enough, and users are more likely to want this IMHO.
So, to be clear, assuming the region encompasses everything,
: text
: text
* Headline
paragraph
paragraph
becomes
: : text
: : text
:
: * Headline
:
: paragraph
: paragraph
and
paragraph
paragraph
: text
: text
becomes
: paragraph
: paragraph
:
: : text
: : text
Is that correct?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-03 11:20 ` Nicolas Goaziou
@ 2014-02-03 14:59 ` Bastien
2014-02-03 15:08 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-02-03 14:59 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> So, to be clear, assuming the region encompasses everything,
>
> : text
> : text
>
> * Headline
>
> paragraph
> paragraph
>
> becomes
>
> : : text
> : : text
> :
> : * Headline
> :
> : paragraph
> : paragraph
>
> and
>
> paragraph
> paragraph
>
> : text
> : text
>
> becomes
>
> : paragraph
> : paragraph
> :
> : : text
> : : text
>
> Is that correct?
No -- sorry. My suggestion is that this region
Some text
: and some fixed line
becomes
: Some text
: and some fixed line
If people want the behavior you describe, then using `C-x r t'
will do. Otherwise, they will want the whole region to be converted
into a fixed-width region.
What do you think?
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-03 14:59 ` Bastien
@ 2014-02-03 15:08 ` Nicolas Goaziou
2014-02-03 15:36 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-03 15:08 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Bastien <bzg@gnu.org> writes:
> No -- sorry. My suggestion is that this region
>
> Some text
> : and some fixed line
>
> becomes
>
> : Some text
> : and some fixed line
>
> If people want the behavior you describe, then using `C-x r t'
> will do. Otherwise, they will want the whole region to be converted
> into a fixed-width region.
>
> What do you think?
Specifications for regions are still not clear.
Will
: and some fixed line
Some text
also become
: and some fixed line
: Some text
?
And what about headlines, e.g.
: and some fixed line
* Headline
Some text
or,
Some text
* Headline
: and some fixed line
Same question for verbatim blocks. What happens in the following region?
Some text
#+begin_example
contents
#+end_example
: and some fixed line
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-03 15:08 ` Nicolas Goaziou
@ 2014-02-03 15:36 ` Bastien
2014-02-03 15:45 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-02-03 15:36 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Will
>
> : and some fixed line
> Some text
>
> also become
>
> : and some fixed line
> : Some text
>
> ?
Yes, if beg and end of the region are in each of those two lines.
> And what about headlines, e.g.
>
> : and some fixed line
>
> * Headline
>
> Some text
becomes
: and some fixed line
:
: * Headline
:
: Some text
> or,
>
> Some text
>
> * Headline
>
> : and some fixed line
becomes
: Some text
:
: * Headline
:
: and some fixed line
> Same question for verbatim blocks. What happens in the following region?
>
> Some text
>
> #+begin_example
> contents
> #+end_example
>
> : and some fixed line
becomes
: Some text
:
: #+begin_example
: contents
: #+end_example
:
: and some fixed line
The baseline is this:
- always consider regions made of whole lines
- when all lines are fixed-width in the region, C-c : converts them to
regular text
- when zero or more (but not all) lines are fixed-width, converts all
lines to fixed-width lines, ignoring lines that are already fixed-width
Does that make more sense?
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-03 15:36 ` Bastien
@ 2014-02-03 15:45 ` Nicolas Goaziou
2014-02-03 22:41 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-03 15:45 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Bastien <bzg@altern.org> writes:
> The baseline is this:
>
> - always consider regions made of whole lines
>
> - when all lines are fixed-width in the region, C-c : converts them to
> regular text
>
> - when zero or more (but not all) lines are fixed-width, converts all
> lines to fixed-width lines, ignoring lines that are already fixed-width
>
> Does that make more sense?
It is clearer now, thank you. I'll send a patch later on the ML.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-03 15:45 ` Nicolas Goaziou
@ 2014-02-03 22:41 ` Nicolas Goaziou
2014-02-05 10:12 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-03 22:41 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> It is clearer now, thank you. I'll send a patch later on the ML.
Here is the function. If it is good enough, I'll add tests and wrap it
up in a patch.
#+begin_src emacs-lisp
(defun org-toggle-fixed-width ()
"Toggle fixed-width markup.
Add or remove fixed-width markup on current line, whenever it
makes sense. Return an error otherwise.
If a region is active and if it contains only fixed-width areas
or blank lines, remove all fixed-width markup in it. If the
region contains anything else, convert all non-fixed-width lines
to fixed-width ones."
(interactive)
(if (not (org-region-active-p))
(if (org-at-heading-p)
(user-error "Cannot insert a fixed-width line here")
(beginning-of-line)
(let* ((element (org-element-at-point))
(type (org-element-type element)))
(cond
((and (eq type 'fixed-width)
(looking-at "[ \t]*\\(:\\(?: \\|$\\)\\)"))
(replace-match
"" nil nil nil (if (= (line-end-position) (match-end 0)) 0 1)))
((and (eq type 'paragraph)
(<= (org-element-property :post-affiliated element) (point)))
(skip-chars-forward " \t")
(insert ": "))
((and (org-looking-at-p "[ \t]*$")
(or (memq type '(headline inlinetask))
(save-excursion
(skip-chars-forward " \r\t\n")
(<= (org-element-property :end element) (point)))))
(delete-region (point) (line-end-position))
(org-indent-line)
(insert ": "))
(t (user-error "Cannot insert a fixed-width line here")))))
(let* ((begin (save-excursion
(goto-char (region-beginning))
(line-beginning-position)))
(end (copy-marker
(save-excursion
(goto-char (region-end))
(unless (eolp) (beginning-of-line))
(if (save-excursion (re-search-backward "\\S-" begin t))
(progn (skip-chars-backward " \r\t\n") (point))
(point)))))
(all-fixed-width-p
(catch 'not-all-p
(save-excursion
(goto-char begin)
(skip-chars-forward " \r\t\n")
(when (eobp) (throw 'not-all-p nil))
(while (< (point) end)
(let ((element (org-element-at-point)))
(if (eq (org-element-type element) 'fixed-width)
(goto-char (org-element-property :end element))
(throw 'not-all-p nil))))
t))))
(if all-fixed-width-p
(save-excursion
(goto-char begin)
(while (< (point) end)
(when (looking-at "[ \t]*\\(:\\(?: \\|$\\)\\)")
(replace-match
"" nil nil nil
(if (= (line-end-position) (match-end 0)) 0 1)))
(forward-line)))
(let ((min-ind (point-max)))
;; Find minimum indentation across all lines.
(save-excursion
(goto-char begin)
(if (not (save-excursion (re-search-forward "\\S-" end t)))
(setq min-ind 0)
(catch 'zerop
(while (< (point) end)
(unless (org-looking-at-p "[ \t]*$")
(let ((ind (org-get-indentation)))
(setq min-ind (min min-ind ind))
(when (zerop ind) (throw 'zerop t))))
(forward-line)))))
;; Loop over all lines and add fixed-width markup everywhere
;; but in fixed-width lines.
(save-excursion
(goto-char begin)
(while (< (point) end)
(cond
((org-at-heading-p)
(insert ": ")
(forward-line)
(while (and (< (point) end) (org-looking-at-p "[ \t]*$"))
(insert ":")
(forward-line)))
((org-looking-at-p "[ \t]*:\\( \\|$\\)")
(let* ((element (org-element-at-point))
(element-end (org-element-property :end element)))
(if (eq (org-element-type element) 'fixed-width)
(progn (goto-char element-end)
(skip-chars-backward " \r\t\n")
(forward-line))
(let ((limit (min end element-end)))
(while (< (point) limit)
(let ((buffer-invisibility-spec nil))
(org-move-to-column min-ind t))
(insert ": ")
(forward-line))))))
(t
(let ((buffer-invisibility-spec nil))
(org-move-to-column min-ind t))
(insert ": ")
(forward-line)))))))
(set-marker end nil))))
#+end_src
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-03 22:41 ` Nicolas Goaziou
@ 2014-02-05 10:12 ` Bastien
2014-02-06 17:56 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-02-05 10:12 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Here is the function. If it is good enough, I'll add tests and wrap it
> up in a patch.
I don't think we should prevent users to convert a headline into a
fixed-width line. Also, better to use the IGNORE-INVISIBLE arg of
org-move-to-column IMO.
Otherwise works fine, thanks!
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-05 10:12 ` Bastien
@ 2014-02-06 17:56 ` Nicolas Goaziou
2014-02-06 22:00 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-06 17:56 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Hello,
Bastien <bzg@gnu.org> writes:
> I don't think we should prevent users to convert a headline into a
> fixed-width line.
True. I also allowed to turn one-line elements (keywords, clock,
planning) into fixed-width areas.
> Also, better to use the IGNORE-INVISIBLE arg of
> org-move-to-column IMO.
Done.
> Otherwise works fine, thanks!
Applied in master, with tests.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-06 17:56 ` Nicolas Goaziou
@ 2014-02-06 22:00 ` Bastien
2014-02-07 8:51 ` Nicolas Goaziou
0 siblings, 1 reply; 31+ messages in thread
From: Bastien @ 2014-02-06 22:00 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode List, Carsten Dominik
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> True. I also allowed to turn one-line elements (keywords, clock,
> planning) into fixed-width areas.
I see that turning a commented line is prevented, while turning
several commented lines is allowed. This feels weird. I don't
think we should prevent this.
What do you think?
> Applied in master, with tests.
Thanks for applying the patch.
--
Bastien
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [RFC] Make QUOTE an export keyword instead of an element type
2014-02-06 22:00 ` Bastien
@ 2014-02-07 8:51 ` Nicolas Goaziou
2014-02-07 9:10 ` Bastien
0 siblings, 1 reply; 31+ messages in thread
From: Nicolas Goaziou @ 2014-02-07 8:51 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode List, Carsten Dominik
Hello,
Bastien <bzg@gnu.org> writes:
> I see that turning a commented line is prevented, while turning
> several commented lines is allowed. This feels weird. I don't
> think we should prevent this.
>
> What do you think?
I don't think there's much point in comparing function's behaviours when
acting on a single line or on a region: they are very different. For
example, you can break the structure of an example block in the latter
case, but not in the former.
Anyway, in this particular case, I guess we could consider comments as
a stack of one line elements. I added the feature.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2014-02-07 9:10 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26 13:57 [RFC] Make QUOTE an export keyword instead of an element type Nicolas Goaziou
2014-01-26 15:41 ` Thomas S. Dye
2014-01-26 16:58 ` Rasmus
2014-01-26 21:07 ` Nick Dokos
2014-01-26 21:42 ` Samuel Wales
2014-01-26 22:03 ` Bastien
2014-01-26 23:42 ` Nick Dokos
2014-01-27 1:29 ` Rasmus
2014-01-27 10:06 ` Sebastien Vauban
2014-01-27 10:20 ` Thorsten Jolitz
2014-01-27 5:46 ` Carsten Dominik
2014-01-27 11:12 ` Nicolas Goaziou
2014-01-27 11:21 ` Bastien
2014-01-27 20:45 ` Nicolas Goaziou
2014-01-28 8:52 ` Bastien
2014-01-31 15:44 ` Bastien
2014-02-01 13:24 ` Nicolas Goaziou
2014-02-01 22:43 ` Bastien
2014-02-02 21:40 ` Nicolas Goaziou
2014-02-02 22:20 ` Bastien
2014-02-03 11:20 ` Nicolas Goaziou
2014-02-03 14:59 ` Bastien
2014-02-03 15:08 ` Nicolas Goaziou
2014-02-03 15:36 ` Bastien
2014-02-03 15:45 ` Nicolas Goaziou
2014-02-03 22:41 ` Nicolas Goaziou
2014-02-05 10:12 ` Bastien
2014-02-06 17:56 ` Nicolas Goaziou
2014-02-06 22:00 ` Bastien
2014-02-07 8:51 ` Nicolas Goaziou
2014-02-07 9:10 ` Bastien
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).