Growlnotify from emacs

Post a message via Growl from emacs

(defvar growlnotify-command (executable-find "growlnotify") "The path to growlnotify")

(defun growl (title message)
  "Shows a message through the growl notification system using
 `growlnotify-command` as the program."
  (flet ((encfn (s) (encode-coding-string s (keyboard-coding-system))) )
    (let* ((process (start-process "growlnotify" nil
                                   (encfn title)
                                   "-a" "Emacs"
                                   "-n" "Emacs")))
      (process-send-string process (encfn message))
      (process-send-string process "\n")
      (process-send-eof process)))

Post clipboard to your blog from emacs using org2blog

Quick helper function that posts the contents of your clipboard using org2blog.

(defun post-clipboard-to-blog ()
  (insert "\n#+BEGIN_SRC\n")
  (insert "\n#+END_SRC\n")
  (search-backward "#+BEGIN_SRC")
(global-set-key (kbd "C-x V") 'post-clipboard-to-blog)

Adjusting Emacs frame size and position based on screen size

I’m regulary jumping between my big display and the notebook screen.
This little function resizes and repositions my emacs window based on the screen size.
You will need to adjust the sizes to your need.

(defun set-frame-size-according-to-resolution ()
    (if window-system
      (if (> (x-display-pixel-width) 1500) ;; 1500 is the delimiter marging in px to consider the screen big
             (set-frame-width (selected-frame) 237) ;; on the big screen make the fram 237 columns big
             (set-frame-width (selected-frame) 177)) ;; on the small screen we use 177 columns
      (setq my-height (/ (- (x-display-pixel-height) 150) ;; cut 150 px of the screen height and use the rest as height for the frame
      (set-frame-height (selected-frame) my-height)
      (set-frame-position (selected-frame) 3 90) ;; position the frame 3 pixels left and 90 px down
  ;; (set-frame-size-according-to-resolution)
  (global-set-key (kbd "C-x 9") 'set-frame-size-according-to-resolution)

Just put this in your .emacs or any other startup script

Open current buffer in largest window

This little function opens the current buffer in the largest available window.

(defun open-in-largest-window()
  "Open current buffer in largest window"
  (let ((oldbuf (current-buffer)))
  (select-window (get-largest-window))
  (switch-to-buffer oldbuf))
(global-set-key (kbd "C-x 5") 'open-in-largest-window)