emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org mode escape characters
       [not found] <1831243639.3822729.1657506981314.ref@mail.yahoo.com>
@ 2022-07-11  2:36 ` David Boss
  2022-07-11 11:05   ` Ihor Radchenko
  2022-07-11 16:22   ` Max Nikulin
  0 siblings, 2 replies; 4+ messages in thread
From: David Boss @ 2022-07-11  2:36 UTC (permalink / raw)
  To: emacs-orgmode

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

I generally run in Fundamental mode. Since ASCII is really only a 7-bit code, I use the high bit to indicate italics. I wrote a Java program for printing; it makes all characters 16-bit, despite their starting as 8-bit,so no problem. For emacs, I wrote the necessary hooks to catch high bits in a file's 8-bit characters; on readin, the high bits are cleared, and characters intended to be italic get an italic property, instead; on writeout, characters with the italic property get their high bits set; no sweat, the hooks work.
I want to be able to copy an emacs buffer, with some characters having italic mode set, and paste that into an email compose buffer, and have the italics set in the email buffer; this should work, but it doesn't, whoknows, who cares, why not. But if I copy/paste a .odt file, with italicized characters, the italics show up as intended, in the email buffer. But, how to generate the .odt file? Pandoc, of course, but pandoc only eats emacsfiles if they're Org mode. So, I wrote a lisp function, to generate the Org mode file I need, from  fundamental-mode-plus-hooks emacs. And yes, pandoc will eat the Org mode file, as intended, and convert it to .odt, as intended, and I can copy/paste the .odt, and italics show up, as intended, in the email buffer. Except,
Org mode is very crude: it indicates italics by surrounding text by slashes, and so,
what if the original text contained slashes, intended as ordinary text, not escape characters? What if the slashes themselves are intended to be italicized?
Is there some way to tell Org mode to use different escape characters? Or to make ordinary emacs characters with the italic property, copy and paste, like God intended?
                                                                                                                                                                                         David Boss

[-- Attachment #2: Type: text/html, Size: 3579 bytes --]

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

* Re: Org mode escape characters
  2022-07-11  2:36 ` Org mode escape characters David Boss
@ 2022-07-11 11:05   ` Ihor Radchenko
       [not found]     ` <1085471464.4732784.1657559607712@mail.yahoo.com>
  2022-07-11 16:22   ` Max Nikulin
  1 sibling, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2022-07-11 11:05 UTC (permalink / raw)
  To: David Boss; +Cc: emacs-orgmode

David Boss <dave.boss@yahoo.com> writes:

> Org mode is very crude: it indicates italics by surrounding text by slashes, and so,
> what if the original text contained slashes, intended as ordinary
> text, not escape characters? What if the slashes themselves are
> intended to be italicized?

You can then surround them by zero-width spaces. See https://orgmode.org/manual/Escape-Character.html#Escape-Character

> Is there some way to tell Org mode to use different escape characters?

No, currently.

> Or to make ordinary emacs characters with the italic property, copy
> and paste, like God intended?

Probably htmlize? https://github.com/hniksic/emacs-htmlize

Best,
Ihor


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

* Re: Org mode escape characters
  2022-07-11  2:36 ` Org mode escape characters David Boss
  2022-07-11 11:05   ` Ihor Radchenko
@ 2022-07-11 16:22   ` Max Nikulin
  1 sibling, 0 replies; 4+ messages in thread
From: Max Nikulin @ 2022-07-11 16:22 UTC (permalink / raw)
  To: emacs-orgmode

On 11/07/2022 09:36, David Boss wrote:
> I generally run in Fundamental mode. Since ASCII is really only a 7-bit 
> code, I use the high bit to indicate italics.
...
> I want to be able to copy an emacs buffer, with some characters having 
> italic mode set, and paste that into an email compose buffer, and have 
> the italics set in the email buffer; this should work, but it doesn't, who
> knows, who cares, why not. But if I copy/paste a .odt file, with 
> italicized characters, the italics show up as intended, in the email 
> buffer.

You did not provided any detail which email client and which OS you are 
using. I do not know how it is implemented on Windows, but on Linux 
applications declares several MIME types for selection: UTF8_STRING, 
text/html, etc. Applications that can insert formatted text use HTML, 
pure text application query plain text. To inspect available types the 
following command may be used:

     xclip -target TARGETS -out -selection CLIPBOARD

AFAIK emacs can not provide several types for selection content and 
xclip does not have such feature as well. When you are sure that namely 
formatted text is required, you can try to feed markup to xclip -target 
text/html.

I do not think that Org is appropriate tool for your purpose, escaping 
is tricky, zero-width spaces when used in such case should be removed 
from the target document. Constructing org-element AST directly may be 
more reliable.

Within Emacs yank-handler text property may help to copy text from your 
specific encoding to other buffers.



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

* Re: Org mode escape characters
       [not found]     ` <1085471464.4732784.1657559607712@mail.yahoo.com>
@ 2022-07-12  2:38       ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-07-12  2:38 UTC (permalink / raw)
  To: David Boss; +Cc: emacs-orgmode

David Boss <dave.boss@yahoo.com> writes:

>  You tell me to "surround" slashes by zero-width-space characters, to keep them from being taken as italic escapes.OK. First problem: what, exactly, is the zero-width space character? I won't be entering text with my fingers, a lispfunction I wrote will be inserting the characters I need. So, exactly what 8-bit value is a zero-width-escape? 00000000?The example in 17.12 seems to put the zero-escape after the control character it's supposed to affect, but then theeffect of it balances forward. 12.6 tells me I also have to put a comma before any line beginning with a star, despitethe fact that my only purpose was to deal with italics. I need to write a function which works, first time, every time;I can't keep playing around with each piece of text it applies to, until it works on that one. OK, helping me get afunction written is not your job, but I shouldn't need .odt and/or pandoc; I should not have needed your help,at all: plain vanilla copy/paste in emacs should bring along text properties within the scope of the copied text.
> Still, I do appreciate your help.

Org does not perform any kind of format conversion when you kill
selection by default.

There is however a third-party package that provides some (limited?)
support for clipboard conversion: https://github.com/jkitchin/ox-clip

Note that Org is a markup format with all the relevant advantages and
disadvantages. The requirement to escape some special symbols is
one of the disadvantages.

You can insert zero-width space using C-x 8 <RET> or by its hex number
or directly copying it to (insert "​").

Note that Org does provide the means to convert Org markup into
alternative markups like HTML. This is done using export functionality:
https://orgmode.org/manual/Exporting.html#Exporting

Hope it helps.

Best,
Ihor


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

end of thread, other threads:[~2022-07-12  2:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1831243639.3822729.1657506981314.ref@mail.yahoo.com>
2022-07-11  2:36 ` Org mode escape characters David Boss
2022-07-11 11:05   ` Ihor Radchenko
     [not found]     ` <1085471464.4732784.1657559607712@mail.yahoo.com>
2022-07-12  2:38       ` Ihor Radchenko
2022-07-11 16:22   ` Max Nikulin

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