Richard G Riley <[EMAIL PROTECTED]> writes:
Hi Richard,
> Works well. I'd already done this last night actually but used
> setq. Is this bad?
Not really. You will get compiler warnings when trying to byte-compile
it and it's not a clean style.
| (defun rdictcc-rgr-translate()
| (interactive)
| ; (save-window-excursion
| (message "myt")
| (save-selected-window
| (let ((word (rdictcc-current-word)))
| (when (and word rdictcc-rgr-show-translations (not(eq word
rdictcc-rgr-last-word)))
| (rdictcc-translate-word word)
| )
| (setq rdictcc-rgr-last-word word)
| )
| )
| )
I've "corrected" it to this:
--8<---------------cut here---------------start------------->8---
(defun rdictcc-rgr-translate()
(interactive)
(save-selected-window
(let ((word (rdictcc-current-word)))
(when (and word
rdictcc-rgr-show-translations
(not (string= word rdictcc-rgr-last-word)))
(rdictcc-translate-word word)
(setq rdictcc-rgr-last-word word)))))
--8<---------------cut here---------------end--------------->8---
When comparing strings you normally use `string=', because two strings
may have the same contents but are not `eq', e.g. they're not the same
lisp object.
And I've moved the last setq into the `when', cause if the word didn't
change there's no reason to re-set it.
Bye,
Tassilo
--
Chuck Norris doesn't see dead people. He makes people dead.
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english