kiwanami / emacs-calfw

A calendar framework for Emacs
1.17k stars 101 forks source link

shortcut for calfw-org #32

Closed skyer9 closed 11 years ago

skyer9 commented 11 years ago

i made "clean exit #20" related function. (close all buffer opened by calfw-org)

but i do not know how to add shortcut in calfw buffer.

can you tell me how to add it?

skyer9 commented 11 years ago

i made some code.

in calfw.el =============

(defun cfw:clean-exit () "Close Calendar Framework with extra action." (interactive) (if (fboundp 'cfw:org-extra-action-before-closing-calfw) (cfw:org-extra-action-before-closing-calfw)) ;; (if (fboundp 'cfw:ical-extra-action-for-close-buffer) ;; (cfw:ical-extra-action-for-close-buffer)) (bury-buffer))

(defvar cfw:calendar-mode-map (cfw:define-keymap '( ...... ("x" . cfw:clean-exit) ...... )) "Default key map of calendar views.")

in calfw-org.el =============

(defun cfw:org-extra-action-before-closing-calfw () "Close buffers opened by calfw-org before closing Calendar Framework." (org-release-buffers org-agenda-new-buffers) (setq org-agenda-new-buffers nil))

i do not know it is best way. but, it works.

kiwanami commented 11 years ago

Hi, @skyer9

You can write the function cfw:clean-exit and cfw:org-extra-action-before-closing-calfw at the outside calfw.el, such as at your init.el, subsequent to requiring calfw.el. And you can customize the keybinding like following code.

(eval-after-load "calfw"
  '(progn
    (define-key cfw:define-keymap "x" 'cfw:clean-exit)))
skyer9 commented 11 years ago

i close it.