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

The point (cursor) position is saved? #92

Open
rieje opened this issue May 19, 2018 · 2 comments
Open

The point (cursor) position is saved? #92

rieje opened this issue May 19, 2018 · 2 comments

Comments

@rieje
Copy link

rieje commented May 19, 2018

When a perspective is restored, the point (cursor) position is saved--is this true? I don't want it to be saved and let save-place handle that instead. I disabled save-place and removed its history file and found that with persp-mode enabled, the cursor position is saved. With it commented out, the cursor position is not.

How can I disable cursor position being saved?

Much appreciated.

@Bad-ptr
Copy link
Owner

Bad-ptr commented May 26, 2018

When a perspective is restored, the point (cursor) position is saved--is this true?

Yes, this is true. It's saved/restored by emacs' window-state-get/put functions.

However you can try to reset positions after they were restored:

(defun persp-reset-buffer-positions-after-init (file phash &rest _args)
  (when (and (eq phash *persp-hash*)
             (string= file (concat (or (file-name-directory fname)
                                       (expand-file-name persp-save-dir))
                                   (file-name-nondirectory fname))))

    (unless save-place-mode
      (dolist (b (buffer-list))
        (with-current-buffer b (beginning-of-buffer))))
    (remove-hook 'persp-after-load-state-functions
                 #'persp-reset-buffer-positions-after-init)))

(add-hook 'persp-after-load-state-functions
          #'persp-reset-buffer-positions-after-init)

@rieje
Copy link
Author

rieje commented Jun 15, 2018

Doesn't seem to work--does it work for you? I removed save-place and the saved perspectives files and it still restores the cursor to what it was previously instead of resetting it.

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