Skip to content

Commit

Permalink
Initial implementation that doesn't quite work
Browse files Browse the repository at this point in the history
  • Loading branch information
rbanffy committed Nov 28, 2015
1 parent 87dca6d commit 8517ede
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
@@ -1,2 +1,9 @@
# selectric-mode
Make your Emacs sound like a proper typewriter.

Make your Emacs sound like a proper typewriter. Extremely useful if you
have a puny, silent, rubberish, non-clicky keyboard.

The sound of the typewriter was recorded by a person nicknamed
"secretmojo" and is available on
https://www.freesound.org/people/secretmojo/sounds/224012/ under a
Creative Commons license.
55 changes: 55 additions & 0 deletions selectric-mode.el
@@ -0,0 +1,55 @@
;;; selectric-mode.el --- IBM Selectric mode for Emacs -*- lexical-binding: t; -*-

;; Copyright (C) 2015 Ricardo Bánffy

;; Author: Ricardo Bánffy <rbanffy@gmail.com>
;; Keywords: multimedia, convenience, typewriter, selectric

;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; This minor mode plays the sound of an IBM Selectric typewriter as
;; you type.

;;; Code:

(defun selectric-type-sound ()
(start-process-shell-command
"*Messages*" nil (format "aplay %sselectric-type.wav"
(file-name-directory load-file-name))))

(define-minor-mode selectric-mode
"Toggle Selectric mode.
Interactively with no argument, this command toggles the mode.
A positive prefix argument enables the mode, any other prefix
argument disables it. From Lisp, argument omitted or nil enables
the mode, `toggle' toggles the state.
When Selectric mode is enabled, your Emacs will sound like an IBM
Selectric typewriter."
:global t
;; The initial value.
:init-value nil
;; The indicator for the mode line.
:lighter " Selectric"
:group 'selectric

(if selectric-mode
(add-hook 'post-self-insert-hook 'selectric-type-sound)
(remove-hook 'post-self-insert-hook 'selectric-type-sound))
)

(provide 'selectric-mode)
;;; selectric-mode.el ends here
Binary file added selectric-move.wav
Binary file not shown.
Binary file added selectric-type.wav
Binary file not shown.

0 comments on commit 8517ede

Please sign in to comment.