Changeset 1162

Show
Ignore:
Timestamp:
06/06/08 16:41:41 (2 years ago)
Author:
alex
Message:

Much better cycle-buffers

Location:
alex-emacs-settings
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • alex-emacs-settings/dotemacs-alex-common.el

    r1161 r1162  
    113113(define-key global-map  "\C-c9"         'ecb-layout-alexTopHistorySourcesMethods) 
    114114 
    115 ;; ===================== cycle buffers  
    116  
    117     ; necessary support function for buffer burial 
    118     (defun crs-delete-these (delete-these from-this-list) 
    119       "Delete DELETE-THESE FROM-THIS-LIST." 
    120       (cond 
    121        ((car delete-these) 
    122         (if (member (car delete-these) from-this-list) 
    123             (crs-delete-these (cdr delete-these) (delete (car delete-these) 
    124                                                      from-this-list)) 
    125           (crs-delete-these (cdr delete-these) from-this-list))) 
    126        (t from-this-list))) 
    127  
    128     ; this is the list of buffers I never want to see 
    129     (defvar crs-hated-buffers 
    130       '("KILL" "*Compile-Log*") 
    131       '("KILL" "*Pymax*") 
    132 ) 
    133  
    134     ; might as well use this for both 
    135     (setq iswitchb-buffer-ignore (append '("^ " "*Buffer") crs-hated-buffers)) 
    136  
    137     (defun crs-hated-buffers () 
    138       "List of buffers I never want to see, converted from names to buffers." 
    139       (delete nil 
    140               (append 
    141                (mapcar 'get-buffer crs-hated-buffers) 
    142                (mapcar (lambda (this-buffer) 
    143                          (if (string-match "^ " (buffer-name this-buffer)) 
    144                              this-buffer)) 
    145                        (buffer-list))))) 
    146  
    147     ; I'm sick of switching buffers only to find KILL right in front of me 
    148     (defun crs-bury-buffer (&optional n) 
    149       (interactive) 
    150       (unless n 
    151         (setq n 1)) 
    152       (let ((my-buffer-list (crs-delete-these (crs-hated-buffers) 
    153                                               (buffer-list (selected-frame))))) 
    154         (switch-to-buffer 
    155          (if (< n 0) 
    156              (nth (+ (length my-buffer-list) n) 
    157                   my-buffer-list) 
    158            (bury-buffer) 
    159            (nth n my-buffer-list))))) 
    160  
    161 ;    (global-set-key [(control tab)] 'crs-bury-buffer) 
    162 ;    (global-set-key [(backtab)] (lambda () 
    163 ;                                           (interactive) 
    164 ;                                           (crs-bury-buffer -1))) 
    165     (global-set-key [(backtab)] 'crs-bury-buffer) 
    166     (global-set-key [(s-tab)] 'crs-bury-buffer) 
    167     (global-set-key [(control tab)] (lambda () 
    168                                            (interactive) 
    169                                            (crs-bury-buffer -1))) 
    170  
    171  
    172 ;; =============  end of cycle buffers  
     115;; ;; ===================== cycle buffers  
     116 
     117;;     ; necessary support function for buffer burial 
     118;;     (defun crs-delete-these (delete-these from-this-list) 
     119;;       "Delete DELETE-THESE FROM-THIS-LIST." 
     120;;       (cond 
     121;;        ((car delete-these) 
     122;;         (if (member (car delete-these) from-this-list) 
     123;;             (crs-delete-these (cdr delete-these) (delete (car delete-these) 
     124;;                                                      from-this-list)) 
     125;;           (crs-delete-these (cdr delete-these) from-this-list))) 
     126;;        (t from-this-list))) 
     127 
     128;;     ; this is the list of buffers I never want to see 
     129;;     (defvar crs-hated-buffers 
     130;;       '("KILL" "*Compile-Log*") 
     131;;       '("KILL" "*Pymax*") 
     132;; ) 
     133 
     134;;     ; might as well use this for both 
     135;;     (setq iswitchb-buffer-ignore (append '("^ " "*Buffer") crs-hated-buffers)) 
     136 
     137;;     (defun crs-hated-buffers () 
     138;;       "List of buffers I never want to see, converted from names to buffers." 
     139;;       (delete nil 
     140;;               (append 
     141;;                (mapcar 'get-buffer crs-hated-buffers) 
     142;;                (mapcar (lambda (this-buffer) 
     143;;                          (if (string-match "^ " (buffer-name this-buffer)) 
     144;;                              this-buffer)) 
     145;;                        (buffer-list))))) 
     146 
     147;;     ; I'm sick of switching buffers only to find KILL right in front of me 
     148;;     (defun crs-bury-buffer (&optional n) 
     149;;       (interactive) 
     150;;       (unless n 
     151;;         (setq n 1)) 
     152;;       (let ((my-buffer-list (crs-delete-these (crs-hated-buffers) 
     153;;                                               (buffer-list (selected-frame))))) 
     154;;         (switch-to-buffer 
     155;;          (if (< n 0) 
     156;;              (nth (+ (length my-buffer-list) n) 
     157;;                   my-buffer-list) 
     158;;            (bury-buffer) 
     159;;            (nth n my-buffer-list))))) 
     160 
     161;; ;    (global-set-key [(control tab)] 'crs-bury-buffer) 
     162;; ;    (global-set-key [(backtab)] (lambda () 
     163;; ;                                           (interactive) 
     164;; ;                                           (crs-bury-buffer -1))) 
     165;;     (global-set-key [(backtab)] 'crs-bury-buffer) 
     166;;     (global-set-key [(s-tab)] 'crs-bury-buffer) 
     167;;     (global-set-key [(control tab)] (lambda () 
     168;;                                            (interactive) 
     169;;                                            (crs-bury-buffer -1))) 
     170 
     171 
     172;; ;; =============  end of cycle buffers  
     173 
     174(autoload 'cycle-buffer "cycle-buffer" "Cycle forward." t) 
     175(autoload 'cycle-buffer-backward "cycle-buffer" "Cycle backward." t) 
     176(autoload 'cycle-buffer-permissive "cycle-buffer" "Cycle forward allowing *buffers*." t) 
     177(autoload 'cycle-buffer-backward-permissive "cycle-buffer" "Cycle backward allowing *buffers*." t) 
     178(autoload 'cycle-buffer-toggle-interesting "cycle-buffer" "Toggle if this buffer will be considered." t) 
     179(global-set-key [(control shift right)]        'cycle-buffer) 
     180(global-set-key [(control shift left)]        'cycle-buffer-backward) 
     181(global-set-key [(backtab)]       'cycle-buffer) 
     182(global-set-key [(control shift down)]  'cycle-buffer-backward-permissive) 
     183(global-set-key [(control shift up)] 'cycle-buffer-permissive) 
    173184 
    174185