• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Mikey Boldt

What am I doing?

  • Home
  • About Mikey
  • Contact

emacs

Remove a Key Binding From Emacs Mode

January 5, 2016 by Leave a Comment

I am experimenting with Gnu Global to navigate a Java project in emacs with the ggtags package. I find it fast and slick, but I hit a bump in the road when I found that it remaps M-< and M-> — the default bindings to jump to the top and bottom of a buffer — when there are multiple matches for a tag. I find this intolerable. Don’t whack useful key bindings. </rant>

Luckily, this is emacs and I can customize everything. I think this is the first time I have deleted key bindings, so I figured I’d document it. A quick search found a post on Emacs Redux which includes how to remove emacs key bindings. In short, set the mode map entry for the key binding you want to remove to nil. Here is what I added:

;; ggtags: don't whack my useful key bindings!
(eval-after-load 'ggtags
  '(progn
     (define-key ggtags-navigation-map (kbd "M-<") nil)
     (define-key ggtags-navigation-map (kbd "M->") nil)))

Filed Under: Tech Tagged With: emacs, gnu global, key bindings

Process Management in Emacs with proced

July 23, 2012 by Leave a Comment

Leaving emacs frustrates me, especially when it’s for things I would normally do in a command shell. But alas, I would regularly drop into a shell to run the top command, as I did not know of an emacs replacement. I became fed up enough with this to do some googling, and found proced, which is a dired-like mode for managing processes.

I haven’t done much with it yet, just looked at processes and killed an xeyes as a test. It seems to have common keybindings: g to update the buffer, q to bury the buffer, marking like dired, etc. It doesn’t seem to have a home on the internets or an info page, but M-x proced [enter] C-h m provides good documentation. Glad to have this new-to-me tool in my belt.

Filed Under: Tech Tagged With: emacs, proced, processes, top

Linking to MS Office File in Emacs Org Mode

July 18, 2012 by 3 Comments

My daily workflow includes emacs org mode files for each project I’m working on. I often link to files, programs, etc. from these org mode files. I tried linking to a MS Excel spreadsheet using my usual

file:/path/to/file.xlsx

link. However, since the xlsx file is really a zip file, emacs opened a dired buffer revealing the contents, rather than opening it in Excel.

After a bit of googling, I found a message from the org mode mailing list about linking to Excel and Word documents from org mode and discovered the file+sys link type. This, per the org mode External Links manual, will “open via OS, like double-click”, which is exactly what I want. Good reminder for myself: when all else fails, RTFM.

Filed Under: Tech Tagged With: emacs, msoffice, orgmode

Email Update: Notmuch

May 27, 2012 by Leave a Comment

Introduction

In my last email-related post, I discussed Disciplined Email via Gnus. I theorized that reading email like a newsgroup would enforce more disciplined, efficient email use. I stand by that philosophy, but changed my email client to Notmuch.

Why Switch from Gnus to Notmuch

Reasons for switching from Gnus to Notmuch include:

Local copy of email
I had been doing email over IMAP, both work and personal. I was interested in getting a local copy of my email for backup and availability purposes. For this, I use OfflineImap, which synchronizes IMAP email with a local maildir. This integrates nicely with Notmuch, while I found Gnus maildir support slow and clunky.
Fast search
Search lives at the core of Notmuch. As a response to the Sup email client (get it?), Notmuch provides indexing, and searching, while search seems peripheral to Gnus.
Unified email
I like the unified inbox I get with K9 mail on my Android phone. I find separation between email accounts unnatural. Notmuch provides a single “inbox” tag for new messages, regardless of the account; I did not figure out how to do this easily in Gnus.

Nits About this Setup

A couple smaller things bug me about my current setup, though possibly not enough for me to spend time fixing:

OfflineImap occasionally goes to lunch
I think this happens when OfflineImap is running when I put my laptop to sleep. When it wakes up again OfflineImap eats a CPU, so I go kill it. I run OfflineImap via cron, so I don’t need to restart anything.
Email forwards sent from default account
When responding to email via the Notmuch emacs mail client (which uses Message Mode) does the right thing–if you have multiple email accounts, it sends the response from the account that received the email. However, email forwards send from the default account, even if a different account received the original email.

Conclusion

I find email with Notmuch + OfflineImap superior to Gnus + IMAP.

Filed Under: Tech Tagged With: emacs, email, gnus, notmuch

Emacs: open-line with fill-prefix

January 16, 2012 by Leave a Comment

This has happened to me one-too-many times, so I figure I’d post it:

I’m writing a longish comment in some code. I write it on a single line at first, then call fill-paragraph to let Emacs break it up into multiple lines of sane width. But, it prefixes each line with some text I’ve recently killed. The same prefix pops up when I call open-line as well.

I dug into this a bit, and found that I must have accidentally set the variable fill-prefix (which is bound to C-x .). To undo this, just call set-variable and set fill-prefix to nil, and go back to happily opening lines and filling paragraphs.

Filed Under: Tech Tagged With: emacs

