Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make ordering of `anything-c-buffers' match `switch-to-buffer'

This allows `anything-c-source-buffers+' to become an involutary function
(it is its own inverse). This is how `switch-to-buffer' works, and is convenient
when the frame is split into multiple windows.

Signed-off-by: Dan Hackney <dan@haxney.org>
  • Loading branch information...
commit d8849dcfc204f9f2a260d94abe89e97f21f681d0 1 parent 569aa14
Daniel Hackney authored

Showing 1 changed file with 24 additions and 6 deletions. Show diff stats Hide diff stats

  1. +24 6 anything-config.el
30 anything-config.el
@@ -12,7 +12,7 @@
12 12 ;; Copyright (C) 2009, rubikitch, all rights reserved.
13 13 ;; Copyright (C) 2009, Thierry Volpiatto, all rights reserved.
14 14 ;; Created: 2009-02-16 21:38:23
15   -;; Version: 2010.2.6
  15 +;; Version: 2010.2.24
16 16 ;; URL: http://www.emacswiki.org/emacs/download/anything-config.el
17 17 ;; Keywords: anything, anything-config
18 18 ;; Compatibility: GNU Emacs 22 ~ 23
@@ -1096,13 +1096,31 @@ It is cleared after executing action.")
1096 1096
1097 1097 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Anything Sources ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1098 1098 ;;;; <Buffer>
  1099 +(defun anything-get-visible-buffers (&optional minibuf all-frames)
  1100 + (let ((bufs (make-symbol "buffers")))
  1101 + (set bufs nil)
  1102 + (walk-windows '(lambda (wind)
  1103 + (add-to-list bufs (window-buffer wind)))
  1104 + minibuf
  1105 + all-frames)
  1106 + (symbol-value bufs)))
  1107 +
1099 1108 (defun anything-c-buffer-list ()
1100 1109 "Return the list of names of buffers with boring buffers filtered out.
1101   -Boring buffers is specified by `anything-c-boring-buffer-regexp'.
1102   -The first buffer in the list will be the last recently used
1103   -buffer that is not the current buffer."
1104   - (let ((buffers (mapcar 'buffer-name (buffer-list))))
1105   - (append (cdr buffers) (list (car buffers)))))
  1110 +Boring buffer names are specified by
  1111 +`anything-c-boring-buffer-regexp'. The first buffer in the list
  1112 +will be the last recently used buffer that is not visible in the
  1113 +current frame."
  1114 + (save-window-excursion
  1115 + ;; `frameconfig' is a dynamically-bound variable from `anything'. It would
  1116 + ;; be nice if there were a cleaner way of doing this.
  1117 + (anything-set-frame/window-configuration frameconfig)
  1118 + (let ((buffers (buffer-list))
  1119 + (visible (anything-get-visible-buffers)))
  1120 +
  1121 + (mapc '(lambda (buf) (setq buffers (delete buf buffers))) visible)
  1122 + (mapcar 'buffer-name buffers)
  1123 + )))
1106 1124
1107 1125 (defvar anything-c-source-buffers
1108 1126 '((name . "Buffers")

0 comments on commit d8849dc

Please sign in to comment.
Something went wrong with that request. Please try again.