From mboxrd@z Thu Jan 1 00:00:00 1970 From: prayner Subject: patch to add org-table-previous-row to org-table Date: Sun, 5 Jul 2015 08:46:37 +1000 Message-ID: <21912.25165.91884.664853@localhost.localdomain> Reply-To: prayner@unimelb.edu.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBWCs-00006P-Cz for emacs-orgmode@gnu.org; Sat, 04 Jul 2015 18:46:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZBWCo-0004R3-6S for emacs-orgmode@gnu.org; Sat, 04 Jul 2015 18:46:46 -0400 Received: from mail-gw2.its.unimelb.edu.au ([128.250.5.151]:44919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBWCn-0004QN-SM for emacs-orgmode@gnu.org; Sat, 04 Jul 2015 18:46:42 -0400 Received: from localhost.localdomain (unknown [10.1.128.67]) by mail-gw2.its.unimelb.edu.au (Postfix) with ESMTP id AFC1B28200D for ; Sun, 5 Jul 2015 08:46:37 +1000 (AEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I am working with the accessibility system emacspeak to improve eyes-free access to org-mode tables. Most of this can be done outside the org-mode tree by advising existing functions but I've run into a need for a new function. I need org-table-previous-row analogous to org-table-next-row. Below is a patch to add this. The behaviour is almost identical to org-table-next-row except that org-table-previous-row in the first row of the table is a no-op. Please consider adding this to the repository. Comments and corrections welcome but please send them to me directly as well as the list. regards Peter ---------------------------------------------------------------------- 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