]> gitweb @ CieloNegro.org - sugar.git/blobdiff - dot-files/_emacs_el
Auto commit by The Sugar System.
[sugar.git] / dot-files / _emacs_el
index 51180d719596504afe2e12743366806868b9e82d..27bd7e5f1850ec3cef3859f1b8d695d210d3cff0 100644 (file)
 ;; windmove
 (windmove-default-keybindings)
 
+;; file renaming
+;; Originally from stevey, adapted to support moving to a new directory.
+(defun rename-file-and-buffer (new-name)
+  "Renames both current buffer and file it's visiting to NEW-NAME."
+  (interactive
+   (progn
+     (if (not (buffer-file-name))
+         (error "Buffer '%s' is not visiting a file!" (buffer-name)))
+     ;; Disable ido auto merge since it too frequently jumps back to the original
+     ;; file name if you pause while typing. Reenable with C-z C-z in the prompt.
+     (let ((ido-auto-merge-work-directories-length -1))
+       (list (read-file-name (format "Rename %s to: " (file-name-nondirectory
+                                                       (buffer-file-name))))))))
+  (if (equal new-name "")
+      (error "Aborted rename"))
+  (setq new-name (if (file-directory-p new-name)
+                     (expand-file-name (file-name-nondirectory
+                                        (buffer-file-name))
+                                       new-name)
+                   (expand-file-name new-name)))
+  ;; Only rename if the file was saved before. Update the
+  ;; buffer name and visited file in all cases.
+  (if (file-exists-p (buffer-file-name))
+      (rename-file (buffer-file-name) new-name 1))
+  (let ((was-modified (buffer-modified-p)))
+    ;; This also renames the buffer, and works with uniquify
+    (set-visited-file-name new-name)
+    (if was-modified
+        (save-buffer)
+      ;; Clear buffer-modified flag caused by set-visited-file-name
+      (set-buffer-modified-p nil)))
+
+  (setq default-directory (file-name-directory new-name))
+
+  (message "Renamed to %s." new-name))
+
 ;; Host specific configuration ------------------------------------------------
 (let ((host (system-name)))
   (cond ((equal host "aria.cielonegro.org")
@@ -57,7 +93,6 @@
                ))))))
 
 ;; Settings for Browser --------------------------------------------------------
