Remove blink-cursor code.
(blink-cursor-timer-function, blink-cursor-suspend): Don't special-case GUIs.
(blink-cursor-mode): Use focus-in/out-hook.
* src/frame.c (Fhandle_focus_in, Fhandle_focus_out): Move to frame.el.
(syms_of_frame): Don't defsubr them.
+2013-11-25 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * frame.el (handle-focus-in, handle-focus-out): Move from frame.c.
+ Remove blink-cursor code.
+ (blink-cursor-timer-function, blink-cursor-suspend):
+ Don't special-case GUIs.
+ (blink-cursor-mode): Use focus-in/out-hook.
+
2013-11-25 Dmitry Gutov <dgutov@yandex.ru>
* vc/vc-git.el (vc-git-annotate-extract-revision-at-line): Make it
2013-11-21 Leo Liu <sdl.web@gmail.com>
- * progmodes/octave.el (octave-mode, inferior-octave-mode): Fix
- obsolete variable comment-use-global-state.
+ * progmodes/octave.el (octave-mode, inferior-octave-mode):
+ Fix obsolete variable comment-use-global-state.
2013-11-21 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de>
- * progmodes/octave.el (octave-mode-map, octave-mode-menu): Add
- `octave-source-file'.
+ * progmodes/octave.el (octave-mode-map, octave-mode-menu):
+ Add `octave-source-file'.
(octave-source-file): New function. (Bug#15935)
2013-11-21 Kenjiro Nakayama <nakayamakenjiro@gmail.com> (tiny change)
(delete-frame frame t)
;; Gildea@x.org says it is ok to ask questions before terminating.
(save-buffers-kill-emacs))))
+
+(defun handle-focus-in (_event)
+ "Handle a focus-in event.
+Focus-in events are usually bound to this function.
+Focus-in events occur when a frame has focus, but a switch-frame event
+is not generated.
+This function runs the hook `focus-in-hook'."
+ (run-hooks 'focus-in-hook))
+
+(defun handle-focus-out (_event)
+ "Handle a focus-out event.
+Focus-out events are usually bound to this function.
+Focus-out events occur when no frame has focus.
+This function runs the hook `focus-out-hook'."
+ (run-hooks 'focus-out-hook))
\f
;;;; Arrangement of frames at startup
"Timer function of timer `blink-cursor-timer'."
(internal-show-cursor nil (not (internal-show-cursor-p)))
;; Each blink is two calls to this function.
- (when (memq window-system '(x ns w32))
- (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done))
- (when (and (> blink-cursor-blinks 0)
- (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done))
- (blink-cursor-suspend)
- (add-hook 'post-command-hook 'blink-cursor-check))))
+ (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done))
+ (when (and (> blink-cursor-blinks 0)
+ (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done))
+ (blink-cursor-suspend)
+ (add-hook 'post-command-hook 'blink-cursor-check)))
(defun blink-cursor-end ()
(setq blink-cursor-timer nil)))
(defun blink-cursor-suspend ()
- "Suspend cursor blinking on NS, X and W32.
+ "Suspend cursor blinking.
This is called when no frame has focus and timers can be suspended.
Timers are restarted by `blink-cursor-check', which is called when a
frame receives focus."
- (when (memq window-system '(x ns w32))
- (blink-cursor-end)
- (when blink-cursor-idle-timer
- (cancel-timer blink-cursor-idle-timer)
- (setq blink-cursor-idle-timer nil))))
+ (blink-cursor-end)
+ (when blink-cursor-idle-timer
+ (cancel-timer blink-cursor-idle-timer)
+ (setq blink-cursor-idle-timer nil)))
(defun blink-cursor-check ()
"Check if cursor blinking shall be restarted.
(if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
(setq blink-cursor-idle-timer nil)
(blink-cursor-end)
+ (remove-hook 'focus-in-hook #'blink-cursor-check)
+ (remove-hook 'focus-out-hook #'blink-cursor-suspend)
(when blink-cursor-mode
- ;; Hide the cursor.
- ;;(internal-show-cursor nil nil)
+ (add-hook 'focus-in-hook #'blink-cursor-check)
+ (add-hook 'focus-out-hook #'blink-cursor-suspend)
(setq blink-cursor-idle-timer
(run-with-idle-timer blink-cursor-delay
blink-cursor-delay
- 'blink-cursor-start))))
+ #'blink-cursor-start))))
\f
;; Frame maximization/fullscreen
+2013-11-25 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * frame.c (Fhandle_focus_in, Fhandle_focus_out): Move to frame.el.
+ (syms_of_frame): Don't defsubr them.
+
2013-11-25 Glenn Morris <rgm@gnu.org>
* lread.c (load_path_default): Change the sense of the argument.
return do_switch_frame (frame, 1, 0, norecord);
}
-DEFUN ("handle-focus-in", Fhandle_focus_in, Shandle_focus_in, 1, 1, "e",
- doc: /* Handle a focus-in event.
-Focus in events are usually bound to this function.
-Focus in events occur when a frame has focus, but a switch-frame event
-is not generated.
-This function runs the hook `focus-in-hook'.
-It also checks if blink-cursor timers should be turned on again. */)
- (Lisp_Object event)
-{
- Frun_hooks (1, &Qfocus_in_hook);
- return call0 (intern ("blink-cursor-check"));
-}
-
-DEFUN ("handle-focus-out", Fhandle_focus_out, Shandle_focus_out, 1, 1, "e",
- doc: /* Handle a focus-out event.
-Focus out events are usually bound to this function.
-Focus out events occur when no frame has focus.
-This function runs the hook `focus-out-hook'.
-It also checks if blink-cursor timers should be turned off. */)
- (Lisp_Object event)
-{
- Frun_hooks (1, &Qfocus_out_hook);
- return call0 (intern ("blink-cursor-suspend"));
-}
-
DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 1, "e",
doc: /* Handle a switch-frame event EVENT.
Switch-frame events are usually bound to this function.
/* Preserve prefix arg that the command loop just cleared. */
kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
Frun_hooks (1, &Qmouse_leave_buffer_hook);
- Fhandle_focus_in (event); // switch-frame implies a focus in.
+ /* `switch-frame' implies a focus in. */
+ call1 (intern ("handle-focus-in"), event);
return do_switch_frame (event, 0, 0, Qnil);
}
defsubr (&Swindow_system);
defsubr (&Smake_terminal_frame);
defsubr (&Shandle_switch_frame);
- defsubr (&Shandle_focus_in);
- defsubr (&Shandle_focus_out);
defsubr (&Sselect_frame);
defsubr (&Sselected_frame);
defsubr (&Sframe_list);