Browse Source

Release 5.06

Carsten Dominik 17 years ago
parent
commit
5b6d6c3425
4 changed files with 428 additions and 284 deletions
  1. 193 184
      org
  2. 210 83
      org.el
  3. BIN
      org.pdf
  4. 25 17
      org.texi

+ 193 - 184
org

@@ -5,7 +5,7 @@ START-INFO-DIR-ENTRY
 * Org Mode: (org).      Outline-based notes management and organizer
 END-INFO-DIR-ENTRY
 
-   This manual is for Org-mode (version 5.05).
+   This manual is for Org-mode (version 5.06).
 
    Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation
 
@@ -27,7 +27,7 @@ File: org,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
 Org Mode Manual
 ***************
 
-This manual is for Org-mode (version 5.05).
+This manual is for Org-mode (version 5.06).
 
    Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation
 
@@ -1982,9 +1982,9 @@ File: org,  Node: Radio targets,  Prev: Internal links,  Up: Internal links
 4.2.1 Radio targets
 -------------------
 
-You can configure Org-mode to link any occurrences of certain target
-names in normal text.  So without explicitly creating a link, the text
-connects to the target radioing its position.  Radio targets are
+Org-mode can automatically turn any occurrences of certain target names
+in normal text into a link.  So without explicitly creating a link, the
+text connects to the target radioing its position.  Radio targets are
 enclosed by triple angular brackets.  For example, a target `<<<My
 Target>>>' causes each occurrence of `my target' in normal text to
 become activated as a link.  The Org-mode file is scanned automatically
@@ -2164,8 +2164,8 @@ Org-mode, but in any Emacs buffer.  For this, you should create two
 global commands, like this (please select suitable global keys
 yourself):
 
