From 2e3c5df4d78e4c956b070efddea2b4405f717640 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 15 Jul 2011 19:08:07 +0200 Subject: EMACS: lots of changes * Extended ** emacs.d/functions.el - Added a optional ~else~ part to ~foreach~ in HTML keywords, since smarty *can* also use ~foreachelse~, and this was only fontifying the ~foreach~ part. - Only load (and modify) naquadah-theme when we're running in X. I'd prefer to know if we have 256 colors available, but I haven't found that yet. - Only try to go to fullscreen if X is running. - Show a lambda symbol when the word lambda is found in a prog-mode buffer. - Enable auto-fill-mode when prog-mode is started. - Don't set pear options, pi-php-mode does it. - Added function to show ~lambda~ as a lambda symbol - Added function to create or update gtags file. ** emacs.el - Add pi-php-mode. - Removed muttrc-mode. - Use pi-php-mode instead of php-mode-improved. - Use ~(getenv)~ to get the browser. - Don't care about ~org-babel-confirm-evaluate~ and ~org-ditaa-jar-path~. - Set ~org-return-follows-link~ to ~t~, enter follows a link in ~org-mode~. - Set ~mouse-autoselect-window~ to ~t~, moving the mouse changes buffer focus. - Set ~pop-up-windows~ to ~nil~, so that popup functions use an existing window. - Set ~org-log-into-drawer~ to ~t~, so that activities are put in a drawer in ~org-mode~. - Set ~mail-header-separator~ to an empty string for ~message-mode~. - Use ~message-mode~ instead of ~mail-mode~. --- emacs.d/functions.el | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'emacs.d/functions.el') diff --git a/emacs.d/functions.el b/emacs.d/functions.el index 6d2a5e5..9c8f7da 100644 --- a/emacs.d/functions.el +++ b/emacs.d/functions.el @@ -74,7 +74,7 @@ Currently adds | & ! . + = - / % * , < > ? : ->" (font-lock-add-keywords 'html-mode '(("{\\(\\*.*\\*\\)}" 1 font-comment-face) - ("{\\/?\\(extends\\|block\\|foreach\\|if\\)" + ("{\\/?\\(extends\\|block\\|foreach\\(else\\)?\\|if\\)" 1 font-lock-builtin-face) ("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)\\(?:|\\(\\(?:\\sw\\|\\s_\\)+\\):\\)" (1 font-lock-variable-name-face) @@ -121,7 +121,24 @@ Currently adds | & ! . + = - / % * , < > ? : ->" (insert-char ?\; width)) (defun x-init () - "Start ide-skel and set some keys") + "Initialization only for X" + (require 'naquadah-theme) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; THEME SETTINGS ;; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (naquadah-theme-set-faces + 'naquadah + + ;; markdown-mode + '(markdown-link-face (:inherit 'link)) + '(markdown-header-face-1 (:inherit 'org-level-1)) + '(markdown-header-face-2 (:inherit 'org-level-2)) + '(markdown-header-face-3 (:inherit 'org-level-3)) + '(markdown-header-face-4 (:inherit 'org-level-4)) + '(markdown-header-face-5 (:inherit 'org-level-5)) + '(markdown-header-face-6 (:inherit 'org-level-6))) + + (add-hook 'emacs-startup-hook 'fullscreen)) (defun cli-init () "Add a space to the linum column" @@ -156,7 +173,9 @@ Currently adds | & ! . + = - / % * , < > ? : ->" ("\\b\\(\\.[0-9]+\\([eE][-+]?[0-9]+\\)?\\([lL]\\|[fF]\\|[dD]\\)?\\)\\b" 0 font-lock-constant-face))) (set-column-marker) - (rainbow-delimiters-mode)) + (rainbow-delimiters-mode) + (pretty-lambdas) + (auto-fill-mode 1)) (defun on-c-mode () (local-set-key [f8] 'c-toggle-header-source) @@ -178,10 +197,6 @@ Currently adds | & ! . + = - / % * , < > ? : ->" (auto-fill-mode 1)) (defun on-php-mode () - (defvar php-warn-if-mumamo-off nil) - (setq case-fold-search t) - (c-set-offset 'arglist-intro '+) - (c-set-offset 'arglist-close '0) (column-marker-1 76) (column-marker-2 81) (local-set-key [f6] 'comment-line)) @@ -189,3 +204,25 @@ Currently adds | & ! . + = - / % * , < > ? : ->" (defun on-mail-mode () (turn-on-auto-fill) (search-forward "\n\n")) + +(defun pretty-lambdas () + (font-lock-add-keywords + nil `(("(\\(lambda\\>\\)" + (0 (progn + (compose-region (match-beginning 1) + (match-end 1) + ?λ))))))) + +;; http://emacs-fu.blogspot.com/2009/01/navigating-through-source-code-using.html +(defun djcb-gtags-create-or-update () + "create or update the gnu global tag file" + (interactive) + (if (not (= 0 (call-process "global" nil nil nil " -p"))) ; tagfile + (let ((olddir default-directory) ; doesn't exist? + (topdir (read-directory-name + "gtags: top of source tree:" default-directory))) + (cd topdir) + (shell-command "gtags && echo 'created tagfile'") + (cd olddir)) ; restore + ;; tagfile already exists; update it + (shell-command "global -u && echo 'updated tagfile'"))) -- cgit v1.2.3-54-g00ecf