As my friend said,this avocado sauce is better:
I have 168 packages installed through Emacs package manager. And I shared my emacs.d at github.
So these days I have been spending much time on solve the issues for people who use my .emacs.d.
The root cause of most issues is the packages downloaded from melpa are not stable enough.
That's understandable because packages hosted at melpa are built automatically from developers' git repositories.
Now here is my solution:
- I use more stable packages from other repositories if possible.
- I use whitelist to explicitly list the packages I want to install from melpa.
White list because although packages on non-melpa are more stable, there are still some exceptions.
For example, the package "erlang" exists both in melpa and marmalade. But only the version at melpa is usable.
Now I need show you the code. See my init-elpa.el at github for configuration. Especially the code related to variable "melpa-include-package".
When I try to use `git send-email' at ubuntu 13.04, I get error message some perl modules are missing.
So here is one line command to install all missing perl modules:
sudo cpan Error Net:SMTP:SSL MIME::Base64 Authen::SASL
I put all my audio files in ~/Music.
The below script create a playlist in m3u format and ask mpd to load it:
cd ~/Music;find . -name '.mp3' -o -name '.flac'|sed -e 's%^./%%g' > all.m3u;mpd ~/.mpd/config;mpc clear;mpc load all.m3u;mpc update
Here is content of my ~/.mpd/config which is basically only a copy from official sample configuration:
See the mpd.conf man page for a more detailed description of each parameter.
Only one command:
sudo apt-get install emacs24-el
How I locate that package emacs24-el:
sudo apt-get install apt-file;sudo apt-file update;
apt-file search help.el.gz
BTW, I assign hot key "C-h C-f" to command "find-fuction" which "Find the definition of the FUNCTION near point".
I've read all the Emacs RSI related articles from the internet.
Typical solutions are:
- buy special hardwares
- remap ctrl key (because Emacs users press Ctrl key too often)
- use Vi key binding
- other Emacs keybinding with some hacking
- voice input
I will disscuss the third item "use Vim key binding" because there is still room to improve.
Here is my observation. Even I use Vi keybinding, there are top three frequently pressed keys which may hurt my left hand: "ESC", "C-x", "C-g"
These top three need me move my left hands too often. That may be the problem of RSI. In this case, A little knowledge of Vim will help.
In vi, we use key combination start with <leader> key. The leader key is actually the comma key ",".
As you can see, comma key is close to the right hand fingers. So using key combination with leader key as the first key to press will give more spare hot keys to replace "ESC", "C-x" and "C-g".
The princple here is DO NOT move hands at all. Following this example, I can figure out many practical solution.
(evil-leader/set-key "xf" 'ido-find-file "xb" 'ido-switch-buffer "xc" 'save-buffers-kill-terminal "jj" 'w3mext-search-js-api-mdn "xz" 'suspend-frame "xvv" 'vc-next-action "xv=" 'vc-diff "xvl" 'vc-print-log )
On some keyboard, the "Alt" key is easy to press because it's big and just under the big thumb. So I can assign some key combination like "M-k" to replace "C-g".
Please note "Alt" and "k" is also close to my fingers. Here is my setup in .emacs:
(global-set-key (kbd "M-k") 'keyboard-quit)
(define-key evil-insert-state-map (kbd "M-k") 'evil-normal-state)
(define-key evil-visual-state-map (kbd ",k") 'evil-exit-visual-state)
(define-key minibuffer-local-map (kbd ",k") 'abort-recursive-edit)
(define-key evil-insert-state-map (kbd "M-j") 'yas-expand)
Some minor modes will re-assign the hot key "C-g", so when I say replace "C-g" with ",k". It may be a bit more elisp code:
;; the original hot key of helm-keyboard-quit is "C-g"
(define-key helm-map (kbd ",k") 'helm-keyboard-quit)
The key point is to understand the princiles instead copy my configuration:
- comma is a good key for hot key prefix, it's used by vi users for ages
- use keys close to fingers (L,J,K,L, for example) in hot keys
- Other keys close to right hand is also useful in key combinations
- Avoid move left hand
This article has three parts.
First part explains setup of mail gateway DavMail for Exchange server.
Second part uses thunderbird to fetch mails from Davmail.
Third part uses Emacs and Gnus to replace thunderbrid. It's optional.
DavMail as mail gateway
Ever wanted to get rid of Outlook ? DavMail is a POP/IMAP/SMTP/Caldav/Carddav/LDAP exchange gateway allowing users to use any mail/calendar client (e.g. Thunderbird with Lightning or Apple iCal) with an Exchange server.
Download the installer at Debian/Ubuntu/Mint:
sudo apt-get install libswt-gtk-3-jni libswt-gtk-3-java libswt-cairo-gtk-3-jni # ubuntu/debian only; for other distribution, just download src package sudo dpkg -i davmail_4.5.1-2303-1_all.deb
Installation is easy. DavMail by itself is a portable java application. Since its GUI is dependent on SWT. So I give the instruction on how to install SWT in ubuntu. If you don't use ubuntu, then you are already technically good enough to know how to install SWT.
Now start DavMail.
Please input the web Outlook url like "https://webmail.mycompany.com.au/owa/" in its GUI.
By default all the services are NOT encrypted. It makes sense because email client and gateway are at the same computer.
Write down the port numbers. In my case, I need port number of IMAP/POP3/SMTP.
That's all you need to do unless DavMail can't detect your Exchange server automatically!
If Exchange server uses un-conventional EWS URL, you need find the URL manually with EWSEditor.
For example, my EWS URL is
https://my-company.local/EWS/Exchange.asmx. In DavMail, input that URL in "Main -> OWA (Exchange) URL" and force the "Exchange Protocol" into "EWS".
BTW, https://outlook.office365.com/ EWS URL is
Create a new account, and manually configure the server. The server name is "127.0.0.1", the port number is already on your paper. The minimum setup needs IMAP port to receive mail and SMTP port to send email.
You don't need care about ssl stuff, let thunderbird handle it. But if you get the error message like "BAD command authentication required" in davmail's log, modify setup in "Account Settings -> Server Settings -> Security Settings -> Connection Settings". Select "None".
The only issue is the "Username". You can log in Outlook Web UI, click "Options -> Change Password". The user name is displayed above the first input box. Please note the full user name may include the work domain.
Gnus cannot access IMAP service of DavMail. There is some bug.
So we have to turn to POP3. Check documentation at EmacsWiki.
If you use POP3, don NOT delete mails on server. You must set the variable "pop3-leave-mail-on-server" to true!
Insert below code into your ~/.emacs:
;; gnus+davmail bug, so I have to use pop3 for DavMail ;; http://permalink.gmane.org/gmane.emacs.gnus.general/83301 ;; but delete all the mails on server is scary (setq pop3-leave-mail-on-server t) (add-to-list 'gnus-secondary-select-methods '(nnml "mycompany")) (setq mail-sources '((pop :server "127.0.0.1" ;; DavMail is running at localhost :port 1110 :user "username" :password "password" :stream network))) ;; by default, DavMail don't encrypt mail
Since I've got many mails in INBOX folder, POP3 could take some time to get them. In worst cases, IT administrator may block DavMail access because it relay too many requests from Gnus! The solution is to use another IMAP client like thunderbird to clean up the INBOX folder before start Gnus.
Another tip is when opening a folder in Gnus, press
C-u ENTER instead of
C-u here means display all the read and unread mails. It's awkward when product manager ask you open an important mail but that mail is invisible because it's marked READ. Check my article Practical guide to use Gnus with Gmail for more tips.