-     (define-key global-map 'org-insert-link-global "\\C-c L")
-     (define-key global-map 'org-open-at-point-global "\\C-c o")
+     (global-set-key "\C-c L" 'org-insert-link-global)
+     (global-set-key "\C-c o" 'org-open-at-point-global)
 
 
 File: org,  Node: Link abbreviations,  Next: Search options,  Prev: Using links outside Org-mode,  Up: Hyperlinks
@@ -5173,10 +5173,13 @@ ASCII export produces a simple and very readable version of an Org-mode
 file.
 
 `C-c C-e a'
-     Export as ASCII file.  If there is an active region, only the
-     region will be exported.  For an org file `myfile.org', the ASCII
-     file will be `myfile.txt'.  The file will be overwritten without
-     warning.  
+     Export as ASCII file.  For an org file `myfile.org', the ASCII file
+     will be `myfile.txt'.  The file will be overwritten without
+     warning.  If there is an active region, only the region will be
+     exported. If the selected region is a single tree, the tree head
+     will become the document title.  If the tree head entry has or
+     inherits an EXPORT_FILE_NAME property, that name will be used for
+     the export.  
 
 `C-c C-e v a'
      Export only the visible part of the document.
@@ -5222,10 +5225,16 @@ File: org,  Node: HTML Export commands,  Next: Quoting HTML tags,  Prev: HTML ex
 ---------------------------
 
 `C-c C-e h'
-     Export as HTML file `myfile.html'.  
+     Export as HTML file `myfile.html'.  For an org file `myfile.org',
+     the ASCII file will be `myfile.html'.  The file will be
+     overwritten without warning.  If there is an active region, only
+     the region will be exported. If the selected region is a single
+     tree, the tree head will become the document title.  If the tree
+     head entry has or inherits an EXPORT_FILE_NAME property, that name
+     will be used for the export.  
 
 `C-c C-e b'
-     Export as HTML file and open it with a browser.  
+     Export as HTML file and immediately open it with a browser.  
 
 `C-c C-e H'
      Export to a temporary buffer, do not create a file.  
@@ -7451,8 +7460,8 @@ Index
 * headline levels, for exporting <1>:    LaTeX export commands.
                                                               (line  26)
 * headline levels, for exporting <2>:    HTML Export commands.
-                                                              (line  38)
-* headline levels, for exporting:        ASCII export.        (line  18)
+                                                              (line  44)
+* headline levels, for exporting:        ASCII export.        (line  21)
 * headline navigation:                   Motion.              (line   6)
 * headline tagging:                      Tags.                (line   6)
 * headline, promotion and demotion:      Structure editing.   (line   6)
@@ -7869,10 +7878,10 @@ Key Index
 * C-c C-e:                               Exporting.           (line  20)
 * C-c C-e a:                             ASCII export.        (line   9)
 * C-c C-e b:                             HTML Export commands.
-                                                              (line   7)
+                                                              (line  13)
 * C-c C-e c:                             iCalendar export.    (line  21)
 * C-c C-e H:                             HTML Export commands.
-                                                              (line  10)
+                                                              (line  16)
 * C-c C-e h:                             HTML Export commands.
                                                               (line   6)
 * C-c C-e I:                             iCalendar export.    (line  16)
@@ -7882,23 +7891,23 @@ Key Index
 * C-c C-e l:                             LaTeX export commands.
                                                               (line   6)
 * C-c C-e R:                             HTML Export commands.
-                                                              (line  13)
+                                                              (line  19)
 * C-c C-e t:                             Export options.      (line  13)
 * C-c C-e v <1>:                         XOXO export.         (line  11)
 * C-c C-e v:                             Sparse trees.        (line  41)
-* C-c C-e v a:                           ASCII export.        (line  13)
+* C-c C-e v a:                           ASCII export.        (line  16)
 * C-c C-e v b:                           HTML Export commands.
-                                                              (line  18)
+                                                              (line  24)
 * C-c C-e v H:                           HTML Export commands.
-                                                              (line  18)
+                                                              (line  24)
 * C-c C-e v h:                           HTML Export commands.
-                                                              (line  18)
+                                                              (line  24)
 * C-c C-e v L:                           LaTeX export commands.
                                                               (line  10)
 * C-c C-e v l:                           LaTeX export commands.
                                                               (line  10)
 * C-c C-e v R:                           HTML Export commands.
-                                                              (line  18)
+                                                              (line  24)
 * C-c C-e x:                             XOXO export.         (line  10)
 * C-c C-f:                               Motion.              (line  12)
 * C-c C-j:                               Motion.              (line  21)
@@ -8173,166 +8182,166 @@ Node: Link format78459
 Node: Internal links79752
 Ref: Internal links-Footnote-181677
 Node: Radio targets81812
-Node: External links82503
-Node: Handling links84907
-Ref: Handling links-Footnote-190204
-Ref: Handling links-Footnote-290441
-Node: Using links outside Org-mode90515
-Node: Link abbreviations91041
-Node: Search options92734
-Ref: Search options-Footnote-194514
-Node: Custom searches94595
-Node: Remember95643
-Node: Setting up remember96630
-Node: Remember templates97212
-Ref: Remember templates-Footnote-1100658
-Node: Storing notes100756
-Node: TODO items102643
-Node: TODO basics103620
-Node: TODO extensions105384
-Node: Workflow states106203
-Ref: Workflow states-Footnote-1107378
-Node: TODO types107471
-Ref: TODO types-Footnote-1109054
-Node: Multiple sets in one file109136
-Node: Per file keywords110747
-Ref: Per file keywords-Footnote-1112036
-Node: Priorities112237
-Node: Breaking down tasks113847
-Ref: Breaking down tasks-Footnote-1114367
-Node: Checkboxes114463
-Node: Tags117312
-Node: Tag inheritance118084
-Node: Setting tags119021
-Ref: Setting tags-Footnote-1123544
-Ref: Setting tags-Footnote-2123656
-Node: Tag searches123739
-Node: Properties and columns126456
-Node: Property syntax127561
-Node: Special properties129982
-Node: Property searches130898
-Node: Column view131553
-Node: Defining columns132720
-Node: Scope of column definitions133118
-Node: Column attributes134040
-Node: Using column view136288
-Node: Property API138275
-Node: Timestamps138629
-Node: Time stamps139090
-Ref: Time stamps-Footnote-1141518
-Node: Creating timestamps141634
-Node: The date/time prompt143708
-Ref: The date/time prompt-Footnote-1145696
-Node: Custom time format145802
-Node: Deadlines and scheduling147494
-Ref: Deadlines and scheduling-Footnote-1149114
-Node: Inserting deadline/schedule149269
-Node: Repeated tasks150207
-Node: Progress logging151846
-Node: Closing items152501
-Ref: Closing items-Footnote-1153435
-Ref: Closing items-Footnote-2153504
-Node: Tracking TODO state changes153577
-Node: Clocking work time154433
-Ref: Clocking work time-Footnote-1158079
-Ref: Clocking work time-Footnote-2158157
-Node: Agenda views158283
-Node: Agenda files160234
-Ref: Agenda files-Footnote-1161200
-Ref: Agenda files-Footnote-2161349
-Node: Agenda dispatcher161542
-Node: Built-in agenda views163239
-Node: Weekly/Daily agenda163819
-Node: Global TODO list166761
-Node: Matching tags and properties169039
-Node: Timeline170128
-Node: Stuck projects170800
-Node: Presentation and sorting172651
-Node: Categories173442
-Node: Time-of-day specifications174106
-Node: Sorting of agenda items176077
-Node: Agenda commands177359
-Node: Custom agenda views184640
-Node: Storing searches185359
-Node: Block agenda187271
-Node: Setting Options188501
-Node: Exporting Agenda Views191240
-Ref: Exporting Agenda Views-Footnote-1195524
-Ref: Exporting Agenda Views-Footnote-2195581
-Node: Extracting Agenda Information for other programs195767
-Node: Embedded LaTeX199893
-Ref: Embedded LaTeX-Footnote-1200987
-Node: Math symbols201177
-Node: Subscripts and Superscripts201944
-Node: LaTeX fragments202790
-Ref: LaTeX fragments-Footnote-1205023
-Ref: LaTeX fragments-Footnote-2205284
-Node: Processing LaTeX fragments205418
-Node: CDLaTeX mode206366
-Ref: CDLaTeX mode-Footnote-1208852
-Node: Exporting209000
-Node: ASCII export210467
-Node: HTML export211757
-Node: HTML Export commands212383
-Node: Quoting HTML tags213751
-Node: Links214386
-Node: Images215083
-Ref: Images-Footnote-1215954
-Node: CSS support216015
-Ref: CSS support-Footnote-1217334
-Node: LaTeX export217447
-Node: LaTeX export commands217771
-Node: Quoting LaTeX code218933
-Node: XOXO export219438
-Node: iCalendar export219878
-Node: Text interpretation221097
-Node: Comment lines221688
-Node: Initial text222083
-Node: Footnotes223752
-Node: Enhancing text224567
-Ref: Enhancing text-Footnote-1226436
-Node: Export options226526
-Node: Publishing228802
-Ref: Publishing-Footnote-1229763
-Ref: Publishing-Footnote-2229907
-Node: Configuration230058
-Node: Project alist230776
-Node: Sources and destinations231842
-Node: Selecting files232572
-Node: Publishing action233320
-Node: Publishing options234654
-Node: Publishing links237029
-Node: Project page index238542
-Node: Sample configuration239320
-Node: Simple example239812
-Node: Complex example240485
-Node: Triggering publication242561
-Node: Miscellaneous243246
-Node: Completion243880
-Node: Customization245550
-Node: In-buffer settings246133
-Node: The very busy C-c C-c key251660
-Node: Clean view253421
-Node: TTY keys255998
-Node: Interaction257608
-Node: Cooperation258005
-Node: Conflicts260881
-Node: Bugs262884
-Node: Extensions and Hacking264380
-Node: Extensions265105
-Node: Adding hyperlink types267048
-Node: Tables in arbitrary syntax270710
-Node: Radio tables271799
-Node: A LaTeX example274302
-Ref: A LaTeX example-Footnote-1277948
-Ref: A LaTeX example-Footnote-2278096
-Node: Translator functions278531
-Ref: Translator functions-Footnote-1281640
-Node: Dynamic blocks281728
-Node: Special agenda views283700
-Node: Using the property API286878
-Node: History and Acknowledgments288359
-Node: Index294935
-Node: Key Index329427
+Node: External links82512
+Node: Handling links84916
+Ref: Handling links-Footnote-190213
+Ref: Handling links-Footnote-290450
+Node: Using links outside Org-mode90524
+Node: Link abbreviations91034
+Node: Search options92727
+Ref: Search options-Footnote-194507
+Node: Custom searches94588
+Node: Remember95636
+Node: Setting up remember96623
+Node: Remember templates97205
+Ref: Remember templates-Footnote-1100651
+Node: Storing notes100749
+Node: TODO items102636
+Node: TODO basics103613
+Node: TODO extensions105377
+Node: Workflow states106196
+Ref: Workflow states-Footnote-1107371
+Node: TODO types107464
+Ref: TODO types-Footnote-1109047
+Node: Multiple sets in one file109129
+Node: Per file keywords110740
+Ref: Per file keywords-Footnote-1112029
+Node: Priorities112230
+Node: Breaking down tasks113840
+Ref: Breaking down tasks-Footnote-1114360
+Node: Checkboxes114456
+Node: Tags117305
+Node: Tag inheritance118077
+Node: Setting tags119014
+Ref: Setting tags-Footnote-1123537
+Ref: Setting tags-Footnote-2123649
+Node: Tag searches123732
+Node: Properties and columns126449
+Node: Property syntax127554
+Node: Special properties129975
+Node: Property searches130891
+Node: Column view131546
+Node: Defining columns132713
+Node: Scope of column definitions133111
+Node: Column attributes134033
+Node: Using column view136281
+Node: Property API138268
+Node: Timestamps138622
+Node: Time stamps139083
+Ref: Time stamps-Footnote-1141511
+Node: Creating timestamps141627
+Node: The date/time prompt143701
+Ref: The date/time prompt-Footnote-1145689
+Node: Custom time format145795
+Node: Deadlines and scheduling147487
+Ref: Deadlines and scheduling-Footnote-1149107
+Node: Inserting deadline/schedule149262
+Node: Repeated tasks150200
+Node: Progress logging151839
+Node: Closing items152494
+Ref: Closing items-Footnote-1153428
+Ref: Closing items-Footnote-2153497
+Node: Tracking TODO state changes153570
+Node: Clocking work time154426
+Ref: Clocking work time-Footnote-1158072
+Ref: Clocking work time-Footnote-2158150
+Node: Agenda views158276
+Node: Agenda files160227
+Ref: Agenda files-Footnote-1161193
+Ref: Agenda files-Footnote-2161342
+Node: Agenda dispatcher161535
+Node: Built-in agenda views163232
+Node: Weekly/Daily agenda163812
+Node: Global TODO list166754
+Node: Matching tags and properties169032
+Node: Timeline170121
+Node: Stuck projects170793
+Node: Presentation and sorting172644
+Node: Categories173435
+Node: Time-of-day specifications174099
+Node: Sorting of agenda items176070
+Node: Agenda commands177352
+Node: Custom agenda views184633
+Node: Storing searches185352
+Node: Block agenda187264
+Node: Setting Options188494
+Node: Exporting Agenda Views191233
+Ref: Exporting Agenda Views-Footnote-1195517
+Ref: Exporting Agenda Views-Footnote-2195574
+Node: Extracting Agenda Information for other programs195760
+Node: Embedded LaTeX199886
+Ref: Embedded LaTeX-Footnote-1200980
+Node: Math symbols201170
+Node: Subscripts and Superscripts201937
+Node: LaTeX fragments202783
+Ref: LaTeX fragments-Footnote-1205016
+Ref: LaTeX fragments-Footnote-2205277
+Node: Processing LaTeX fragments205411
+Node: CDLaTeX mode206359
+Ref: CDLaTeX mode-Footnote-1208845
+Node: Exporting208993
+Node: ASCII export210460
+Node: HTML export211961
+Node: HTML Export commands212587
+Node: Quoting HTML tags214374
+Node: Links215009
+Node: Images215706
+Ref: Images-Footnote-1216577
+Node: CSS support216638
+Ref: CSS support-Footnote-1217957
+Node: LaTeX export218070
+Node: LaTeX export commands218394
+Node: Quoting LaTeX code219556
+Node: XOXO export220061
+Node: iCalendar export220501
+Node: Text interpretation221720
+Node: Comment lines222311
+Node: Initial text222706
+Node: Footnotes224375
+Node: Enhancing text225190
+Ref: Enhancing text-Footnote-1227059
+Node: Export options227149
+Node: Publishing229425
+Ref: Publishing-Footnote-1230386
+Ref: Publishing-Footnote-2230530
+Node: Configuration230681
+Node: Project alist231399
+Node: Sources and destinations232465
+Node: Selecting files233195
+Node: Publishing action233943
+Node: Publishing options235277
+Node: Publishing links237652
+Node: Project page index239165
+Node: Sample configuration239943
+Node: Simple example240435
+Node: Complex example241108
+Node: Triggering publication243184
+Node: Miscellaneous243869
+Node: Completion244503
+Node: Customization246173
+Node: In-buffer settings246756
+Node: The very busy C-c C-c key252283
+Node: Clean view254044
+Node: TTY keys256621
+Node: Interaction258231
+Node: Cooperation258628
+Node: Conflicts261504
+Node: Bugs263507
+Node: Extensions and Hacking265003
+Node: Extensions265728
+Node: Adding hyperlink types267671
+Node: Tables in arbitrary syntax271333
+Node: Radio tables272422
+Node: A LaTeX example274925
+Ref: A LaTeX example-Footnote-1278571
+Ref: A LaTeX example-Footnote-2278719
+Node: Translator functions279154
+Ref: Translator functions-Footnote-1282263
+Node: Dynamic blocks282351
+Node: Special agenda views284323
+Node: Using the property API287501
+Node: History and Acknowledgments288982
+Node: Index295558
+Node: Key Index330050
 
 End Tag Table

+ 210 - 83
org.el

@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <dominik at science dot uva dot nl>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
-;; Version: 5.05
+;; Version: 5.06
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -83,7 +83,7 @@
 
 ;;; Version
 
-(defconst org-version "5.05"
+(defconst org-version "5.06"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -428,7 +428,7 @@ the property API."
   :group 'org-structure
   :type '(repeat (string :tag "Drawer Name")))
 
-(defcustom org-cycle-global-at-bob t
+(defcustom org-cycle-global-at-bob nil
   "Cycle globally if cursor is at beginning of buffer and not at a headline.
 This makes it possible to do global cycling without having to use S-TAB or
 C-u TAB.  For this special case to work, the first line of the buffer
@@ -489,7 +489,7 @@ the values `folded', `children', or `subtree'."
   :tag "Org Edit Structure"
   :group 'org-structure)
 
-
+; FIXME
 (defcustom org-special-ctrl-a/e nil
   "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
 When set, `C-a' will bring back the cursor to the beginning of the
@@ -501,7 +501,10 @@ it to the beginning of the line.
 in the headline.  A second `C-e' will then jump to the true end of the
 line, after any tags."
   :group 'org-edit-structure
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "off" nil)
+	  (const :tag "after bullet first" t)
+	  (const :tag "border first" reversed)))
 
 (if (fboundp 'defvaralias)
     (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e))
@@ -2111,15 +2114,19 @@ The idea behind this is that such items will appear in the agenda anyway."
 
 (defcustom org-agenda-skip-scheduled-if-done nil
   "Non-nil means don't show scheduled items in agenda when they are done.
-This is relevant for the daily/weekly agenda, not for the TODO list."
+This is relevant for the daily/weekly agenda, not for the TODO list.  And
+it applied only to the actualy date of the scheduling.  Warnings about
+an item with a past scheduling dates are always turned off when the item
+is DONE."
   :group 'org-agenda-skip
   :type 'boolean)
 
 (defcustom org-agenda-skip-deadline-if-done nil
   "Non-nil means don't show deadines when the corresponding item is done.
 When nil, the deadline is still shown and should give you a happy feeling.
-
-This is relevant for the daily/weekly agenda."
+This is relevant for the daily/weekly agenda.  And it applied only to the
+actualy date of the deadline.  Warnings about approching and past-due
+deadlines are always turned off when the item is DONE."
   :group 'org-agenda-skip
   :type 'boolean)
 
@@ -4159,6 +4166,7 @@ The following commands are available:
       (let ((bmp (buffer-modified-p)))
 	(org-table-map-tables 'org-table-align)
 	(set-buffer-modified-p bmp)))
+    (org-cycle-hide-drawers 'all)
     (cond
      ((eq org-startup-folded t)
       (org-cycle '(4)))
@@ -10873,6 +10881,8 @@ according to FMT (default from `org-email-link-description-format')."
 
 (defun org-make-link-string (link &optional description)
   "Make a link with brackets, consisting of LINK and DESCRIPTION."
+  (unless (string-match "\\S-" link)
+    (error "Empty link"))
   (when (stringp description)
     ;; Remove brackets from the description, they are fatal.
     (while (string-match "\\[\\|\\]" description)
@@ -10963,8 +10973,7 @@ according to FMT (default from `org-email-link-description-format')."
 ;;;###autoload
 (defun org-insert-link-global ()
   "Insert a link like Org-mode does.
-This command can be called in any mode to follow a link that has
-Org-mode syntax."
+This command can be called in any mode to insert a link in Org-mode syntax."
   (interactive)
   (org-run-like-in-org-mode 'org-insert-link))
 
@@ -13440,6 +13449,45 @@ With prefix ARG, realign all tags in headings in the current buffer."
 	tags)
        (t (error "Tags alignment failed"))))))
 
+(defun org-change-tag-in-region (beg end tag off)
+  "Add or remove TAG for each entry in the region.
+This works in the agenda, and also in an org-mode buffer."
+  (interactive
+   (list (region-beginning) (region-end)
+	 (let ((org-last-tags-completion-table
+		(if (org-mode-p)
+		    (org-get-buffer-tags)
+		  (org-global-tags-completion-table))))
+	   (completing-read
+	    "Tag: " 'org-tags-completion-function nil nil nil
+	    'org-tags-history))
+	 (progn
+	   (message "[s]et or [r]emove? ")
+	   (equal (read-char-exclusive) ?r))))
+  (if (fboundp 'deactivate-mark) (deactivate-mark))
+  (let ((agendap (equal major-mode 'org-agenda-mode))
+	l1 l2 m buf pos newhead (cnt 0))
+    (goto-char end)
+    (setq l2 (1- (org-current-line)))
+    (goto-char beg)
+    (setq l1 (org-current-line))
+    (loop for l from l1 to l2 do
+	  (goto-line l)
+	  (setq m (get-text-property (point) 'org-hd-marker))
+	  (when (or (and (org-mode-p) (org-on-heading-p))
+		    (and agendap m))
+	    (setq buf (if agendap (marker-buffer m) (current-buffer))
+		  pos (if agendap m (point)))
+	    (with-current-buffer buf
+	      (save-excursion
+		(save-restriction
+		  (goto-char pos)
+		  (setq cnt (1+ cnt))
+		  (org-toggle-tag tag (if off 'off 'on))
+		  (setq newhead (org-get-heading)))))
+	    (and agendap (org-agenda-change-all-lines newhead m))))
+    (message "Tag :%s: %s in %d headings" tag (if off "removed" "set") cnt)))
+
 (defun org-tags-completion-function (string predicate &optional flag)
   (let (s1 s2 rtn (ctable org-last-tags-completion-table)
 	   (confirm (lambda (x) (stringp (car x)))))
@@ -16290,7 +16338,8 @@ The following commands are available:
     "--"
     ("Tags and Properties"
      ["Show all Tags" org-agenda-show-tags t]
-     ["Set Tags" org-agenda-set-tags t]
+     ["Set Tags current line" org-agenda-set-tags (not (org-region-active-p))]
+     ["Change tag in region" org-agenda-set-tags (org-region-active-p)]
      "--"
      ["Column View" org-columns t])
     ("Date/Schedule"
@@ -18220,7 +18269,7 @@ the documentation of `org-diary'."
 	 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
 	 (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
 	 d2 diff dfrac wdays pos pos1 category tags
-	 ee txt head face s upcomingp)
+	 ee txt head face s upcomingp donep timestr)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
@@ -18255,14 +18304,18 @@ the documentation of `org-diary'."
 				(point)
 				(progn (skip-chars-forward "^\r\n")
 				       (point))))
-		    (if (and org-agenda-skip-deadline-if-done
-			     (string-match org-looking-at-done-regexp head))
+		    (setq donep (string-match org-looking-at-done-regexp head))
+		    (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+			(setq timestr (concat (match-string 1 s) " ")))
+		    (if (and donep
+			     (or org-agenda-skip-deadline-if-done
+				 (not (= diff 0))))
 			(setq txt nil)
 		      (setq txt (org-format-agenda-item
 				 (if (= diff 0)
 				     "Deadline:  "
 				   (format "In %3d d.: " diff))
-				 head category tags))))
+				 head category tags timestr))))
 		(setq txt org-agenda-no-heading-message))
 	      (when txt
 		(setq face (org-agenda-deadline-face dfrac))
@@ -18274,7 +18327,8 @@ the documentation of `org-diary'."
 		  'org-category category
 		  'type (if upcomingp "upcoming-deadline" "deadline")
 		  'date (if upcomingp date d2)
-		  'face face 'undone-face face 'done-face 'org-done)
+		  'face (if donep 'org-done face)
+		  'undone-face face 'done-face 'org-done)
 		(push txt ee))))))
     ee))
 
