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

Patch: customizable org-table speak function



Hi,
I have different kinds of tables in org files. Sometimes I want the row headers to be spoken, and sometimes I want the column headers to be read aloud. Sometimes, the cell contents will do because the table is pretty short.
However, currently, Emacspeak's behavior is hard-coded to just speak the cell contents. This patch makes that behavior customizable by adding a variable you can customize and calling that function instead.
1 file changed, 14 insertions(+), 3 deletions(-)
lisp/emacspeak-org.el | 17 ++++++++++++++---

modified   lisp/emacspeak-org.el
@@ -167,6 +167,17 @@
   (when (ems-interactive-p)
     (emacspeak-auditory-icon 'item)
     (emacspeak-speak-line)))
+(defcustom emacspeak-org-table-after-movement-function #'emacspeak-org-table-speak-current-element
+  "The function to call after moving in a table"
+  :type  '(choice
+           (const :tag "speak cell contents only" emacspeak-org-table-speak-current-element)
+           (const :tag "speak column header" emacspeak-org-table-speak-column-header)
+           (const :tag "speak row header" emacspeak-org-table-speak-row-header)
+           (const :tag "speak cell contents and column header" emacspeak-org-table-speak-column-header-and-element)
+           (const :tag "speak cell contents and row header" emacspeak-org-table-speak-row-header-and-element)
+           (const :tag "speak column contents and both headers" emacspeak-org-table-speak-both-headers-and-element))
+  :group 'emacspeak-org)
+
 ;;; orgalist-mode defines structured navigators that in turn call org-cycle.
 ;;; Removing itneractive check in advice for org-cycle
 ;;; to speech enable all such nav commands.
@@ -181,7 +192,7 @@
      "Provide auditory feedback."
      (cond
       ((org-at-table-p 'any)
-       (emacspeak-org-table-speak-current-element))
+       (funcall emacspeak-org-table-after-movement-function))
       (t
 ;;; org produces relevant feedback via org-unlogged-message (folded, children)
        (let ((dtk-stop-immediately nil))
@@ -431,7 +442,7 @@
   (when (ems-interactive-p)
     (cond
      ((org-at-table-p 'any)
-      (emacspeak-org-table-speak-current-element))
+      (funcall emacspeak-org-table-after-movement-function))
      (t
       (emacspeak-speak-line)
       (emacspeak-auditory-icon 'select-object)))))
@@ -591,7 +602,7 @@
  (eval
   `(defadvice ,f  (after emacspeak pre act comp)
      "Provide auditory feedback."
-     (emacspeak-org-table-speak-current-element))))
+     (funcall emacspeak-org-table-after-movement-function))))
 
 ;;}}}
 ;;{{{ Additional table function:



|May 1995 - Last Year |Current Year|


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

Contact Info Page