[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: google-translate
From: |
Emanuel Berg |
Subject: |
Re: google-translate |
Date: |
Sat, 19 Sep 2015 17:25:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Ian Zimmerman <itz@buug.org> writes:
>> (defun translate (src-lang dst-lang text)
>> (interactive)
>> (let ((killed kill-ring))
>> (google-translate-translate src-lang dst-lang text 'kill-ring)
>> (let ((translation (string-make-unibyte (current-kill 0))))
> ^^^^^^^^^^^^^^^^^^^
> Why do you do that? That may be your problem
> right there.
That was it! The reason I put it there was to get rid
of the properties. I replaced it with
`substring-no-properties' but it seems that isn't
needed either. The reason I thought it was needed is:
put the region around this word: spiderweb - and hit
M-w (`kill-ring-save'). Now evaluate:
(message "%s" (current-kill 0))
this will show:
#("spiderweb" 0 9 (fontified t))
now evaluate:
(message "%s" (substring-no-properties (current-kill 0)))
and get the desired:
"spiderweb"
however this:
(progn
(kill-new "spiderwebs")
(message "%s" (current-kill 0)) )
also gives no properties! So perhaps it is an
interactive/noninteractive issue as in a string (as
*data*), regardless how it is showed, there aren't
any properties.
Anyway, thank you. Here is the most recent edition:
(defun translate (src-lang dst-lang text)
(interactive)
(let ((killed kill-ring))
(google-translate-translate src-lang dst-lang text 'kill-ring)
(let ((translation (current-kill 0)))
(setq kill-ring-yank-pointer killed)
(message "%s: %s" text translation) )))
--
underground experts united
http://user.it.uu.se/~embe8573
- google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), (continued)
- google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), Emanuel Berg, 2015/09/08
- Re: google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), Andrey Tykhonov, 2015/09/09
- Re: google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), Emanuel Berg, 2015/09/09
- Re: google-translate, Emanuel Berg, 2015/09/15
- Re: google-translate, Alex Kost, 2015/09/16
- Re: google-translate, Emanuel Berg, 2015/09/16
- Re: google-translate, Emanuel Berg, 2015/09/17
- Re: google-translate, Emanuel Berg, 2015/09/18
- Re: google-translate, Ian Zimmerman, 2015/09/19
- Re: google-translate, Emanuel Berg, 2015/09/19
- Re: google-translate,
Emanuel Berg <=
Re: Is it possible to transform text before feeding it to ispell?, Michael Heerdegen, 2015/09/08
Re: Is it possible to transform text before feeding it to ispell?, Eli Zaretskii, 2015/09/08