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

Patch to improve org date manipulation



Good afternoon,

Please find attached a small patch that modifies the way emacspeak
speaks org dates when they are changed with s-up and s-down.

Previously emacspeak would speak the entire line.  I found this a little
verbose and wanted to hear just the relevant information.

This patch attempts to address this by doing the following:
- Compare the date before and after the change. 
- Find where the two strings differ.
- Move point to the difference and then move back past any numbers.
- Speak the line from this point.


I welcome peoples thoughts on both the efficacy of this aproach and my
coding style.
. 
Kind regards

Bart
Index: emacspeak-org.el
===================================================================
--- emacspeak-org.el	(revision 8334)
+++ emacspeak-org.el	(working copy)
@@ -269,8 +269,8 @@
 
 (loop for f in
       '(
-        org-timestamp-down org-timestamp-down-day
-                           org-timestamp-up org-timestamp-up-day)
+        org-timestamp-down-day
+	org-timestamp-up-day)
       do
       (eval
        `(defadvice ,f (after emacspeak pre act comp)
@@ -279,6 +279,28 @@
             (emacspeak-auditory-icon 'select-object)
             (emacspeak-speak-line)))))
 
+(loop for f in
+      '(
+        org-timestamp-down org-timestamp-up)
+      do
+      (eval
+       `(defadvice ,f (around emacspeak pre act comp)
+	  "Provide auditory feedback."
+	  (when (ems-interactive-p )
+	    (emacspeak-auditory-icon 'select-object)
+	    (let ((prior 
+		   (append (buffer-substring 
+			    (save-excursion (beginning-of-line) (point))
+			    (save-excursion (end-of-line) (point))
+			    ) nil)))
+	      ad-do-it
+	      (save-excursion 
+		(beginning-of-line)
+		(while (equal (char-after) (pop prior))
+		  (forward-char))
+		(skip-chars-backward "0-9")
+		(emacspeak-speak-line 1)))))))
+
 (defadvice org-eval-in-calendar (after emacspeak pre act comp)
   "Speak what is returned."
   (declare (special org-ans2))
-- 


Kind regards

Bart


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

priestdo@xxxxxxxxxxx No Soliciting!

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

Emacspeak Files | Emacspeak Blog