alfiedotwtf4 · 2022-12-25 14:07
Merry Christmas!
During my Christmas break, I thought I would learn more about the wonderful world of Emacs. I thought tweaking my personal window management might have been a good place to start, however this is not working as I wanted it to...
So I have 2 windows open and the point is on the right. If I run my function, I expected it to:
1. open the next buffer in the left window
2. open the documentation in the left window
But nothing happens. I've added debugging to show that the function is being called, and it seems fine.
Any help would be appreciated!
​
**(defun** **show-docs-left ()**
**(interactive)**
**(windmove-display-in-direction 'left)**
**(eldoc-doc-buffer))**
**(global-set-key (kbd "C-c d l") 'show-docs-left)**
eel_3y3 · 2022-12-25 14:42
Is there anything in \*Messages\*? Your code works fine for me as long as the point is over a lisp symbol, either calling the function directly or using the shortcut.
link0ff · 2022-12-25 16:00
`windmove-display-in-direction` redirects the buffer displayed by the next command to the left window. But `eldoc-doc-buffer` doesn't display a buffer, it only returns the value with the buffer. So maybe you could use something like this instead:
(display-buffer-in-direction (eldoc-doc-buffer) '(nil (direction . left)))
alfiedotwtf4 · 2022-12-26 05:41
Thanks, I keep forgetting about \*Messages\*, but I think it was the way I was calling things.
alfiedotwtf4 · 2022-12-26 05:42
Thanks for that. With your code I was able to do exactly what I wanted (after a lot of trail and error). It may not be the most abstracted and the right way to do things, but it works :)
`(defun show-docs-left-window ()`
`(interactive)`
`(windmove-left)`
`(display-buffer (eldoc-doc-buffer) '(display-buffer-same-window))`
`(windmove-right))`
`(global-set-key (kbd "C-c d l") 'show-docs-left-window)`
`(defun show-docs-left-new-window ()`
`(interactive)`
`(display-buffer-in-direction (eldoc-doc-buffer) '(nil (direction . left))))`
`(global-set-key (kbd "C-c d L") 'show-docs-left-new-window)`
`(defun show-docs-right-window ()`
`(interactive)`
`(windmove-right)`
`(display-buffer (eldoc-doc-buffer) '(display-buffer-same-window))`
`(windmove-left))`
`(global-set-key (kbd "C-c d r") 'show-docs-right-window)`
`(defun show-docs-right-new-window ()`
`(interactive)`
`(display-buffer-in-direction (eldoc-doc-buffer) '(nil (direction . right))))`
`(global-set-key (kbd "C-c d R") 'show-docs-right-new-window)`