Execute Code via Org-mode Links

January 5, 2012 by Leave a Comment

I was recently browsing the org-mode link documentation to see how I could link to my Gnus email inbox1. Looking through, I noticed a couple of interesting link capabilities I had not known about before:

shell:ls *.org A shell command
elisp:org-agenda Interactive Elisp command
elisp:(find-file-other-frame "Elisp.org") Elisp form to evaluate

Having the ability to run arbitrary shell commands and Elisp code via an Org-mode link seems very powerful. This is mainly a note-to-self to remember this capability. I will report back if/when I find a good practical application for this.

Footnotes:

1 The format is gnus:group.

Filed Under: Tech Tagged With: emacs, orgmode

Disciplined Email via Emacs Gnus

December 18, 2011 by 1 Comment

I’m a believer in the Inbox Zero philosophy; that is, I don’t like my brain to be in my inbox. If I have more than about 5 read emails sitting around, I get uncomfortable. I recently noticed myself getting sloppy with email, so I watched the Merlin Mann’s original Inbox Zero video for a refresher. The part of the video where Mann describes typical email processing as a deli chef who reads the orders multiple times, organizes them in different ways, but never actually makes a sandwich. Email is a support tool to help us actually do things. It is a means to an end, not an end in itself.

So, I took a look at the tools and processes I use for email. Since email is text, IMHO it belongs in emacs. I have been using emacs mew for a while now, since I like how it allows you to keep using emacs when it’s doing IMAP operations. I also use k9mail on my Android phone to check email hourly. My plan was to process email in mew daily, and keep in touch with the rest on my phone.

My analysis is I got sloppy in three aspects:

  • I read too much email on my phone. I was e.g. catching up on mailing lists on my phone, when really that should be done at my daily mew session.
  • In my daily mew check, I would leave mail for processing later.

To combat this, I started using Gnus instead of mew. The key feature of Gnus is that it reads email like a newsgroup reader–that is, once an email is marked is “read,” by default it no longer shows up in your inbox. This provides a constant reminder that email should be read once and processed, not left in the inbox to reread and process later.

As a side benefit, I find Gnus to display email beautifully. HTML emails show inline images properly. It displays messages properly threaded. I love the overall look-and-feel.

This is my current plan for disciplined email. In a month or two of using Gnus, I’ll check in to see how my email processing is going.

Filed Under: Tech Tagged With: emacs, email, gnus

Emacs: ssh with Tab Completion

December 5, 2011 by 1 Comment

Something that’s bugged me is that when I ssh into another machine inside a shell in emacs, tab completion gets still behaves as if I’m on the local machine. Just by chance, I once started a shell when using TRAMP to edit a remote file via scp, and noticed that the shell was on the remote machine and tab completion worked! So, I used this little in a function to start a remote with tab completion without manually opening a file on the remote machine first:

(defun remote-shell (&optional host)
  "Open a remote shell to a host."
  (interactive)
  (with-temp-buffer
    (let ((host (or host (read-string "Host: "))))
      (cd (concat "/scp:" host ":"))
      (shell (concat "*" host "*")))))

(defun myserver-shell () (interactive) (remote-shell "myserver"))

Filed Under: Tech Tagged With: emacs

Install Emacs 24 in Ubuntu

November 30, 2011 by 16 Comments

[2012-07-19] Update: Please see Damien Cassou’s comment describing his emacs snapshot PPA moving forward.

After reading several good things about emacs 24, I decided to give it a shot. A little googling led me to Damien Cassou’s emacs snapshot PPA. Simply ran the following:

sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get install emacs-snapshot
emacs-snapshot

Everything works great so far, specifically email in mew, chatting with jabber.el, my org files, and org2blog/wp. Played with the built-in ELPA package manager a little, and I really thing it will be nice to avoid manual package management.

Haven’t decided if/how often I’ll update my snapshot. Maybe until emacs 24 comes out in the Canonical packages? But then will I want to stay on the bleeding edge? Thoughts/suggestions/experiences?

Filed Under: Tech Tagged With: emacs, ubuntu

Primary Sidebar

Recent Posts

  • Recover from Blank Screen After Unplugging External Display in XFCE
  • Remove a Key Binding From Emacs Mode
  • Disable Bluetooth on Ubuntu Startup
  • Geequie: Cull Photos on Linux
  • Sync PDFs with Android using Dropsync

Recent Comments

  • Ricardo Orbegozo on Linking to MS Office File in Emacs Org Mode
  • eliaso on Linking to MS Office File in Emacs Org Mode
  • Joao Brito on Linking to MS Office File in Emacs Org Mode
  • Unable to install Emacs 24 from ppa:cassou/emacs | Ubuntu InfoUbuntu Info on Install Emacs 24 in Ubuntu
  • Unable to install Emacs 24 from ppa:cassou/emacs | WyldePlayground.netWyldePlayground.net - on Install Emacs 24 in Ubuntu

Copyright © 2025 · Mikey Boldt Theme on Genesis Framework · WordPress · Log in