global hotkey / keyboard shortcut in Mac OS X to bring up remember buffer in emacs: record a new thought or TO DO task anywhere

This method worked for me, and this didn’t.

I added the following in my .emacs file:

<pre class="src src-sh">;; Emacs server on by default

(server-start)

;; http://metajack.im/2008/12/30/gtd-capture-with-emacs-orgmode/?dsq=13708223#comment-13708223 ;; together with the apple script C-M-\ anywhere in Mac to bring up the remember buffer ;; C-c C-c to save in ~/.notes and close; (require ‘remember) (defadvice remember-finalize (after delete-remember-frame activate) “Advise remember-finalize to close the frame if it is the remember frame” (if (equal “remember” (frame-parameter nil ‘name)) (delete-frame)))

(defadvice remember-destroy (after delete-remember-frame activate) “Advise remember-destroy to close the frame if it is the rememeber frame” (if (equal “remember” (frame-parameter nil ‘name)) (delete-frame)))

;; make the frame contain a single window. by default org-remember ;; splits the window. (add-hook ‘remember-mode-hook ‘delete-other-windows)

(defun make-remember-frame () “Create a new frame and run org-remember.” (interactive) (make-frame ‘((name . “remember”) (width . 80) (height . 10))) (select-frame-by-name “remember”) (org-remember))

I used this applescript with spark and bound it to C-M-\ : property eclient :

<pre class="src src-sh"><span style="color: #ffa07a;">"/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -e '(make-remember-frame)'"</span>

do shell script eclient

tell application “Emacs” activate end tell

Now, wherever im at in Mac, i just hit C-M-\ and my remember buffer will be brought up. I type what my thoughts are. Hit C-c C-c to save and close buffer. When I have time, go to ~/.notes and organize my thoughts, and finish the to-do tasks. Set the ending of that file as:

Captures

Anything i add will be under ** Date, and after that will be my notes. So remember-mode is org-mode!

debugging errors in emacs (.emacs)

So recently i wanted to try to add on other popular emacs packages such as elscreen and Do Re Mi (doremi). However, I couldn’t configure them to work as i got some errors after adding stuff to my .emacs. I posted comments on people’s blogs and emailed them to try to figure this out.

Finally, I contacted Drew Adams, the author of Doremi and many other popular emacs packages (search in my vinhdizzo email for his email address). He was willing to help me. The following was his email, which showed me how to debug in emacs very efficiently. If i added new stuff in emacs and i get errors, do:

  1. start emacs without all the baggage, ie, emacs -Q
  2. try executing those new emacs code, either by M-x, or by highlighting them and doing M-x eval-region.
  3. if there is a bug, then i should still get an error still here.

otherwise, the error must be some kind of conflicts. try moving this up my .emacs somewhere (this work for both of those packages i mentioned before).

2nd tip i got from drew adams is to do binary search when i don’t know where the error came from in my .emacs. his email sums it up: “”” OK. So the first lesson learned is to test without all of the extra baggage in your .emacs.

Here’s the second lesson: ;-)

To find what is causing the problem in your .emacs, use a binary search: Comment out half of the file and see whether the problem is there. Then comment out half of the problem half, then half of that problem quarter, then… Binary search is very quick – in very little time you’ll know what’s causing the problem.

You probably already knew that, but it’s always worth repeating, just in case.

Good luck. Let me know if the problem comes from one of my libraries.

Regards,

Drew “””

Man i love the open source community!