Home About me Blog Po polsku

Content AND Presentation

2014-09-01 Quick opening of the init file

Since I’m continuously tweaking my Emacs configuration, I found myself repeatedly opening my init file, hitting C-x C-f init RET (with a few moments of waiting before RET, so that ido has a chance to recall where my init.el resides). Since I was a bit tired of that, I finally looked for some undefined key, found C-h C-i (maybe not the best combo, but who cares), and did this:

(global-set-key (kbd "C-h C-i")
		(lambda ()
		  (orgstruct-mode 1)))

As you can see, I’m turning Orgstruct mode here. It seems that it’s the easiest way to ``orgify’’ one’s init file, and I didn’t want to turn Orgstruct mode on with a file-local variable, since then Emacs would load Org before my customization of e.g. org-export-backends (or at least I think so, in fact, I didn’t check it). Of course, I also did

(setq orgstruct-heading-prefix-regexp ";; ")

and now I can fold and unfold sections of my init file. Finally!
CategoryEnglish, CategoryBlog, CategoryEmacs

Komentarze na tej stronie

2014-08-31 A simple, command-line-driven password store

I am currently in the process of moving my email workflow to a saner one (which I will probably write about in some time), so I tried to learn basics of applied cryptography. After successfully setting up my key pair, I went on to store passwords in encrypted files and making my email retrieval tool use some kind of agent (currently the default Ubuntu’s one, which is kind of broken – like a lot of things in Ubuntu…) to ease the pain of typing the passwords again and again. During some exchange on the Emacs mailing list, I was advised to use the pass utility instead of “raw” gpg to store my passwords. What a great little program it is! It even supports git: if the password store is at the same time a git repo, all password changes will be automatically committed. Cute! The only reason I’m not going to migrate my KeePass database to pass is that KeePass has a nice Android client.

CategoryEnglish, CategoryBlog, CategoryEmacs

Komentarze na tej stronie

2014-08-18 find-function-view-mode

Tired of doing C-h f, then typing the function name and then C-x C-o TAB RET to go to the source, I finally put the find-function onto C-h C-f (replacing mostly useless Emacs FAQ) (I learned about find-function from the indispensable Emacs Redux post.) However, I usually don’t want to edit my Emacs’ guts in place, so I looked up the (two-line) source for find-function (guess how, ha, ha), and came up with this one:

(defun find-function-view-mode (fun)
  (interactive (find-function-read))
  (find-function-do-it fun nil 'switch-to-buffer)
  (view-mode 1))

(global-set-key (kbd "C-h C-f") 'find-function-view-mode)

Trivial, but very useful.

As a side note: I also added (global-set-key (kbd "C-z C-v") 'view-mode) to my C-z keymap. Being used to less (how metaphysical!), I like view-mode a lot. Give it a try if you happen to open files in Emacs just to look at them, not edit them.

CategoryEnglish, CategoryBlog, CategoryEmacs

Komentarze na tej stronie


(Więcej means More in Polish; click it to see older entries.)

CategoryEnglish, CategoryBlog