(defvar chery-switch-buffers-history '()) (defun chery-switch-buffers () (interactive) (loop for buffer being the buffers for buffer-name = (buffer-name buffer) unless (string-match "^ \\|^*" buffer-name) collect (list buffer-name) into table and collect buffer-name into name-list finally (setq chery-switch-buffers-history (cddr name-list)) (switch-to-buffer (completing-read "Buffer: " (rest table) nil t (second name-list) 'chery-switch-buffers-history)))) (global-set-key [(meta p)] 'chery-switch-buffers)