@@ -18300,15 +18354,16 @@ FRACTION is what fraction of the head-warning time has passed."
 	 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
 	 (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
 	 d2 diff pos pos1 category tags
-	 ee txt head pastduep donep face)
+	 ee txt head pastschedp donep face timestr s)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
       (catch :skip
 	(org-agenda-skip)
-	(setq pos (1- (match-beginning 1))
+	(setq s (match-string 1)
+	      pos (1- (match-beginning 1))
 	      d2 (org-time-string-to-absolute (match-string 1) d1)
 	      diff (- d2 d1))
-	(setq pastduep (and todayp (< diff 0)))
+	(setq pastschedp (and todayp (< diff 0)))
 	;; When to show a scheduled item in the calendar:
 	;; If it is on or past the date.
 	(if (or (and (< diff 0) todayp)
@@ -18324,16 +18379,20 @@ FRACTION is what fraction of the head-warning time has passed."
 				(point)
 				(progn (skip-chars-forward "^\r\n") (point))))
 		    (setq donep (string-match org-looking-at-done-regexp head))
-		    (if (and org-agenda-skip-scheduled-if-done donep)
+		    (if (string-match " \\([012]?[0-9]:[0-9][0-9]\\)" s)
+			(setq timestr (concat (match-string 1 s) " ")))
+		    (if (and donep
+			     (or org-agenda-skip-scheduled-if-done
+				 (not (= diff 0))))
 			(setq txt nil)
 		      (setq txt (org-format-agenda-item
 				 (if (= diff 0)
 				     "Scheduled: "
 				   (format "Sched.%2dx: " (- 1 diff)))
-				 head category tags))))
+				 head category tags timestr))))
 		(setq txt org-agenda-no-heading-message))
 	      (when txt
-		(setq face (if pastduep
+		(setq face (if pastschedp
 			       'org-scheduled-previously
 			     'org-scheduled-today))
 		(org-add-props txt props
@@ -18341,8 +18400,8 @@ FRACTION is what fraction of the head-warning time has passed."
 		  'face (if donep 'org-done face)
 		  'org-marker (org-agenda-new-marker pos)
 		  'org-hd-marker (org-agenda-new-marker pos1)
-		  'type (if pastduep "past-scheduled" "scheduled")
-		  'date (if pastduep d2 date)
+		  'type (if pastschedp "past-scheduled" "scheduled")
+		  'date (if pastschedp d2 date)
 		  'priority (+ (- 5 diff) (org-get-priority txt))
 		  'org-category category)
 		(push txt ee))))))
