]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/transcribe/transcribe.el
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa: transcribe.el update
[gnu-emacs-elpa] / packages / transcribe / transcribe.el
index 4ab00a3959b4c5d30da0ead8bae4bca446eadb00..de9736e66fec8367fde96ab0631fd3ea3d872c40 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright 2014-2015  Free Software Foundation, Inc.
 
 ;; Author: David Gonzalez Gandara <dggandara@member.fsf.org>
-;; Version: 0.0.1
+;; Version: 0.5.0
 
 ;; This program is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 
 ;;; Commentary:
 
-;; INSTALLATION
-;;-------------------
-;; If you don't use transcribe as a package, you can install manually:
-;;    Copy this file to somewhere in your drive
-
-;; To load the file --> M-: (load "~/transcribe.el") --- change the route to where you copied the file
-
-;; DEPENDENCIES:
-;;-----------------------------
+;; REQUIRES:
+;; -----------------------------
 ;; In order to use the most important functions of transcribe, you need to install emms and mpg321.
 ;;
-;; DESCRIPTION
-;;-------------------------
+;; USAGE:
+;; -------------------------
 ;; Transcribe is a tool to make audio transcriptions easy. It allows the transcriber to control the audio easily while typing, as well as automate the insertion of xml tags, in case the transcription protocol include them.
 ;; 
 ;;  AUDIO COMMANDS
-;;------------------------------
+;; ------------------------------
 ;;     C-x C-p --------> Play audio file. You will be prompted for the name of the file. The recommended format is mp2.
 ;;     <f5> -----------> Pause or play audio.
 ;;     C-x <right> ----> seek audio 10 seconds forward.
 ;;     <f8> -----------> seek interactively: positive seconds go forward and negative seconds go backward
 ;;
 ;;  XML TAGGING COMMANDS
-;;--------------------------------------------------
+;; --------------------------------------------------
 ;;     C-x C-n --> Create new episode structure. This is useful in case your xml file structure requires it. You can customize the text inserted manipulating the realted function.
 ;;     <f6> -----> Interactively insert new tag. You will be prompted for the content of the tag. The starting tag and the end tag will be inserted automatically and the cursor placed in the proper place to type.
 ;;
 ;;
 ;;
 ;; SPECIFIC COMMANDS I USE, THAT YOU MAY FIND USEFUL
-;;------------------------------------------------
+;; ------------------------------------------------
 ;;     C-x C-a ------> This runs an external discourse analysis tool. It defaults to my own script analyze_episodes2.py, but you can customise the command to launch any other.
 ;;     <f11> --------> Customised tag 1. Edit the function to adapt to your needs.
 ;;     <f12> --------> Customised tag 2. Edit the function to adapt to your needs.
@@ -60,7 +53,7 @@
 
 ;;; Code:
 
-(if t (require 'emms-setup))    ;Only require it at run-time.
+(if t (require 'emms-setup))
 ;(require 'emms-player-mpd)
 ;(setq emms-player-mpd-server-name "localhost")
 ;(setq emms-player-mpd-server-port "6600")
 (if t (require 'emms-playing-time))
 (emms-playing-time 1)
 
-(global-set-key (kbd "C-x C-p") 'emms-play-file)
-
-(global-set-key (kbd "<f5>") 'emms-pause)
-
-(global-set-key (kbd "C-x <down>") 'emms-stop)
-
-(global-set-key (kbd "C-x <right>") 'emms-seek-forward)
-
-(global-set-key (kbd "C-x <left>") 'emms-seek-backward)
 
-(global-set-key (kbd "<f8>") 'emms-seek)
-
-(defun analyze-episode (episode person)
+(defun transcribe-analyze-episode (episode person)
   (interactive "sepisode: \nsperson:")
   (shell-command (concat (expand-file-name  "analyze_episodes2.py") " -e " episode " -p " person " -i " buffer-file-name )))
 
-(global-unset-key (kbd "C-x C-A"))
-(global-set-key (kbd "C-x C-A") 'analyze-episode)
-
-(defun draw-boxplot ()
-  (interactive)
-  (shell-command (concat (expand-file-name "/usr/bin/Rscript ") "boxplot_students.R " buffer-file-name)))
-
-(global-unset-key (kbd "C-x C-B"))
-(global-set-key (kbd "C-x C-B") 'draw-boxplot)
-
-(defun define-xml-tag (xmltag)
+(defun transcribe-define-xml-tag (xmltag)
   (interactive "stag:")
   (insert (format "<%s></%s>" xmltag xmltag))
   (backward-char 3)
   (backward-char (string-width xmltag)))
 
-(defun xml-tag-l1 ()
+(defun transcribe-xml-tag-l1 ()
   (interactive)
   (insert "<l1></l1>")
   (backward-char 3)
   (backward-char 2))
 
-(defun xml-tag-l2 ()
+(defun transcribe-xml-tag-l2 ()
   (interactive)
   (insert "<l2 clauses=\"1\" errors=\"0\"></l2>")
   (backward-char 3)
   (backward-char 2))
 
-(fset 'xml-tag-l2-break "</l2><l2 clauses=\"1\" errors=\"0\">")
-(fset 'set-attributes "clauses=\"1\" errors=\"0\"")
+(fset 'transcribe-xml-tag-l2-break "</l2><l2 clauses=\"1\" errors=\"0\">")
+(fset 'transcribe-set-attributes "clauses=\"1\" errors=\"0\"")
 
-(defun display-audio-info ()
+(defun transcribe-display-audio-info ()
   (interactive)
   (emms-player-mpg321-remote-proc)
   (shell-command "/usr/bin/mpg321 -R - &"))
 
 
-(global-set-key (kbd "<f6>") 'define-xml-tag)
-(global-set-key (kbd "<f7>") 'xml-tag-l2-break)
-(global-set-key (kbd "<f4>") 'set-attributes)
-(global-set-key (kbd "<f11>") 'xml-tag-l1)
-(global-set-key (kbd "<f12>") 'xml-tag-l2)
-
 (fset 'NewEpisode
       "<episode>\n<number>DATE-NUMBER</number>\n<duration></duration>\n<comment></comment>\n<subject>Subject (level)</subject>\n<task>\n\t<role>low or high</role>\n<context>low or high</context>\n<demand>low or high</demand>\r</task>\n<auxiliar>Yes/no</auxiliar>\n<transcription>\n</transcription>\n</episode>")
 
-(global-unset-key (kbd "C-x C-n"))
-(global-set-key (kbd "C-x C-n") 'NewEpisode)
+(define-minor-mode transcribe-mode
+ "Toggle transcribe-mode"
+  nil
+  " Transcribe"
+  '(([?\C-x ?\C-p] . emms-play-file)
+    ([?\C-x ?\C-a] . transcribe-analyze-episode)
+    ([?\C-x ?\C-n] . NewEpisode)
+    ([?\C-x down] . emms-stop)
+    ([?\C-x right] . emms-seek-forward)
+    ([?\C-x left] . emms-seek-backward)
+    ([f5] . emms-pause)
+    ([f6] . transcribe-define-xml-tag)
+    ([f7] . transcribe-xml-tag-l2-break)
+    ([f8] . emms-seek)
+    ([f4] . transcribe-set-atributes)
+    ([f11] . transcribe-xml-tag-l1)
+    ([f12] . transcribe-xml-tag-l2))
+)
 
 (provide 'transcribe)