Browse Source

Merge commit 'org/master' into ded-org-src

Dan Davison 15 years ago
parent
commit
8bd1eb5d4b
9 changed files with 154 additions and 91 deletions
  1. 3 2
      contrib/babel/lisp/langs/org-babel-dot.el
  2. 6 0
      doc/ChangeLog
  3. 66 61
      doc/org.texi
  4. 12 0
      lisp/ChangeLog
  5. 47 18
      lisp/org-agenda.el
  6. 1 1
      lisp/org-inlinetask.el
  7. 11 8
      lisp/org-mobile.el
  8. 1 1
      lisp/org-src.el
  9. 7 0
      lisp/org.el

+ 3 - 2
contrib/babel/lisp/langs/org-babel-dot.el

@@ -57,10 +57,11 @@ called by `org-babel-execute-src-block'."
   (let ((result-params (split-string (or (cdr (assoc :results params)) "")))
         (out-file (cdr (assoc :file params)))
         (cmdline (cdr (assoc :cmdline params)))
+        (cmd (or (cdr (assoc :cmd params)) "dot"))
         (in-file (make-temp-file "org-babel-dot")))
     (with-temp-file in-file (insert body))
-    (message (concat "dot " in-file " " cmdline " -o " out-file))
-    (shell-command (concat "dot " in-file " " cmdline " -o " out-file))
+    (message (concat cmd " " in-file " " cmdline " -o " out-file))
+    (shell-command (concat cmd " " in-file " " cmdline " -o " out-file))
     out-file))
 
 (defun org-babel-prep-session:dot (session params)

+ 6 - 0
doc/ChangeLog

@@ -1,3 +1,9 @@
+2009-10-14  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Agenda commands): Document that SPC is a filter for
+	any tag.
+	(Search view): Renamed from "Keyword search".
+
 2009-10-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (Cap): New chapter.

+ 66 - 61
doc/org.texi

@@ -281,7 +281,7 @@ The built-in agenda views
 * Global TODO list::            All unfinished action items
 * Matching tags and properties::  Structured information with fine-tuned search
 * Timeline::                    Time-sorted view for single file
-* Keyword search::              Finding entries by keyword
+* Search view::                 Find entries by searching for text
 * Stuck projects::              Find projects you need to review
 
 Presentation and sorting
@@ -6143,14 +6143,14 @@ TODO state associated with them,
 a @emph{timeline view} that shows all events in a single Org file,
 in time-sorted view,
 @item
-a @emph{keyword search view} that shows all entries from multiple files
+a @emph{text search view} that shows all entries from multiple files
 that contain specified keywords,
 @item
 a @emph{stuck projects view} showing projects that currently don't move
 along, and
 @item
-@emph{custom views} that are special tag/keyword searches and
-combinations of different views.
+@emph{custom views} that are special searches and combinations of different
+views.
 @end itemize
 
 @noindent
@@ -6320,7 +6320,7 @@ In this section we describe the built-in views.
 * Global TODO list::            All unfinished action items
 * Matching tags and properties::  Structured information with fine-tuned search
 * Timeline::                    Time-sorted view for single file
-* Keyword search::              Finding entries by keyword
+* Search view::                 Find entries by searching for text
 * Stuck projects::              Find projects you need to review
 @end menu
 
@@ -6670,7 +6670,7 @@ Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
 @samp{NEXT}.
 @end table
 
-@node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
+@node Timeline, Search view, Matching tags and properties, Built-in agenda views
 @subsection Timeline for a single file
 @cindex timeline, single file
 @cindex time-sorted view
@@ -6691,10 +6691,11 @@ When called with a @kbd{C-u} prefix, all unfinished TODO entries
 The commands available in the timeline buffer are listed in
 @ref{Agenda commands}.
 
-@node Keyword search, Stuck projects, Timeline, Built-in agenda views
-@subsection Keyword search
-@cindex keyword search
-@cindex searching, for keywords
+@node Search view, Stuck projects, Timeline, Built-in agenda views
+@subsection Search view
+@cindex search view
+@cindex text search
+@cindex searching, for text
 
 This agenda view is a general text search facility for Org mode entries.
 It is particularly useful to find notes.
@@ -6702,15 +6703,14 @@ It is particularly useful to find notes.
 @table @kbd
 @kindex C-c a s
 @item C-c a s
-This is a special search that lets you select entries by keywords or
-regular expression, using a boolean logic.  For example, the search
-string
-
-@example
-+computer +wifi -ethernet -@{8\.11[bg]@}
-@end example
-
-@noindent
+This is a special search that lets you select entries by matching a substring
+or specific words using a boolean logic.
+@end table
+For example, the search string @samp{computer equipment} will find entries
+that contain @samp{computer equipment} as a substring.  If the two words are
+separated by more space or a line break, the search will still match.
+Search view can also search for specific keywords in the entry, using Boolean
+logic.  The search string @samp{+computer +wifi -ethernet -@{8\.11[bg]@}}
 will search for note entries that contain the keywords @code{computer}
 and @code{wifi}, but not the keyword @code{ethernet}, and which are also
 not matched by the regular expression @code{8\.11[bg]}, meaning to
@@ -6719,9 +6719,8 @@ exclude both 8.11b and 8.11g.
 @vindex org-agenda-text-search-extra-files
 Note that in addition to the agenda files, this command will also search
 the files listed in @code{org-agenda-text-search-extra-files}.
-@end table
 
-@node Stuck projects,  , Keyword search, Built-in agenda views
+@node Stuck projects,  , Search view, Built-in agenda views
 @subsection Stuck projects
 
 If you are following a system like David Allen's GTD to organize your
@@ -7129,16 +7128,16 @@ binding the variable @code{org-agenda-filter-preset} as an option.  This
 filter will then be applied to the view and persist as a basic filter through
 refreshes and more secondary filtering.}
 
-You will be prompted for a tag selection letter.  Pressing @key{TAB} at that
-prompt will offer use completion to select a tag (including any tags that do
-not have a selection character).  The command then hides all entries that do
-not contain or inherit this tag.  When called with prefix arg, remove the
-entries that @emph{do} have the tag.  A second @kbd{/} at the prompt will
-turn off the filter and unhide any hidden entries.  If the first key you
-press is either @kbd{+} or @kbd{-}, the previous filter will be narrowed by
-requiring or forbidding the selected additional tag.  Instead of pressing
-@kbd{+} or @kbd{-} after @kbd{/}, you can also immediately use the @kbd{\}
-command.
+You will be prompted for a tag selection letter, SPC will mean any tag at
+all.  Pressing @key{TAB} at that prompt will offer use completion to select a
+tag (including any tags that do not have a selection character).  The command
+then hides all entries that do not contain or inherit this tag.  When called
+with prefix arg, remove the entries that @emph{do} have the tag.  A second
+@kbd{/} at the prompt will turn off the filter and unhide any hidden entries.
+If the first key you press is either @kbd{+} or @kbd{-}, the previous filter
+will be narrowed by requiring or forbidding the selected additional tag.
+Instead of pressing @kbd{+} or @kbd{-} after @kbd{/}, you can also
+immediately use the @kbd{\} command.
 
 @vindex org-sort-agenda-noeffort-is-high
 In order to filter for effort estimates, you should set-up allowed
@@ -11685,13 +11684,20 @@ The following example counts the number of entries with TODO keyword
 @i{MobileOrg} is an application for the @i{iPhone/iPod Touch} series of
 devices, developed by Richard Moreland.  @i{MobileOrg} offers offline viewing
 and capture support for an Org-mode system rooted on a ``real'' computer.  It
-does also allow you to edit existing entries.
+does also allow you to record changes to existing entries.  For information
+about @i{MobileOrg}, see @uref{http://mobileorg.ncogni.to/}).
 
 This appendix describes the support Org has for creating agenda views in a
 format that can be displayed by @i{MobileOrg}, and for integrating notes
-captured and changes made by @i{MobileOrg} into the main system.  It does not
-cover the operation of @i{MobileOrg} itself (see
-@uref{http://mobileorg.ncogni.to/}).
+captured and changes made by @i{MobileOrg} into the main system.
+
+For changing tags and TODO states in MobileOrg, you should have set up the
+customization variables @code{org-todo-keywords} and @code{org-tags-alist} to
+cover all important tags and todo keywords, even if individual files use only
+part of these.  MobileOrg will also offer you states and tags set up with
+in-buffer settings, but it will understand the logistics of todo state
+@i{sets} (@pxref{Per-file keywords}) and @i{mutually exclusive} tags
+(@pxref{Setting tags}) only for those set in these variables.
 
 @menu
 * Setting up the staging area::  Where to interact with the mobile device
@@ -11704,8 +11710,8 @@ cover the operation of @i{MobileOrg} itself (see
 
 Org-mode has commands to prepare a directory with files for @i{MobileOrg},
 and to read captured notes from there.  If Emacs can directly write to the
-WebDAV directory accessed by @i{MobileOrg}, all you need to do is to point to
-this directory using the variable @code{org-mobile-directory}.
+WebDAV directory accessed by @i{MobileOrg}, just point to this directory
+using the variable @code{org-mobile-directory}.
 
 If Emacs cannot access the WebDAV directory directly, you can use a local
 directory for staging.  Other means must then be used to keep this directory
@@ -11713,18 +11719,15 @@ in sync with the WebDAV directory.  In the following example, files are
 staged in @file{~/stage}, and Org-mode hooks take care of moving files to and
 from the WebDAV directory using @file{scp}.
 
-@example
+@smallexample
 (setq org-mobile-directory "~/stage/")
 (add-hook 'org-mobile-post-push-hook
-  (lambda ()
-   (shell-command "scp ~/stage/* user@@webdavhost:mobile/")))
+  (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/")))
 (add-hook 'org-mobile-pre-pull-hook
-  (lambda ()
-   (shell-command "scp user@@webdavhost:mobile/mobileorg.org ~/stage/ ")))
+  (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ ")))
 (add-hook 'org-mobile-post-pull-hook
-  (lambda ()
-   (shell-command "scp ~/stage/mobileorg.org user@@webdavhost:mobile/")))
-@end example
+  (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/")))
+@end smallexample
 
 @node Pushing to MobileOrg, Pulling from MobileOrg, Setting up the staging area, MobileOrg
 @section Pushing to MobileOrg
@@ -11742,7 +11745,7 @@ entries can be uniquely identified if @i{MobileOrg} flags them for further
 action.  Finally, Org writes the file @file{index.org}, containing links to
 all other files.  If @i{MobileOrg} is configured to request this file from
 the WebDAV server, all agendas and Org files will be downloaded to the
-iPhone.  To speed up the download, MobileOrg will only read files whose
+device.  To speed up the download, MobileOrg will only read files whose
 checksums@footnote{stored automatically in the file @file{checksums.dat}}
 have changed.
 
@@ -11751,26 +11754,27 @@ have changed.
 
 When @i{MobileOrg} synchronizes with the WebDAV server, it not only pulls the
 Org files for viewing.  It also appends captured entries and pointers to
-flagged entries to the file @file{mobileorg.org} on the server.  Org has
-a @emph{pull} operation that integrates this information into an inbox file
-and operates on the pointers to flagged entries.  Here is how it works:
+flagged and changed entries to the file @file{mobileorg.org} on the server.
+Org has a @emph{pull} operation that integrates this information into an
+inbox file and operates on the pointers to flagged entries.  Here is how it
+works:
 
 @enumerate
 @item
 Org moves all entries found in
 @file{mobileorg.org}@footnote{@file{mobileorg.org} will be empty after this
 operation.} and appends them to the file pointed to by the variable
-@code{org-mobile-inbox-for-pull}.  Each captured entry will be a top-level
-entry in the inbox file.
-@item
-After moving the entries, Org will attempt to act on the flags.  Some flags
-specify simple operations that will be executed directly and without user
-interaction.  Examples are marking an entry as DONE and/or archiving
-it@footnote{as specified by the variable @code{org-archive-default-action}}.
-All other flagged entries will receive a tag @code{:FLAGGED:}, so that they
-can be easily found again.  When there is a problem finding the entry that
-should be flagged, the pointer entry will remain in the inbox and will be
-marked with an error message.
+@code{org-mobile-inbox-for-pull}.  Each captured entry and each editing event
+will be a top-level entry in the inbox file.
+@item
+After moving the entries, Org will attempt to implement the changes made in
+@i{MobileOrg}.  Some changes are applied directly and without user
+interaction.  Examples are all changes to tags, TODO state, headline and body
+text that can be cleanly applied.  Entries that have been flagged for further
+action will receive a tag @code{:FLAGGED:}, so that they can be easily found
+again.  When there is a problem finding an entry or applying the change, the
+pointer entry will remain in the inbox and will be marked with an error
+message.  You need to later resolve these issues by hand.
 @item
 Org will then generate an agenda view with all flagged entries.  The user
 should then go through these entries and do whatever actions are necessary.
@@ -11785,7 +11789,8 @@ another window and also push it onto the kill ring.  So you could use @kbd{?
 z C-y C-c C-c} to store that flagging note as a normal note in the entry.
 Pressing @kbd{?} twice in succession will offer to remove the
 @code{:FLAGGED:} tag along with the recorded flagging note (which is stored
-in a property).
+in a property).  In this way you indicate, that the intended processing for
+this flagged entry is finished.
 @end table
 @end enumerate
 

+ 12 - 0
lisp/ChangeLog

@@ -1,3 +1,15 @@
+2009-10-14  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-filter-make-matcher): Allow to filter
+	entries that have no tags.
+	(org-agenda-search-view): New customize group.
+	(org-agenda-search-view-search-words-only): New option.
+	(org-search-view): Implement substring search.
+
+2009-10-13  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-outline-level): Add doc string.
+
 2009-10-12  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-inlinetask.el (org-inlinetask-export): Re-introduce

+ 47 - 18
lisp/org-agenda.el

@@ -482,6 +482,10 @@ this one will be used."
   "Options concerning the general tags/property/todo match agenda view."
   :tag "Org Agenda Match View"
   :group 'org-agenda)
+(defgroup org-agenda-search-view nil
+  "Options concerning the general tags/property/todo match agenda view."
+  :tag "Org Agenda Match View"
+  :group 'org-agenda)
 
 (defvar org-agenda-archives-mode nil
   "Non-nil means, the agenda will include archived items.
@@ -871,6 +875,16 @@ current display in the agenda."
   :group 'org-agenda-daily/weekly
   :type 'plist)
 
+(defcustom org-agenda-search-view-search-words-only nil
+  "Non-nil means, the search string is interpreted as individual words
+The search then looks for each word separately in each entry and
+selects entries that have matches for all words.
+When nil, matching as loose words will only take place if the first
+word is preceded by + or -.  If that is not the case, the search
+string will just be matched as a substring in the entry, but with
+each space character allowing for any whitespace, including newlines."
+  :group 'org-agenda-search-view
+  :type 'boolean)
 
 (defgroup org-agenda-time-grid nil
   "Options concerning the time grid in the Org-mode Agenda."
@@ -3142,10 +3156,19 @@ user should get a chance to edit this string, with cursor at position
 EDIT-AT.
 
 The search string is broken into \"words\" by splitting at whitespace.
-The individual words are then interpreted as a boolean expression with
-logical AND.  Words prefixed with a minus must not occur in the entry.
-Words without a prefix or prefixed with a plus must occur in the entry.
-Matching is case-insensitive and the words are enclosed by word delimiters.
+Depending on the variable `org-agenda-search-view-search-words-only'
+and on wether the first character in the search string is \"+\" or \"-\",
+The string is then interpreted either as a substrig with variable amounts
+of whitespace, or as a list or individual words that should be matched.
+
+The default is a substring match, where each space in the search string
+can expand to an arbitrary amount of whitespace, including newlines.
+
+If matching individual words, these words are then interpreted as a
+boolean expression with logical AND.  Words prefixed with a minus must
+not occur in the entry. Words without a prefix or prefixed with a plus
+must occur in the entry.  Matching is case-insensitive and the words
+are enclosed by word delimiters.
 
 Words enclosed by curly braces are interpreted as regular expressions
 that must or must not match in the entry.
