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

Re: Identica-mode customization for emacspeak

T.V. Raman <tv.raman.tv@gmail.com> wrote:
> I'd say release earll, release ofen and iterate -- AKA
> perfection never comes.

With that in mind, here's the current version.

Warning: it contains code that has known bugs. For example, the function which
notifies the user of the arrival of new messages is meant by default to do so
only if the Identica buffer is current. Unfortunately there's something wrong
with the test that's supposed to control this, as a result of which no
notifications occur at all.

Similarly, the code to read URIs in the minibuffer when the F4 command is
issued fails to do so. I've had it occasionally working, so I'll need to go
back and try to find out what's wrong here.

There are probably other bugs that an experienced Lisp programmer would notice
straight away.

On the positive side, it's already practically useful despite the
shortcomings, and it served as a good exercise in my road to learning Lisp -
and it was fun to write.

;;{{{ Copyright
;;;Copyright (C) 2010, Jason White
;;; Portions Copyright (C) 1995 -- 2009, T. V. Raman
;;;All rights reserved.
;;; This file is not part of GNU Emacs, but the same permissions apply.
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; GNU Emacs is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING.  If not, write to
;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.


(require 'emacspeak-preamble)
;;{{{ Introduction
;;This module speech-enables identica-mode: http://www.nongnu.org/identica-mode/
;;The code is influenced in particular by emacspeak-twit.el.
;;{{{ variables
(defvar emacspeak-identica-announce-new-dents nil
  "*If true, announce new dents even if identica-buffer is not current")
;;{{{ Voice map
   (identica-username-face voice-bolden)
   (identica-reply-face voice-brighten)
   (identica-uri-face voice-lighten)))

;;{{{Key bindings
(emacspeak-rebind #'backward-char #'emacspeak-backward-char identica-mode-map)
(emacspeak-rebind #'forward-char #'emacspeak-forward-char identica-mode-map)

;;{{{ Hooks
(add-hook 'identica-mode-hook 'turn-on-voice-lock)
(add-hook 'identica-new-dents-hook 'emacspeak-identica-new-dents)

;;{{{ Supporting functions
(defun emacspeak-identica-speak-status ()
  "Speaks text between point and the end of the current status"
      ((start (point))
       (end (or (identica-get-next-username-face-pos start)
    (emacspeak-speak-region start end)))

(defun emacspeak-identica-new-dents ()
  "Announce the arrival of new messages"
  (when (or emacspeak-identica-announce-new-dents
	    (eql (get-buffer identica-buffer) (current-buffer))))
    (message "%d new Identica %s"
	     (if (> identica-new-dents-count 1)
		 "messages" "message"))))


;;{{{ Advice
(loop for f in
      `(defadvice ,f (around emacspeak pre act comp)
	 "Provide auditory feedback"
	 (when (interactive-p)
	       ((prior (point)))
	     (unless (eql prior (point))
	       (emacspeak-auditory-icon 'select-object)

(loop for f in
	 `(defadvice ,f (after emacspeak pre act comp)
	    "Provide auditory feedback"
	    (when (and
		   (get-text-property (point) 'uri))
	      (emacspeak-auditory-icon 'select-object)
	      (emacspeak-speak-region (point) (next-property-change (point)))))))

(defadvice identica-tinyurl-replace-at-point (after emacspeak pre act comp)
  "Provide auditory feedback"
  (let ((bounds (bounds-of-thing-at-point 'url)))
      (if bounds (emacspeak-speak-region (car bounds) (cdr bounds)))))


(provide 'emacspeak-identica)
;;{{{ File-local variables

;;; local variables:
;;; folded-file: t
;;; byte-compile-dynamic: t
;;; end:


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