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

Re: Advising expand-region



Here is a cleaned up and properly documented version.

;; emacspeak-expand-region.el --- Speech enable expand-region
;;{{{ Copyright:
;;; Copyright (C) 2012, Jason J.G. White
;;; Portions copyright (C) 1995 -- 2012, T.V. Raman
;;; 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
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; 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.

;;}}}
;;{{{ Requires:
(require 'emacspeak-preamble)
;;}}}
;;{{{ Introduction
;;; Expand-region extends the region, based on the syntax of the text in the buffer,
;;; upon each successive invocation of er/expand-region. Correspondingly,
;;; er/contract-region shrinks the region. Note that point is moved to the
;;; start of the newly expanded or contracted region.
;;;
;;; See the Git repository at git://github.com/magnars/expand-region.el.git
;;}}}
;;{{{ Code:
(loop for f in
      '(er/expand-region
	er/contract-region)
      do
      (eval `(defadvice ,f (around emacspeak pre act comp)
	       "Provide auditory feedback."
	       (let ((emacspeak-speak-messages)
		     (history er/history))
		 ad-do-it
		 (if (and (interactive-p) (not (eql history er/history)))
		     (let ((deactivate-mark))
		       (emacspeak-auditory-icon 'mark-object)
		       (ems-set-personality-temporarily (point) (mark) 'animate
							(emacspeak-speak-region (point) (mark)))))))))
;;}}}
(provide 'emacspeak-expand-region)
;;{{{  emacs 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