@@ -3170,7 +3193,7 @@ in `org-agenda-text-search-extra-files'."
 		      'keymap org-agenda-keymap
 		      'help-echo (format "mouse-2 or RET jump to location")))
 	 regexp rtn rtnall files file pos
-	 marker category tags c neg re
+	 marker category tags c neg re as-words
 	 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
     (unless (and (not edit-at)
 		 (stringp string)
@@ -3193,19 +3216,25 @@ in `org-agenda-text-search-extra-files'."
     (when (equal (string-to-char words) ?!)
       (setq todo-only t
 	    words (substring words 1)))
+    (if (or org-agenda-search-view-search-words-only
+	    (member (string-to-char string) '(?- ?+)))
+	(setq as-words t))
     (setq words (org-split-string words))
-    (mapc (lambda (w)
-	    (setq c (string-to-char w))
-	    (if (equal c ?-)
-		(setq neg t w (substring w 1))
-	      (if (equal c ?+)
-		  (setq neg nil w (substring w 1))
-		(setq neg nil)))
-	    (if (string-match "\\`{.*}\\'" w)
-		(setq re (substring w 1 -1))
-	      (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")))
-	    (if neg (push re regexps-) (push re regexps+)))
-	  words)
+    (if as-words
+	(mapc (lambda (w)
+		(setq c (string-to-char w))
+		(if (equal c ?-)
+		    (setq neg t w (substring w 1))
+		  (if (equal c ?+)
+		      (setq neg nil w (substring w 1))
+		  (setq neg nil)))
+		(if (string-match "\\`{.*}\\'" w)
+		    (setq re (substring w 1 -1))
+		  (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")))
+		(if neg (push re regexps-) (push re regexps+)))
+	      words)
+      (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+")
+	    regexps+))
     (setq regexps+ (sort regexps+ (lambda (a b) (> (length a) (length b)))))
     (if (not regexps+)
 	(setq regexp (concat "^" org-outline-regexp))
@@ -5085,7 +5114,7 @@ to switch to narrowing."
     (dolist (x (append (get 'org-agenda-filter :preset-filter)
 		       org-agenda-filter))
       (if (member x '("-" "+"))
-	  (setq f1 '(not tags))
+	  (setq f1 (if (equal x "-") 'tags '(not tags)))
 	(if (string-match "[<=>?]" x)
 	    (setq f1 (org-agenda-filter-effort-form x))
 	  (setq f1 (list 'member (downcase (substring x 1)) 'tags)))

+ 1 - 1
lisp/org-inlinetask.el

@@ -93,7 +93,7 @@ the value of this variable."
   :group 'org-inlinetask
   :type 'boolean)
 
-(defcustom org-inlinetask-export nil
+(defcustom org-inlinetask-export t
   "Non-nil means, export inline tasts.
 When nil, they will not be exported."
   :group 'org-inlinetask

+ 11 - 8
lisp/org-mobile.el

@@ -306,7 +306,8 @@ agenda view showing the flagged items."
       (insert "#+TAGS: " (mapconcat 'identity tags " ") "\n")
       (insert "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
       (insert "#+ALLPRIORITIES: A B C" "\n")
-      (insert "* [[file:agendas.org][Agenda Views]]\n")
+      (when (file-exists-p "agendas.org")
+	(insert "* [[file:agendas.org][Agenda Views]]\n"))
       (while (setq entry (pop files-alist))
 	(setq file (car entry)
 	      link-name (cdr entry))
@@ -409,7 +410,7 @@ The table of checksums is written to the file mobile-checksums."
 				    " TITLE: " gdesc " " match "</after>"))
 		      settings))
 	  (push (list type match settings) new)))))
-    (list "X" "SUMO" (reverse new) nil)))
+    (and new (list "X" "SUMO" (reverse new) nil))))
 
 (defvar org-mobile-creating-agendas nil)
 (defun org-mobile-write-agenda-for-mobile (file)
@@ -480,13 +481,14 @@ The table of checksums is written to the file mobile-checksums."
   (interactive)
   (let* ((file (expand-file-name "agendas.org"
 				 org-mobile-directory))
+	 (sumo (org-mobile-sumo-agenda-command))
 	 (org-agenda-custom-commands
-	  (list (append (org-mobile-sumo-agenda-command)
-			(list (list file)))))
+	  (list (append sumo (list (list file)))))
 	 (org-mobile-creating-agendas t))
     (unless (file-writable-p file)
       (error "Cannot write to file %s" file))
-    (org-store-agenda-views)))
+    (when sumo
+      (org-store-agenda-views))))
 
 (defun org-mobile-move-capture ()
   "Move the contents of the capture file to the inbox file.
@@ -524,20 +526,21 @@ If BEG and END are given, only do this in that region."
   (require 'org-archive)
   (setq org-mobile-last-flagged-files nil)
   (setq beg (or beg (point-min)) end (or end (point-max)))
-  (goto-char beg)
 
   ;; Remove all Note IDs
+  (goto-char beg)
   (while (re-search-forward "^\\*\\* Note ID: [-0-9A-F]+[ \t]*\n" nil t)
     (replace-match ""))
 
   ;; Find all the referenced entries, without making any changes yet
+  (goto-char beg)
   (let ((marker (make-marker))
 	(bos-marker (make-marker))
 	(end (move-marker (make-marker) end))
 	buf-list
 	id-pos org-mobile-error)
     (while (re-search-forward
-	    "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ \t]+\\[\\[\\(\\(id\\|olp\\):\\([^]\n ]+\\)\\)" end t)
+	    "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ \t]+\\[\\[\\(\\(id\\|olp\\):\\([^]\n]+\\)\\)" end t)
       (setq id-pos (condition-case msg
 		       (org-mobile-locate-entry (match-string 4))
 		     (error (nth 1 msg))))
@@ -712,7 +715,7 @@ as a string."
 	    (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0)))
 	    (setq end (save-excursion (org-end-of-subtree t t))))
 	  (when (org-on-heading-p)
-	    (throw 'exit (move-marker (make-marker) (point)))))))))
+	    (move-marker (make-marker) (point))))))))
 
 (defun org-mobile-locate-entry (link)
   (if (string-match "\\`id:\\(.*\\)$" link)

+ 1 - 1
lisp/org-src.el

@@ -122,7 +122,7 @@ but which mess up the display of a snippet in Org exported files.")
 
 (defcustom org-src-lang-modes
   '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
-    ("asymptote" . asy))
+    ("asymptote" . asy) ("dot" . fundamental))
   "Alist mapping languages to their major mode.
 The key is the language name, the value is the string that should
 be inserted as the name of the major mode.  For many languages this is

+ 7 - 0
lisp/org.el

@@ -4659,6 +4659,13 @@ between words."
 	t)))
 
 (defun org-outline-level ()
+  "Compute the outline level of the heading at point.
+This function assumes that the cursor is at the beginning of a line matched
+by outline-regexp.  Otherwise it returns garbage.
+If this is called at a normal headline, the level is the number of stars.
+Use `org-reduced-level' to remove the effect of `org-odd-levels'.
+For plain list items, if they are matched by `outline-regexp', this returns
+1000 plus the line indentation."
   (save-excursion
     (looking-at outline-regexp)
     (if (match-beginning 1)