@@ -19050,7 +19109,7 @@ and by additional input from the age of a schedules or deadline entry."
 	 (goto-char pos)
 	 (if (and (org-mode-p) (not (member type '("sexp"))))
 	     (setq dbeg (progn (org-back-to-heading t) (point))
-		   dend (org-end-of-subtree t))
+		   dend (org-end-of-subtree t t))
 	   (setq dbeg (point-at-bol)
 		 dend (min (point-max) (1+ (point-at-eol)))))
 	 (goto-char dbeg)
@@ -19365,28 +19424,30 @@ the tags of the current headline come last."
   "Set tags for the current headline."
   (interactive)
   (org-agenda-check-no-diary)
-  (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
-  (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
-                       (org-agenda-error)))
-	 (buffer (marker-buffer hdmarker))
-	 (pos (marker-position hdmarker))
-	 (inhibit-read-only t)
-	 newhead)
-    (org-with-remote-undo buffer
-      (with-current-buffer buffer
-	(widen)
-	(goto-char pos)
-	(save-excursion
-	  (org-show-context 'agenda))
-	(save-excursion
-	  (and (outline-next-heading)
-	       (org-flag-heading nil)))   ; show the next heading
-	(goto-char pos)
-	(call-interactively 'org-set-tags)
-	(end-of-line 1)
-	(setq newhead (org-get-heading)))
-      (org-agenda-change-all-lines newhead hdmarker)
-      (beginning-of-line 1))))
+  (if (and (org-region-active-p) (interactive-p))
+      (call-interactively 'org-change-tag-in-region)
+    (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
+    (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+			 (org-agenda-error)))
+	   (buffer (marker-buffer hdmarker))
+	   (pos (marker-position hdmarker))
+	   (inhibit-read-only t)
+	   newhead)
+      (org-with-remote-undo buffer
+	(with-current-buffer buffer
+	  (widen)
+	  (goto-char pos)
+	  (save-excursion
+	    (org-show-context 'agenda))
+	  (save-excursion
+	    (and (outline-next-heading)
+		 (org-flag-heading nil)))   ; show the next heading
+	  (goto-char pos)
+	  (call-interactively 'org-set-tags)
+	  (end-of-line 1)
+	  (setq newhead (org-get-heading)))
+	(org-agenda-change-all-lines newhead hdmarker)
+	(beginning-of-line 1)))))
 
 (defun org-agenda-toggle-archive-tag ()
   "Toggle the archive tag for the current entry."
@@ -20501,6 +20562,7 @@ translations.  There is currently no way for users to extend this.")
 	 (asciip (plist-get parameters :for-ascii))
 	 (latexp (plist-get parameters :for-LaTeX))
 	 (commentsp (plist-get parameters :comments))
+	 (archived-trees (plist-get parameters :archived-trees))
 	 (inhibit-read-only t)
 	 (outline-regexp "\\*+ ")
 	 a b xx
@@ -20528,13 +20590,13 @@ translations.  There is currently no way for users to extend this.")
 	(insert (plist-get parameters :add-text) "\n"))
 
       ;; Get rid of archived trees
-      (when (not (eq org-export-with-archived-trees t))
+      (when (not (eq archived-trees t))
 	(goto-char (point-min))
 	(while (re-search-forward re-archive nil t)
 	  (if (not (org-on-heading-p t))
 	      (org-end-of-subtree t)
 	    (beginning-of-line 1)
-	    (setq a (if org-export-with-archived-trees
+	    (setq a (if archived-trees
 			(1+ (point-at-eol)) (point))
 		  b (org-end-of-subtree t))
 	    (if (> b a) (delete-region a b)))))
@@ -20581,7 +20643,7 @@ translations.  There is currently no way for users to extend this.")
 				     '(org-protected t))
 	      (delete-region (match-beginning 0) (match-end 0))))))
 
-      ;; Protect quoted subtreedes
+      ;; Protect quoted subtrees
       (goto-char (point-min))
       (while (re-search-forward re-quote nil t)
 	(goto-char (match-beginning 0))
@@ -20607,12 +20669,24 @@ translations.  There is currently no way for users to extend this.")
 			     (point-at-eol))
 	    (end-of-line 1))))
 
