emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFC] Creole-style / Support for **emphasis**__within__**a word**
@ 2014-03-04 13:11 Jambunathan K
  2014-03-04 14:55 ` Jambunathan K
  2014-03-22 14:05 ` Nicolas Goaziou
  0 siblings, 2 replies; 26+ messages in thread
From: Jambunathan K @ 2014-03-04 13:11 UTC (permalink / raw)
  To: emacs-orgmode

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


Nicolas

(Sorry for multiple posts.  `customize-save-variable' in the attached
minimal emacs -- which I foolishly added to the top of my .emacs --
wiped out all my customizations including IMAP and SMTP settings)

[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".  I will not provide a
formal patch.

What about formalizing such an arrangement...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emphasis.org --]
[-- Type: text/x-org, Size: 659 bytes --]

#+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 #3: emphasis.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10286 bytes --]

[-- Attachment #4: .emacs.minimal.el --]
[-- Type: application/emacs-lisp, Size: 1097 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: org-emphasis.diff --]
[-- Type: text/x-diff, Size: 2676 bytes --]

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 "]"

^ permalink raw reply related	[flat|nested] 26+ messages in thread
* [RFC] Creole-style / Support for **emphasis**__within__**a word**
@ 2014-03-04 13:00 Jambunathan K
  0 siblings, 0 replies; 26+ messages in thread
From: Jambunathan K @ 2014-03-04 13:00 UTC (permalink / raw)
  To: emacs-orgmode

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


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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emphasis.org --]
[-- Type: text/x-org, Size: 659 bytes --]

#+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 #3: emphasis.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10286 bytes --]

[-- Attachment #4: .emacs.minimal.el --]
[-- Type: application/emacs-lisp, Size: 1097 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: org-emphasis.diff --]
[-- Type: text/x-diff, Size: 2676 bytes --]

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 "]"

^ permalink raw reply related	[flat|nested] 26+ messages in thread
* [RFC] Creole-style / Support for **emphasis**__within__**a word**
@ 2014-03-04 12:56 Jambunathan K
  0 siblings, 0 replies; 26+ messages in thread
From: Jambunathan K @ 2014-03-04 12:56 UTC (permalink / raw)
  To: emacs-orgmode

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


Nicolas

[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".  I will not provide a
formal patch.

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


[-- Attachment #2: .emacs.minimal.el --]
[-- Type: application/emacs-lisp, Size: 1097 bytes --]

[-- Attachment #3: emphasis.odt --]
[-- Type: application/vnd.oasis.opendocument.text, Size: 10286 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: emphasis.org --]
[-- Type: text/x-org, Size: 659 bytes --]

#+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

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-01-25 18:52 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-04 13:11 [RFC] Creole-style / Support for **emphasis**__within__**a word** Jambunathan K
2014-03-04 14:55 ` Jambunathan K
2014-03-22 14:05 ` Nicolas Goaziou
2014-03-22 14:21   ` Bastien
2014-03-22 14:54     ` Andreas Leha
2014-03-22 15:22       ` Bastien
2014-03-22 15:30     ` Nicolas Goaziou
2014-03-22 15:37       ` Bastien
2014-03-23  0:53         ` Samuel Wales
2014-03-23  0:06       ` Marcin Borkowski
2014-03-23 11:32         ` Suvayu Ali
2014-03-23 11:39           ` Marcin Borkowski
2014-03-23  2:59   ` Jambunathan K
2022-01-24 10:50     ` [O] " Vincent Belaïche
2022-01-24 11:54       ` Nicolas Goaziou
2022-01-24 12:09       ` [O] " Juan Manuel Macías
2022-01-24 12:32         ` Vincent Belaïche
2022-01-25 10:55           ` Nicolas Goaziou
2022-01-25 17:18             ` Vincent Belaïche
2022-01-25 17:30               ` Juan Manuel Macías
2022-01-25 18:45                 ` Vincent Belaïche
2022-01-25 17:52               ` Nicolas Goaziou
2022-01-25 18:20               ` Vincent Belaïche
2022-01-25 16:27           ` Max Nikulin
  -- strict thread matches above, loose matches on Subject: below --
2014-03-04 13:00 Jambunathan K
2014-03-04 12:56 Jambunathan K

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).