-(setq browse-url-browser-function 'w3m-browse-url)
 (global-set-key "\C-xm" 'browse-url-at-point)
 
 ;; Setting for the Mode Line ---------------------------------------------------
     (cond ((equal host "seras")
            (set-frame-font "Dejavu Sans Mono 11" t))
 
+          ((equal host "yukari.cielonegro.org")
+           (set-frame-font "Dejavu Sans Mono 11" t))
+
           ((equal host "aria.cielonegro.org")
            (progn
              (set-frame-font "Dejavu Sans Mono 13" t)
-             (set-fontset-font nil 'japanese-jisx0208 "さざなみゴシック")
-             (set-fontset-font nil 'japanese-jisx0212 "さざなみゴシック")
-             (set-fontset-font nil 'katakana-jisx0201 "さざなみゴシック"))))))
-
-;; Hooks for newline-and-indent ------------------------------------------------
-;(mapcar (lambda (hook)
-;     (add-hook hook
-;           (lambda ()
-;             (local-set-key "\C-m" 'newline-and-indent)
-;             (local-set-key "\C-j" 'newline)
-;             )))
-;   '(perl-mode-hook
-;     cperl-mode-hook
-;     java-mode-hook
-;     javascript-mode-hook
-;     c-mode-hook
-;     c++-mode-hook
-;     objc-mode-hook
-;     emacs-lisp-mode-hook
-;     lisp-mode-hook
-;     yatex-mode-hook
-;     css-mode-hook
-;     scheme-mode-hook))
+             ;; Emacs 24.4.1 somehow gets very slow when the following
+             ;; lines are uncommented.
+             ;;(set-fontset-font nil 'japanese-jisx0208 "さざなみゴシック")
+             ;;(set-fontset-font nil 'japanese-jisx0212 "さざなみゴシック")
+             ;;(set-fontset-font nil 'katakana-jisx0201 "さざなみゴシック")
+             )))))
 
 ;; Setting for Packages --------------------------------------------------------
 (defun require-if-present (feature)
       (load-file path)
     (message "Warning: file %s is absent" path)))
 
-;; session
-(require-if-present 'session)
+;; cmake
+(autoload 'cmake-mode "cmake-mode" nil t)
+(add-to-list 'auto-mode-alist '("CMakeLists\\.txt\\'" . cmake-mode))
+(add-to-list 'auto-mode-alist '("\\.cmake\\'" . cmake-mode))
+
+;; ditz
+(require-if-present 'ditz)
 
 ;; flyspell
 (require-if-present 'flyspell)
 
-;; ditz
-(require-if-present 'ditz)
+;; jaspace
+(require-if-present 'jaspace)
+
+;; glsl
+(autoload 'glsl-mode "glsl-mode" nil t)
+(add-to-list 'auto-mode-alist '("\\.glsl\\'" . glsl-mode))
+(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
+(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
+(add-to-list 'auto-mode-alist '("\\.geom\\'" . glsl-mode))
+
+;; rust
+(autoload 'rust-mode "rust-mode" nil t)
+(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
+
+;; session
+(require-if-present 'session)
+(if (featurep 'session)
+    (session-initialize))
 
 ;; mediawiki
 (require-if-present 'mediawiki)
 
-;; jaspace
-(require-if-present 'jaspace)
+;; midnight
+(require-if-present 'midnight)
 
 ;; color-theme
 (require-if-present 'color-theme)
@@ -170,8 +212,14 @@ Will prompt you shell name when you type `C-u' before this command." t)
     (paren-activate))
 
 ;; elscreen
-(load "elscreen" "ElScreen" t)
-(elscreen-start)
+(condition-case e
+    (load "elscreen" "ElScreen" t)
+  (file-error
+   (if (equal (cadr e) "Cannot open load file")
+       (message "Warning: feature %s is absent" feature) ; warn and ignore
+     (apply 'signal (car e) (cdr e))))) ; rethrow
+(if (featurep 'elscreen)
+    (elscreen-start))
 (require-if-present 'elscreen-w3m)
 
 ;; undo-tree
@@ -189,6 +237,12 @@ Will prompt you shell name when you type `C-u' before this command." t)
       (append '(("\\.rst$" . rst-mode)
                 ("\\.rest$" . rst-mode)) auto-mode-alist))
 
+;; graphviz-dot-mode
+(autoload 'graphviz-dot-mode "graphviz-dot-mode"
+  "Major mode for the dot language." t)
+(add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode))
+(add-to-list 'auto-mode-alist '("\\.gv\\'" . graphviz-dot-mode))
+
 ;; textile-mode
 (autoload 'textile-mode "textile-mode"
   "Major mode for editing Textile documents." t)
@@ -278,10 +332,14 @@ Will prompt you shell name when you type `C-u' before this command." t)
 (autoload 'cleite "cleite" "Cleite RSS Aggregator -- Emacs Interface" t)
 
 ;; javascript
-(autoload 'js2-mode "js2" nil t)
-(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
+(add-to-list 'auto-mode-alist '("\\.js$" . javascript-mode))
 (add-to-list 'auto-mode-alist '("\\.json$" . javascript-mode))
 
+;; typescript
+(autoload 'typescript-mode "typescript-mode"
+  "Major mode for editing typescript." t)
+(add-to-list 'auto-mode-alist '("\\.ts$" . typescript-mode))
+
 ;; vimrc
 (autoload 'vimrc-mode "vimrc-mode"
   "Major mode for editing `.vimrc', `xxx.vim' and `.exrc' files." t)
@@ -369,21 +427,23 @@ Will prompt you shell name when you type `C-u' before this command." t)
 (setq erlang-electric-commands nil)
 
 ;; SKK
-(require 'skk-autoloads)
-(require 'skk-study)
-(global-set-key "\C-x\C-j" 'skk-mode)
-(global-set-key "\C-xj" 'skk-auto-fill-mode)
-(global-set-key "\C-xt" 'skk-tutorial)
-(setq skk-use-jisx0201-input-method t)
-(setq skk-rom-kana-rule-list
-      '(("@" nil "@")
-        ("wi" nil ("ヰ" . "ゐ"))
-        ("we" nil ("ヱ" . "ゑ"))
-        ;;("hh" "h" ("ン" . "ん"))
-        ;;("mm" "m" ("ン" . "ん"))
-        ("zx" nil ("ゝ" . "ヽ"))
-        ("zc" nil ("ゞ" . "ヾ"))))
-(set-input-method 'japanese-skk) ; INPUT METHOD
+(require-if-present 'skk-autoloads)
+(if (featurep 'skk-autoloads)
+       (progn
+         (require-if-present 'skk-study)
+         (global-set-key "\C-x\C-j" 'skk-mode)
+         (global-set-key "\C-xj" 'skk-auto-fill-mode)
+         (global-set-key "\C-xt" 'skk-tutorial)
+         (setq skk-use-jisx0201-input-method t)
+         (setq skk-rom-kana-rule-list
+                       '(("@" nil "@")
+                         ("wi" nil ("ヰ" . "ゐ"))
+                         ("we" nil ("ヱ" . "ゑ"))
+                         ;;("hh" "h" ("ン" . "ん"))
+                         ;;("mm" "m" ("ン" . "ん"))
+                         ("zx" nil ("ゝ" . "ヽ"))
+                         ("zc" nil ("ゞ" . "ヾ"))))
+         (set-input-method 'japanese-skk))) ; INPUT METHOD
 
 ;; navi2ch
 (autoload 'navi2ch "navi2ch" "Navigator for 2ch for Emacs" t)
@@ -414,11 +474,20 @@ Will prompt you shell name when you type `C-u' before this command." t)
 (setq tsv-separator-list '("\t"))
 ;(add-to-list 'auto-mode-alist '("\\.[Tt][Ss][Vv]\\'" . tsv-mode))
 
+;; markdown-mode
+;; http://jblevins.org/projects/markdown-mode/
+(autoload 'markdown-mode "markdown-mode.el" "Major mode for editing Markdown files" t)
+(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
+
 ;; yaml-mode
 (autoload 'yaml-mode "yaml-mode"
   "Major mode for editing YAML files." t)
 (add-to-list 'auto-mode-alist '("\\.ya?ml$"  . yaml-mode))
 
+;; less-css-mode
+(autoload 'less-css-mode "less-css-mode" "Major mode for editing LESS files" t)
+(add-to-list 'auto-mode-alist '("\\.less\\'" . less-css-mode))
+
 ;; Troublesome Tasks
 (if (equal (system-name) "seras")
     (progn
@@ -498,7 +567,9 @@ Will prompt you shell name when you type `C-u' before this command." t)
  '(ac-ignore-case nil)
  '(appt-display-format (quote window))
  '(appt-message-warning-time 20)
+ '(browse-url-browser-function (quote browse-url-firefox))
  '(canlock-password "a14fa4d2601465d55585c291fa8b3943e189e716")
+ '(clean-buffer-list-delay-general 7)
  '(cleite:auto-refresh-interval nil)
  '(cleite:measure-srpc-call-time t)
  '(compilation-scroll-output (quote first-error))
@@ -524,8 +595,11 @@ Will prompt you shell name when you type `C-u' before this command." t)
  '(ecb-tip-of-the-day nil)
  '(ecb-tree-buffer-style (quote ascii-guides))
  '(ecb-windows-width 0.2)
+ '(electric-indent-mode nil)
  '(elscreen-display-tab t)
  '(global-whitespace-mode t)
+ '(graphviz-dot-auto-indent-on-newline nil)
+ '(graphviz-dot-auto-indent-on-semi nil)
  '(haskell-program-name "ghci")
  '(ido-enable-flex-matching t)
  '(ido-everywhere t)
@@ -534,6 +608,7 @@ Will prompt you shell name when you type `C-u' before this command." t)
     ("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./" "\\.ttc")))
  '(ido-work-directory-list-ignore-regexps (quote ("^\\(/mnt/ibm/\\|/Volumes/IBM80GB/\\)")))
  '(indent-tabs-mode nil)
+ '(ispell-dictionary "english")
  '(jabber-nickname "PHO")
  '(jabber-resource "emacs")
  '(jabber-server "jabber.jp")
@@ -543,7 +618,9 @@ Will prompt you shell name when you type `C-u' before this command." t)
  '(js2-indent-on-enter-key nil)
  '(js2-mirror-mode nil)
  '(js2-use-font-lock-faces t)
+ '(lua-indent-level 4)
  '(makefile-mode-hook (quote ((lambda nil (set-variable (quote tab-width) 8)))))
+ '(markdown-live-preview-delete-export (quote delete-on-export))
  '(mediawiki-site-alist
    (quote
     (("Wikipedia" "http://en.wikipedia.org/w/" "username" "password" "Main Page")
@@ -604,6 +681,7 @@ Will prompt you shell name when you type `C-u' before this command." t)
      (30 subj)
      "|"
      (0 body))))
+ '(midnight-mode t)
  '(mouse-wheel-progessive-speed nil)
  '(mouse-wheel-scroll-amount (quote (1 ((shift) . 5) ((control)))))
  '(mpc-browser-tags
@@ -621,6 +699,7 @@ Will prompt you shell name when you type `C-u' before this command." t)
  '(newsticker-url-list-defaults
    (quote
     (("slashdot" "http://slashdot.org/index.rss" nil 3600))))
+ '(ns-command-modifier (quote meta))
  '(nxml-auto-insert-xml-declaration-flag t)
  '(nxml-slash-auto-complete-flag t)
  '(org-replace-disputed-keys t)
@@ -643,11 +722,11 @@ Will prompt you shell name when you type `C-u' before this command." t)
     ("schemas.xml" "~/share/nxml/schemas.xml" "/usr/pkg/share/emacs/site-lisp/nxml-mode/schema/schemas.xml")))
  '(rst-level-face-base-light 50)
  '(safe-local-variable-values (quote ((todo-categories "Todo" "Todo" "Todo" "Todo"))))
- '(session-use-package t nil (session))
+ '(select-enable-clipboard t)
  '(tramp-auto-save-directory "/tmp/tramp-auto-save")
- '(tramp-completion-reread-directory-timeout 2)
- '(tramp-default-host "localhost")
- '(tramp-default-method "sshx")
+ '(tramp-completion-reread-directory-timeout 2 nil (tramp))
+ '(tramp-default-host "localhost" nil (tramp))
+ '(tramp-default-method "sshx" nil (tramp))
  '(uniquify-buffer-name-style (quote forward) nil (uniquify))
  '(uniquify-trailing-separator-p t)
  '(vc-cvs-diff-switches (quote ("-u")))
@@ -670,7 +749,7 @@ Will prompt you shell name when you type `C-u' before this command." t)
    (quote
     (face tabs trailing space-before-tab newline indentation empty space-after-tab)))
  '(woman-cache-filename "~/.wmncach.el")
- '(x-select-enable-clipboard t))
+ '(yaml-block-literal-electric-alist (quote ((62 . "-")))))
 (custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.