-      ;; Specific LaTeX cleaning
+      ;; Specific LaTeX stuff
       (when latexp
 	(require 'org-export-latex nil t)
 	(org-export-latex-cleaned-string))
 
+      ;; Specific HTML stuff
+      (when htmlp
+	;; Convert LaTeX fragments to images
+	(when (plist-get parameters :LaTeX-fragments)
+	  (org-format-latex
+	   (concat "ltxpng/" (file-name-sans-extension
+			      (file-name-nondirectory
+			       org-current-export-file)))
+	   org-current-export-dir nil "Creating LaTeX image %s"))
+	(message "Exporting..."))
+
       ;; Remove or replace comments
+      ;; FIXME: Does LaTeX export take care of its own comments?
       ;; If :comments is set, use this char for commenting out comments and
       ;; protect them. otherwise delete them
       (goto-char (point-min))
@@ -20637,14 +20711,6 @@ translations.  There is currently no way for users to extend this.")
 	 (replace-match "\\1 \\3")
 	 (goto-char (match-beginning 0))))
 
-      ;; Convert LaTeX fragments to images
-      (when (plist-get parameters :LaTeX-fragments)
-	(org-format-latex
-	 (concat "ltxpng/" (file-name-sans-extension
-			    (file-name-nondirectory
-			     org-current-export-file)))
-	 org-current-export-dir nil "Creating LaTeX image %s"))
-      (message "Exporting...")
 
       ;; Normalize links: Convert angle and plain links into bracket links
       ;; Expand link abbreviations
