.emacs-my
changeset 1112 1fc59cf19c28
parent 1111 494d4d574a26
child 1113 b0aec76c3745
equal deleted inserted replaced
1111:494d4d574a26 1112:1fc59cf19c28
  1338 
  1338 
  1339 (when (>= emacs-major-version 22)
  1339 (when (>= emacs-major-version 22)
  1340   (require 'org))
  1340   (require 'org))
  1341 
  1341 
  1342 ;; XXX org-todo-keywords '((sequence "TODO" "START" "|" "DONE")) for org-version 4.67c
  1342 ;; XXX org-todo-keywords '((sequence "TODO" "START" "|" "DONE")) for org-version 4.67c
  1343 ;; XXX (setq org-todo-keywords '("TODO" "START" "DONE")) for org-version 6.05b
       
  1344 (when (or (featurep 'org) (featurep 'org-install))
  1343 (when (or (featurep 'org) (featurep 'org-install))
  1345   (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
  1344   (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
  1346   (setq org-directory "~/devel/my-devel/gtd")
  1345   (setq org-directory "~/devel/my-devel/gtd")
  1347   (setq
  1346   (setq
  1348    org-agenda-ndays 31
  1347    org-agenda-ndays 31
  1362   (setq my-org-agenda-learning-file (concat org-directory "/LEARNING.org"))
  1361   (setq my-org-agenda-learning-file (concat org-directory "/LEARNING.org"))
  1363   (setq org-agenda-files `(,my-org-agenda-todo-file ,my-org-agenda-note-file ,my-org-agenda-learning-file))
  1362   (setq org-agenda-files `(,my-org-agenda-todo-file ,my-org-agenda-note-file ,my-org-agenda-learning-file))
  1364   (define-key global-map "\C-va" 'org-agenda)
  1363   (define-key global-map "\C-va" 'org-agenda)
  1365   (define-key global-map "\C-ve" (lambda nil (interactive) (find-file my-org-agenda-note-file)))
  1364   (define-key global-map "\C-ve" (lambda nil (interactive) (find-file my-org-agenda-note-file)))
  1366 
  1365 
       
  1366   (setq org-todo-keywords '("TODO" "DONE"))
       
  1367 
  1367   ;; My tags for remember buffer.
  1368   ;; My tags for remember buffer.
  1368   (setq org-tag-alist
  1369   (setq org-tag-alist
  1369         '(
  1370         '(
  1370           ("ADMIN" . ?a)
  1371           ("ADMIN" . ?a)
  1371           ("BLOG" . ?b)
  1372           ("BLOG" . ?b)
  1405             ))
  1406             ))
  1406     (setq org-remember-store-without-prompt t)
  1407     (setq org-remember-store-without-prompt t)
  1407     (org-remember-insinuate)
  1408     (org-remember-insinuate)
  1408     ))
  1409     ))
  1409 
  1410 
  1410   ;; (setq org-todo-keyword-faces
  1411   )
  1411   ;;       '(("TODO" . (:foreground "red" :weight bold))
  1412 
  1412   ;;         ("WAIT" . (:foreground "orange" :weight bold))
  1413 
  1413   ;;         ("DONE" . (:foreground "green" :weight bold))) )
  1414 (defun my-org-archive-location (org-file)
  1414   )
  1415   (concat (if (string-match "\\(.*\\)\\.org$" org-file)
       
  1416               (match-string 1 org-file)
       
  1417             org-file)
       
  1418           "_done.org"))
       
  1419 
       
  1420 (defun my-org-archive ()
       
  1421   "Move marked by `org-done-keywords' entries to archive file defined by `my-org-archive-location'."
       
  1422   (interactive)
       
  1423   (let ( (org-archive (my-org-archive-location (buffer-file-name)))
       
  1424          (entry-re (concat "^\\* "))
       
  1425          (entry-done-re (concat "^\\* *" (mapconcat 'regexp-quote org-done-keywords "\\|") " "))
       
  1426          entry-beg entry-end )
       
  1427     (save-excursion
       
  1428       (show-all)
       
  1429       (kill-new "")
       
  1430       (goto-char (point-min))
       
  1431       (while (re-search-forward entry-done-re nil t)
       
  1432         (setq entry-beg (line-beginning-position))
       
  1433         ()
       
  1434         (if (re-search-forward entry-re nil t)
       
  1435             (beginning-of-line)
       
  1436           (goto-char (point-max)))
       
  1437         (setq entry-end (point))
       
  1438         (let ( (last-command 'kill-region) )
       
  1439           (kill-region entry-beg entry-end))
       
  1440         )
       
  1441       (find-file org-archive)
       
  1442       (goto-char (point-max))
       
  1443       (insert ?\n)
       
  1444       (yank)
       
  1445       )))
  1415 
  1446 
  1416 (setq org-agenda-include-diary t)
  1447 (setq org-agenda-include-diary t)
  1417 
  1448 
  1418 (defun my-org-kill-by-tag (tag)
  1449 (defun my-org-kill-by-tag (tag)
  1419   "Put all entries that matches TAG from current org-file to `kill-ring'."
  1450   "Put all entries that matches TAG from current org-file to `kill-ring'."