* Re: org-protocol bug
[not found] <20091111004014.4199f1ca.andy13@gmx.net>
@ 2009-11-11 4:01 ` Sebastian Rose
2009-11-11 9:06 ` Sebastian Rose
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Rose @ 2009-11-11 4:01 UTC (permalink / raw)
To: Andreas Burtzlaff; +Cc: Emacs-orgmode mailing list
Hi Andreas,
seems this has to do with the internal encoding of Emacs.
I need some advice at this point from the emacs-devel list.
I'll be back if I find out something.
Andreas Burtzlaff <andy13@gmx.net> writes:
> Hello Sebastian,
>
> I'm not sure you noticed the org-protocol bug in this thread on the
> org-mode list:
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18673.html
>
> To sum it up, when the title of a page contains an &ndash then the error
> org-protocol-unhex-compound: Invalid character: 8211, #o20023, #x2013
> occurs when invoking remember in Emacs 22, not in Emacs 23.
>
> Just wondering whether you have any idea how this could be fixed.
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: org-protocol bug
2009-11-11 4:01 ` org-protocol bug Sebastian Rose
@ 2009-11-11 9:06 ` Sebastian Rose
2009-11-11 16:57 ` Andreas Burtzlaff
0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Rose @ 2009-11-11 9:06 UTC (permalink / raw)
To: Emacs-orgmode mailing list
[-- Attachment #1: Type: text/plain, Size: 491 bytes --]
Hi Carsten and Andreas,
thanks to Kenichi Handa, here is a proposal to fix the issus mentioned
below. I tested it in emacs 22 and 23 and it seems to work just fine.
Carsten, as always if I use some new elisp construct, please review the
patch. I used `eval-when-compile' and `defsubst' to inline the
char-to-string function, since it might be called very often, depending
on the amount of text passed to emacs through org-protocol.
Andreas, could you check if it works for you, too?
[-- Attachment #2: Decode UTF-8 char integer values in emacs 22, too --]
[-- Type: text/x-diff, Size: 1298 bytes --]
diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 133fae4..9b34ed9 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -280,6 +280,19 @@ decode each split part."
(mapcar 'org-protocol-unhex-string split-parts))
split-parts)))
+
+;; This inline function is needed in org-protocol-unhex-compound to do
+;; the right thing to decode UTF-8 char integer values.
+(eval-when-compile
+ (if (>= emacs-major-version 23)
+ (defsubst org-protocol-char-to-string(c)
+ "Defsubst to decode UTF-8 character values in emacs 23 and beyond."
+ (char-to-string sum))
+ (defun org-protocol-char-to-string (c)
+ "Defsubst to decode UTF-8 character values in emacs 22."
+ (string (decode-char 'ucs sum)))))
+
+
(defun org-protocol-unhex-string(str)
"Unhex hexified unicode strings as returned from the JavaScript function
encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'."
@@ -331,7 +344,7 @@ encodeURIComponent. E.g. `%C3%B6' is the german Umlaut `ü'."
(setq sum (+ (lsh sum shift) val))
(if (> eat 0) (setq eat (- eat 1)))
(when (= 0 eat)
- (setq ret (concat ret (char-to-string sum)))
+ (setq ret (concat ret (org-protocol-char-to-string sum)))
(setq sum 0))
)) ;; end (while bytes
ret ))
[-- Attachment #3: Type: text/plain, Size: 528 bytes --]
> Andreas Burtzlaff <andy13@gmx.net> writes:
>> Hello Sebastian,
>>
>> I'm not sure you noticed the org-protocol bug in this thread on the
>> org-mode list:
>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg18673.html
>>
>> To sum it up, when the title of a page contains an &ndash then the error
>> org-protocol-unhex-compound: Invalid character: 8211, #o20023, #x2013
>> occurs when invoking remember in Emacs 22, not in Emacs 23.
>>
>> Just wondering whether you have any idea how this could be fixed.
Sebastian
[-- Attachment #4: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Re: org-protocol bug
2009-11-11 9:06 ` Sebastian Rose
@ 2009-11-11 16:57 ` Andreas Burtzlaff
2009-11-11 18:36 ` Sebastian Rose
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Burtzlaff @ 2009-11-11 16:57 UTC (permalink / raw)
To: Sebastian Rose; +Cc: Emacs-orgmode mailing list
On Wed, 11 Nov 2009 10:06:36 +0100
Sebastian Rose <sebastian_rose@gmx.de> wrote:
>
> Andreas, could you check if it works for you, too?
>
Yes, it works with both 23 and 22.
Thanks for your effort.
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: org-protocol bug
2009-11-11 16:57 ` Andreas Burtzlaff
@ 2009-11-11 18:36 ` Sebastian Rose
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Rose @ 2009-11-11 18:36 UTC (permalink / raw)
To: Andreas Burtzlaff; +Cc: Emacs-orgmode mailing list
Andreas Burtzlaff <andy13@gmx.net> writes:
> On Wed, 11 Nov 2009 10:06:36 +0100
> Sebastian Rose <sebastian_rose@gmx.de> wrote:
>>
>> Andreas, could you check if it works for you, too?
>>
>
> Yes, it works with both 23 and 22.
>
> Thanks for your effort.
Tanks for checking Andreas,
Sebastian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-11 18:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20091111004014.4199f1ca.andy13@gmx.net>
2009-11-11 4:01 ` org-protocol bug Sebastian Rose
2009-11-11 9:06 ` Sebastian Rose
2009-11-11 16:57 ` Andreas Burtzlaff
2009-11-11 18:36 ` Sebastian Rose
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.