Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(pop-to-buffer-same-window ...) causing margin to be stripped #20

Open
rytswd opened this issue May 30, 2024 · 2 comments
Open

(pop-to-buffer-same-window ...) causing margin to be stripped #20

rytswd opened this issue May 30, 2024 · 2 comments

Comments

@rytswd
Copy link

rytswd commented May 30, 2024

I just noticed how running (dwim-shell-command) from a buffer with custom margin set with something like (set-window-margins nil 3 3) gets the margin reset to nil due to the following line in cl-defun dwim-shell-command-execute-script:

    ;; Momentarily set buffer to same window, so it's next in recent stack.
    ;; Makes finding the shell command buffer a lot easier.
    (let ((current (current-buffer)))
      (pop-to-buffer-same-window proc-buffer)
      (pop-to-buffer-same-window current))

The comment makes it clear about the rationale of this code, but I'm wondering if there is a better way to achieve this somehow, so that the existing buffer won't get affected?

Screen.Recording.2024-05-30.at.13.57.40.mov
@xenodium
Copy link
Owner

Ah, we can likely do better there.

I had a quick try at something like:

(let ((current (current-buffer))
      (margins (window-margins)))
  (pop-to-buffer-same-window proc-buffer)
  (pop-to-buffer-same-window current)
  (set-window-margins nil (car margins) (cdr margins)))

but this didn't work. Got suggestions? Happy to take PRs.

@rytswd
Copy link
Author

rytswd commented May 30, 2024

I've looked a bit into what we could do instead, but couldn't find other routes. It just needs to make into buffer-list but can't think of any other ways (and tried a few approaches but couldn't make them to work 🫣)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants