[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/greader 8b916cde15 1/4: greader: Variable `greader-afte
From: |
ELPA Syncer |
Subject: |
[elpa] externals/greader 8b916cde15 1/4: greader: Variable `greader-after-change-language-hook' added. |
Date: |
Fri, 23 Feb 2024 06:58:05 -0500 (EST) |
branch: externals/greader
commit 8b916cde15b2eaaeeadbe01ca6519e768b4d1b12
Author: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
Commit: Michelangelo Rodriguez <michelangelo.rodriguez@gmail.com>
greader: Variable `greader-after-change-language-hook' added.
This variable owes its origin to the need to support the
multilingual dictionary functionality.
---
greader-dict.el | 7 ++++---
greader.el | 10 +++++++---
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/greader-dict.el b/greader-dict.el
index cae7e8a7c7..e11fb0277b 100644
--- a/greader-dict.el
+++ b/greader-dict.el
@@ -618,9 +618,10 @@ as a word definition."
(greader-dict-read-from-dict-file)
(add-hook 'greader-after-get-sentence-functions
#'greader-dict--replace-wrapper 1)
- ; (add-hook 'greader-reading-mode-hook
#'greader-dict--update))))
-
- (add-hook 'buffer-list-update-hook #'greader-dict--update))))
+ (add-hook 'buffer-list-update-hook #'greader-dict--update)
+ (add-hook 'greader-after-change-language-hook
+ (lambda ()
+ (when greader-dict-mode (greader-dict-read-from-dict-file)))))))
;; Questa funzione è solo di utilità e potrebbe essere rimossa o
;; modificata in qualsiasi momento.
(defun greader-dict-beep ()
diff --git a/greader.el b/greader.el
index 557c30680f..3d1955417e 100644
--- a/greader.el
+++ b/greader.el
@@ -668,11 +668,13 @@ Optional argument STRING contains the string passed to
`greader-read-asynchronous'."
(if greader-filter-enabled
(message string)))
-
+(defvar greader-after-change-language-hook nil
+ "The functions stored in this variable are executed just after new
+language is set.")
(defun greader-set-language (lang)
"Set language of tts.
LANG must be in ISO code, for example `en' for English or `fr' for
-French. This function sets the language of tts local for current
+French. This function sets the language of tts locally for current
buffer, so if you want to set it globally, please use
`M-x customize-option RET greader-language RET'."
(interactive
@@ -681,7 +683,9 @@ buffer, so if you want to set it globally, please use
(if (equal result 'not-implemented)
(read-string "Set language to: ")
result))))
- (greader-call-backend 'lang lang))
+ (greader-call-backend 'lang lang)
+ (run-hooks greader-after-change-language-hook))
+
(defun greader-set-punctuation (flag)
"Set punctuation to FLAG."
(greader-call-backend 'punctuation flag))