Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. (defun get-file-from-buffer-other-window ()
  2. "Load a file into another window referenced by the string on the current line"
  3. (interactive)
  4.  
  5. ;; get the filename and lineno
  6. (setq vals (get-fileline))
  7. (print vals)
  8.  
  9. ;; load the filename into the next window and goto linenumber
  10. (switch-to-buffer-other-window (find-file-noselect (nth 0 vals)))
  11. (goto-line (nth 1 vals))
  12. )
  13.  
  14. (defun display-on-side (buffer &optional not-this-window frame)
  15. (let* ((window (or (minibuffer-selected-window)
  16. (selected-window)))
  17. (display-buffer-function nil)
  18. (pop-up-windows nil))
  19. (with-selected-window (or window (error "display-on-side"))
  20. (when (one-window-p t)
  21. (split-window-horizontally))
  22. (display-buffer buffer not-this-window frame))))
  23.  
  24. (setq display-buffer-function 'display-on-side)
  25.  
  26. ;; unit test, should open in the same side window.
  27. (display-buffer (get-buffer-create "*foo*"))
  28. (display-buffer (get-buffer-create "*bar*"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement