summaryrefslogtreecommitdiffhomepage
path: root/org/jao-org-popup.el
blob: eb5b24d2f7ec252ac405a66882c83b3289e6eb12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;;; frame popups
;; http://metajack.im/2008/12/30/gtd-capture-with-emacs-orgmode/
(defsubst jao-remember--frame-p ()
  (equal "*Remember*" (frame-parameter nil 'name)))

(defadvice remember-finalize (after delete-remember-frame activate)
  "Advise remember-finalize to close the frame if it is the remember frame"
  (when (jao-remember--frame-p) (delete-frame)))

(defadvice remember-destroy (after delete-remember-frame activate)
  "Advise remember-destroy to close the frame if it is the remember frame"
  (when (jao-remember--frame-p) (delete-frame)))

;; make the frame contain a single window. by default org-remember
;; splits the window.
(defun jao-remember--delete-other-windows ()
  (when (jao-remember--frame-p) (delete-other-windows)))

(add-hook 'remember-mode-hook 'jao-remember--delete-other-windows)

(defun make-remember-frame ()
  "Create a new frame and run org-remember"
  (interactive)
  (make-frame-on-display (getenv "DISPLAY")
                         '((name . "*Remember*")
                           (width . 80)
                           (height . 10)))
  (select-frame-by-name "*Remember*")
  (org-remember nil ?x))

(provide 'jao-org-popup)