Tassilo Horn <[EMAIL PROTECTED]> writes: > Richard G Riley <[EMAIL PROTECTED]> writes: > > Hi Richard, > >> I did this and it works well enough. I now have an auto updated >> rdictcc buffer when scrolling around in w3m or article buffers. Thanks >> for your help. Maybe some sort of timer would be nice so it only >> updates the rdictcc buffer after resting on the same word for a while >> - but that is a little beyond my current experience at the >> moment. > > I'd suggest to save the current word in a global variable (`defvar') and > only update the translation if the current word is not nil and not > string= with the saved word. When that's the case, do the translation > and save the current word in the global variable.
Works well. I'd already done this last night actually but used setq. Is this bad? ,---- | | (setq rdictcc-rgr-show-translations nil) | (setq rdictcc-rgr-last-word nil) | | (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) | ) | ) | ) | | (add-hook 'w3m-after-cursor-move-hook 'rdictcc-rgr-translate) | | (define-key gnus-article-mode-map [right] (lambda () (interactive)(rdictcc-rgr-translate)(forward-char))) | (define-key gnus-article-mode-map [left] (lambda () (interactive)(rdictcc-rgr-translate)(backward-char))) | (define-key gnus-article-mode-map [up] (lambda () (interactive)(rdictcc-rgr-translate)(previous-line))) | (define-key gnus-article-mode-map [down] (lambda () (interactive)(rdictcc-rgr-translate)(next-line))) | | (global-set-key (kbd "<f5> T") 'rdictcc-rgr-translate) | (global-set-key (kbd "<f5> o") (lambda()(interactive)(setq rdictcc-rgr-show-translations (not rdictcc-rgr-show-translations)))) `---- _______________________________________________ info-gnus-english mailing list [email protected] http://lists.gnu.org/mailman/listinfo/info-gnus-english
