From: raman <raman@google.com>
To: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: HowTo: Run a hook when a buffer becomes "current"
Date: Thu, 17 Dec 2015 20:20:08 -0800 [thread overview]
Message-ID: <p91d1u4v153.fsf@google.com> (raw)
In-Reply-To: <E1a9mHl-0000bc-LK@fencepost.gnu.org> (Richard Stallman's message of "Thu, 17 Dec 2015 23:04:53 -0500")
Richard Stallman <rms@gnu.org> writes:
I just sent a short follow-up to Karl's note, but here is a more
detailed explanation.
I'm implementing myself something I'm calling "SoundScapes" --I'm
building it within Emacspeak but it may well be useful more generally.
I got tired of having to listen to text-to-speech all day long and
wanted to see if having soft nature sounds in the background helped.
I didn't want to get distracted from what I'm working on by having to
select music that plays in the background etc -- and I discovered this
package http://boodler.org -- that lets me play a variety of soft nature
sounds in the background.
so i wrote myself module soundscape.el
Code: github.io/tvraman/emacspeak (lisp/soundscape.el) -- docs are here:
http://tvraman.github.io/emacspeak/manual/soundscape.html
I divided the types of things I do into categories:
(things I do == things I do in Emacs since I dont use anything else)
Communicate: mail, gnus, twitter, jabber etc
Program (prog-mode covers them all)
text-mode (write content)
special-mode: applications written in Emacs
web: eww, w3
Then I created a mapping from modes to soundscapes (think mode -> mood)
and finally, i attached myself to select-mode-hook to switch the
soundscape that is playing.
My first attempt at doing this failed badly -- I tried attaching myself
to buffer-list-update-hook -- it fails because that hook gets called way
too often.
I'm not wedded to the advice on select-window;
-- all I want is to be able to attach my soundscape-update-hook to
the right point in Emacs so that when a buffer becomes current, the set
of playing SoundScapes automatically change (both killing off
soundscapes that are now irrelevant vs starting ones that are now
relevant per the context.
--Raman
any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > I specifically want to run a function when a function becomes current
> > and interactable by the user -- agreed that I dont want to run code in
> > the case of set-buffer. For now, an after advice on select-window does
> > nicely -- a select-window-hook would obviate the need for that advice
>
> That too will cause trouble for debugging. I think it is better
> for interfaces to simply operate on whatever buffer you're typing at.
>
> What would you like to use select-window-hook to do? Let's look for
> some way to achieve the ultimate goal.
--
next prev parent reply other threads:[~2015-12-18 4:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-16 16:37 HowTo: Run a hook when a buffer becomes "current" raman
2015-12-16 21:51 ` Nicolas Richard
2015-12-16 23:04 ` David Kastrup
2015-12-16 23:20 ` T.V Raman
2015-12-17 4:58 ` Richard Stallman
2015-12-17 16:15 ` raman
2015-12-18 4:04 ` Richard Stallman
2015-12-18 4:20 ` raman [this message]
2015-12-18 9:30 ` David Kastrup
2015-12-18 16:15 ` raman
2015-12-19 4:37 ` Richard Stallman
2015-12-19 16:43 ` raman
2015-12-19 17:07 ` Dmitry Gutov
2015-12-20 3:07 ` raman
2015-12-22 17:47 ` John Wiegley
2015-12-22 18:19 ` raman
2015-12-18 1:56 ` Karl Fogel
2015-12-18 3:19 ` raman
2015-12-18 12:14 ` Marcin Borkowski
2015-12-18 16:18 ` raman
2015-12-18 17:06 ` David Kastrup
2015-12-18 18:13 ` Marcin Borkowski
2015-12-18 18:28 ` T.V Raman
2015-12-18 20:12 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=p91d1u4v153.fsf@google.com \
--to=raman@google.com \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.