Skip to content

Instantly share code, notes, and snippets.

@applecargo
Last active January 5, 2017 14:55
Show Gist options
  • Save applecargo/195c6a2c2badcdd421e3be971f40f02b to your computer and use it in GitHub Desktop.
Save applecargo/195c6a2c2badcdd421e3be971f40f02b to your computer and use it in GitHub Desktop.
;;repositories
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "https://melpa.org/packages/")))
;;
;;2015.12. - after emacs update.. helm is not working!! unbinding keys..
;;
;;(global-set-key (kbd "C-x b") 'helm-mini)
;;(global-set-key (kbd "M-x") 'helm-M-x)
;;(global-set-key (kbd "C-c h o") 'helm-occur)
;;(global-set-key (kbd "C-c h m") 'helm-multi-occur)
(global-set-key (kbd "C-c SPC") 'ace-jump-mode)
;;(global-nlinum-mode 1) ; doesn't work!
(global-linum-mode 1)
;; insert date time
(defun insert-date-time ()
"Insert date & time"
(interactive)
(insert "####")
(insert (shell-command-to-string
"date"))
)
(global-set-key (kbd "C-x C-d") 'insert-date-time)
;; tab size
(setq tab-width 4)
;; font config
;; font setting for eng/kor mixed table works in org-mode
;; this setting works but by 'luck'.
;; monaco+nanumgothic but all rendered with nanumgothiccoding (eng & kor) and then all fit very good.. (maybe at first, i don't have Monaco font.. maybe!)
;; check out -> http://crazia.tistory.com/entry/Emacs-24x-%EB%B2%84%EC%A0%BC-%ED%95%9C%EA%B8%80-%ED%8F%B0%ED%8A%B8-%EC%84%A4%EC%A0%95-orgmode-%EC%9D%98-%ED%95%9C%EA%B8%80-%ED%85%8C%EC%9D%B4%EB%B8%94-%EA%B9%A8%EC%A7%80%EC%A7%80-%EC%95%8A%EA%B2%8C-%EB%B3%B4%EC%9D%B4%EA%B8%B0
;; (set-face-attribute 'default nil :family "Monaco" :height 120) ; 120 works fine, 130 fails. 110 fails. 100 fails. humm... only 120 works!
;; (set-fontset-font "fontset-default" '(#x1100 . #xffdc)
;; '("NanumGothicOTF" . "iso10646-1"))
;; (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)
;; '("NanumGothicOTF" . "iso10646-1"))
;; font setting for normal use. (coding / viewing)
(set-face-font 'default "Dejavu Sans Mono-11")
(set-fontset-font "fontset-default" 'hangul
"Nanum Gothic Coding-11")
;; ;; a snipet from 'cinsk'
;; ;; default Latin font (e.g. Consolas)
;; ;; but I use Monaco
;; (set-face-attribute 'default nil :family "Monaco")
;; ;; default font size (point * 10)
;; ;;
;; ;; WARNING! Depending on the default font,
;; ;; if the size is not supported very well, the frame will be clipped
;; ;; so that the beginning of the buffer may not be visible correctly.
;; (set-face-attribute 'default nil :height 130)
;; ;; use specific font for Korean charset.
;; ;; if you want to use different font size for specific charset,
;; ;; add :size POINT-SIZE in the font-spec.
;; (set-fontset-font t 'hangul (font-spec :name "NanumGothicCoding"))
;; ;; font-config old.
;; ;; (set-face-font 'default "Dejavu Sans Mono-12")
;; ;; (set-fontset-font "fontset-default" 'hangul
;; ;; "Nanum Gothic Coding-12")
;; ;; font config - resizing for org-mode table!
;; ;; (setq face-font-rescale-alist
;; ;; '((".*hiragino.*" . 1.2)
;; ;; ("NanumGothicCoding" . 1.2307692307692308)))
;; (setq face-font-rescale-alist '("NanumGothicCoding" . 12.2))
;; (set-face-attribute 'default nil :family "Monaco")
;; (set-face-attribute 'default nil :family "NanumGothicCodingOTF")
;; (set-face-font 'default "Dejavu Sans Mono-12")
;; (set-face-font 'default "Monaco-10")
;; (set-face-font 'default "Dejavu Sans Mono-12")
;; (set-fontset-font "fontset-default" '(#x1100 . #xffdc)
;; '("NanumGothicOTF" . "iso10646-1"))
;; (set-fontset-font "fontset-default" '(#xe0bc . #xf66e)
;; '("NanumGothicOTF" . "iso10646-1"))
;; (set-fontset-font "fontset-default" 'kana
;; '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
;; (set-fontset-font "fontset-default" 'han
;; '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
;; (set-fontset-font "fontset-default" 'japanese-jisx0208
;; '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
;; (set-fontset-font "fontset-default" 'katakana-jisx0201
;; '("Hiragino Kaku Gothic Pro" . "iso10646-1"))
;; hangul input
(set-language-environment "Korean")
(prefer-coding-system 'utf-8)
;; mouse wheel scroll
(setq mouse-wheel-scroll-amount '(1))
(setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
;; gui
(menu-bar-mode -1) ; if ARG is positive, and disable it otherwise.
(tool-bar-mode -1) ; if ARG is positive, and disable it otherwise.
(tooltip-mode -1) ; if ARG is positive, and disable it otherwise.
(load-theme 'wombat)
(setq display-time-day-and-date 1)
(display-time)
(scroll-bar-mode -1) ; if ARG is positive, and disable it otherwise.
;;package init check! --> https://www.emacswiki.org/emacs/ELPA
;; basic initialization, (require) non-ELPA packages, etc.
;;(setq package-enable-at-startup nil)
(package-initialize)
;; (require) your ELPA packages, configure them as normal
;;dired
(require 'dired)
(setq dired-listing-switches "-laF")
;; from http://www.emacswiki.org/emacs/dired+.el
(define-key dired-mode-map [C-down-mouse-1] 'dired-mouse-find-file) ; `C-mouse-1'
;;;###autoload
(defun dired-mouse-find-file (event) ; Bound to `C-mouse-1'
"Replace Dired in its window by this file or directory."
(interactive "e")
(let (file)
(with-current-buffer (window-buffer (posn-window (event-end event)))
(save-excursion (goto-char (posn-point (event-end event)))
(setq file (dired-get-filename nil t))))
(unless (stringp file) (error "No file here"))
(select-window (posn-window (event-end event)))
(find-file (file-name-sans-versions file t))))
;;emacs-arduino-mode
(autoload 'arduino-mode "arduino-mode" "Arduino editing mode." t)
(add-to-list 'auto-mode-alist '("\.ino$" . arduino-mode))
;;org-mode
;; The following lines are always needed. Choose your own keys.
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
;;calendar
(global-set-key (kbd "<f8>") 'calendar)
;;markdown-mode
(setq markdown-list-indent-width 2)
;;debug: command monitoring hook for org-mode
;; (add-hook 'org-mode-hook (function mwe:log-keyboard-commands))
;;server for emacsclients
(require 'server)
(unless (server-running-p)
(server-start))
;;scroll page one line at a time
(global-set-key (quote [M-down]) (quote scroll-up-line))
(global-set-key (quote [M-up]) (quote scroll-down-line))
;;goto line
(global-set-key "\M-g" 'goto-line)
;;markdown parse
(custom-set-variables
'(markdown-command "/usr/bin/pandoc"))
;; match paren - author : donghee park
(defun jump-match-paren (arg)
"Go to the matching parenthesis."
(interactive "p")
(cond ((looking-at "\\s\(\\|\\s\[") (forward-list 1) (backward-char 1))
((looking-at "\\s\)\\|\\s\]") (forward-char 1) (backward-list 1))
(t (back-to-indentation))
))
(global-set-key [C-return] 'jump-match-paren)
;;workspace restoration
;; (desktop-save-mode 1)
;; (require 'save-history) ; Save minibuffer history between sessions
;; (require 'recentf)
;; (setq recentf-auto-cleanup 'never) ;;To protect tramp
(setq backup-directory-alist
`((".*" . ,"/tmp/")))
(setq auto-save-file-name-transforms
`((".*" ,"/tmp/" t)))
;; always start 'full-screen'
(toggle-frame-fullscreen)
;; insert date, time..
(defun now ()
"Insert string for the current time formatted like '2:34 PM'."
(interactive) ; permit invocation in minibuffer
;; (insert (format-time-string "%D %-I:%M %p"))) ; original
(insert (format-time-string "%-I:%M%p "))) ; modified to print only 'time'
;; (defun today ()
;; "Insert string for today's date nicely formatted in American style, e.g. Sunday, September 17, 2000."
;; (interactive) ; permit invocation in minibuffer
;; (insert (format-time-string "%A, %B %e, %Y")))
(define-key global-map [(control c)(d)] 'now) ; assign 'C-c d'
;; c/c++ mode indentation preference
(c-set-offset 'substatement-open 0)
;; supercollider
(require 'sclang)
;; (custom-set-variables
;; '(sclang-auto-scroll-post-buffer t)
;; '(sclang-eval-line-forward nil)
;; '(sclang-help-path (quote ("/Applications/SuperCollider/Help")))
;; '(sclang-runtime-directory "~/.sclang/"))
(custom-set-variables
'(sclang-auto-scroll-post-buffer t)
'(sclang-eval-line-forward nil))
;; ox-reveal
(require 'ox-reveal)
;; web-mode
;; install
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
;; customization
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
@applecargo
Copy link
Author

asus chromebook flip c100p / crouton / ubuntu / trusty / xfce
korean input/display environment + many goodies...

@applecargo
Copy link
Author

update.. / this one's from archlinux shuttle ds81.. whatever.. just keep 1 single .emacs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment