Commits

Anonymous committed cc2c8dd

* Update

  • Participants
  • Parent commits 4a31078

Comments (0)

Files changed (8)

           (progn (forward-char 1)
                  (just-one-space 0)
                  (backward-char 1)))))
-
-(defadvice message (after message-tail activate)
-  "goto point max after a message"
-  (with-current-buffer "*Messages*"
-    (goto-char (point-max))
-    (let ((windows (get-buffer-window-list (current-buffer) nil t)))
-      (while windows
-        (set-window-point (car windows) (point-max))
-        (setq windows (cdr windows))))))

files/emacs-lisp-mode.el

+(require 'thingatpt)
+
 (setq my-emacs-lisp-open-line-list '(
                                     if
                                     when
                                     defcustom
                                     let
                                     let*
+                                    progn
                                     ))
 
 (defun my-emacs-lisp-open-line ()
 function on `my-emacs-lisp-open-line-list'."
   (interactive)
   (open-next-line)
-  (when (save-excursion
-          (forward-char)
-          (backward-sexp)
-          (member (car (sexp-at-point)) my-emacs-lisp-open-line-list))
+  (when (and (save-excursion
+               (forward-char)
+               (backward-sexp)
+               (member (car (sexp-at-point)) my-emacs-lisp-open-line-list))
+             (thing-at-point 'sexp)
+             (eq (following-char) ?\)))
     (newline)
     (indent-according-to-mode)
     (previous-line)))
 
 (defun my-emacs-lisp-init ()
   (define-key emacs-lisp-mode-map (kbd "RET") 'my-emacs-lisp-open-line)
-  )
+  (define-key emacs-lisp-mode-map (kbd "M-RET") 'open-next-line))
 
 (add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-init)
 ;; Make sure all backup files only live in one place
 (setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
 
+;; Make backups of files, even when they're in version control
+(setq vc-make-backup-files t)
+
 ;; Autoload modes
 (add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
 
 
 ;; ... but not in Org tables
 (set-face-attribute 'org-table nil :inherit 'fixed-pitch)
-
-;; (custom-set-faces
-;;  '(variable-pitch ((t (:family "Bitstream Vera Serif")))))
-
-(setq ibuffer-saved-filter-groups
-      (quote (("default"
-               ("Org" ;; all org-related buffers
-                (mode . org-mode))
-               ("emacs-config"
-                (or (filename . ".emacs.d")
-                    (filename . ".emacs")
-                    (filename . "emacs-config")))
-               ("TeX"
-                (or (mode . tex-mode)
-                    (mode . TeX-mode)
-                    (mode . latex-mode)
-                    (mode . LaTeX-mode)
-                    (filename . ".tex")))
-               ("Web"
-                (or (mode . html-mode)
-                    (mode . css-mode)
-                    (mode . PHP-mode)))
-               ("Sunrise"
-                (or (mode . sr-mode)))
-               ("Programming" ;; prog stuff not already in MyProjectX
-                (or
-                 (mode . c-mode)
-                 (mode . perl-mode)
-                 (mode . python-mode)
-                 (mode . cc-mode)
-                 (mode . js-mode)
-                 ;; etc
-                 ))))))
-
-(defun customize-ibuffer-mode ()
-  (ibuffer-switch-to-saved-filter-groups "default")
-  (setq ibuffer-hidden-filter-groups
-        (push "Sunrise" ibuffer-hidden-filter-groups)))
-(add-hook 'ibuffer-mode-hook 'customize-ibuffer-mode)
+;; filter groups
+(setq ibuffer-saved-filter-groups
+      (quote (("default"
+               ("Org" ;; all org-related buffers
+                (mode . org-mode))
+               ("emacs-config"
+                (or (filename . ".emacs.d")))
+               ("emacs"
+                (or (mode . emacs-lisp-mode)))
+               ("TeX"
+                (or (mode . tex-mode)
+                    (mode . TeX-mode)
+                    (mode . latex-mode)
+                    (mode . LaTeX-mode)))
+               ("Web"
+                (or (mode . html-mode)
+                    (mode . css-mode)
+                    (mode . PHP-mode)))
+               ("Sunrise"
+                (or (mode . sr-mode)))
+               ("Tramp"
+                (or (name . "tramp")))
+               ("Programming" ;; prog stuff not already in MyProjectX
+                (or
+                 (mode . c-mode)
+                 (mode . perl-mode)
+                 (mode . python-mode)
+                 (mode . cc-mode)
+                 (mode . js-mode)
+                 ;; etc
+                 ))))))
+
+;; column settings
+(defun my-transform-buffer-name (name)
+  "Transform buffer name for display in `ibuffer'."
+  (cond
+   ((string-match " *(Sunrise)" name)
+    (substring name 0 (match-beginning 0)))
+   (t name)))
+
+(define-ibuffer-column name
+  (:inline t
+   :header-mouse-map ibuffer-name-header-map
+   :props
+   ('mouse-face 'highlight 'keymap ibuffer-name-map
+        'ibuffer-name-column t
+        'help-echo '(if tooltip-mode
+                "mouse-1: mark this buffer\nmouse-2: select this buffer\nmouse-3: operate on this buffer"
+                  "mouse-1: mark buffer   mouse-2: select buffer   mouse-3: operate"))
+   :summarizer
+   (lambda (strings)
+     (let ((bufs (length strings)))
+       (cond ((zerop bufs) "No buffers")
+         ((= 1 bufs) "1 buffer")
+         (t (format "%s buffers" bufs))))))
+  (propertize (my-transform-buffer-name (buffer-name)) 'font-lock-face (ibuffer-buffer-name-face buffer mark)))
+
+(define-ibuffer-column size-h
+  (:name "Size"
+   :inline t
+   :summarizer
+   (lambda (column-strings)
+     (let ((total 0))
+       (dolist (string column-strings)
+         (setq total
+               ;; like, ewww ...
+               (+
+                (let ((number (float (string-to-number string))))
+                  (cond
+                   ((string-match-p "K" string)
+                    (* number 1000))
+                   ((string-match-p "M" string)
+                    (* number 1000000))
+                   (t number)))
+                total)))
+       (file-size-human-readable total 'si))))
+  (file-size-human-readable (buffer-size) 'si))
+
+;; Modify the default ibuffer-formats
+(setq ibuffer-formats
+  '((mark modified read-only
+          " " (name 25 25 :left :elide)
+          " " (size-h 9 -1 :right)
+          " " (mode 16 16 :left :elide)
+          " " filename-and-process)
+    (mark " " (name 16 -1)
+          " " filename)))
+
+;; startup function
+(defun customize-ibuffer-mode ()
+  "Startup function."
+  (ibuffer-switch-to-saved-filter-groups "default")
+  (add-to-list 'ibuffer-hidden-filter-groups "Sunrise")
+  (add-to-list 'ibuffer-hidden-filter-groups "Tramp"))
+(add-hook 'ibuffer-mode-hook 'customize-ibuffer-mode)
+
+;; Switching to ibuffer puts the cursor on the most recent buffer
+(defadvice ibuffer (around ibuffer-point-to-most-recent activate) ()
+  "Open ibuffer with cursor pointed to most recent buffer name"
+  (let ((recent-buffer-name (buffer-name)))
+    ad-do-it
+    (ibuffer-jump-to-buffer recent-buffer-name)))
 
 (require 'ido)
 (ido-mode t)
-(setq ido-enable-flex-matching t) ; fuzzy matching is a must have
-(setq ido-enable-last-directory-history nil) ; forget latest selected directory names
+;; fuzzy matching is a must have
+(setq ido-enable-flex-matching t)
+;; forget latest selected directory names
+(setq ido-enable-last-directory-history nil)
+;; Allow the same buffer to be open in different frames
+(setq ido-default-buffer-method 'selected-window)
 
 ;; Display ido results vertically, rather than horizontally
 (setq ido-decorations (quote ("\n-> " "" "\n   " "\n   ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]")))

files/smartparens.el

 (define-key sp-keymap (kbd "C-M-<delete>") 'sp-splice-sexp-killing-forward)
 (define-key sp-keymap (kbd "C-M-<backspace>") 'sp-splice-sexp-killing-backward)
 
+(define-key input-decode-map (kbd "C-[") (kbd "H-["))
+(define-key sp-keymap (kbd "C-]") 'sp-select-next-thing)
+(define-key sp-keymap (kbd "H-[") 'sp-select-previous-thing)
+
 ;;; add new pairs
 (sp-add-pair "*" "*")
 (sp-add-pair "$" "$")
+(setq tramp-default-method "plinkx")
+(setq tramp-terminal-type "dumb")
+
+;; in file `tramp-sh.el' it is necessary to add
+;; (tramp-password-end-of-line "xy") ;see docstring for "xy"
+;; to "plinkx" method.
 (load "files/ispell")
 (load "files/dired")
 (load "files/markdown")
-
+(load "files/tramp")
+(load "files/ibuffer")
 (load "files/undo-tree")
 (load "files/expand-region")
-
 (load "files/emacs-lisp-mode")
 
 ;; vendor
  '(background-color "#002b36")
  '(background-mode dark)
  '(blink-cursor-mode nil)
+ '(blink-matching-paren nil)
  '(calc-settings-file "~\\.emacs.d\\my-calc.el")
  '(column-number-mode t)
  '(cursor-color "#839496")
  '(erc-timestamp-format-right " [%H:%M:%S]")
  '(foreground-color "#839496")
  '(global-undo-tree-mode t)
+ '(golden-ratio-exclude-buffer-names (quote ("*helm kill-ring*")))
+ '(ibuffer-fontification-alist (quote ((10 buffer-read-only font-lock-constant-face) (15 (and buffer-file-name (string-match ibuffer-compressed-file-name-regexp buffer-file-name)) font-lock-doc-face) (20 (string-match "^*" (buffer-name)) font-lock-keyword-face) (25 (and (string-match "^ " (buffer-name)) (null buffer-file-name)) italic) (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face) (35 (memq major-mode (quote (dired-mode sr-mode))) font-lock-function-name-face))))
+ '(ibuffer-show-empty-filter-groups t)
  '(ido-ubiquitous-command-exceptions (quote (smex-major-mode-commands beautify-smex ido-goto-symbol grep-read-files highlight-phrase)))
  '(ido-ubiquitous-function-exceptions (quote (hi-lock-read-face-name)))
  '(ido-ubiquitous-mode t)
  '(menu-bar-mode nil)
  '(sp-autoinsert-quote-if-followed-by-closing-pair nil)
  '(sp-ignore-modes-list (quote (calc-mode dired-mode ibuffer-mode minibuffer-inactive-mode sr-mode help-mode)))
+ '(sp-navigate-consider-symbols t)
  '(sr-attributes-display-mask (quote (nil nil nil nil t t t)))
  '(sr-listing-switches "-alh")
  '(sr-popviewer-enabled nil)