emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Let radio target works well with Chinese
@ 2019-02-24 10:08 Feng Shu
  2019-02-25 12:31 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Feng Shu @ 2019-02-24 10:08 UTC (permalink / raw)
  To: orgmode-devel

[-- Attachment #1: 0001-Let-radio-target-works-well-with-Chinese.patch --]
[-- Type: text/x-patch, Size: 1170 bytes --]

From bbf085c61f8b7e9b80077b401cd275b420b4ddca Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Sun, 24 Feb 2019 17:52:51 +0800
Subject: [PATCH] Let radio target works well with Chinese
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org.el (org-update-radio-target-regexp): Let radio target works well with Chinese.

There is no need to force split words with the help
of space for Chinese, this change let the below
example works well.

<<<天空>>>

我爱天空和大地
    ^^^^
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9f33c9e60..ea68aacfc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6052,8 +6052,8 @@ by a #."
 Also refresh fontification if needed."
   (interactive)
   (let ((old-regexp org-target-link-regexp)
-	(before-re "\\(?:^\\|[^[:alnum:]]\\)\\(")
-	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\)")
+	(before-re "\\(?:^\\|[^[:alnum:]]\\|\\cc\\)\\(")
+	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\|\\cc\\)")
 	(targets
 	 (org-with-wide-buffer
 	  (goto-char (point-min))
-- 
2.20.1


[-- Attachment #2: Type: text/plain, Size: 6 bytes --]



-- 

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

* Re: [PATCH] Let radio target works well with Chinese
  2019-02-24 10:08 [PATCH] Let radio target works well with Chinese Feng Shu
@ 2019-02-25 12:31 ` Nicolas Goaziou
  2019-02-25 14:08   ` Emilio Francesquini
  2019-02-28 10:39   ` tumashu
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2019-02-25 12:31 UTC (permalink / raw)
  To: Feng Shu; +Cc: orgmode-devel

Hello,

"Feng Shu" <tumashu@163.com> writes:

> * lisp/org.el (org-update-radio-target-regexp): Let radio target works well with Chinese

Thank you.

> There is no need to force split words with the help
> of space for Chinese, this change let the below
> example works well.
>
> <<<天空>>>
>
> 我爱天空和大地
>     ^^^^

Org doesn't support mid-word radio targets. Is there any strong reason
to make a case for Chinese? What about other languages?


Regards,

-- 
Nicolas Goaziou

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

* Re: [PATCH] Let radio target works well with Chinese
  2019-02-25 12:31 ` Nicolas Goaziou
@ 2019-02-25 14:08   ` Emilio Francesquini
  2019-02-25 19:50     ` Eric Abrahamsen
  2019-02-28 10:39   ` tumashu
  1 sibling, 1 reply; 7+ messages in thread
From: Emilio Francesquini @ 2019-02-25 14:08 UTC (permalink / raw)
  To: Feng Shu, orgmode-devel

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

Hello,

> <<<天空>>>
> >
> > 我爱天空和大地
> >     ^^^^
>
> Org doesn't support mid-word radio targets. Is there any strong reason
> to make a case for Chinese? What about other languages?
>

My knowledge in Chinese is rather limited, but if it is a little like
Japanese the problem is that those languages do not use spaces to separate
words.

I found myself in the same situation writing radio targets in Japanese...
My workaroud was to insert artificial spaces as needed... :/

Regards,

Emilio

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

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

* Re: [PATCH] Let radio target works well with Chinese
  2019-02-25 14:08   ` Emilio Francesquini
@ 2019-02-25 19:50     ` Eric Abrahamsen
  2019-02-26  3:02       ` tumashu
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Abrahamsen @ 2019-02-25 19:50 UTC (permalink / raw)
  To: emacs-orgmode

Emilio Francesquini <e.francesquini@ufabc.edu.br> writes:

> Hello,
>
>> <<<天空>>>
>> >
>> > 我爱天空和大地
>> >     ^^^^
>>
>> Org doesn't support mid-word radio targets. Is there any strong reason
>> to make a case for Chinese? What about other languages?
>>
>
> My knowledge in Chinese is rather limited, but if it is a little like
> Japanese the problem is that those languages do not use spaces to separate
> words.
>
> I found myself in the same situation writing radio targets in Japanese...
> My workaroud was to insert artificial spaces as needed... :/

I've gotten this information (does-space-separate-words) for specific
characters before using either of these two methods:

(aref (char-category-set ?b) ?|) => nil
(aref (char-category-set ?中) ?|) => t

(aref fill-nospace-between-words-table?b) => nil
(aref fill-nospace-between-words-table ?中) => t

| is the category character for "line breakable". Perhaps adding "\c|"
to the regexp would DTRT?

Eric

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

* Re: [PATCH] Let radio target works well with Chinese
  2019-02-25 19:50     ` Eric Abrahamsen
@ 2019-02-26  3:02       ` tumashu
  0 siblings, 0 replies; 7+ messages in thread
From: tumashu @ 2019-02-26  3:02 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode











At 2019-02-26 03:50:37, "Eric Abrahamsen" <eric@ericabrahamsen.net> wrote:
>Emilio Francesquini <e.francesquini@ufabc.edu.br> writes:
>
>> Hello,
>>
>>> <<<天空>>>
>>> >
>>> > 我爱天空和大地
>>> >     ^^^^
>>>
>>> Org doesn't support mid-word radio targets. Is there any strong reason
>>> to make a case for Chinese? What about other languages?
>>>
>>
>> My knowledge in Chinese is rather limited, but if it is a little like
>> Japanese the problem is that those languages do not use spaces to separate
>> words.
>>
>> I found myself in the same situation writing radio targets in Japanese...
>> My workaroud was to insert artificial spaces as needed... :/
>
>I've gotten this information (does-space-separate-words) for specific
>characters before using either of these two methods:
>
>(aref (char-category-set ?b) ?|) => nil
>(aref (char-category-set ?中) ?|) => t
>
>(aref fill-nospace-between-words-table?b) => nil
>(aref fill-nospace-between-words-table ?中) => t
>
>| is the category character for "line breakable". Perhaps adding "\c|"
>to the regexp would DTRT?

Seem to be a good idea :-)

>
>Eric
>

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

* Re: [PATCH] Let radio target works well with Chinese
  2019-02-25 12:31 ` Nicolas Goaziou
  2019-02-25 14:08   ` Emilio Francesquini
@ 2019-02-28 10:39   ` tumashu
  2019-02-28 13:52     ` Nicolas Goaziou
  1 sibling, 1 reply; 7+ messages in thread
From: tumashu @ 2019-02-28 10:39 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

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











在 2019-02-25 20:31:24,"Nicolas Goaziou" <mail@nicolasgoaziou.fr> 写道:
>Hello,
>
>"Feng Shu" <tumashu@163.com> writes:
>
>> * lisp/org.el (org-update-radio-target-regexp): Let radio target works well with Chinese
>
>Thank you.
>
>> There is no need to force split words with the help
>> of space for Chinese, this change let the below
>> example works well.
>>
>> <<<天空>>>
>>
>> 我爱天空和大地
>>     ^^^^
>
>Org doesn't support mid-word radio targets. Is there any strong reason
>to make a case for Chinese? What about other languages?
>
>


Because Chinese need no space between words :-), for example:

    我不知道这个事情到底对不对,你觉得对就对,不对就不对。

I have updated the patch adviced by Eric Abrahamsen:




>Regards,
>
>-- 
>Nicolas Goaziou

[-- Attachment #2: 0001-Let-radio-target-works-well-with-Chinese.patch --]
[-- Type: application/octet-stream, Size: 1130 bytes --]

From 8dd941e06fb9225b446c86561c8ad898414c6a4d Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Sun, 24 Feb 2019 17:52:51 +0800
Subject: [PATCH] Let radio target works well with Chinese
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org.el (org-update-radio-target-regexp): Let radio target works well with Chinese.

There is no need to force split words with the help
of space for Chinese, this change let the below
example works well.

<<<天空>>>

我爱天空和大地
    ^^^^
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9f33c9e60..104982bfe 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6052,8 +6052,8 @@ by a #."
 Also refresh fontification if needed."
   (interactive)
   (let ((old-regexp org-target-link-regexp)
-	(before-re "\\(?:^\\|[^[:alnum:]]\\)\\(")
-	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\)")
+	(before-re "\\(?:^\\|[^[:alnum:]]\\|\\c|\\)\\(")
+	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\|\\c|\\)")
 	(targets
 	 (org-with-wide-buffer
 	  (goto-char (point-min))
-- 
2.20.1


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

* Re: [PATCH] Let radio target works well with Chinese
  2019-02-28 10:39   ` tumashu
@ 2019-02-28 13:52     ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2019-02-28 13:52 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-orgmode

Hello,

tumashu  <tumashu@163.com> writes:

> 在 2019-02-25 20:31:24,"Nicolas Goaziou" <mail@nicolasgoaziou.fr> 写道:
>>Hello,
>>
>>"Feng Shu" <tumashu@163.com> writes:
>>
>>> * lisp/org.el (org-update-radio-target-regexp): Let radio target works well with Chinese
>>
>>Thank you.
>>
>>> There is no need to force split words with the help
>>> of space for Chinese, this change let the below
>>> example works well.
>>>
>>> <<<天空>>>
>>>
>>> 我爱天空和大地
>>>     ^^^^
>>
>>Org doesn't support mid-word radio targets. Is there any strong reason
>>to make a case for Chinese? What about other languages?
>>
>>
>
>
> Because Chinese need no space between words :-), for example:
>
>     我不知道这个事情到底对不对,你觉得对就对,不对就不对。

This is a strong reason, indeed.

> I have updated the patch adviced by Eric Abrahamsen:

I added a comment and applied the patch. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2019-02-28 13:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-24 10:08 [PATCH] Let radio target works well with Chinese Feng Shu
2019-02-25 12:31 ` Nicolas Goaziou
2019-02-25 14:08   ` Emilio Francesquini
2019-02-25 19:50     ` Eric Abrahamsen
2019-02-26  3:02       ` tumashu
2019-02-28 10:39   ` tumashu
2019-02-28 13:52     ` Nicolas Goaziou

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