Johnny [Life & Code]

Semper Exploro!

~/.emacs

with 6 comments

Current ~/.emacs

;; My Information
(setq user-full-name “Johnny Jacob”)

;; setting the title emacs window
(setq frame-title-format “emacs – %b”)
;; Don’t want any startup message
(setq inhibit-startup-message   t)
;;; Color scheme
(set-foreground-color “steelblue2”)
(set-background-color “black”)
(set-cursor-color “red”)
;; Frame Title
(setq frame-title-format “Emacs: %b “)

(tool-bar-mode nil) ; toolbar not available on the Win32 port yet…
(menu-bar-mode nil) ; turn off the menus

;;; Setting the default font
(set-default-font “8×13”)
;;; Start Emacs Server
(server-start)

;;; Emacs Desktop – Saving sessions.
(desktop-load-default)
(desktop-read)
(setq desktop-save-mode t)

;;; C-Mode Templates
(require ‘tempo)
;;; (setq tempo-interactive t)

(add-hook ‘c-mode-hook
‘(lambda ()
(local-set-key [f11] ‘tempo-complete-tag)
(tempo-use-tag-list ‘c-tempo-tags)
))
;;; Templates appended to c-tempo-tags

(defvar c-tempo-tags nil
“Tempo tags for C mode”)

(tempo-define-template “c-debug-pf”
‘(“printf(\”%s(%d):%s:”r” \\n\”, __FILE__, __LINE__, __PRETTY_FUNCTION__);”>)
“include”
“Insert a printf statement with info on location”
‘c-tempo-tags)
;;; Custom Keybindings
(global-set-key “\C-z” ‘shell)
(global-set-key “\M-n” ‘goto-line)

;;Clipboard
(setq x-select-enable-clipboard t)

;;; Inserts the template “c-debug-pf”
(global-set-key “\C-x\C-q” ‘tempo-template-c-debug-pf)
;;; Shell Customizations
(setq comint-scroll-show-maximum-output t)

(load “~/.emacs.d/dired+.el”)
(toggle-dired-find-file-reuse-dir 1)

;; Function display in mode line
(which-function-mode t)

;; XCSCOPE
(load “~/.emacs.d/xcscope.el”)
(require ‘xcscope)
(setq cscope-initial-directory “/home/jjohnny/src/git/”)

;; EMACS Temporary Files
(defvar user-temporary-file-directory “/home/jjohnny/src/tmp-files/”)
(make-directory user-temporary-file-directory t)
(setq backup-by-copying t)
(setq backup-directory-alist
`((“.” . ,user-temporary-file-directory)
(,tramp-file-name-regexp nil)))
(setq auto-save-list-file-prefix
(concat user-temporary-file-directory “.auto-saves-“))
(setq auto-save-file-name-transforms
`((“.*” ,user-temporary-file-directory t)))

;; reload current file . TODO : Find a better way

(defun reload-file ()
(interactive)
(find-file (buffer-name))
)

;; Mail Configuration

(setq user-mail-address “mymail@gmail.com”)
(setq user-full-name “Johnny Jacob”)
(load-library “smtpmail”)
(load-library “nnimap”)
(load-library “starttls”)
(setq gnus-select-method ‘(nnimap “imap.gmail.com”
(nnimap-address “imap.gmail.com”)
(nnimap-server-port 993)
(nnimap-authinfo-file “~/.imap-authinfo”)
(nnimap-stream ssl)))

(setq smtpmail-starttls-credentials ‘((“smtp.gmail.com” 587 nil nil))
smtpmail-smtp-server “smtp.gmail.com”
smtpmail-default-smtp-server “smtp.gmail.com”
send-mail-function ‘smtpmail-send-it
message-send-mail-function ‘smtpmail-send-it
smtpmail-smtp-service 587
smtpmail-auth-credentials ‘((“smtp.gmail.com”
587
mymail@gmail.com”
nil)))
(add-hook ‘gnus-topic-mode-hook ‘gnus-topic-mode)

Old ~/.emacs

;; setting the title emacs window
(setq frame-title-format “emacs – %b”)
;; Don’t want any startup message
(setq inhibit-startup-message t)
;;; Color scheme
(set-foreground-color “steelblue3”)
;;(set-foreground-color “”)
(set-background-color “gray2”)
(set-cursor-color “red”)
;; Frame Title
(setq frame-title-format “Emacs: %b %+%+ %f”)

