ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] Re: cyclebuffer integration


From: Joe Corneli
Subject: [RP] Re: cyclebuffer integration
Date: Sat Mar 6 17:23:28 2004

OK, I think I finally have it "right".  

It makes a list like this:

joes_ratpoison.el
 follow.el
 *Shell Command Output*
 cyclebuffer.el
 *Completions*
 .emacs
 READ-ME
 third-assignment.lisp
 .tcshrc
 loaddefs.el
 *shell*
 *Help*
 tree.el
 |||*Messages*|||

The `|||' move up and down the list when you scroll backwards and
forwards through the buffers.  They `|||' could be replaced with
something to turn backlighting off and on if such a thing exists.

Here is the code.  Its totally non-bubonic!

Joe

PS. There is a slight bug, I think in cyclebuffer.el - when you kill
a buffer, the list doesn't update quite correctly. It shouldn't be
too hard to fix here.


(defun ratpoison-cyclebuffer-forward ()
(interactive)
(setq this-command 'cyclebuffer-forward)
(cyclebuffer-forward)
(ratpoison-echo-buffer-list))

(defun ratpoison-cyclebuffer-backward ()
(interactive)
(setq this-command 'cyclebuffer-backward)
(cyclebuffer-backward)
(ratpoison-echo-buffer-list))

(defun ratpoison-echo-buffer-list ()
(interactive)
(ratpoison-echo
 (let* ((blist (copy-list cyclebuffer-buffer-list))
        (hlist (nthcdr cyclebuffer-buffer-index
                       blist))
        (str (progn
               (rplaca hlist
                       (intern (concat "|||"
                                       (buffer-name (current-buffer))
                                       "|||")))
               (replace-regexp-in-string "||| " "|||\n "
               (replace-regexp-in-string "\\\\ " " "
               (replace-regexp-in-string "\\\\\\." "."
               (replace-regexp-in-string "\\\\$" "\n"
               (replace-regexp-in-string "^[( ]\\|)$" ""
               (replace-regexp-in-string "\\(#<buffer \\)\\(.*?\\)\\(>\\)" 
"\\2\n "
               (replace-regexp-in-string " #<buffer  .*?>" "" 
                                       (format "%S" blist))))))
))))
        (len (length str)))
(substring str 0 (1- len))
)))

(defun ratpoison-kill-this-buffer ()
(interactive)
(setq this-command 'kill-this-buffer)
(kill-this-buffer)
(ratpoison-echo-buffer-list))

;; some sample bindings
(global-set-key [(control super b)] 'ratpoison-cyclebuffer-backward)
(global-set-key [(control super n)] 'ratpoison-cyclebuffer-forward)
(global-set-key [(control super d)] 'ratpoison-kill-this-buffer)
(global-set-key [(control super w)] 'ratpoison-echo-buffer-list)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]