mak <makm...@gmail.com> writes:
> So my questions are: do you guys use winner mode? If you do, how do
> you deal with this issue?
You have the variable `winner-boring-buffers', but the problem is that
you have many *Helm-<this>*, *helm-<that>* buffers and it would be
difficult to add all buffers to this.
So the best is to use a regexp matching all helm buffers, here the code
to add to .emacs:
--8<---------------cut here---------------start------------->8---
;;; winner-mode config
;;
;;
(setq winner-boring-buffers '("*Completions*"
"*Compile-Log*"
"*inferior-lisp*"
"*Fuzzy Completions*"
"*Apropos*"
"*dvc-error*"
"*Help*"
"*cvs*"
"*Buffer List*"
"*Ibuffer*"
))
(when (require 'winner)
(defvar winner-boring-buffers-regexp
"\*[hH]elm.*\\|\*xhg.*\\|\*xgit.*")
(defun winner-set1 (conf)
;; For the format of `conf', see `winner-conf'.
(let* ((buffers nil)
(alive
;; Possibly update `winner-point-alist'
(loop for buf in (mapcar 'cdr (cdr conf))
for pos = (winner-get-point buf nil)
if (and pos (not (memq buf buffers)))
do (push buf buffers)
collect pos)))
(winner-set-conf (car conf))
(let (xwins) ; to be deleted
;; Restore points
(dolist (win (winner-sorted-window-list))
(unless (and (pop alive)
(setf (window-point win)
(winner-get-point (window-buffer win) win))
(not (or (member (buffer-name (window-buffer win))
winner-boring-buffers)
(string-match winner-boring-buffers-regexp
(buffer-name (window-buffer win))))))
(push win xwins))) ; delete this window
;; Restore marks
(letf (((current-buffer)))
(loop for buf in buffers
for entry = (cadr (assq buf winner-point-alist))
do (progn (set-buffer buf)
(set-mark (car entry))
(setf (winner-active-region) (cdr entry)))))
;; Delete windows, whose buffers are dead or boring.
;; Return t if this is still a possible configuration.
(or (null xwins)
(progn
(mapc 'delete-window (cdr xwins)) ; delete all but one
(unless (one-window-p t)
(delete-window (car xwins))
t))))))
(defalias 'winner-set 'winner-set1))
(winner-mode 1)
--8<---------------cut here---------------end--------------->8---
I forgot this because I was not using winner-mode anymore, but now you
remind me this, I will submit a patch to Emacs :-)
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
That's awesome!! I've just tried the above code and it works like a charm.
> I forgot this because I was not using winner-mode anymore, but now you
> remind me this, I will submit a patch to Emacs :-)
Just out of curiosity, what do you use instead? Registers?
Thank you so much.
mak
> Just out of curiosity, what do you use instead? Registers?
elscreen