Here's my function:
(defun scroller-down ()
"Scrolling down conditional for buffer and minibuffer."
(interactive)
(if (active-minibuffer-window)
(ivy-scroll-down-command)
(scroll-down-command)))
(defun scroller-up ()
"Scrolling up conditional for buffer and minibuffer."
(interactive)
(if (active-minibuffer-window)
(ivy-scroll-up-command)
(scroll-up-command)))
This function determines if the minibuffer is open.
If it is open and the cursor is in it, it will scroll in the minibuffer.
However, if it is open and the cursor is not in it, it will neither scroll in the minibuffer, nor the current buffer that the cursor is in.
My goal is to determine which scroll to use depending on if the cursor is in the minibuffer or not.
Is there a variable that returns true if the cursor position is in the minibuffer?
Also is there a better way to condense this function into one, and use a cond
to check if a certain key is pressed, thus activating the appropriate scroll function??
emacs -Q
, describing what you see at each step and what you expected to see instead.(minibufferp)
for several years now to help me know programmatically when to change the color of theminibuffer-prompt
face and thedefault
face in the minibuffer when I move in and out of it; and, then I use(with-selected-window (minibuffer-window) ...)
to do my stuff within that window. Perhaps that combination can either help, or inspire you ...minibufferp
had an optional argument for BUFFER. [Return t if BUFFER is a minibuffer. No argument or nil as argument means use current buffer as BUFFER. BUFFER can be a buffer or a buffer name.]active-minibuffer-window
doesn't care whether the active minibuffer window is selected or not. @lawlist, you should post theminibufferp
details as an answer.