Hey ! You use stumpwm, emacs or tmux and your screen (not the GNU screen) split in lot of parts ? There is a solution to improve that. ZOOMING !
Each of them work with a screen divided into panes/windows (the meaning of theses words change between the program), sometime you want want to have the one where your work in fullscreen. An option exists in each of them to get fullscreen temporarly on a window.
Emacs : (not native)
This is not native in emacs, you will need to install
from your favorite repository.
Add the thoses lines in your ~/.emacs :
(require 'zoom-window) (global-set-key (kbd "C-x C-z") 'zoom-window-zoom)
Type C-x C-z to zoom/unzoom your current frame
Toogle zoom (in or out)
Add this to your ~/.stumpwmrc
(define-key *root-map* (kbd "z") "fullscreen")
Using “prefix z” the current window will toggle fullscreen.
In this article we will see how to fetch, read and manage your emails from Emacs using mu4e. The process is the following : mbsync command (while mbsync is the command name, the software name is isync) create a mirror of an imap account into a Maildir format on your filesystem. mu from mu4e will create a database from the Maildir directory using xapian library (full text search database), then mu4e (mu for emacs) is the GUI which queries xapian database to manipulates your mails.
Mu4e handles with dynamic bookmarks, so you can have some predefined filters instead of having classic folders. You can also do a query and reduce the results with successives queries.
You may have heard about using notmuch with emacs to manage mails, mu4e and notmuch doesn’t do the same job. While notmuch is a nice tool to find messages from queries and create filters, it operates as a read-only tool and can’t do anything with your mail. mu4e let you write mail, move, delete, flag etc… AND still allow to make complex queries.
I wrote this article to allow people to try mu4e quickly, you may want to read both isync and mu4e manual to have a better configuration suiting your needs.
On OpenBSD you need to install 2 packages :
pkg_add mu4e isync
We need to configure isync to connect to the IMAP server :
Edit the file ~/.mbsyncrc, there is a trick to not have the password in clear text in the configuration file, see isync configuration manual for this :
iMAPAccount my_imap Host my_host_domain.info User imap_user Pass my_pass_in_clear_text SSLType IMAPS IMAPStore my_imap-remote Account my_imap MailDirStore my_imap-local Path ~/Maildir/my_imap/ Inbox ~/Maildir/my_imap/Inbox channel my_imap Master :my_imap-remote: Slave :my_imap-local: Patterns * Create Slave Expunge Both
mu4e / emacs configuration
We need to configure mu4e in order to tell where to find the mail folder. Add this to your ~/.emacs file.
(require 'mu4e) (setq mu4e-maildir "~/Maildir/my_imap/" mu4e-sent-folder "/Sent Messages/" mu4e-trash-folder "/Trash" mu4e-drafts-folder "/Drafts")
A few commands are needed in order to make everything works. We need to create the base folder as mbsync command won’t do the job for some reason, and we need mu to index the mails the first time.
mbsync can takes a moment because it will download ALL your mails.
mkdir -p ~/Maildir/my_imap mbsync -aC mu index --maildir=~/Maildir/my_imap
how to use
start emacs, run M-x mu4e RET and enjoy, the documentation of mu4e is well done. Press “U” at mu4e screen to synchronize with imap server.
A query for mu4e looks like this :
list:misc.openbsd.org flag:unread avahi
This query will search mails having list header “misc.openbsd.org” and which are unread and which contains “avahi” pattern.
This one will looks for mails within date range of 1st january 2014 to 15th february 2015 containing word “urgent”.
The current setup doesn’t handle sending mails, I’ll write another article about this. This requires configuring a smtp authentification and an identify for mu4e.
Also, you may need to tweak mbsync configuration or mu4e configuration, some settings must be changed depending on the imap server, this is particuliarly important for deleted mails.
You want to fold (hide) code between brackets like an if statement, a function, a loop etc.. ? Use the HideShow minor-mode which is part of emacs. All you need is to enable hs-minor-mode. Now you can fold/unfold by cycling with C-c @ C-c.
If you are using emacs under Microsoft Windows and you want to edit remote files through SSH, it’s possible to do it without using Cygwin. Tramp can use the tool “plink” from putty tools to do ssh.
What you need is to get “plink.exe” from the following page and get it into your $PATH, or choose the installer which will install all putty tools.
Then, edit your emacs file to add the following lines to tell it that you want to use plink when using tramp
(require 'tramp) (set-default 'tramp-default-method "plink")
Now, you can edit your remote files, but you will need to type your password. I think that in order to get password-less with ssh keys, you would need to use putty key agent.
Since I upgraded to Emacs 25 it was no longer saving my last cursor position in edited file. This is a feature I really like because I often fire and close emacs rather than keeping it opened.
Before (< emacs 25)
(setq save-place-file "~/.emacs.d/saveplace") (setq-default save-place t) (require 'saveplace)
(save-place-mode t) (setq save-place-file "~/.emacs.d/saveplace") (setq-default save-place t)
That’s all :)
If you have an android Phone, here are two things you may like :
Org-mode <=> Android
First is the MobileOrg app to synchronize your calendar/tasks between your computer org-mode files and your phone. I am using org-mode since a few months, I think I do pretty basics things with it like having a todo list with a deadline for each item. Having it in my phone calendar is a good enhancement. I can also add todo items from my phone to show it on my computer.
The phone and your computer get synced by publishing a special format of org files for the mobile on a remote server. Mobile Org supports ssh, webdav, dropbox or sdcard. I’m using ssh because I own a server and I can reliabily have my things connected together there on a dedicated account. Emacs will then use tramp to publish/retrieve the files.
Read/Write sms from a remote place
Second useful thing I like with my android phone is being able to write and send sms (+ some others things but I was most interested by SMS) from my computer. A few services already exists but they work with “cloud” logic and I don’t want my phone to be connected to one more service. The MAXS app provides me what I need : ability to read/write the sms of my phone from the computer without web browser and relying on my own services. MAXS connects the phone to a XMPP account and you set a whitelist of XMPP mails able to send commands, that’s all. Here are a few examples of use :
To write a SMS I just need to speak to the jabber account of my phone and write
sms send firstname lastname hello how are you ?
Be careful, there are 2 spaces after the lastname ! I think it’s like this so MAXS can make easily the difference between the name and the message.
I can also reply quickly to the last contacted person
reply to Yes I'm answering from my computer
To read the last n sms
sms read n
It’s still not perfect because sometimes it lose connectivity and you can’t speak with it anymore but from the project author it’s not a problem seen on every phone. I did not have the time yet to report exactly the problem (I need to play with Android Debug Bridge for that). If you want to install MAXS, you will need a few app from the store to get it working. First, you will need MAXS main and MAXS transport (a plugin to use XMPP) and then plugins for the differents commands you want, so, maybe, smsread and smswrite. Check their website for more informations.
As presenter earlier on my website, I use profanity as XMPP client. It’s a light and easy to configure/use console client.
I switched to mu4e to manage my mails at work, and also to send mails. But in our corporation we all have a signature that include our logo and some hypertext links, so I couldn’t just insert my signature and be done with that. There is a simple way to deal with this problem, I fetched the html part of my signature (which include an image in base64) and pasted it into my emacs config file this way.
(setq mu4e-compose-signature "<#part type=text/html><html><body><p>Hello ! I am the html signature which can contains anything in html !</p></body></html><#/part>" )
I pasted my signature instead of the hello world text of course, but you only have to use the part tag and you are done ! The rest of your mails will be plain text, except this part.
Here is a dump of my emacs config file. That may be useful for some emacs users who begin.
If you doesn’t want to have your_filename.txt~ files with a tilde at the end (this is a default backup file), add this
; I don't want to have backup files everywhere with filename~ name (setq backup-inhibited t) (setq auto-save-default nil)
To have parenthesis highlighting on match, which is very useful, you will need this
; show match parenthesis (show-paren-mode 1)
I really like this one. It will save the cursor position in every file you edit. When you edit it again, you start exactly where you leaved the last time.
; keep the position of the cursor after editing (setq save-place-file "~/.emacs.d/saveplace") (setq-default save-place t) (require 'saveplace)`
If you write in utf–8 (which is very common now) you should add this.
; utf8 (prefer-coding-system 'utf-8)
Emacs modes are used depending on the extension of a file. Sometime you need to edit files with a custom extension but you want to use a mode for it. So, you just need to add some line like this to get your mode automatically when you load the file.
; associate extension - mode (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
My Org-mode part in the config file
(require 'org) (define-key global-map "\C-ca" 'org-agenda) (setq org-log-done t) (setq org-agenda-files (list "~/Org/work.org" "~/Org/home.org"))
Stop mixing tabs and space when indenting
(setq indent-tabs-mode nil)