Nicolas

(Re-sent with the diff file)

[RFC] Creole-style / Support for **emphasis**__within__**a word**

The attached files should speak for themselves.  Such an arrangement

a) Does not change the status quo AT ALL.
b) Provide more rope.

The patch is in the spirit of "show and tell".

That said, if I were to say "Let's formalize this arrangement" what will
you say?

#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
#+OPTIONS: author:nil c:nil creator:comment d:(not "LOGBOOK") date:nil
#+OPTIONS: e:t email:nil f:t inline:t num:nil p:nil pri:nil prop:nil
#+OPTIONS: stat:t tags:t tasks:t tex:t timestamp:t toc:nil todo:t |:t
#+TITLE: a
#+DATE: <2014-03-04 Tue>
#+AUTHOR: Jambunathan K
#+EMAIL: kjambunathan@debian-6.05
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE: en
#+SELECT_TAGS: export
#+EXCLUDE_TAGS: noexport
#+CREATOR: Emacs 24.3.50.33 (Org mode 8.2.5h)

Support for **emphasis**__within__**a word**. ==A proposal==.

* Headline 1

**bold**and**bold**//italic// __underline__==and==++strike-through++ plain text

Attachment: emphasis.odt
Description: application/vnd.oasis.opendocument.text

Attachment: .emacs.minimal.el
Description: application/emacs-lisp

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 0faf1fd..131b442 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2612,6 +2612,11 @@ Assume point is at the first star marker."
 CONTENTS is the contents of the object."
   (format "*%s*" contents))
 
+(defvar org-element--marker->type 
+  (loop for markers in  (mapcar 'car org-emphasis-alist)
+	for element-type in '(bold italic underline verbatim code strike-through)
+	collect (cons markers element-type)))
+
 (defun org-element-text-markup-successor ()
   "Search for the next text-markup object.
 
@@ -2622,15 +2627,10 @@ and CDR is beginning position."
     (unless (bolp) (backward-char))
     (when (re-search-forward org-emph-re nil t)
       (let ((marker (match-string 3)))
-	(cons (cond
-	       ((equal marker "*") 'bold)
-	       ((equal marker "/") 'italic)
-	       ((equal marker "_") 'underline)
-	       ((equal marker "+") 'strike-through)
-	       ((equal marker "~") 'code)
-	       ((equal marker "=") 'verbatim)
-	       (t (error "Unknown marker at %d" (match-beginning 3))))
-	      (match-beginning 2))))))
+	(cons
+	 (or (assoc-default marker org-element--marker->type)
+	     (error "Unknown marker at %d" (match-beginning 3)))
+	 (match-beginning 2))))))
 
 
 ;;;; Code
diff --git a/lisp/org.el b/lisp/org.el
index f2bb99f..24f07f9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4191,10 +4191,14 @@ After a match, the match groups contain these elements:
 	   (body (nth 3 e))
 	   (nl (nth 4 e))
 	   (body1 (concat body "*?"))
-	   (markers (mapconcat 'car org-emphasis-alist ""))
+	   (markers (mapconcat (lambda (em)
+				 (regexp-quote (car em))
+				 )
+			       org-emphasis-alist "\\|"))
 	   (vmarkers (mapconcat
-		      (lambda (x) (if (eq (nth 2 x) 'verbatim) (car x) ""))
-		      org-emphasis-alist "")))
+		      (lambda (x)
+			(regexp-quote (if (eq (nth 2 x) 'verbatim) (car x) "")))
+		      org-emphasis-alist "\\|")))
       ;; make sure special characters appear at the right position in the class
       (if (string-match "\\^" markers)
 	  (setq markers (concat (replace-match "" t t markers) "^")))
@@ -4211,7 +4215,7 @@ After a match, the match groups contain these elements:
       (setq org-emph-re
 	    (concat "\\([" pre "]\\|^\\)"
 		    "\\("
-		    "\\([" markers "]\\)"
+		    "\\(" markers "\\)"
 		    "\\("
 		    "[^" border "]\\|"
 		    "[^" border "]"
@@ -4223,7 +4227,7 @@ After a match, the match groups contain these elements:
       (setq org-verbatim-re
 	    (concat "\\([" pre "]\\|^\\)"
 		    "\\("
-		    "\\([" vmarkers "]\\)"
+		    "\\(" vmarkers "\\)"
 		    "\\("
 		    "[^" border "]\\|"
 		    "[^" border "]"

Reply via email to