Mercurial > emacs
comparison lisp/textmodes/org.el @ 66689:a9a692f50d60
(org-read-date, org-goto-calendar)
(org-recenter-calendar, org-agenda-goto-calendar): Temporarily
clear 'calendar-move-hook'.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 04 Nov 2005 09:25:17 +0000 |
parents | 5a25cc5e524a |
children | 947d92b6000d |
comparison
equal
deleted
inserted
replaced
66688:4f7af488adb0 | 66689:a9a692f50d60 |
---|---|
3 ;; Copyright (c) 2004, 2005 Free Software Foundation | 3 ;; Copyright (c) 2004, 2005 Free Software Foundation |
4 ;; | 4 ;; |
5 ;; Author: Carsten Dominik <dominik at science dot uva dot nl> | 5 ;; Author: Carsten Dominik <dominik at science dot uva dot nl> |
6 ;; Keywords: outlines, hypermedia, calendar | 6 ;; Keywords: outlines, hypermedia, calendar |
7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
8 ;; Version: 3.18 | 8 ;; Version: 3.19 |
9 ;; | 9 ;; |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 ;; | 11 ;; |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
78 ;; Org-mode, you can read the same text online as HTML. There is also an | 78 ;; Org-mode, you can read the same text online as HTML. There is also an |
79 ;; excellent reference card made by Philip Rooke. | 79 ;; excellent reference card made by Philip Rooke. |
80 ;; | 80 ;; |
81 ;; Changes: | 81 ;; Changes: |
82 ;; ------- | 82 ;; ------- |
83 ;; Version 3.19 | |
84 ;; - Bug fixes | |
85 ;; | |
83 ;; Version 3.18 | 86 ;; Version 3.18 |
84 ;; - Export of calendar information in the standard iCalendar format. | 87 ;; - Export of calendar information in the standard iCalendar format. |
85 ;; - Some bug fixes. | 88 ;; - Some bug fixes. |
86 ;; | 89 ;; |
87 ;; Version 3.17 | 90 ;; Version 3.17 |
215 (defvar calc-embedded-open-formula) | 218 (defvar calc-embedded-open-formula) |
216 (defvar font-lock-unfontify-region-function) | 219 (defvar font-lock-unfontify-region-function) |
217 | 220 |
218 ;;; Customization variables | 221 ;;; Customization variables |
219 | 222 |
220 (defvar org-version "3.18" | 223 (defvar org-version "3.19" |
221 "The version number of the file org.el.") | 224 "The version number of the file org.el.") |
222 (defun org-version () | 225 (defun org-version () |
223 (interactive) | 226 (interactive) |
224 (message "Org-mode version %s" org-version)) | 227 (message "Org-mode version %s" org-version)) |
225 | 228 |
779 :type 'hook) | 782 :type 'hook) |
780 | 783 |
781 (defcustom org-level-color-stars-only nil | 784 (defcustom org-level-color-stars-only nil |
782 "Non-nil means fontify only the stars in each headline. | 785 "Non-nil means fontify only the stars in each headline. |
783 When nil, the entire headline is fontified. | 786 When nil, the entire headline is fontified. |
784 After changing this, requires restart of Emacs to become effective." | 787 After changin this, requires restart of Emacs to become effective." |
785 :group 'org-structure | 788 :group 'org-structure |
786 :type 'boolean) | 789 :type 'boolean) |
787 | 790 |
788 (defcustom org-adapt-indentation t | 791 (defcustom org-adapt-indentation t |
789 "Non-nil means, adapt indentation when promoting and demoting. | 792 "Non-nil means, adapt indentation when promoting and demoting. |
2863 "Press \\[org-complete] again to insert example settings")))) | 2866 "Press \\[org-complete] again to insert example settings")))) |
2864 (t | 2867 (t |
2865 (message "Making completion list...") | 2868 (message "Making completion list...") |
2866 (let ((list (sort (all-completions pattern table) 'string<))) | 2869 (let ((list (sort (all-completions pattern table) 'string<))) |
2867 (with-output-to-temp-buffer "*Completions*" | 2870 (with-output-to-temp-buffer "*Completions*" |
2868 (display-completion-list list pattern))) | 2871 (display-completion-list list))) |
2869 (message "Making completion list...%s" "done")))))) | 2872 (message "Making completion list...%s" "done")))))) |
2870 | 2873 |
2871 ;;; Comments, TODO and DEADLINE | 2874 ;;; Comments, TODO and DEADLINE |
2872 | 2875 |
2873 (defun org-toggle-comment () | 2876 (defun org-toggle-comment () |
3187 (apply | 3190 (apply |
3188 'encode-time | 3191 'encode-time |
3189 (mapcar (lambda(x) (or x 0)) ;; FIXME: Problem with timezone? | 3192 (mapcar (lambda(x) (or x 0)) ;; FIXME: Problem with timezone? |
3190 (parse-time-string (match-string 1)))) | 3193 (parse-time-string (match-string 1)))) |
3191 (current-time))) | 3194 (current-time))) |
3195 (calendar-move-hook nil) | |
3196 (view-diary-entries-initially nil) | |
3192 (timestr (format-time-string | 3197 (timestr (format-time-string |
3193 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) | 3198 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) |
3194 (prompt (format "YYYY-MM-DD [%s]: " timestr)) | 3199 (prompt (format "YYYY-MM-DD [%s]: " timestr)) |
3195 ans ans1 ans2 | 3200 ans ans1 ans2 |
3196 second minute hour day month year tl) | 3201 second minute hour day month year tl) |
3198 (if org-popup-calendar-for-date-prompt | 3203 (if org-popup-calendar-for-date-prompt |
3199 ;; Also show a calendar for date selection | 3204 ;; Also show a calendar for date selection |
3200 ;; Copied (with modifications) from planner.el by John Wiegley | 3205 ;; Copied (with modifications) from planner.el by John Wiegley |
3201 (save-excursion | 3206 (save-excursion |
3202 (save-window-excursion | 3207 (save-window-excursion |
3203 (let ((view-diary-entries-initially nil)) | 3208 (calendar) |
3204 (calendar)) | |
3205 (calendar-forward-day (- (time-to-days default-time) | 3209 (calendar-forward-day (- (time-to-days default-time) |
3206 (calendar-absolute-from-gregorian | 3210 (calendar-absolute-from-gregorian |
3207 (calendar-current-date)))) | 3211 (calendar-current-date)))) |
3208 (let* ((old-map (current-local-map)) | 3212 (let* ((old-map (current-local-map)) |
3209 (map (copy-keymap calendar-mode-map)) | 3213 (map (copy-keymap calendar-mode-map)) |
3522 (org-recenter-calendar (time-to-days time))))) | 3526 (org-recenter-calendar (time-to-days time))))) |
3523 | 3527 |
3524 (defun org-recenter-calendar (date) | 3528 (defun org-recenter-calendar (date) |
3525 "If the calendar is visible, recenter it to DATE." | 3529 "If the calendar is visible, recenter it to DATE." |
3526 (let* ((win (selected-window)) | 3530 (let* ((win (selected-window)) |
3527 (cwin (get-buffer-window "*Calendar*" t))) | 3531 (cwin (get-buffer-window "*Calendar*" t)) |
3532 (calendar-move-hook nil)) | |
3528 (when cwin | 3533 (when cwin |
3529 (select-window cwin) | 3534 (select-window cwin) |
3530 (calendar-goto-date (if (listp date) date | 3535 (calendar-goto-date (if (listp date) date |
3531 (calendar-gregorian-from-absolute date))) | 3536 (calendar-gregorian-from-absolute date))) |
3532 (select-window win)))) | 3537 (select-window win)))) |
3534 (defun org-goto-calendar (&optional arg) | 3539 (defun org-goto-calendar (&optional arg) |
3535 "Go to the Emacs calendar at the current date. | 3540 "Go to the Emacs calendar at the current date. |
3536 If there is a time stamp in the current line, go to that date. | 3541 If there is a time stamp in the current line, go to that date. |
3537 A prefix ARG can be used force the current date." | 3542 A prefix ARG can be used force the current date." |
3538 (interactive "P") | 3543 (interactive "P") |
3539 (let ((tsr org-ts-regexp) diff) | 3544 (let ((tsr org-ts-regexp) diff |
3545 (calendar-move-hook nil) | |
3546 (view-diary-entries-initially nil)) | |
3540 (if (or (org-at-timestamp-p) | 3547 (if (or (org-at-timestamp-p) |
3541 (save-excursion | 3548 (save-excursion |
3542 (beginning-of-line 1) | 3549 (beginning-of-line 1) |
3543 (looking-at (concat ".*" tsr)))) | 3550 (looking-at (concat ".*" tsr)))) |
3544 (let ((d1 (time-to-days (current-time))) | 3551 (let ((d1 (time-to-days (current-time))) |
3545 (d2 (time-to-days | 3552 (d2 (time-to-days |
3546 (org-time-string-to-time (match-string 1))))) | 3553 (org-time-string-to-time (match-string 1))))) |
3547 (setq diff (- d2 d1)))) | 3554 (setq diff (- d2 d1)))) |
3548 (let ((view-diary-entries-initially nil)) | 3555 (calendar) |
3549 (calendar)) | |
3550 (calendar-goto-today) | 3556 (calendar-goto-today) |
3551 (if (and diff (not arg)) (calendar-forward-day diff)))) | 3557 (if (and diff (not arg)) (calendar-forward-day diff)))) |
3552 | 3558 |
3553 (defun org-date-from-calendar () | 3559 (defun org-date-from-calendar () |
3554 "Insert time stamp corresponding to cursor date in *Calendar* buffer. | 3560 "Insert time stamp corresponding to cursor date in *Calendar* buffer. |
5246 (defun org-agenda-goto-calendar () | 5252 (defun org-agenda-goto-calendar () |
5247 "Open the Emacs calendar with the date at the cursor." | 5253 "Open the Emacs calendar with the date at the cursor." |
5248 (interactive) | 5254 (interactive) |
5249 (let* ((day (or (get-text-property (point) 'day) | 5255 (let* ((day (or (get-text-property (point) 'day) |
5250 (error "Don't know which date to open in calendar"))) | 5256 (error "Don't know which date to open in calendar"))) |
5251 (date (calendar-gregorian-from-absolute day))) | 5257 (date (calendar-gregorian-from-absolute day)) |
5252 (let ((view-diary-entries-initially nil)) | 5258 (calendar-move-hook nil) |
5253 (calendar)) | 5259 (view-diary-entries-initially nil)) |
5260 (calendar) | |
5254 (calendar-goto-date date))) | 5261 (calendar-goto-date date))) |
5255 | 5262 |
5256 (defun org-calendar-goto-agenda () | 5263 (defun org-calendar-goto-agenda () |
5257 "Compute the Org-mode agenda for the calendar date displayed at the cursor. | 5264 "Compute the Org-mode agenda for the calendar date displayed at the cursor. |
5258 This is a command that has to be installed in `calendar-mode-map'." | 5265 This is a command that has to be installed in `calendar-mode-map'." |
9572 (defun org-start-icalendar-file (name) | 9579 (defun org-start-icalendar-file (name) |
9573 "Start an iCalendar file by inserting the header." | 9580 "Start an iCalendar file by inserting the header." |
9574 (let ((user user-full-name) | 9581 (let ((user user-full-name) |
9575 (calname "something") | 9582 (calname "something") |
9576 (name (or name "unknown")) | 9583 (name (or name "unknown")) |
9577 (timezone "Europe/Amsterdam")) ;; FIXME: How to get the real timezone? | 9584 (timezone "FIXME")) |
9578 (princ | 9585 (princ |
9579 (format "BEGIN:VCALENDAR | 9586 (format "BEGIN:VCALENDAR |
9580 VERSION:2.0 | 9587 VERSION:2.0 |
9581 X-WR-CALNAME:%s | 9588 X-WR-CALNAME:%s |
9582 PRODID:-//%s//Emacs with Org-mode//EN | 9589 PRODID:-//%s//Emacs with Org-mode//EN |
9583 X-WR-TIMEZONE:Europe/%s | 9590 X-WR-TIMEZONE:Europe/Amsterdam |
9584 CALSCALE:GREGORIAN\n" name user timezone)))) | 9591 CALSCALE:GREGORIAN\n" name user timezone)))) |
9585 | 9592 |
9586 (defun org-finish-icalendar-file () | 9593 (defun org-finish-icalendar-file () |
9587 "Finish an iCalendar file by inserting the END statement." | 9594 "Finish an iCalendar file by inserting the END statement." |
9588 (princ "END:VCALENDAR\n")) | 9595 (princ "END:VCALENDAR\n")) |