2011-10-08 26 views
7

Ciao ho acceso buffer di ciclismo immissione seguenti comandi nel mio .emacsBuffer bicicletta in Emacs: evitare graffi e messaggi tampone

(global-set-key (kbd "<C-tab>") 'bury-buffer) 

Ma mentre in bicicletta Come si evita in bicicletta attraverso i messaggi e buffer scrratch che sono sempre presenti in qualsiasi elenco di buffer emacs. Io non uso mai quei buffer e diventare un occhio-dolente quando si pedala attraverso il mio tampone-list

risposta

7

Se non si utilizza mai il buffer zero, basta aggiungere questo ai vostri .emacs per chiudere automaticamente:

(kill-cuscinetto "* scratch *")

ho anche trovato this code sul Emacs wiki che dovrebbe fare quello che vuoi:

; necessary support function for buffer burial 
(defun crs-delete-these (delete-these from-this-list) 
    "Delete DELETE-THESE FROM-THIS-LIST." 
    (cond 
    ((car delete-these) 
    (if (member (car delete-these) from-this-list) 
     (crs-delete-these (cdr delete-these) (delete (car delete-these) 
               from-this-list)) 
     (crs-delete-these (cdr delete-these) from-this-list))) 
    (t from-this-list))) 
; this is the list of buffers I never want to see 
(defvar crs-hated-buffers 
    '("KILL" "*Compile-Log*")) 
; might as well use this for both 
(setq iswitchb-buffer-ignore (append '("^ " "*Buffer") crs-hated-buffers)) 
(defun crs-hated-buffers() 
    "List of buffers I never want to see, converted from names to buffers." 
    (delete nil 
      (append 
      (mapcar 'get-buffer crs-hated-buffers) 
      (mapcar (lambda (this-buffer) 
        (if (string-match "^ " (buffer-name this-buffer)) 
         this-buffer)) 
        (buffer-list))))) 
; I'm sick of switching buffers only to find KILL right in front of me 
(defun crs-bury-buffer (&optional n) 
    (interactive) 
    (unless n 
    (setq n 1)) 
    (let ((my-buffer-list (crs-delete-these (crs-hated-buffers) 
              (buffer-list (selected-frame))))) 
    (switch-to-buffer 
    (if (< n 0) 
     (nth (+ (length my-buffer-list) n) 
       my-buffer-list) 
     (bury-buffer) 
     (nth n my-buffer-list))))) 
(global-set-key [(control tab)] 'crs-bury-buffer) 
(global-set-key [(control meta tab)] (lambda() 
             (interactive) 
             (crs-bury-buffer -1))) 

Sarà necessario aggiungere i buffer scratch e messaggi alla variabile crs-hated-buffers, ad es .:

(add-to-list 'crs-hated-buffers "*Messages*") 
(add-to-list 'crs-hated-buffers "*scratch*") 
5

risposto alla tua domanda specifica di Luke. Nella mia esperienza personale, il ciclo di buffering è più utile come pila usata di recente, invece delle funzioni di default di Emacs. Cioè, i buffer che hai usato di recente dovrebbero apparire in cima allo stack, in modo simile a come funziona alt-tab in Windows.

Ci sono alcuni pacchetti che implementano questo sul wiki. buffer-stack è quello che raccomando. Ha un elenco di buffer esclusi per impostazione predefinita, ho incluso la mia configurazione buffer-stack-suppl, che esegue lo stesso filtro in modalità principale. Se fai domande su buffer-stack, farò del mio meglio per aiutarti.

+0

Come faccio a specificare un carattere jolly quando chiedo tampone-stack di ignorare sempre/untrack alcuni buffer? per esempio. se voglio chiedergli di aggiungere alla lista di untrack * .html come faccio? – incandescentman

1

Bene, se si utilizza ido-mode per passare da un buffer all'altro, è possibile impostare ido-ignore-buffers in modo che corrisponda ai buffer che si desidera ignorare. Dalla documentazione:

Elenco di espressioni regolari o funzioni corrispondenti ai nomi di buffer da ignorare. Ad esempio, il comportamento tradizionale non è quello di elencare i buffer i cui nomi iniziano con con uno spazio, per il quale il regexp è "` ". Vedere il file sorgente per le funzioni di esempio che filtrano i nomi dei buffer.

Per maggiori informazioni su ido-mode vedere: Introduction to ido-mode

3

tutti i buffer Non ho usato, come gratta e vinci, i messaggi e completamenti, scompigliato con il mio flusso di lavoro.

Sono riuscito a liberarmene completamente, senza rompere emacs in alcun modo.

Posted prima here, e incollato muggito:

Posto questo nel vostro.emacs:

;; Makes *scratch* empty. 
(setq initial-scratch-message "") 

;; Removes *scratch* from buffer after the mode has been set. 
(defun remove-scratch-buffer() 
    (if (get-buffer "*scratch*") 
     (kill-buffer "*scratch*"))) 
(add-hook 'after-change-major-mode-hook 'remove-scratch-buffer) 

;; Removes *messages* from the buffer. 
(setq-default message-log-max nil) 
(kill-buffer "*Messages*") 

;; Removes *Completions* from buffer after you've opened a file. 
(add-hook 'minibuffer-exit-hook 
     '(lambda() 
     (let ((buffer "*Completions*")) 
      (and (get-buffer buffer) 
       (kill-buffer buffer))))) 

;; Don't show *Buffer list* when opening multiple files at the same time. 
(setq inhibit-startup-buffer-menu t) 

;; Show only one active window when opening multiple files at the same time. 
(add-hook 'window-setup-hook 'delete-other-windows) 

Bonus:

;; No more typing the whole yes or no. Just y or n will do. 
(fset 'yes-or-no-p 'y-or-n-p) 
+0

SI SI SI GRAZIE !!!! –

Problemi correlati