(tool-bar-mode nil) ; toolbar not available on the Win32 port yet…
(menu-bar-mode nil) ; turn off the menus

;;; Load PATH
(add-to-list ‘load-path “~/.emacs.d/planner/planner/”)
(add-to-list ‘load-path “~/.emacs.d/planner/muse/lisp/”)
(add-to-list ‘load-path “~/.emacs.d/remember/”)

;;; Setting the default font
(set-default-font “8×13”)

;;; Start Emacs Server
(server-start)

;;; Emacs Desktop – Saving sessions.
(desktop-load-default)
(desktop-read)
(setq desktop-files-not-to-save “muse$”)

;;; TAGS table list
(setq tags-table-list
‘(“/home/jjohnny/src/svn/simias/trunk/simias-server/”))
;;; TEMPO MODE SETTINGS
;;; This is a way to hook tempo into cc-mode
(defvar c-tempo-tags nil
“Tempo tags for C mode”)

;;; C-Mode Templates
(require ‘tempo)
;;; (setq tempo-interactive t)

(add-hook ‘c-mode-hook
‘(lambda ()
(local-set-key [f11] ‘tempo-complete-tag)
(tempo-use-tag-list ‘c-tempo-tags)
))
;;; Templates appended to c-tempo-tags

;; (tempo-define-template “c-debug-pf”
;; ‘(“printf(\”%s(%d):%s:”r” \\n\”, __FILE__, __LINE__, __PRETTY_FUNCTION__);”>)
;; “include”
;; “Insert a printf statement with info on location”
;; ‘c-tempo-tags)

(tempo-define-template “c-debug-pf”
‘(“Console.WriteLine (\”DEBUG : {0} \\n\”,”r”);”>)
“include”
“Insert a printf statement with info on location”
‘c-tempo-tags)

(setq compile-command “make”
compilation-ask-about-save nil
compilation-window-height 16)
(global-set-key [f7] ‘compile)
;;; Set java-mode for C#
(setq auto-mode-alist
(append ‘((“\\.cs$” . java-mode)) auto-mode-alist))

;;; Custom Keybindings
(global-set-key “\C-z” ‘shell)
(global-set-key “\M-n” ‘goto-line)

;;Clipboard
(setq x-select-enable-clipboard t)

;;; Inserts the template “c-debug-pf”
(global-set-key “\C-x\C-q” ‘tempo-template-c-debug-pf)
;;; Shell Customizations
(setq comint-scroll-show-maximum-output t)

;; Remote file editing via ssh
(add-to-list ‘load-path “~/.emacs.d/tramp/lisp/”)
(require ‘tramp)
(setq tramp-default-method “ssh”)

;; SVN Interface for emacs
(add-to-list ‘load-path “~/.emacs.d/psvn/”)
(require ‘psvn)

