citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

emacs-mailto-handler (967B)


      1 #!/usr/bin/env sh
      2 # emacs-mailto-handler
      3 # From http://www.emacswiki.org/emacs/MailtoHandler, 31 July 2010.
      4 
      5 # Takes a mailto link as its argument and pass it to Emacs.
      6 
      7 # For example, using the Mozex extension for Firefox, set the mailer to:
      8 #   emacs-mailto-handler %r
      9 # (you may need to specify the full pathname of emacs-mailto-handler)
     10 # and add to your ~/.emacs:
     11 #   (autoload 'mailto-compose-mail "mailto-compose-mail")
     12 
     13 
     14 mailto=$1
     15 mailto="${mailto#mailto:}"
     16 mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
     17 
     18 #elisp_expr="(compose-mail \"$mailto\")"
     19 elisp_expr="(compose-mail \"$mailto\")"
     20 
     21 ## This version re-uses an existing window.
     22 #emacsclient -n --eval "$elisp_expr"
     23 
     24 exec emacsclient -s $HOME/.emacs.d/server/server -n -c \
     25      --eval "$elisp_expr" \
     26      '(set-window-dedicated-p (selected-window) t)'
     27 
     28 ## This version creates a fresh window.
     29 # emacsclient -a "" -c -n --eval "$elisp_expr" \
     30 # 	'(set-window-dedicated-p (selected-window) t)'
     31