Re: [O] [PATCH] Let radio target works well with Chinese
Hello, tumashu writes: > 在 2019-02-25 20:31:24,"Nicolas Goaziou" 写道: >>Hello, >> >>"Feng Shu" 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
Re: [O] [PATCH] Let radio target works well with Chinese
在 2019-02-25 20:31:24,"Nicolas Goaziou" 写道: >Hello, > >"Feng Shu" 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 0001-Let-radio-target-works-well-with-Chinese.patch Description: Binary data
Re: [O] [PATCH] Let radio target works well with Chinese
At 2019-02-26 03:50:37, "Eric Abrahamsen" wrote: >Emilio Francesquini 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 >
Re: [O] [PATCH] Let radio target works well with Chinese
Emilio Francesquini 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
Re: [O] [PATCH] Let radio target works well with Chinese
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
Re: [O] [PATCH] Let radio target works well with Chinese
Hello, "Feng Shu" 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
[O] [PATCH] Let radio target works well with Chinese
>From bbf085c61f8b7e9b80077b401cd275b420b4ddca Mon Sep 17 00:00:00 2001 From: Feng Shu 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 --