I want to set different intervals for blinking ON and for blinking OFF. I mean, I want the cursor to stay visible for 1 second and OFF for 0.2 second. I read the cursor documentation but closest I found is the blink-cursor-interval that changes both ON and OFF blinking.
How can I customize this in Emacs?
There's no such functionality built into Emacs, but you can hack it by adding the following lines to your .emacs file:
(defvar blink-cursor-interval-visible 1)
(defvar blink-cursor-interval-invisible 0.2)
(defadvice internal-show-cursor (before unsymmetric-blink-cursor-interval)
(when blink-cursor-timer
(setf (timer--repeat-delay blink-cursor-timer)
(if (internal-show-cursor-p)
blink-cursor-interval-visible
blink-cursor-interval-invisible))))
(ad-activate 'internal-show-cursor)
Emacs implements the blinking of the cursor with a toggle function called by a timer. Each time the function is called, it either hides the cursor if it is currently visible, or shows it if it is invisible. Unfortunately, the timer calls this function at a fixed interval.
In order to realize different delay times depending on the state of the cursor, the above code advises the internal function that shows or hides the cursor. Each time that function is called, the advice changes the delay time of the timer to either 1 or 0.2, depending on whether the cursor is visible or not. That is, every time the cursor is hidden or shown, the timer's delay time is changed.
Quite hackish, but it does the trick.