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

some more work on org tables (fwd)





--


---------- Forwarded message ----------
Date: Sat, 4 Jul 2015 21:36:00
From: prayner <prayner@unimelb.edu.au>
To: emacspeak@cs.vassar.edu
Subject: some more work on org tables
Resent-Date: Sat,  4 Jul 2015 21:43:15 -0400 (EDT)
Resent-From: emacspeak@cs.vassar.edu

I've done a bit more to add some of the functionality of
emacspeak-table-ui into browsing org-mode tables. One can now read row
and column headers using, e.g. "ctrl-e b" for both (keystrokes
copied from emacspeak-table-ui).
One catch at the moment is that the command to move up through a
column requires a new function in org-table. I've asked for that to be
added but I include it here for people who can and wish to install it
locally.
A few things still to do on automated reading of headers but I already
find this useful.
cheers
Peter
----------------------------------------------------------------------
git diff origin -- emacspeak-org.el
diff --git a/lisp/emacspeak-org.el b/lisp/emacspeak-org.el
index 8a7d834..0b78d49 100644
--- a/lisp/emacspeak-org.el
+++ b/lisp/emacspeak-org.el
@@ -172,7 +172,7 @@
               (emacspeak-org-table-speak-current-element))
              (t
               (emacspeak-speak-line)
-              (emacspeak-auditory-icon 'select-object)))))))xrjp
+              (emacspeak-auditory-icon 'select-object)))))))

 (defadvice org-overview (after emacspeak pre act comp)
   "Provide auditory feedback."
@@ -395,12 +395,18 @@
           ("M-S-<right>" org-shiftmetaright)
           ("M-S-<up>" org-shiftmetaup)
           ("M-S-RET" org-insert-todo-heading)
+	  ("S-RET" org-table-previous-row)
           ("M-n" org-next-item)
           ("M-p" org-previous-item)
           ("S-<down>" org-shiftdown)
           ("S-<left>" org-shiftleft)
           ("S-<right>" org-shiftright)
           ("S-<up>" org-shiftup)
+	  ("C-e <SPC>" emacspeak-org-table-speak-current-element)
+	  ("C-e ." emacspeak-org-table-speak-coordinates)
+	  ("C-e b" emacspeak-org-table-speak-both-headers-and-element)
+	  ("C-e r" emacspeak-org-table-speak-row-header-and-element)
+	  ("C-e c" emacspeak-org-table-speak-column-header-and-element)
           ("S-TAB" org-shifttab)
           )
         do
@@ -545,9 +551,56 @@
   "echoes current table element"
   (interactive)
   (dtk-speak-and-echo (org-table-get-field)))
+
+;;;###autoload
+(defun emacspeak-org-table-speak-column-header ()
+  "echoes column header"
+  (interactive)
+  (dtk-speak-and-echo (org-table-get 1 nil)))
+
+;;;###autoload
+(defun emacspeak-org-table-speak-row-header ()
+  "echoes column header"
+  (interactive)
+  (dtk-speak-and-echo (org-table-get nil 1 )))
+
+;;;###autoload
+(defun emacspeak-org-table-speak-coordinates ()
+  "echoes coordinates"
+  (interactive)
+  (dtk-speak-and-echo (concat "row " (number-to-string (org-table-current-line))
+			      ", column " (number-to-string (org-table-current-column)))))
+
+;;;###autoload
+(defun emacspeak-org-table-speak-both-headers-and-element ()
+  "echoes coordinates"
+  (interactive)
+  (dtk-speak-and-echo (concat (org-table-get nil 1) ", "
+			      (org-table-get  1 nil) ", "
+			      (org-table-get-field))))
+
+;;;###autoload
+(defun emacspeak-org-table-speak-row-header-and-element ()
+  "echoes coordinates"
+  (interactive)
+  (dtk-speak-and-echo (concat (org-table-get nil 1) ", "
+			      (org-table-get-field))))
+
+;;;###autoload
+(defun emacspeak-org-table-speak-column-header-and-element ()
+  "echoes coordinates"
+  (interactive)
+  (dtk-speak-and-echo (concat
+			      (org-table-get  1 nil) ", "
+			      (org-table-get-field))))
+
+
+
+
+
 (loop
  for f in
- '(org-table-next-field org-table-previous-field)
+ '(org-table-next-field org-table-previous-field org-table-next-row org-table-previous-row)
  do
  (eval
   `(defadvice ,f  (after emacspeak pre act comp)
----------------------------------------------------------------------

And now the org-table patch
----------------------------------------------------------------------
git diff origin -- org-table.el
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 8a6e22b..f17d84d 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1092,6 +1092,30 @@ Before doing so, re-align the table if necessary."
       (if (looking-at " ") (forward-char 1)))))

 ;;;###autoload
+(defun org-table-previous-row ()
+  "Go to the previous row (same column) in the current table.
+Before doing so, re-align the table if necessary."
+  (interactive)
+  (org-table-maybe-eval-formula)
+  (org-table-maybe-recalculate-line)
+  (if (or (looking-at "[ \t]*$")
+	  (save-excursion (skip-chars-backward " \t") (bolp)))
+      (newline)
+    (if (and org-table-automatic-realign
+	     org-table-may-need-update)
+	(org-table-align))
+    (let ((col (org-table-current-column)))
+      (beginning-of-line 0)
+      (if (or (not (org-at-table-p))
+	      (org-at-table-hline-p))
+	  (progn
+	    (beginning-of-line 1)))
+      (org-table-goto-column col)
+      (skip-chars-backward "^|\n\r")
+      (if (looking-at " ") (forward-char 1)))))
+
+
+;;;###autoload
 (defun org-table-copy-down (n)
   "Copy the value of the current field one row below.

----------------------------------------------------------------------




--
Peter Rayner
Leader, Clean Air and Urban Landscapes NESP hub.
room 343
School of Earth Sciences, University of Melbourne, 3010, Vic, Australia
tel: work: +61 (0)3 8344 9708; fax: +61 (0)3 8344 7761
mobile +61 402 752 379, skype: petermorag
mail-to: prayner@unimelb.edu.au
google scholar profile <http://scholar.google.com.au/citations?user=H3up71wAAAAJ&hl=en>

-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
subject of "unsubscribe" or "help".

-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
subject of "unsubscribe" or "help".



If you have questions about this archive or had problems using it, please send mail to:

priestdo@cs.vassar.edu No Soliciting!

Emacspeak List Archive | 2010 | 2009 | 2008 | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 | 2001 | 2000 | 1999 | 1998 | Pre 1998

Emacspeak Files | Emacspeak Blog | Search the archive