emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "R. Michael Weylandt" <michael.weylandt@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Prepare release 8.2.6
Date: Sun, 6 Apr 2014 21:48:59 -0400	[thread overview]
Message-ID: <CAAmySGM1D0reyx=o6U=vFS+pMbErfzDPk5ZiVp3hXXOEMYX5dQ@mail.gmail.com> (raw)
In-Reply-To: <87y4zj60vz.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

On Sat, Apr 5, 2014 at 3:18 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> "R. Michael Weylandt" <michael.weylandt@gmail.com> writes:
>
>>> 1) Tell Emacs not to break inline source blocks when filling paragraphs:
>
> I suggest not to use `org-in-regexp' here but `org-element-context'.

I'm not as familiar with org-element-context, but I think the attached
is what you had in mind.

> Besides inline source blocks, ISTR there was other places where filling
> was inappropriate (verbatim, code, export snippet, macro...). A single
> `org-element-context' will find them all.

Verbatim seems to work over multiple lines so I've left them out.
Macros and inline source blocks don't so I've included them. Not sure
what other elements to look at:

>
> Another option for the problem at hand is to simply remove newline
> characters in inline source blocks before executing them.
>

That might be better but would require a bit more work: at present,
inline source blocks can't extend over multiple lines so org wouldn't
recognize a construct like

src_python[:exports results]{1 + 2 +
3 + 4}

as an inline source block in the first place. Looking at
org-inline-src-block-regexp I'm not sure why though.

Patch also attached to improve link handling

Michael

[-- Attachment #2: 0001-org.el-Don-t-fill-on-inline-source-blocks-or-macros.patch --]
[-- Type: application/octet-stream, Size: 1828 bytes --]

From 03f58af1eba4550dd8f2500468ee852d52a89260 Mon Sep 17 00:00:00 2001
From: Michael Weylandt <michael.weylandt@gmail.com>
Date: Sun, 6 Apr 2014 21:19:56 -0400
Subject: [PATCH 1/2] org.el: Don't fill on inline source blocks or macros

* lisp/org.el (org-fill-element-nobreak-p): New function

* lisp/org.el (org-setup-filling): Add org-fill-element-nobreak-p to
  fill-nobreak-predicate

Org currently doesn't recognize inline source blocks or macros spread
over multiple lines so we need to keep Emacs from filling (line
wrapping) and breaking these elements.

TINYCHANGE
---
 lisp/org.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 318d95a..52ac8dd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -22246,7 +22246,8 @@ hierarchy of headlines by UP levels before marking the subtree."
      (org-uniquify
       (append fill-nobreak-predicate
 	      '(org-fill-line-break-nobreak-p
-		org-fill-paragraph-with-timestamp-nobreak-p)))))
+		org-fill-paragraph-with-timestamp-nobreak-p
+		org-fill-element-nobreak-p)))))
   (let ((paragraph-ending (substring org-element-paragraph-separate 1)))
     (org-set-local 'paragraph-start paragraph-ending)
     (org-set-local 'paragraph-separate paragraph-ending))
@@ -22268,6 +22269,12 @@ hierarchy of headlines by UP levels before marking the subtree."
   (and (org-at-timestamp-p t)
        (not (looking-at org-ts-regexp-both))))
 
+(defun org-fill-element-nobreak-p ()
+  "Non-nil when a new line at point would break an element which
+  cannot be split over multiple lines."
+  (member (car (org-element-context))
+	  '(inline-src-block macro)))
+
 (declare-function message-in-body-p "message" ())
 (defvar orgtbl-line-start-regexp) ; From org-table.el
 (defun org-adaptive-fill-function ()
-- 
1.8.3.4 (Apple Git-47)


[-- Attachment #3: 0002-org.el-Remove-and-from-org-link-escape-chars.patch --]
[-- Type: application/octet-stream, Size: 1118 bytes --]

From 7023f412093e1c17203c9959e929ad57557006f5 Mon Sep 17 00:00:00 2001
From: Michael Weylandt <michael.weylandt@gmail.com>
Date: Sun, 6 Apr 2014 21:37:12 -0400
Subject: [PATCH 2/2] org.el: Remove =, +, and ; from org-link-escape-chars

* org.el (org-link-escape-chars): Remove =, +, and ;

=, +, and ; are all valid URI characters (RFC 3986) and don't break
org's syntax so there's no need to escape them in link handling.

This fixes, e.g.,

(org-insert-link nil "http://google.com/search?q=orgmode" "Org mode")

which previously would produce an invalid URI in both the org file and
exported documents.

TINYCHANGE
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 52ac8dd..f883f56 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9740,7 +9740,7 @@ according to FMT (default from `org-email-link-description-format')."
 	  "]"))
 
 (defconst org-link-escape-chars
-  '(?\ ?\[ ?\] ?\; ?\= ?\+)
+  '(?\ ?\[ ?\])
   "List of characters that should be escaped in link.
 This is the list that is used for internal purposes.")
 
-- 
1.8.3.4 (Apple Git-47)


  reply	other threads:[~2014-04-07  1:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03  6:37 Prepare release 8.2.6 Bastien
2014-04-04  9:05 ` Sebastien Vauban
2014-04-04 11:51 ` Michael Weylandt
2014-04-05 16:41   ` R. Michael Weylandt
2014-04-05 19:18     ` Nicolas Goaziou
2014-04-07  1:48       ` R. Michael Weylandt [this message]
2014-04-07 10:19         ` Nicolas Goaziou
2014-04-17 19:58           ` Bastien
2014-04-04 14:32 ` Michael Weylandt
2014-04-05 16:45   ` R. Michael Weylandt
2014-04-05 19:27     ` Nicolas Goaziou
2014-04-05 21:48       ` York Zhao
2014-04-06 17:51       ` R. Michael Weylandt
2014-04-06 18:03         ` Nicolas Goaziou
2014-04-11  2:43         ` Eric Schulte
2014-04-13 17:02           ` R. Michael Weylandt
2014-04-17  6:26             ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2014-04-03  7:53 Bastien
2014-04-03  9:17 ` Alan Schmitt
2014-04-03 10:13 ` KDr2
2014-04-03 11:47 ` Rainer M Krug
2014-04-18 12:04   ` Bastien
2014-04-28 13:40     ` Rainer M Krug
2014-04-03 11:47 ` Rainer M Krug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAmySGM1D0reyx=o6U=vFS+pMbErfzDPk5ZiVp3hXXOEMYX5dQ@mail.gmail.com' \
    --to=michael.weylandt@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).