@@ -20708,6 +20774,22 @@ translations.  There is currently no way for users to extend this.")
 	  ;; Return the title string
 	  (org-trim (match-string 0)))))))
 
+(defun org-export-get-title-from-subtree ()
+  "Return subtree title and exclude it from export."
+  (let (title (m (mark)))
+    (save-excursion
+      (goto-char (region-beginning))
+      (when (and (org-at-heading-p)
+		 (>= (org-end-of-subtree t t) (region-end)))
+	;; This is a subtree, we take the title from the first heading
+	(goto-char (region-beginning))
+	(looking-at org-todo-line-regexp)
+	(setq title (match-string 3))
+	(org-unmodified
+	 (add-text-properties (point) (1+ (point-at-eol))
+			      (list :org-license-to-kill t)))))
+    title))
+	 
 (defun org-solidify-link-text (s &optional alist)
   "Take link text and make a safe target out of it."
   (save-match-data
@@ -20767,6 +20849,7 @@ When LEVEL is non-nil, increase section numbers on that level."
 ;;; ASCII export
 
 (defvar org-last-level nil) ; dynamically scoped variable
+(defvar org-min-level nil) ; dynamically scoped variable
 (defvar org-levels-open nil) ; dynamically scoped parameter
 (defvar org-ascii-current-indentation nil) ; For communication
 
@@ -20779,6 +20862,13 @@ underlined headlines.  The default is 3."
   (setq-default org-todo-line-regexp org-todo-line-regexp)
   (let* ((opt-plist (org-combine-plists (org-default-export-plist)
 					(org-infile-export-plist)))
+	 (region-p (org-region-active-p))
+	 (subtree-p
+	  (when region-p
+	    (save-excursion
+	      (goto-char (region-beginning))
+	      (and (org-at-heading-p)
+		   (>= (org-end-of-subtree t t) (region-end))))))
 	 (custom-times org-display-custom-times)
 	 (org-ascii-current-indentation '(0 . 0))
 	 (level 0) line txt
@@ -20788,7 +20878,10 @@ underlined headlines.  The default is 3."
          (filename (concat (file-name-as-directory
 			    (org-export-directory :ascii opt-plist))
 			   (file-name-sans-extension
-			    (file-name-nondirectory buffer-file-name))
+			    (or (and subtree-p
+				     (org-entry-get (region-beginning)
+						    "EXPORT_FILE_NAME" t))
+				(file-name-nondirectory buffer-file-name)))
 			   ".txt"))
 	 (filename (if (equal (file-truename filename)
 			      (file-truename buffer-file-name))
@@ -20800,7 +20893,8 @@ underlined headlines.  The default is 3."
 	 (date  (format-time-string "%Y/%m/%d" (current-time)))
 	 (time  (format-time-string "%X" (org-current-time)))
 	 (author      (plist-get opt-plist :author))
-	 (title       (or (plist-get opt-plist :title)
+	 (title       (or (and subtree-p (org-export-get-title-from-subtree))
+			  (plist-get opt-plist :title)
 			  (and (not
 				(plist-get opt-plist :skip-before-1st-heading))
 			       (org-export-grab-title-from-buffer))
@@ -20822,6 +20916,8 @@ underlined headlines.  The default is 3."
 		  :for-ascii t
 		  :skip-before-1st-heading
 		  (plist-get opt-plist :skip-before-1st-heading)
+		  :archived-trees
+		  (plist-get opt-plist :archived-trees)
 		  :add-text (plist-get opt-plist :text))
 		 "[\r\n]")) ;; FIXME: why \r here???/
 	 thetoc have-headings first-heading-pos
@@ -20832,7 +20928,8 @@ underlined headlines.  The default is 3."
        (remove-text-properties (point-min) (point-max)
 			       '(:org-license-to-kill t))))
 
-    (setq org-last-level 1)
+    (setq org-min-level (org-get-min-level lines))
+    (setq org-last-level org-min-level)
     (org-init-section-numbers)
 
     (find-file-noselect filename)
@@ -20908,7 +21005,8 @@ underlined headlines.  The default is 3."
 			       (progn
 				 (push
 				  (concat
-				   (make-string (* (1- level) 4) ?\ )
+				   (make-string
+				    (* (max 0 (- level org-min-level)) 4) ?\ )
 				   (format (if todo "%s (*)\n" "%s\n") txt))
 				  thetoc)
 				 (setq org-last-level level))
@@ -21354,6 +21452,12 @@ the body tags themselves."
 	 valid thetoc have-headings first-heading-pos
 	 (odd org-odd-levels-only)
 	 (region-p (org-region-active-p))
+	 (subtree-p
+	  (when region-p
+	    (save-excursion
+	      (goto-char (region-beginning))
+	      (and (org-at-heading-p)
+		   (>= (org-end-of-subtree t t) (region-end))))))
 	 ;; The following two are dynamically scoped into other
 	 ;; routines below.
 	 (org-current-export-dir (org-export-directory :html opt-plist))
@@ -21361,11 +21465,15 @@ the body tags themselves."
          (level 0) (line "") (origline "") txt todo
          (umax nil)
          (umax-toc nil)
+	 (dummy (debug))
          (filename (if to-buffer nil
 		     (concat (file-name-as-directory
 			      (org-export-directory :html opt-plist))
 			     (file-name-sans-extension
-			      (file-name-nondirectory buffer-file-name))
+			      (or (and subtree-p
+				       (org-entry-get (region-beginning)
+						      "EXPORT_FILE_NAME" t))
+				  (file-name-nondirectory buffer-file-name)))
 			     ".html")))
 	 (current-dir (if buffer-file-name
 			  (file-name-directory buffer-file-name)
@@ -21379,7 +21487,8 @@ the body tags themselves."
 	 (date (format-time-string "%Y/%m/%d" (current-time)))
 	 (time  (format-time-string "%X" (org-current-time)))
          (author      (plist-get opt-plist :author))
-	 (title       (or (plist-get opt-plist :title)
+	 (title       (or (and subtree-p (org-export-get-title-from-subtree))
+			  (plist-get opt-plist :title)
 			  (and (not
 				(plist-get opt-plist :skip-before-1st-heading))
 			       (org-export-grab-title-from-buffer))
@@ -21423,6 +21532,8 @@ the body tags themselves."
 	    :for-html t
 	    :skip-before-1st-heading
 	    (plist-get opt-plist :skip-before-1st-heading)
+	    :archived-trees
+	    (plist-get opt-plist :archived-trees)
 	    :add-text
 	    (plist-get opt-plist :text)
 	    :LaTeX-fragments
@@ -21441,7 +21552,8 @@ the body tags themselves."
 
     (message "Exporting...")
 
-    (setq org-last-level 1)
+    (setq org-min-level (org-get-min-level lines))
+    (setq org-last-level org-min-level)
     (org-init-section-numbers)
 
     ;; Get the language-dependent settings
@@ -21572,7 +21684,7 @@ lang=\"%s\" xml:lang=\"%s\">
 			    )))
 		    line)
 			  lines))
-	    (while (> org-last-level 0)
+	    (while (> org-last-level (1- org-min-level))
 	      (setq org-last-level (1- org-last-level))
 	      (push "</li>\n</ul>\n" thetoc))
 	    (setq thetoc (if have-headings (nreverse thetoc) nil))))
@@ -23410,11 +23522,7 @@ See the individual commands for more information."
      ["Next Same Level" outline-forward-same-level t]
      ["Previous Same Level" outline-backward-same-level t]
      "--"
-     ["Jump" org-goto t]
-     "--"
-     ["C-a/e find headline/item start/end"
-      (setq org-special-ctrl-a/e (not org-special-ctrl-a/e))
-      :style toggle :selected org-special-ctrl-a/e])
+     ["Jump" org-goto t])
     ("Edit Structure"
      ["Move Subtree Up" org-shiftmetaup (not (org-at-table-p))]
      ["Move Subtree Down" org-shiftmetadown (not (org-at-table-p))]
@@ -23470,6 +23578,7 @@ See the individual commands for more information."
      ["Priority Down" org-shiftdown t])
     ("TAGS and Properties"
      ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)]
+     ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)] ;FIXME
      ["Column view of properties" org-columns t])
     ("Dates and Scheduling"
      ["Timestamp" org-time-stamp t]
@@ -23983,14 +24092,22 @@ beyond the end of the headline."
        ((and (looking-at org-todo-line-regexp)
 	     (= (char-after (match-end 1)) ?\ ))
 	(goto-char
-	 (cond ((> pos (match-beginning 3)) (match-beginning 3))
-	       ((= pos (point)) (match-beginning 3))
-	       (t (point)))))
+	 (if (eq org-special-ctrl-a/e t)
+	     (cond ((> pos (match-beginning 3)) (match-beginning 3))
+		   ((= pos (point)) (match-beginning 3))
+		   (t (point)))
+	   (cond ((> pos (point)) (point))
+		 ((not (eq last-command this-command)) (point))
+		 (t (match-beginning 3))))))
        ((org-at-item-p)
 	(goto-char
-	 (cond ((> pos (match-end 4)) (match-end 4))
-	       ((= pos (point)) (match-end 4))
-	       (t (point)))))))))
+	 (if (eq org-special-ctrl-a/e t)
+	     (cond ((> pos (match-end 4)) (match-end 4))
+		   ((= pos (point)) (match-end 4))
+		   (t (point)))
+	   (cond ((> pos (point)) (point))
+		 ((not (eq last-command this-command)) (point))
+		 (t (match-end 4))))))))))
 
 (defun org-end-of-line (&optional arg)
   "Go to the end of the line.
@@ -24004,10 +24121,14 @@ beyond the end of the headline."
     (let ((pos (point)))
       (beginning-of-line 1)
       (if (looking-at (org-re ".*?\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))
-	  (if (or (< pos (match-beginning 1))
-		  (= pos (match-end 0)))
-	      (goto-char (match-beginning 1))
-	    (goto-char (match-end 0)))
+	  (if (eq org-special-ctrl-a/e t)
+	      (if (or (< pos (match-beginning 1))
+		      (= pos (match-end 0)))
+		  (goto-char (match-beginning 1))
+		(goto-char (match-end 0)))
+	    (if (or (< pos (match-end 0)) (not (eq this-command last-command)))
+		(goto-char (match-end 0))
+	      (goto-char (match-beginning 1))))
 	(end-of-line arg)))))
 
 (define-key org-mode-map "\C-a" 'org-beginning-of-line)
@@ -24264,7 +24385,13 @@ Still experimental, may disappear in the furture."
 	       t)))
 	  (t nil))))                                 ; call paragraph-fill
 
