emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Roland Kaufmann <rlndkfmn+orgmode@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Hrvoje Niksic <hniksic@xemacs.org>
Subject: Re: [PATCH] Markup on same line as text
Date: Sun, 27 Feb 2011 22:09:43 +0100	[thread overview]
Message-ID: <AANLkTincty8YpKNOWJLxpqMNaE88BJoujKPjbxz0ROhQ@mail.gmail.com> (raw)
In-Reply-To: <87vd06eph4.fsf@altern.org>

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

Sorry for taking so long to come back to this; I had some unrelated
problems with my system.

> Please let us know if there is a useful way to generalize the workaround
> presented earlier in the thread.

Attached is against the latest git tree for org-mode a patch which I
believe does the trick. (This supersedes the previous patch against
htmlize.el).

Thanks to Hrvoje for suggesting this approach and providing the code
to reset the face attribute.

-- 
   Roland.

[-- Attachment #2: 0001-Markup-on-same-line-as-text.patch --]
[-- Type: application/octet-stream, Size: 1681 bytes --]

From 98e2a586eb0e911ec6b5bedeec4af5f00ee2bf6c Mon Sep 17 00:00:00 2001
From: Roland Kaufmann <rlndkfmn+orgmode@gmail.com>
Date: Sun, 27 Feb 2011 20:52:31 +0100
Subject: [PATCH] Markup on same line as text

* org-exp.el (org-export-format-source-code-or-example): fontify one
  line at the time to avoid partial overlap between fontification and
  reference markup.
---
 lisp/org-exp.el |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 9a35b00..dbcf105 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2375,6 +2375,15 @@ in the list) and remove property and value from the list in LISTVAR."
 (defvar org-export-latex-listings-options) ;; defined in org-latex.el
 (defvar org-export-latex-minted-options) ;; defined in org-latex.el
 
+(defun org-remove-formatting-on-newlines-in-region (beg end)
+  "Remove formatting on newline characters"
+  (interactive "r")
+  (save-excursion
+    (goto-char beg)
+    (while (progn (end-of-line) (< (point) end))
+      (put-text-property (point) (1+ (point)) 'face nil)
+      (forward-char 1))))
+
 (defun org-export-format-source-code-or-example
   (backend lang code &optional opts indent caption)
   "Format CODE from language LANG and return it formatted for export.
@@ -2461,6 +2470,8 @@ INDENT was the original indentation of the block."
 				(funcall mode)
 			      (fundamental-mode))
 			    (font-lock-fontify-buffer)
+			    ;; markup each line separately
+			    (org-remove-formatting-on-newlines-in-region (point-min) (point-max))
 			    (org-src-mode)
 			    (set-buffer-modified-p nil)
 			    (org-export-htmlize-region-for-paste
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

      reply	other threads:[~2011-02-27 21:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 22:12 [PATCH] Markup on same line as text Roland Kaufmann
2011-02-16 20:04 ` Hrvoje Niksic
2011-02-16 21:53   ` Roland Kaufmann
2011-02-17 21:58 ` Hrvoje Niksic
2011-02-19 14:26   ` Roland Kaufmann
2011-02-19 23:49     ` Hrvoje Niksic
2011-02-26  9:39     ` Bastien
2011-02-27 21:09       ` Roland Kaufmann [this message]

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=AANLkTincty8YpKNOWJLxpqMNaE88BJoujKPjbxz0ROhQ@mail.gmail.com \
    --to=rlndkfmn+orgmode@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=hniksic@xemacs.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).