From: Brian Jenkins <brian@brianjenkins.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: [PATCH] focus hook documentation
Date: Wed, 20 Nov 2013 13:47:09 -0500 [thread overview]
Message-ID: <CADTx1Oz_FVE0-FRjvrxLOSGq1FmemrJUL8M_05kPb=x690b1bA@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 196 bytes --]
Hello, Emacs Hackers.
Here is documentation for the new focus hooks (focus-in-hook and
focus-out-hook), including requests not to impose focus hooks on others,
as discussed.
Best,
Brian Jenkins
[-- Attachment #1.2: Type: text/html, Size: 308 bytes --]
[-- Attachment #2: focus-hook-docs.patch --]
[-- Type: application/octet-stream, Size: 3598 bytes --]
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 4935534..1027c86 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1479,6 +1479,28 @@ The redirection lasts until @code{redirect-frame-focus} is called to
change it.
@end defun
+@defun focus-in-hook
+This is a normal hook run when an Emacs frame gains input focus.
+
+Note that this hook is run when focus switches from one Emacs frame to
+another.
+
+This hook should not be set in published packages. It
+should be be left to the user to configure, as behavior on focus
+change is a matter of (often strongly held) personal preference.
+@end defun
+
+@defun focus-out-hook
+Normal hook run when a frame loses input focus.
+
+Note that this hook is run when focus switches from one Emacs frame to
+another.
+
+This hook should not be set in published packages. It
+should be be left to the user to configure, as behavior on focus
+change is a matter of (often strongly held) personal preference.
+@end defun
+
@defopt focus-follows-mouse
This option is how you inform Emacs whether the window manager transfers
focus when the user moves the mouse. Non-@code{nil} says that it does.
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index 745393f..08396cb 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -115,6 +115,12 @@ Function to call to ``quit'' the current buffer.
@vindex delayed-warnings-hook
The command loop runs this soon after @code{post-command-hook} (q.v.).
+@item focus-in-hook
+@vindex focus-in-hook
+@itemx focus-out-hook
+@vindex focus-out-hook
+@xref{Input Focus}
+
@item delete-frame-functions
@xref{Deleting Frames}.
diff --git a/etc/NEWS b/etc/NEWS
index 9772f97..900855c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -165,6 +165,8 @@ Generic commands are interactive functions whose implementation can be
selected among several alternatives, as a matter of user preference.
** New hooks `focus-in-hook', `focus-out-hook'.
+Normal hooks run when an Emacs frame gains or loses input focus.
+(Intended for use only by end-users, not in packages.)
** The blink cursor stops blinking after 10 blinks (default) on X and NS.
You can change the default by customizing the variable blink-cursor-blinks.
diff --git a/src/frame.c b/src/frame.c
index fbfc772..5b537da 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -4472,12 +4472,22 @@ The pointer becomes visible again when the mouse is moved. */);
Vmake_pointer_invisible = Qt;
DEFVAR_LISP ("focus-in-hook", Vfocus_in_hook,
- doc: /* Normal hook run when a frame gains input focus. */);
+ doc: /* Normal hook run when an Emacs frame gains input focus.
+Note that this hook is run when focus switches from one Emacs frame to
+another.
+This hook should not be set in published packages. It
+should be be left to the user to configure, as behavior on focus
+change is a matter of (often strongly held) personal preference.*/);
Vfocus_in_hook = Qnil;
DEFSYM (Qfocus_in_hook, "focus-in-hook");
DEFVAR_LISP ("focus-out-hook", Vfocus_out_hook,
- doc: /* Normal hook run when a frame loses input focus. */);
+ doc: /* Normal hook run when an Emacs frame loses input focus.
+Note that this hook is run when focus switches from one Emacs frame to
+another.
+This hook should not be set in published packages. It
+should be be left to the user to configure, as behavior on focus
+change is a matter of (often strongly held) personal preference.*/);
Vfocus_out_hook = Qnil;
DEFSYM (Qfocus_out_hook, "focus-out-hook");
next reply other threads:[~2013-11-20 18:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-20 18:47 Brian Jenkins [this message]
2013-11-23 17:04 ` [PATCH] focus hook documentation Brian Jenkins
2013-11-23 19:10 ` Glenn Morris
2013-11-23 22:47 ` Brian Jenkins
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADTx1Oz_FVE0-FRjvrxLOSGq1FmemrJUL8M_05kPb=x690b1bA@mail.gmail.com' \
--to=brian@brianjenkins.org \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).