-
+(defun org-get-min-level (lines)
+  (let ((re "^\\(\\*+\\) ") l min)
+    (catch 'exit
+      (while (setq l (pop lines))
+	(if (string-match re l)
+	    (throw 'exit (org-tr-level (length (match-string 1 l))))))
+      1)))
 
 ;;;; Finish up
 

BIN
org.pdf


+ 25 - 17
org.texi

@@ -3,7 +3,7 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 5.05
+@set VERSION 5.06
 @set DATE August 2007
 
 @dircategory Emacs
@@ -2186,15 +2186,15 @@ earlier.
 @cindex targets, radio
 @cindex links, radio targets
 
-You can configure Org-mode to link any occurrences of certain target
-names in normal text.  So without explicitly creating a link, the text
-connects to the target radioing its position.  Radio targets are
-enclosed by triple angular brackets.  For example, a target
-@samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
-normal text to become activated as a link.  The Org-mode file is
-scanned automatically for radio targets only when the file is first
-loaded into Emacs.  To update the target list during editing, press
-@kbd{C-c C-c} with the cursor on or at a target.
+Org-mode can automatically turn any occurrences of certain target names
+in normal text into a link.  So without explicitly creating a link, the
+text connects to the target radioing its position.  Radio targets are
+enclosed by triple angular brackets.  For example, a target @samp{<<<My
+Target>>>} causes each occurrence of @samp{my target} in normal text to
+become activated as a link.  The Org-mode file is scanned automatically
+for radio targets only when the file is first loaded into Emacs.  To
+update the target list during editing, press @kbd{C-c C-c} with the
+cursor on or at a target.
 
 @node External links, Handling links, Internal links, Hyperlinks
 @section External links
@@ -2406,8 +2406,8 @@ global commands, like this (please select suitable global keys
 yourself):
 
 @lisp
-(define-key global-map 'org-insert-link-global "\\C-c L")
-(define-key global-map 'org-open-at-point-global "\\C-c o")
+(global-set-key "\C-c L" 'org-insert-link-global)
+(global-set-key "\C-c o" 'org-open-at-point-global)
 @end lisp
 
 @node Link abbreviations, Search options, Using links outside Org-mode, Hyperlinks
@@ -5650,10 +5650,12 @@ file.
 @table @kbd
 @kindex C-c C-e a
 @item C-c C-e a
-Export as ASCII file.  If there is an active region, only the region
-will be exported.  For an org file @file{myfile.org}, the ASCII file
+Export as ASCII file.  For an org file @file{myfile.org}, the ASCII file
 will be @file{myfile.txt}.  The file will be overwritten without
-warning.
+warning.  If there is an active region, only the region will be
+exported. If the selected region is a single tree, the tree head will
+become the document title.  If the tree head entry has or inherits an
+EXPORT_FILE_NAME property, that name will be used for the export.
 @kindex C-c C-e v a
 @item C-c C-e v a
 Export only the visible part of the document.
@@ -5703,10 +5705,16 @@ language, but with additional support for tables.
 @table @kbd
 @kindex C-c C-e h
 @item C-c C-e h
-Export as HTML file @file{myfile.html}.
+Export as HTML file @file{myfile.html}.  For an org file
+@file{myfile.org}, the ASCII file will be @file{myfile.html}.  The file
+will be overwritten without warning.  If there is an active region, only
+the region will be exported. If the selected region is a single tree,
+the tree head will become the document title.  If the tree head entry
+has or inherits an EXPORT_FILE_NAME property, that name will be used for
+the export.
 @kindex C-c C-e b
 @item C-c C-e b
-Export as HTML file and open it with a browser.
+Export as HTML file and immediately open it with a browser.
 @kindex C-c C-e H
 @item C-c C-e H
 Export to a temporary buffer, do not create a file.