Skip to Content.
Sympa Menu

emacspeak - Re: [Emacspeak] (Patch) Fixing helm mode with Emacspeak

Subject: Emacspeak discussion list

List archive

Re: [Emacspeak] (Patch) Fixing helm mode with Emacspeak


Chronological Thread 
  • From: Parham Doustdar <parham90 AT gmail.com>
  • To: Tim Cross <theophilusx AT gmail.com>
  • Cc: Emacspeaks <emacspeak AT emacspeak.net>
  • Subject: Re: [Emacspeak] (Patch) Fixing helm mode with Emacspeak
  • Date: Mon, 29 Dec 2025 22:28:01 +0100

Hi Tim,
Very good point, thanks for the explanation.
This issue started on Helm version 20240912.613. However, I’m currently on
Helm version 20251225.613. Upgrading did not break the fix.
Best,
Parham
> On 27 Dec 2025, at 02:09, Tim Cross <theophilusx AT gmail.com> wrote:
>
> Hi Parham,
>
> as this can be a moving target, can you indicate which version of helm
> and emacs you fixed this bug on? I don't use helm, but want to make sure
> anyone else seing this post can check to see what version of emacs and
> helm they are running as I know that we often have a very wide range of
> versions being used on this list, including quite a lot of people
> running old versions of everything as 'if it ain't broke' philosophy.
>
> I'm assuming yur running the last commit of emacspeak as wsell (and not
> the last 'official' release)
>
> Tim
>
> "Parham Doustdar" (via emacspeak Mailing List) <emacspeak AT emacspeak.net>
> writes:
>
>> Hi all,
>> I have been facing a couple of issues with helm help that I finally got
>> around to identifying and fixing, patch is at the end of the email.
>> Basically, there are two issues:
>> The first is that as you try to navigate around in helm help, Emacspeak
>> keeps reading the helm help default prompt. So, you hear the main text at
>> the same time as the notification stream is reading the prompt.
>> Second issue is that, because Helm has its own command dispatcher in the
>> helm help mode, the Emacspeak prefix key doesn’t work.
>> The fix:
>> 1. Emacspeak is advising helm help mode, but the helm help
>> mode-before-hook is actually being called on a different buffer than the
>> *helm help* buffer. As a result, when Emacspeak tries to turn off
>> emacspeak-speak-messages, nothing happens. The right way to do this seems
>> to be to advise the helm-help-event-loop directly.
>> 2. The read-key advice doesn’t actually take the emacspeak-speak-messages
>> variable into account when speaking the prompt. As a result, after fixing
>> the issue above, the prompt still keeps getting spoken when you navigate.
>> To fix that, I added a simple check to the read-key advice to check for
>> emacspeak-speak-messages before it speaks.
>> 3. Finally, since this help loop is a custom thing, the Emacspeak prefix
>> key doesn’t work. So I added our own dispatcher to the helm help keymap.
>> ---
>> lisp/emacspeak-advice.el | 24 +++++++++++++-----------
>> lisp/emacspeak-helm.el | 27 +++++++++++++++++++++------
>> 2 files changed, 34 insertions(+), 17 deletions(-)
>>
>> diff --git a/lisp/emacspeak-advice.el b/lisp/emacspeak-advice.el
>> index 0a72e7859..a052c6bc5 100644
>> --- a/lisp/emacspeak-advice.el
>> +++ b/lisp/emacspeak-advice.el
>> @@ -936,23 +936,25 @@
>> (eval
>> `(defadvice ,f (before emacspeak pre act comp)
>> "Speak prompt"
>> + (when emacspeak-speak-messages
>> (let ((prompt (ad-get-arg 0)))
>> (emacspeak-icon 'char)
>> (setq emacspeak-last-message prompt)
>> (setq emacspeak-read-char-prompt-cache prompt)
>> - (tts-with-punctuations 'all (dtk-notify (or prompt "key")))))))
>> + (tts-with-punctuations 'all (dtk-notify (or prompt "key"))))))))
>>
>> (defadvice read-char-choice (before emacspeak pre act comp)
>> "Speak the prompt. "
>> - (let* ((prompt (ad-get-arg 0))
>> - (chars (ad-get-arg 1))
>> - (m
>> - (format
>> - "%s: %s"
>> - prompt
>> - (mapconcat #'(lambda (c) (format "%c" c)) chars ", "))))
>> - (ems--log-message m)
>> - (tts-with-punctuations 'all (dtk-speak m))))
>> + (when emacspeak-speak-messages
>> + (let* ((prompt (ad-get-arg 0))
>> + (chars (ad-get-arg 1))
>> + (m
>> + (format
>> + "%s: %s"
>> + prompt
>> + (mapconcat #'(lambda (c) (format "%c" c)) chars ", "))))
>> + (ems--log-message m)
>> + (tts-with-punctuations 'all (dtk-speak m)))))
>>
>>
>> ;;; advice completion functions to speak:
>> diff --git a/lisp/emacspeak-helm.el b/lisp/emacspeak-helm.el
>> index bd9f3274f..f721fe849 100644
>> --- a/lisp/emacspeak-helm.el
>> +++ b/lisp/emacspeak-helm.el
>> @@ -122,19 +122,26 @@
>> (emacspeak-speak-line)))
>>
>> ;;; Support helm-help
>> -(add-hook
>> - 'helm-help-mode-before-hook
>> - #'(lambda()
>> - "Turn off speaking read-key prompts"
>> - (setq emacspeak-speak-messages nil)
>> - (emacspeak-icon 'open-object)))
>> -
>> -(add-hook
>> - 'helm-help-mode-after-hook
>> - #'(lambda()
>> - "restore speaking messages."
>> - (setq emacspeak-speak-messages t)
>> - (emacspeak-icon 'close-object)))
>> +
>> +(defadvice helm-help-event-loop (around emacspeak pre act comp)
>> + "Silence messages during helm help loop."
>> + (setq emacspeak-speak-messages nil)
>> + (emacspeak-icon 'open-object)
>> + (unwind-protect
>> + ad-do-it
>> + (setq emacspeak-speak-messages t)
>> + (emacspeak-icon 'close-object)))
>> +
>> +(defun emacspeak-helm-help-dispatch-prefix ()
>> + "Dispatch C-e prefix commands in helm help."
>> + (interactive)
>> + (let* ((key (read-key-sequence-vector (format "%s " (key-description
>> emacspeak-prefix))))
>> + (cmd (lookup-key emacspeak-keymap key)))
>> + (when (commandp cmd)
>> + (call-interactively cmd))))
>> +
>> +(with-eval-after-load 'helm-lib
>> + (helm-help-define-key (key-description emacspeak-prefix)
>> #'emacspeak-helm-help-dispatch-prefix))
>>
>> (provide 'emacspeak-helm)
>> ;;; end of file
>>
>> Emacspeak discussion list -- emacspeak AT emacspeak.net
>> To unsubscribe send email to:
>> emacspeak-request AT emacspeak.net with a subject of: unsubscribe




Archive powered by MHonArc 2.6.19+.

Top of Page