<commit_before>;; -*- Emacs-Lisp -*-
;; Settings for `ibuffer'.

;; Copyright (C) 2011 Dylan.Wen

;; Author: Dylan.Wen <<EMAIL>>
;; Time-stamp: <2015-04-27 11:10>

;; This file is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this file.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; `ibuffer'
;; a good buffer Manager

;;; Code:


;; load `ibuffer', if it isn't loaded yet
(require 'ibuffer)


(defadvice ibuffer (around ibuffer-goto-recent-buffer)
  "Goto the most recent buffer line after switch to ibuffer."
  (let ((recent-buffer-name (buffer-name)))
    ad-do-it
    (or (equal recent-buffer-name "*Ibuffer*")
        (ibuffer-jump-to-buffer recent-buffer-name))))


(defun ibuffer-settings ()
  "Settings for `ibuffer'."

  ;; sort buffer by recent usage frequency
  (setq ibuffer-sorting-mode 'recency)
  ;; always open ibuffer with cursor pointing to the most recent buffer
  (setq ibuffer-always-show-last-buffer t)
  ;; display header line
  (setq ibuffer-use-header-line t)
  ;; do show the empty group
  (setq ibuffer-show-empty-filter-groups nil)

  ;; set format
  (setq ibuffer-formats
        '((mark modified read-only " "
                (name 30 30 :left :elide) " "
                (size 9 -1 :right) " "
                (mode 16 16 :left :elide) " "
                filename-and-process)
          (mark " " (name 30 -1) " " filename)))

  ;; gnus-style grouping
  (setq ibuffer-saved-filter-groups
        (quote (("Default"
                 ("Dired" (mode . dired-mode))
                 ("ELisp" (or (mode . emacs-lisp-mode)))
                 ("Lisp" (or (mode . lisp-mode)
                             (mode . slime-repl-mode)))
                 ("Scheme" (or (mode . scheme-mode)
                               (mode . scheme-interaction-mode)))
                 ("Ruby" (mode . ruby-mode))
                 ("Python" (mode . python-mode))
                 ("Joxa" (mode . joxa-mode))
                 ("Elixir" (mode . elixir-mode))
                 ("Erlang" (mode . erlang-mode))
                 ("Go" (mode . go-mode))
                 ("C/C++" (or (mode . c-mode)<commit_msg>add enh ruby mode for ibuffer<commit_after>;; -*- Emacs-Lisp -*-
;; Settings for `ibuffer'.

;; Copyright (C) 2011 Dylan.Wen

;; Author: Dylan.Wen <<EMAIL>>
;; Time-stamp: <2015-04-27 18:19>

;; This file is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this file.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; `ibuffer'
;; a good buffer Manager

;;; Code:


;; load `ibuffer', if it isn't loaded yet
(require 'ibuffer)


(defadvice ibuffer (around ibuffer-goto-recent-buffer)
  "Goto the most recent buffer line after switch to ibuffer."
  (let ((recent-buffer-name (buffer-name)))
    ad-do-it
    (or (equal recent-buffer-name "*Ibuffer*")
        (ibuffer-jump-to-buffer recent-buffer-name))))


(defun ibuffer-settings ()
  "Settings for `ibuffer'."

  ;; sort buffer by recent usage frequency
  (setq ibuffer-sorting-mode 'recency)
  ;; always open ibuffer with cursor pointing to the most recent buffer
  (setq ibuffer-always-show-last-buffer t)
  ;; display header line
  (setq ibuffer-use-header-line t)
  ;; do show the empty group
  (setq ibuffer-show-empty-filter-groups nil)

  ;; set format
  (setq ibuffer-formats
        '((mark modified read-only " "
                (name 30 30 :left :elide) " "
                (size 9 -1 :right) " "
                (mode 16 16 :left :elide) " "
                filename-and-process)
          (mark " " (name 30 -1) " " filename)))

  ;; gnus-style grouping
  (setq ibuffer-saved-filter-groups
        (quote (("Default"
                 ("Dired" (mode . dired-mode))
                 ("ELisp" (or (mode . emacs-lisp-mode)))
                 ("Lisp" (or (mode . lisp-mode)
                             (mode . slime-repl-mode)))
                 ("Scheme" (or (mode . scheme-mode)
                               (mode . scheme-interaction-mode)))
                 ("Ruby" (or (mode . ruby-mode)
                             (mode . enh-ruby-mode)))
                 ("Python" (mode . python-mode))
                 ("Joxa" (mode . joxa-mode))
                 ("Elixir" (mode . elixir-mode))
                 ("Erlang" (mode . erlang-mode))
                 ("Go" (mode . go-mode))
                 ("C/C++" (or (mode . c-mode)
{'fraction_non_alphanumeric': 0.13108334887190007, 'fraction_numerical': 0.011187768040275966, 'mean_word_length': 2.196662693682956, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2336329', 'n_tokens_mistral': 1693, 'n_tokens_neox': 1585, 'n_words': 547}