Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation that doesn't quite work
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 not shown.
Binary file not shown.