EMACS: hooks, skeletons and ido
* Moved rainbow-delimiters-mode and set-column-marker to prog-mode. * Turn on ido-mode, it seems interesting. * Added prog-mode hook. * Removed emacs-lisp-mode, js-mode, python-mode and lisp-mode hooks since they should all only do what prog-mode hook does. * Added myaethon-set-varchar-docstring and myaethon-set-array-varchar-docstring skeletons, these are both useful for work and a good way to learn more about skeletons.
This commit is contained in:
parent
720c7e82d4
commit
5944a4a97b
1 changed files with 39 additions and 11 deletions
50
emacs.el
50
emacs.el
|
@ -190,17 +190,15 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||||
(if (string-equal suffix "el")
|
(if (string-equal suffix "el")
|
||||||
(byte-compile-file fname)))))
|
(byte-compile-file fname)))))
|
||||||
|
|
||||||
|
(defun on-prog-mode ()
|
||||||
|
(set-column-marker)
|
||||||
|
(rainbow-delimiters-mode))
|
||||||
|
|
||||||
(defun on-c-mode ()
|
(defun on-c-mode ()
|
||||||
(local-set-key [f8] 'c-toggle-header-source)
|
(local-set-key [f8] 'c-toggle-header-source)
|
||||||
(local-set-key [f9] 'compile)
|
(local-set-key [f9] 'compile)
|
||||||
(local-set-key [C-m] 'newline-and-indent)
|
(local-set-key [C-m] 'newline-and-indent)
|
||||||
(local-set-key [C-return] 'newline)
|
(local-set-key [C-return] 'newline))
|
||||||
(set-column-marker)
|
|
||||||
(rainbow-delimiters-mode))
|
|
||||||
|
|
||||||
(defun on-emacs-lisp-mode ()
|
|
||||||
(set-column-marker)
|
|
||||||
(rainbow-delimiters-mode))
|
|
||||||
|
|
||||||
(defun on-html-mode ()
|
(defun on-html-mode ()
|
||||||
(local-set-key [f9] 'browse-to-current-file)
|
(local-set-key [f9] 'browse-to-current-file)
|
||||||
|
@ -309,6 +307,7 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||||
org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar"
|
org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar"
|
||||||
jit-lock-defer-time 0.2
|
jit-lock-defer-time 0.2
|
||||||
htmlize-output-type 'inline-css
|
htmlize-output-type 'inline-css
|
||||||
|
ido-save-directory-list-file nil
|
||||||
|
|
||||||
frame-title-format
|
frame-title-format
|
||||||
'(:eval
|
'(:eval
|
||||||
|
@ -372,6 +371,7 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||||
(global-font-lock-mode t) ; show syntax highlighting, old
|
(global-font-lock-mode t) ; show syntax highlighting, old
|
||||||
(delete-selection-mode t) ; delete selection upon typing
|
(delete-selection-mode t) ; delete selection upon typing
|
||||||
(show-paren-mode t) ; show the opposite paren
|
(show-paren-mode t) ; show the opposite paren
|
||||||
|
(ido-mode t)
|
||||||
(autopair-global-mode) ; automatically add the other
|
(autopair-global-mode) ; automatically add the other
|
||||||
; delimiter
|
; delimiter
|
||||||
|
|
||||||
|
@ -382,8 +382,8 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
(add-hook 'before-save-hook 'on-before-save)
|
(add-hook 'before-save-hook 'on-before-save)
|
||||||
(add-hook 'after-save-hook 'on-after-save)
|
(add-hook 'after-save-hook 'on-after-save)
|
||||||
|
(add-hook 'prog-mode-hook 'on-prog-mode)
|
||||||
(add-hook 'c-mode-hook 'on-c-mode)
|
(add-hook 'c-mode-hook 'on-c-mode)
|
||||||
(add-hook 'emacs-lisp-mode-hook 'on-emacs-lisp-mode)
|
|
||||||
(add-hook 'html-mode-hook 'on-html-mode)
|
(add-hook 'html-mode-hook 'on-html-mode)
|
||||||
(add-hook 'markdown-mode-hook 'on-markdown-mode)
|
(add-hook 'markdown-mode-hook 'on-markdown-mode)
|
||||||
(add-hook 'org-mode-hook 'on-org-mode)
|
(add-hook 'org-mode-hook 'on-org-mode)
|
||||||
|
@ -392,10 +392,7 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||||
(add-hook 'git-commit-mode-hook 'auto-fill-mode)
|
(add-hook 'git-commit-mode-hook 'auto-fill-mode)
|
||||||
(add-hook 'emacs-startup-hook 'fullscreen)
|
(add-hook 'emacs-startup-hook 'fullscreen)
|
||||||
(add-hook 'css-mode-hook 'rainbow-mode)
|
(add-hook 'css-mode-hook 'rainbow-mode)
|
||||||
(add-hook 'js-mode-hook 'rainbow-delimiters-mode)
|
|
||||||
(add-hook 'python-mode-hook 'rainbow-delimiters-mode)
|
|
||||||
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
|
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
|
||||||
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; SKELETONS ;;
|
;; SKELETONS ;;
|
||||||
|
@ -413,6 +410,37 @@ Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||||
"set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})\n"
|
"set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})\n"
|
||||||
"add_subdirectory(src)")
|
"add_subdirectory(src)")
|
||||||
|
|
||||||
|
(define-skeleton myaethon-set-varchar-docstring
|
||||||
|
"A docstring for a varchar setter"
|
||||||
|
""
|
||||||
|
"\/* Setter for the "
|
||||||
|
(skeleton-read "name: ")
|
||||||
|
" column\n"
|
||||||
|
"\n"
|
||||||
|
'(indent-according-to-mode)
|
||||||
|
"$value: string, no longer than "
|
||||||
|
(skeleton-read "len: ")
|
||||||
|
" characters */"
|
||||||
|
'(fill-paragraph))
|
||||||
|
|
||||||
|
(define-skeleton myaethon-set-array-varchar-docstring
|
||||||
|
"A docstring for an array/varchar setter"
|
||||||
|
""
|
||||||
|
'(setq name (skeleton-read "name: "))
|
||||||
|
'(setq len (string-to-number (skeleton-read "length: ")))
|
||||||
|
'(setq size (floor (/ (- len 1) 2)))
|
||||||
|
"/* Setter for the "
|
||||||
|
name
|
||||||
|
" column\n"
|
||||||
|
"\n"
|
||||||
|
'(indent-according-to-mode)
|
||||||
|
"$value: array, with no more than "
|
||||||
|
(number-to-string size)
|
||||||
|
" elements; string, no langer than "
|
||||||
|
(number-to-string len)
|
||||||
|
" characters */"
|
||||||
|
'(fill-paragraph))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; AUTORUN ;;
|
;; AUTORUN ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
Loading…
Reference in a new issue