From cdccc089fa4dfb029d0cfe86e988d0989584e092 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 10 Apr 2008 14:45:18 +0200 Subject: [PATCH] Allow temporary agenda display with inactive timestamps included. You get this by pressing `[' in the agenda or timeline buffer. --- ORGWEBPAGE/Changes.org | 79 +++++++++++++++++++++++++++++++------------------- lisp/org-agenda.el | 29 ++++++++++++++---- lisp/org-macs.el | 2 +- lisp/org.el | 4 ++- 4 files changed, 76 insertions(+), 38 deletions(-) diff --git a/ORGWEBPAGE/Changes.org b/ORGWEBPAGE/Changes.org index 50459ac64..10c3745f3 100644 --- a/ORGWEBPAGE/Changes.org +++ b/ORGWEBPAGE/Changes.org @@ -7,16 +7,19 @@ * Version 6.00 +This is a new major release, mostly because of structural changes +in Org. However, there are also monay bug fixes and new features. + ** Details *** The Org distribution has a new structure - In the distribution files, the lisp files are now located in - a subdirectory "lisp", and the documentation files are - located in a subdirectory "doc". If you are running Org - directly from the unpacked distribtuion archive (zip or tar - file), you need to modify your settings for load-path - accordingly. + In the distribution files as well as in the git repository, + the lisp files are now located in a subdirectory "lisp", and + the documentation files are located in a subdirectory "doc". + If you are running Org directly from the unpacked + distribtuion archive (zip or tar file, or git repository), + you need to modify your settings for load-path accordingly. *** Loading modules @@ -27,45 +30,61 @@ way part of Emacs), as well as contributed packages that will only be available when you have installed them properly (most likely by downloading the distribution and adding - /path/to/orgdir/contrib/lisp to your load path. + /path/to/orgdir/contrib/lisp to your load path). *** New archiving mechanism: The Archive Sibling There is a new method to archive entries in the current file: By moving it to a sibling called the /Archive Sibling/. That - sibling has the heading "Archive" and also carries the ARCHIVE - tag. It seems to me that this is a great way to do archiving - inside a project, to get parts of the project out of the way - and to wait with true archiving (moving to another file) - until the entire project done. The key binding for the is - "C-c C-x A", and from the agenda buffer you can simply use - "A". + sibling has the heading "Archive" and also carries the + ARCHIVE tag. It seems to me that this is a great way to do + archiving inside a project, to get parts of the project out + of the way and to wait with true archiving (moving to another + file) until the entire project done. Archiving to a sibling + keep much of the context like inherited tags and approximate + tree position in tact, so Org is adding only a single + property, the ARCHIVE_TIME. + + The key binding for the is "C-c C-x A", and from the agenda + buffer you can simply use "A". Thanks to Ilya Shlyakhter for this rather clever idea. *** Support for Sebastian Rose's Javasript org-info.js. - This fascinating program allows an Org file (exported to - HTML) to be viewed different ways. There is an Info-like - interface where you can jump through the sections of the - document with the `n' and `p' keys (and others). And there - is a folding interface where you can fold the document much - like you can fold it in org-mode in Emacs. + This fascinating program allows a completely new viewing + experience for web pages created from Org files, valuable in + particular for longish documents. The same document can be + viewed in differnet ways, and switching between the views as + well as navigation uses single-key commands. + + There is an Info-like interface where you can jump through + the sections of the document with the `n' and `p' keys (and + others). And there is a folding interface where you can fold + the document much like you can fold it in org-mode in Emacs, + and cycle throught the visibility both locally and globally. - To set this up, make sure the script is available in the same - location as your HTML file. Make sure that `org-infojs' is - loaded in `org-modules'. Then add a line + To set this up, all you need to do is to make sure that + org-infojs.el gets loaded (customize the variable org-modules + to check). Then add this line to the buffer: : #+INFOJS_OPT: view:info - to the buffer, that is all. The available views are: + In that line, you can configure the initial view and other + settings. Available views are =info= for the info-lke + interface, and =overview=, =content=, and =showall= for the + folding interface. See the manual for more details. The + JavaScript program is currently being served from + orgmode.org, and your exported HTML files will automatically + get it from there. However, you may want to be independent + of the existence and stability of orgmode.org and install a + copy locally. Then you need to change the path from which + the script is loaded, either by using something like + + : #+INFOJS_OPT: view:info path:../scripts/org-info.js + + or by configuring the variable =org-infojs-options=. - - =info=: like the Info program - - =overview=: Folding interface, only top-level headings seen - at startup. - - =content=: Folding interface, all headlines but no text - visible at startup. - - =showall=: Entire file visible at startup. For details see the documentation provided by Sebastian Rose together with org-info.js. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index d2bf3092d..61e654267 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -486,6 +486,9 @@ Needs to be set before org.el is loaded." :group 'org-agenda-startup :type 'boolean) +(defconst org-agenda-include-inactive-timestamps nil + "Non-nil means, include inactive time stamps in agenda and timeline.") + (defgroup org-agenda-windows nil "Options concerning the windows used by the Agenda in Org Mode." :tag "Org Agenda Windows" @@ -3082,17 +3085,18 @@ the documentation of `org-diary'." ".*?>")) (regexp (concat + (if org-agenda-include-inactive-timestamps "[[<]" "<") (regexp-quote (substring (format-time-string (car org-time-stamp-formats) (apply 'encode-time ; DATE bound by calendar (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) - 0 11)) + 1 11)) "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[dwmy]>\\)" "\\|\\(<%%\\(([^>\n]+)\\)>\\)")) - marker hdmarker deadlinep scheduledp donep tmp priority category - ee txt timestr tags b0 b3 e3 head) + marker hdmarker deadlinep scheduledp clockp closedp inactivep + donep tmp priority category ee txt timestr tags b0 b3 e3 head) (goto-char (point-min)) (while (re-search-forward regexp nil t) (setq b0 (match-beginning 0) @@ -3114,10 +3118,17 @@ the documentation of `org-diary'." (- b0 org-ds-keyword-length)) b0) timestr (if b3 "" (buffer-substring b0 (point-at-eol))) + inactivep (= (char-after b0) ?\[) deadlinep (string-match org-deadline-regexp tmp) scheduledp (string-match org-scheduled-regexp tmp) + closedp (and org-agenda-include-inactive-timestamps + (string-match org-closed-string tmp)) + clockp (and org-agenda-include-inactive-timestamps + (or (string-match org-clock-string tmp) + (string-match "]-+\\'" tmp))) donep (org-entry-is-done-p)) - (if (or scheduledp deadlinep) (throw :skip t)) + (if (or scheduledp deadlinep closedp clockp) + (throw :skip t)) (if (string-match ">" timestr) ;; substring should only run to end of time stamp (setq timestr (substring timestr 0 (match-end 0)))) @@ -3131,7 +3142,8 @@ the documentation of `org-diary'." (setq head (match-string 1)) (and org-agenda-skip-timestamp-if-done donep (throw :skip t)) (setq txt (org-format-agenda-item - nil head category tags timestr nil + (if inactivep "[" nil) + head category tags timestr nil remove-re))) (setq txt org-agenda-no-heading-message)) (setq priority (org-get-priority txt)) @@ -3914,6 +3926,11 @@ Negative selection means, regexp must not match for selection of an entry." (org-agenda-manipulate-query ?\})) (defun org-agenda-manipulate-query (char) (cond + ((memq org-agenda-type '(timeline agenda)) + (if (y-or-n-p "Re-display with inactive time stamps included? ") + (let ((org-agenda-include-inactive-timestamps t)) + (org-agenda-redo)) + (error "Abort"))) ((eq org-agenda-type 'search) (org-add-to-string 'org-agenda-query-string @@ -3927,7 +3944,7 @@ Negative selection means, regexp must not match for selection of an entry." (if (member char '(?\{ ?\})) 0 1)))) (set-register org-agenda-query-register org-agenda-query-string) (org-agenda-redo)) - (t (error "Canot manipulate query for %s-type agenda buffers" + (t (error "Cannot manipulate query for %s-type agenda buffers" org-agenda-type)))) (defun org-add-to-string (var string) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 197aefbad..49c3cd1e8 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -207,7 +207,7 @@ we turn off invisibility temporarily. Use this in a `let' form." (while (setq f (pop functions)) (or (fboundp f) (autoload f file d t))))) -(defmacro org-match-line (re) +(defun org-match-line (re) "Looking-at at the beginning of the current line." (save-excursion (goto-char (point-at-bol)) diff --git a/lisp/org.el b/lisp/org.el index 071283e55..f4fdc2164 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -2781,7 +2781,9 @@ means to push this value onto the list in the variable.") (if (not org-done-keywords) (setq org-done-keywords (list (org-last org-todo-keywords-1)))) (setq org-ds-keyword-length (+ 2 (max (length org-deadline-string) - (length org-scheduled-string))) + (length org-scheduled-string) + (length org-clock-string) + (length org-closed-string))) org-drawer-regexp (concat "^[ \t]*:\\(" (mapconcat 'regexp-quote org-drawers "\\|") -- 2.11.4.GIT