(add-to-list ‘load-path “~/.emacs.d/”)
(autoload ‘csharp-mode “csharp-mode”
“Major mode for editing C# code.” t)
(setq auto-mode-alist (cons ‘( “\\.cs\\'” . csharp-mode ) auto-mode-alist ))

;;; Find file
(defun find-file-parse-minibuffer ()
;; Extension to the complete word facility of the minibuffer
(interactive)
(backward-char 4)
(setq found t)
(cond
; local directories
((looking-at “deds”) (setq directory “/home/jjohnny/src/cvs/gnome/evolution-data-server/”))
((looking-at “devo”) (setq directory “/home/jjohnny/src/cvs/gnome/evolution/”))
((looking-at “difo”) (setq directory “/home/jjohnny/src/svn/ifolder/trunk/trunk”))
((looking-at “dsim”) (setq directory “/home/jjohnny/src/svn/simias/trunk/simias”))
(t (setq found nil)))
(cond (found (beginning-of-line)
(kill-line)
(insert directory))
(t (forward-char 4)
(minibuffer-complete))))

(define-key minibuffer-local-completion-map ” ” ‘find-file-parse-minibuffer)
;;;

;;; EMACS CODE BROWSER

;;; cedet
(load-file “/home/jjohnny/.emacs.d/cedet-1.0beta3b/common/cedet.el”)

;;; ecb
(add-to-list ‘load-path
“/home/jjohnny/.emacs.d/ecb/ecb-2.32”)
(require ‘ecb)
(require ‘ecb-autoloads)

(setq semantic-load-turn-everything-on t)
(require ‘semantic-load)

;;;
;;; quilt.el / Muse
;;;

;;;(load “~/.emacs.d/quilt.el”)

;;;
;;; Planner.el / Muse
;;;

(setq muse-project-alist
‘((“WikiPlanner”
(“~/.emacs.d/plans” ;; Or wherever you want your planner files to be
:default “index”
:major-mode planner-mode
:visit-link planner-visit-link)
;; This next part is for specifying where Planner pages
;; should be published and what Muse publishing style to
;; use. In this example, we will use the XHTML publishing
;; style.
(:base “planner-html”
;; where files are published to
;; (the value of `planner-publishing-directory’, if
;; you have a configuration for an older version
;; of Planner)
:path “~/public_html/Plans”))))

(require ‘muse-mode) ; load authoring mode

(require ‘muse-html) ; load publishing styles I use
(require ‘muse-latex)
(require ‘muse-texinfo)
(require ‘muse-docbook)

(require ‘planner)
(require ‘schedule)
(require ‘planner-timeclock)
(require ‘planner-timeclock-summary)
(require ‘planner-timeclock-summary-proj)
(require ‘planner-report)
(require ‘planner-tasks-overview)
(require ‘planner-accomplishments)
(require ‘planner-deadline)
(require ‘planner-id)
(require ‘planner-registry)
(require ‘planner-zoom)
(require ‘planner-rank)

;;; Planner Publishing
(require ‘planner-publish)
(require ‘planner-calendar)
(require ‘planner-rss)

;;; Remember
(require ‘remember)
(require ‘remember-planner)

(setq remember-handler-functions ‘(remember-planner-append))
(setq remember-annotation-functions planner-annotation-functions)
(setq remember-planner-xref-p t)

;;
;;Calendar Stuff
;;

(setq planner-calendar-day-header-chars 2)
(setq planner-calendar-today-page-name “index”)
(setq planner-calendar-prev-month-button “<<“)
(setq planner-calendar-next-month-button “>>”)

;; Planner create today link
(eval-after-load “muse-publish”
‘(add-hook ‘muse-after-publish-hook
‘planner-calendar-create-today-link))

;; Planner RSS FEED settings
(add-to-list ‘remember-planner-append-hook ‘planner-rss-add-note t)
(setq planner-rss-base-url “http://helios/~jjohnny/Plans/&#8221;)
;;(setq planner-rss-category-feeds ‘((“.”
;; “~/public_html/feed.rss”
;; “<?xml version=\”1.0\” encoding=\”utf-8\”?><rss version=\”2.0\”><channel><title>Helios SkYNET</title><link>http://helios/~jjohnny/Plans</link><description>Helios :: Johnny’s Tasks</description></channel></rss>\n”)))

(setq planner-rss-feed-limits ‘((“.” nil 10)))

;;Auto Publish when muse saved
;;(eval-after-load “muse-mode”
;; (add-hook ‘after-save-hook
;; ‘(lambda ()
;; ‘(when (planner-derived-mode-p ‘muse-mode)
;; (muse-project-publish nil)))
;;))
;; nil t))

;;(setq planner-day-page-template “* Tasks\n\n\n* Timeclock\n\n\n* Notes”)

(planner-registry-initialize)
(setq planner-carry-tasks-forward 0)
(setq planner-use-task-numbers t)

;; Task without date
(defun my-planner-create-task ()
“Call `planner-create-task’, but without dates.”
(interactive)
(let ((planner-use-day-pages nil))
(call-interactively ‘planner-create-task)))

;; Planner HTML Styles
(setq planner-html-footer “/home/jjohnny/.emacs.d/plans/templates/planner-footer”)
(setq planner-html-header “/home/jjohnny/.emacs.d/plans/templates/planner-header”)

;;;
;;; Blogger
;;;

;;;(require ‘mt)
;;;(global-set-key “\C-cwc” ‘weblog-create-post)
;;;(global-set-key “\C-cwr” ‘weblog-retrieve-recent-posts)
;;;(global-set-key “\C-cwg” ‘weblog-retrieve-post)
;;;(setq weblog-id “1”)
;;;(setq weblog-post-count 15)
;;;(setq weblog-username “johnnyjacob”)
;;;(setq weblog-password “xxxxxxxxxx”)
;;;(setq weblog-url “https://johnnyjacob.wordpress.com/xmlrpc.php&#8221;)

;;;(load-file “blogger.el”)

;;;
;;; Font Locking Mode
;;;

(defun my-turn-on-font-lock ()
(interactive “”)
;;; Color the faces appropriately
(set-face-foreground ‘bold “lightblue”)
(set-face-foreground ‘bold-italic “olivedrab2”)
(set-face-foreground ‘italic “lightsteelblue”)
(set-face-foreground ‘modeline “white”)
(set-face-background ‘modeline “green”)
(set-face-background ‘highlight “blue”)
;; Turn off underline property for bold and underline
(set-face-underline-p ‘bold nil)
(set-face-underline-p ‘underline nil)
(transient-mark-mode 1)
(font-lock-mode 1))

(defun my-turn-on-font-lock2 ()
(interactive “”)
;;; Color the faces appropriately
(set-face-foreground ‘bold “lightblue”)
(set-face-foreground ‘bold-italic “olivedrab2”)
(set-face-foreground ‘italic “lightsteelblue”)
(set-face-foreground ‘modeline “white”)
(set-face-background ‘modeline “green”)
(set-face-background ‘highlight “blue”)
;; Turn off underline property for bold and underline
(set-face-underline-p ‘bold nil)
(set-face-underline-p ‘underline nil)
(transient-mark-mode 1)
(font-lock-mode 1))

;;; Color Switched

(defvar background-color-rotation
‘(“aliceblue” “thistle” “lemonchiffon” “khaki” “papayawhip”
“honeydew” “mistyrose” “paleturquoise”)
“List of background color names to rotate”)
(defun next-background-color ()
“Rotates among colors in background-color-rotation.”
(set-variable ‘background-color-rotation
(append (cdr background-color-rotation)
(list (car background-color-rotation))))
(car background-color-rotation))
(define-key global-map [f10]
(lambda ()
(interactive)
(set-face-background ‘default (next-background-color))))

;;;
;;; Buffer Switcher
;;;
(defvar LIMIT 1)
(defvar time 0)
(defvar mylist nil)

(defun time-now ()
(car (cdr (current-time))))

(defun bubble-buffer ()
(interactive)
(if (or (> (- (time-now) time) LIMIT) (null mylist))
(progn (setq mylist (copy-alist (buffer-list)))
(delq (get-buffer ” *Minibuf-0*”) mylist)
(delq (get-buffer ” *Minibuf-1*”) mylist)))
(bury-buffer (car mylist))
(setq mylist (cdr mylist))
(setq newtop (car mylist))
(switch-to-buffer (car mylist))
(setq rest (cdr (copy-alist mylist)))
(while rest
(bury-buffer (car rest))
(setq rest (cdr rest)))
(setq time (time-now)))

(global-set-key [f4] ‘bubble-buffer)

(defun geosoft-kill-buffer ()
;; Kill default buffer without the extra emacs questions
(interactive)
(kill-buffer (buffer-name))
(set-name))

(global-set-key [C-delete] ‘geosoft-kill-buffer)
(global-set-key [C-kp-delete] ‘geosoft-kill-buffer)

)
;;;

Updated on Wednesday, June 13 2007

Written by Johnny

August 2, 2006 at 1:34 pm

6 Responses

Subscribe to comments with RSS.

  1. What’s with the (set-name) in geosoft-kill-buffer? My Emacs 22 disavows all knowledge of it, and Google is no help.

    Gwern

    January 23, 2007 at 1:26 am

  2. What’s with the ‘setq weblog-password’ line above? I hope that’s not actually your wordpress password.

    I came here looking for elisp to set the default font, and I found it, thanks!

    C. Scott Ananian

    January 27, 2007 at 4:11 pm

  3. heehe .. itz not 🙂

    Johnny

    January 28, 2007 at 5:31 am

  4. To Gwern: I just omitted the (set-name) in geosoft-kill-buffer. Works for me.

    mwq@irc

    November 6, 2007 at 12:18 pm

  5. Hi,

    Why you don’t use ECB anymore? (XSCOPE is better?)

    Thanks,
    Va

    va

    January 3, 2008 at 8:09 am

  6. @Va : Not sure which is better .. but xscope fits my workflow than ECB. 🙂

    Johnny

    January 3, 2008 at 8:13 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: