RE: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hello, Thank-you both for the reply, I should have mentioned that I am aware of this trick but it works only for document encodings which have the zero-width space, like UTF-8, I was after a fix for documents in ISO-8859-15, aka latin-9. V. De : Juan Manuel Macías Envoyé : lundi 24 janvier 2022 13:09 À : Vincent Belaïche Cc : orgmode Objet : Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word** Hi Vincent, Vincent Belaïche writes: > Hello, > > Sorry to dig out this almost 8 year old discussion, but after looking > into the git HEAD Org Mode manual (v9.5 or so) (info "(org) Emphasis and > Monospace") node, and after looking into the mail archive I could not > find any answer to this question: how to switch style within a word. > > I would like to put something like this in an OrgMode document: > > ~--some-cli-option=~/some cli argument/ > > where the intent is that « --some-cli-option= » would be monospaced, and > « some cli argument » would be italicized, and as you know this does not > work this way. > > Vincent. It seems that this topic is already a classic :-) The supported solution for intra-word emphases is to introduce a zero width space (U+200B), for example: ~--some-cli-option=~[zero-width space]/some cli argument/ I don't really like this solution, but at least it works. If you export to LaTeX, you may want to remove the space using a filter, as in some (few) cases it can alter the LaTeX result. The other realistic possibility is to use macros: {{{mono(--some-cli-option=)}}}{{{emph(some cli argument)}}} That is, more or less, the state of art. By the nature of its syntax, emphasis between words is not possible in Org. Best regards, Juan Manuel
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hi Vincent, Vincent Belaïche writes: > Hello, > > Sorry to dig out this almost 8 year old discussion, but after looking > into the git HEAD Org Mode manual (v9.5 or so) (info "(org) Emphasis and > Monospace") node, and after looking into the mail archive I could not > find any answer to this question: how to switch style within a word. > > I would like to put something like this in an OrgMode document: > > ~--some-cli-option=~/some cli argument/ > > where the intent is that « --some-cli-option= » would be monospaced, and > « some cli argument » would be italicized, and as you know this does not > work this way. > > Vincent. It seems that this topic is already a classic :-) The supported solution for intra-word emphases is to introduce a zero width space (U+200B), for example: ~--some-cli-option=~[zero-width space]/some cli argument/ I don't really like this solution, but at least it works. If you export to LaTeX, you may want to remove the space using a filter, as in some (few) cases it can alter the LaTeX result. The other realistic possibility is to use macros: {{{mono(--some-cli-option=)}}}{{{emph(some cli argument)}}} That is, more or less, the state of art. By the nature of its syntax, emphasis between words is not possible in Org. Best regards, Juan Manuel
RE: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hello, Sorry to dig out this almost 8 year old discussion, but after looking into the git HEAD Org Mode manual (v9.5 or so) (info "(org) Emphasis and Monospace") node, and after looking into the mail archive I could not find any answer to this question: how to switch style within a word. I would like to put something like this in an OrgMode document: ~--some-cli-option=~/some cli argument/ where the intent is that « --some-cli-option= » would be monospaced, and « some cli argument » would be italicized, and as you know this does not work this way. Vincent. De : emacs-orgmode-bounces+vincent.b.1=hotmail...@gnu.org de la part de Jambunathan K Envoyé : dimanche 23 mars 2014 03:59 À : Nicolas Goaziou Cc : emacs-orgmode@gnu.org Objet : Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word** Nicolas Goaziou writes: > Good luck. Got my answer. The rest are just details.
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Nicolas Goaziou writes: > Good luck. Got my answer. The rest are just details.
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Dnia 2014-03-23, o godz. 12:32:46 Suvayu Ali napisał(a): > On Sun, Mar 23, 2014 at 01:06:35AM +0100, Marcin Borkowski wrote: > > Dnia 2014-03-22, o godz. 16:30:31 > > Nicolas Goaziou napisał(a): > > > > > > Also, there is no "backward-compatibility squad", only users who > > > > care about what they like. > > > > > > That is what they want us to believe! :) > > > > Ninja'd! > > > > Re: topic: one idea that is maybe not very Org-ish, but seems > > reasonable: Org already uses LaTeX syntax for sub/superscripts, and > > accepts LaTeX snippets etc. Why not allow \textbf{something} > > parallel to *something*? Would it break something? When using the > > LaTeX exporter, currently it seems (from very few simple > > experiments), that \textbf{whatever} copies "whatever" verbatim to > > the file (I tried LaTeX and HTML exporters). > > Often LaTeX users tend to forget (including myself) one of Org's > features is to be able to export to different backends without major > modifications to the source file (.org file). > > Your proposal breaks that. No, it doesn't. What I meant was to make Org *recognize* the \textbf{...} etc. syntax and *convert* it to ... and similar things (depending on the backend). Sorry if I wasn't clear enough. Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
On Sun, Mar 23, 2014 at 01:06:35AM +0100, Marcin Borkowski wrote: > Dnia 2014-03-22, o godz. 16:30:31 > Nicolas Goaziou napisał(a): > > > > Also, there is no "backward-compatibility squad", only users who > > > care about what they like. > > > > That is what they want us to believe! :) > > Ninja'd! > > Re: topic: one idea that is maybe not very Org-ish, but seems > reasonable: Org already uses LaTeX syntax for sub/superscripts, and > accepts LaTeX snippets etc. Why not allow \textbf{something} parallel > to *something*? Would it break something? When using the LaTeX > exporter, currently it seems (from very few simple experiments), that > \textbf{whatever} copies "whatever" verbatim to the file (I tried LaTeX > and HTML exporters). Often LaTeX users tend to forget (including myself) one of Org's features is to be able to export to different backends without major modifications to the source file (.org file). Your proposal breaks that. -- Suvayu Open source is the future. It sets us free.
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
one option might be to keep what we have for emphasis, ossify it, and create a backend-independent nestable, multiline [and so on] markup for emphasis. but not just any syntax [because that would clutter us with more syntax]. this time it would be $[extensible :pretty-nicely t], and it will work for non-emphasis features and for emphasis sub-features we need later. thus, after this, new features and sub-features do not require new syntax. this keeps our syntax issues to a minimum. -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. And ANYBODY can get it. Denmark: free Karina Hansen NOW.
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Dnia 2014-03-22, o godz. 16:30:31 Nicolas Goaziou napisał(a): > > Also, there is no "backward-compatibility squad", only users who > > care about what they like. > > That is what they want us to believe! :) Ninja'd! Re: topic: one idea that is maybe not very Org-ish, but seems reasonable: Org already uses LaTeX syntax for sub/superscripts, and accepts LaTeX snippets etc. Why not allow \textbf{something} parallel to *something*? Would it break something? When using the LaTeX exporter, currently it seems (from very few simple experiments), that \textbf{whatever} copies "whatever" verbatim to the file (I tried LaTeX and HTML exporters). Of course, one problem would be nesting - regexen won't help in this. But it could be restricted to just letters or something (yes, I know, very inelegant hack - but let's brainstorm a little, maybe someone could come up with a better idea). > Regards, Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Nicolas Goaziou writes: > You call it extreme, I label it ambitious. > > Also, "getting rid of it" really means "no need to change it anymore". > I'd rather have a static complex regexp than a simple customizable one > for the sake of syntax consistency. Of course, a fixed simple regexp is > better (and no regexp at all is even better). Fully agreed. >> Also, there is no "backward-compatibility squad", only users who care >> about what they like. > > That is what they want us to believe! :) I don't know who is "us" ;) -- Bastien
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Bastien writes: > What I'm after is a bit different: Is it? > - keep single character markup; > > - simplify `org-emphasis-regexp-components' (getting it of it is the > extreme version of simplifying it); You call it extreme, I label it ambitious. Also, "getting rid of it" really means "no need to change it anymore". I'd rather have a static complex regexp than a simple customizable one for the sake of syntax consistency. Of course, a fixed simple regexp is better (and no regexp at all is even better). > - allow a more liberal multiline markup fontification where the user > does not have to tweak `org-emphasis-regexp-components'. Which is basically "getting rid of it". See above. > Midword markup is not a priority to me, but I understand how it could > be useful, this would certainly be a plus. I agree. This is not a priority, I wasn't clear on this point. > Also, there is no "backward-compatibility squad", only users who care > about what they like. That is what they want us to believe! :) Regards, -- Nicolas Goaziou
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hi Andreas, I'm also in favor of breaking backward compatibility when it benefits Org's users and developers. We should not consider changes only in terms of backward compatibility, we should also consider them by themselves. What I like with *this markup* is that it's non-intrusive: it's easy to type and it does not clutter the document. And in general, I'd rather fix problems then getting rid of them for maintainability purpose. What's the problems with *this markup*? It is difficult to get proper fontification in some cases, fontification of multiple lines is not reliable beyond a certain amout of lines, and we cannot nest markup. Until someone has taken the time to seriously try to fix those problems without changing the current feature, I don't think we should consider changing the feature itself. But of course, this is always a trade-off. -- Bastien
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hi all, Bastien writes: [ ...] > > Also, there is no "backward-compatibility squad", only users who care > about what they like. I have been part in threads that discuss backward-compatibility. As it looks, there is the feeling that this ML is too(?) much concerned about backward-compatibility -- even in favour over new features or cleaner implementation (both of which the proposed emphasis change would be an example of, IIUC). In a way, I am happy that backward-compatibility is now a major concern. But on the other hand, it is not my intention to block enhancements. For the case at hand, I would happily type double letter emphasis, if that helps to get a clean implementation. If it even allows more features, that would be a benefit. My point of writing is this: If a change like this was going to happen, it would be very nice if a function was provided to change from the old style to the new style. This was (at least) once the case for a major backward incompatible change in babel and even if it did not work flawlessly it was a big help. I guess it would be easy for the lisp-guru who removes the regexp to turn it into such a function. But it would take quite some time for me to dig that regexp somewhen later and produce a working translation function from it... Anyway, as it looks this is probably hypothetical for this particular change. Regards, Andreas
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hi Nicolas, Nicolas Goaziou writes: > In a nutshell, I don't think this will go past the active > "backward-compatibility" squad on the ML. What we're really after is > a way to > > - keep single character markup ; > - get rid of `org-emphasis-regexp-components' ; > - allow midword markup. What I'm after is a bit different: - keep single character markup; - simplify `org-emphasis-regexp-components' (getting it of it is the extreme version of simplifying it); - allow a more liberal multiline markup fontification where the user does not have to tweak `org-emphasis-regexp-components'. Midword markup is not a priority to me, but I understand how it could be useful, this would certainly be a plus. Also, there is no "backward-compatibility squad", only users who care about what they like. -- Bastien
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Hello, Jambunathan K writes: > [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... FWIW I think is the idea is very interesting. This is more verbose, but it could allow us to get rid of the terrible `org-emphasis-regexp-components' variable. Unfortunately, this would introduce incompatibilities in old documents, unless that is, we keep checking `org-emphasis-regexp-components', but then, the change would become, IMO, much less desirable. In a nutshell, I don't think this will go past the active "backward-compatibility" squad on the ML. What we're really after is a way to - keep single character markup ; - get rid of `org-emphasis-regexp-components' ; - allow midword markup. Good luck. Regards, -- Nicolas Goaziou
Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
Jambunathan K writes: > (with-eval-after-load 'org > (setcar org-emphasis-regexp-components "^\\n") > (setcar (cdr org-emphasis-regexp-components) "^\\n") > (customize-save-variable 'org-emphasis-alist org-emphasis-alist)) A small correction Instead of \\n it should be \n. So use the below form instead. (with-eval-after-load 'org (setcar org-emphasis-regexp-components "^\n") (setcar (cdr org-emphasis-regexp-components) "^\n") (customize-save-variable 'org-emphasis-alist org-emphasis-alist))
[O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
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... #+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 emphasis.odt Description: application/vnd.oasis.opendocument.text .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 "]"
[O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
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 emphasis.odt Description: application/vnd.oasis.opendocument.text .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 "]"
[O] [RFC] Creole-style / Support for **emphasis**__within__**a word**
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? .emacs.minimal.el Description: application/emacs-lisp emphasis.odt Description: application/vnd.oasis.opendocument.text #+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