[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Search]

[RFC} Change emacspeak-execute-repeatedly



Hi Raman,

I would like to request a small change to emacspeak-execute-repeatedly.
Essentially, I would like to make the key used to repeat the command
configurable.

Reason is I'm experimenting with evil-mode and in particular the
spacemacs configuration. This setup uses the space character as the main
interface trigger, which conflicts with emacspeak-execute-repeatedly,
requiring hitting space twice to continue.

Below is the change I have made to allow setting of the key used by
emacspeak-execute-repeatedly and figure is would be worth adding to the
emacspeak code base. Basically, it just puts the key in the variable
emacspeak-execute-repeatedly-key and uses that in the
emacspeak-execute-repeatedly function. It is set to space by default. I
just do a setq to set it to another character in my setup (I use 'c' for
continue). The change should be invisible to standard users.

(defvar emacspeak-execute-repeatedly-key 32
  "Key to use to repeat command.")

(defun emacspeak-execute-repeatedly (command)
  "Execute COMMAND repeatedly."
  (interactive (list (read-command "Command to execute repeatedly:")))
  (let ((key "")
        (pos (point))
        (continue t)
        (message (format "Press %s to execute %s again"
                         (if (= 32 emacspeak-execute-repeatedly-key)
                                                            "space"
                                                          (char-to-string emacspeak-execute-repeatedly-key))
                         command)))
    (while continue
      (call-interactively command)
      (cond
       ((= (point) pos) (setq continue nil))
       (t (setq pos (point))
          (setq key (read-key-sequence message))
          (when (and (stringp key)
                     (not (= emacspeak-execute-repeatedly-key (string-to-char key))))
            (dtk-stop)
            (setq continue nil)))))
    (dtk-speak "Exited continuous mode ")))

--
Tim Cross



|All Past Years |Current Year|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page