Skip to content

Commit

Permalink
Merge with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rbanffy committed Dec 1, 2015
2 parents 84ba5cd + 9bc335c commit 55732cf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# selectric-mode

[![MELPA](https://melpa.org/packages/selectric-mode-badge.svg)]
(https://melpa.org/#/selectric-mode)

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.

To install it, simply add it to your load-path, require it:

```elisp
(add-to-list 'load-path "~/.emacs.d/plugins/selectric-mode")
(require 'selectric-mode)
```

And then activate/deactivate with M-x `selectric-mode`. When it's
activated, you'll hear a typing sound for confirmation. When it
deactivates, you'll hear a carriage movement sound instead.
17 changes: 14 additions & 3 deletions selectric-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@
(start-process "*Messages*" nil "aplay" (format "%sselectric-type.wav"
selectric-files-path))))

;;;###autoload
;;;autoload
(defun selectric-move-sound ()
(if (eq system-type 'darwin)
(start-process "*Messages*" nil "afplay" (format "%sselectric-move.wav"
selectric-files-path))
(start-process "*Messages*" nil "aplay" (format "%sselectric-move.wav"
selectric-files-path))))

(define-minor-mode selectric-mode
"Toggle Selectric mode.
Interactively with no argument, this command toggles the mode.
Expand All @@ -52,8 +59,12 @@ Selectric typewriter."
:group 'selectric

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

(provide 'selectric-mode)
Expand Down

0 comments on commit 55732cf

Please sign in to comment.