(defconst dot-emacs (concat (getenv "HOME") "/" "frog.el") "My dot emacs file") (require 'bytecomp) (setq compiled-dot-emacs (byte-compile-dest-file dot-emacs)) (if (or (not (file-exists-p compiled-dot-emacs)) (file-newer-than-file-p dot-emacs compiled-dot-emacs) (equal (nth 4 (file-attributes dot-emacs)) (list 0 0))) (load dot-emacs) (load compiled-dot-emacs)) (add-hook 'kill-emacs-hook '(lambda () (and (file-newer-than-file-p dot-emacs compiled-dot-emacs) (byte-compile-file dot-emacs))))
Tag Archive for emacs
Auto-compiled .emacs file
Growl support for Aquamacs Emacs
;; Growl support ;;; Requires growlnotify, source for which is included in the Growl disk image ;;; Note that the growlnotify --image option is not reliable on OSX 10.5 ;;; see <a href="http://forums.cocoaforge.com/viewtopic.php?f=6&t=17526&p=114069" >http://forums.cocoaforge.com/viewtopic.php?f=6&t=17526&p=114069</a> ;;; Wrapper for growlnotify (defun growl-chat (title message &optional sticky) (interactive "sTitle: sGrowl: ") (shell-command (format "/usr/local/bin/growlnotify %s -m '%s' --appIcon 'Aquamacs Emacs' %s" title message (if sticky "--sticky" "")))) ;;; Sticky notifications (defun growl-chat-sticky (title message) (interactive "sTitle: sGrowl: ") (growl-chat title message t)) ;;; Growl nicknames and highlight words when they are mentioned ;;;; Nickname notifications are sticky (add-hook 'erc-text-matched-hook (lambda (match-type nickuserhost message) (when (and (boundp 'nick) (not (string= nick "ChanServ")) (not (string= nick "services."))) (cond ((eq match-type 'current-nick) (growl-chat-sticky (format "%s said %s" nick (erc-current-nick)) message)) ((eq match-type 'keyword) (growl-chat (format "%s mentioned a Keyword" nick) message))))))
Delete blank lines in emacs
M-x replace-regexp In the "where" part type: C-q C-j C-q C-j + In the "with" part type: C-q C-j
Random mode-line color
(defun set-random-mode-line-background() (interactive) (setq ncolors (length (defined-colors))) (random t) (set-face-background 'mode-line (nth (random ncolors) (defined-colors))))
.emacs for PSTrick user
; dvips (defun my-dvips nil (interactive) (shell-command (concat "dvips " (substring (buffer-name) 0 -4) ".dvi"))) (global-set-key "C-cps" ' my-dvips ) ; evince (PostScript viewer) (defun my-evince nil (interactive) (shell-command (concat "evince " (substring (buffer-name) 0 -4) ".ps &"))) (global-set-key "C-cpp" ' my-evince ) ; dvips -E -o output.eps input.dvi (defun my-dvips-eps nil (interactive) (setq my-dvips-eps-filename (substring (buffer-name) 0 -4)) (shell-command (concat "dvips -E -o" my-dvips-eps-filename ".eps " my-dvips-eps-filename ".dvi"))) (global-set-key "C-cEps" ' my-dvips-eps)
Make numbered backups
;;;Make Numbered Backups of Files (setq version-control t) ;;;Don't ask when deleting old backups (setq delete-old-versions t) ;;;Number of Numbered Backups to Keep ;;;Delete Oldest Version First (setq kept-old-versions 50) (setq kept-new-versions 50)
Persistent.el configuration
;;set up persistent.el ;;to remember histories across emacs sessions (setq persistent-session-list `(read-expression-history extended-command-history find-tag-history query-replace-history grep-history file-name-history compile-history kill-ring replace-string-history replace-regex-history query-replace-regex-history minibuffer-history shell-command-history buffer-name-history find-file-history )) (require `persistent) (persistent-session-load-from-alist) (setq persistent-session-size 500)