Carsten Dominik 17 سال پیش
والد
کامیت
af0cd37b63
9فایلهای تغییر یافته به همراه501 افزوده شده و 198 حذف شده
  1. 163 0
      Makefile
  2. 178 145
      org
  3. 1 1
      org-install.el
  4. 36 19
      org-publish.el
  5. 84 29
      org.el
  6. BIN
      org.pdf
  7. 38 3
      org.texi
  8. BIN
      orgcard.pdf
  9. 1 1
      orgcard.tex

+ 163 - 0
Makefile

@@ -0,0 +1,163 @@
+# Makefile - for the org-mode distribution
+#
+# Maintainer: Carsten Dominik <dominik@science.uva.nl>
+# Version: VERSIONTAG
+#
+# To install org-mode, edit the Makefile, type `make', then `make install'.
+# To create the PDF and HTML documentation files, type `make doc'.
+
+##----------------------------------------------------------------------
+##  YOU MUST EDIT THE FOLLOWING LINES 
+##----------------------------------------------------------------------
+
+# Name of your emacs binary
+EMACS=emacs
+
+# Where local software is found
+prefix=/usr/local
+
+# Where local lisp files go.
+lispdir = $(prefix)/share/emacs/site-lisp
+
+# Where info files go.
+infodir = $(prefix)/info
+
+##----------------------------------------------------------------------
+## YOU MAY NEED TO EDIT THESE
+##----------------------------------------------------------------------
+
+# Using emacs in batch mode.
+BATCH=$(EMACS) -batch -q
+
+# Specify the byte-compiler for compiling org-mode files
+ELC= $(BATCH) -f batch-byte-compile
+
+# How to make a pdf file from a texinfo file
+TEXI2PDF = texi2pdf
+
+# How to create directories
+MKDIR = mkdir -p
+
+# How to create the info files from the texinfo file
+MAKEINFO = makeinfo
+
+# How to create the HTML file
+#TEXI2HTML = ./texi2html -monolithic -number
+TEXI2HTML = makeinfo --html --number-sections --no-split
+
+# How to move the byte compiled files to their destination.  
+MV = mv
+
+# How to copy the lisp files to their distination.
+CP = cp -p
+
+##----------------------------------------------------------------------
+##  BELOW THIS LINE ON YOUR OWN RISK!
+##----------------------------------------------------------------------
+
+# The following variables need to be defined by the maintainer
+LISPFILES  = org.el org-publish.el org-install.el
+ELCFILES   = $(LISPFILES:.el=.elc)
+TEXIFILES  = org.texi
+INFOFILES  = org
+HTMLDIR    = /home/dominik/public_html/Tools/org
+
+.SUFFIXES: .el .elc .texi
+SHELL = /bin/sh
+
+DISTFILES=  README xemacs ${LISPFILES} org.texi org.pdf org orgcard.tex orgcard.pdf Makefile
+
+all:	$(ELCFILES)
+
+install: install-lisp
+
+doc: org.html org.pdf orgcard.pdf
+
+install-lisp: $(LISPFILES) $(ELCFILES)
+	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
+	$(CP) $(LISPFILES) $(lispdir)
+	$(CP) $(ELCFILES)  $(lispdir)
+
+install-info: $(INFOFILES)
+	if [ ! -d $(infodir) ]; then $(MKDIR) $(infodir); else true; fi ;
+	$(CP) $(INFOFILES) $(infodir)
+
+install-noutline: xemacs/noutline.elc
+	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
+	$(CP) xemacs/noutline.el xemacs/noutline.elc $(lispdir)
+
+org.elc:		org.el
+
+org-publish.elc:	org-publish.el
+
+org-install.elc:	org-install.el
+
+xemacs/noutline.elc: xemacs/noutline.el
+
+org:	org.texi
+	$(MAKEINFO) --no-split org.texi -o org
+
+org.pdf: org.texi
+	$(TEXI2PDF) org.texi
+
+org.html: org.texi
+	$(TEXI2HTML) -o org.html org.texi
+
+orgcard.dvi: orgcard.tex
+	tex orgcard.tex
+
+orgcard.pdf: orgcard.dvi
+	dvips -q -f -t landscape orgcard.dvi | gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=orgcard.pdf -c .setpdfwrite -
+
+orgcard.ps: orgcard.dvi
+	dvips -t landscape -o orgcard.ps orgcard.dvi 
+
+# Below here are special targets for maintenance only
+
+info:	
+	$(MAKEINFO) --no-split org.texi -o org
+
+pdf:	
+	$(TEXI2PDF) org.texi
+
+card:	orgcard.pdf orgcard.ps
+
+xcompile:
+	xemacs -batch -q -f batch-byte-compile $(LISPFILES)
+
+ecompile:
+	emacs -batch -q -f batch-byte-compile $(LISPFILES)
+
+distfile:
+	@if [ "X$(TAG)" = "X" ]; then echo "*** No tag ***"; exit 1; fi
+	make info
+	make doc
+	rm -rf org-$(TAG) org-$(TAG).zip
+	$(MKDIR) org-$(TAG)
+	cp -r $(DISTFILES) org-$(TAG)/
+	zip -r org-$(TAG).zip org-$(TAG)
+	gtar zcvf org-$(TAG).tar.gz org-$(TAG)
+
+dist:
+	make distfile TAG=$(TAG)
+	cp org-$(TAG).zip org-$(TAG).tar.gz $(HTMLDIR)
+	rm -f $(HTMLDIR)/org.zip $(HTMLDIR)/org.tar.gz
+	(cd $(HTMLDIR); ln -s org-$(TAG).zip org.zip)
+	(cd $(HTMLDIR); ln -s org-$(TAG).tar.gz org.tar.gz)
+	make doc
+	cp org.pdf orgcard.pdf org.texi org.html $(HTMLDIR)
+
+minidist:
+	rm -f org-$(TAG).zip
+	zip org-$(TAG).zip org.el
+	scp org-$(TAG).zip remote.science.uva.nl:public_html/Tools/org/
+
+clean:
+	rm -f $(ELCFILES) org.pdf org org.html orgcard.pdf orgcard.ps
+	rm -f *~ 
+	rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs
+	rm -f *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps
+
+.el.elc:
+	$(ELC) $<
+

+ 178 - 145
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 4.46).
+   This manual is for Org-mode (version 4.48).
 
    Copyright (C) 2004, 2005, 2006 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 4.46).
+This manual is for Org-mode (version 4.48).
 
    Copyright (C) 2004, 2005, 2006 Free Software Foundation
 
@@ -178,6 +178,7 @@ Custom agenda views
 * Storing searches::            Type once, use often
 * Block agenda::                All the stuff you need in a single buffer
 * Setting Options::             Changing the rules
+* Batch processing::            Agenda views from the command line
 
 Embedded LaTeX
 
@@ -3215,6 +3216,7 @@ dispatcher (*note Agenda dispatcher::), just like the default commands.
 * Storing searches::            Type once, use often
 * Block agenda::                All the stuff you need in a single buffer
 * Setting Options::             Changing the rules
+* Batch processing::            Agenda views from the command line
 
 
 File: org,  Node: Storing searches,  Next: Block agenda,  Prev: Custom agenda views,  Up: Custom agenda views
@@ -3300,7 +3302,7 @@ your agenda for the current week, all TODO items that carry the tag
 `C-c a o' provides a similar view for office tasks.
 
 
-File: org,  Node: Setting Options,  Prev: Block agenda,  Up: Custom agenda views
+File: org,  Node: Setting Options,  Next: Batch processing,  Prev: Block agenda,  Up: Custom agenda views
 
 8.9.3 Setting Options for custom commands
 -----------------------------------------
@@ -3356,6 +3358,32 @@ this interface, the _values_ are just lisp expressions.  So if the
 value is a string, you need to add the double quotes around the value
 yourself.
 
+
+File: org,  Node: Batch processing,  Prev: Setting Options,  Up: Custom agenda views
+
+8.9.4 Creating agenda views in batch processing
+-----------------------------------------------
+
+If you want to print or otherwise reprocess agenda views, it can be
+useful to create an agenda from the command line.  This is the purpose
+of the function `org-batch-agenda'.  It takes as a parameter one of the
+strings that are the keys in `org-agenda-custom-commands'.  For
+example, to directly print the current TODO list, you could use
+
+     emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
+
+You may also modify parameters on the fly like this:
+
+     emacs -batch -l ~/.emacs                                      \
+        -eval '(org-batch-agenda "a"                               \
+                 org-agenda-ndays 300                              \
+                 org-agenda-include-diary nil                      \
+                 org-agenda-files (quote ("~/org/project.org")))'  \
+        | lpr
+
+which will produce a 300 day agenda, fully restricted to the Org file
+`~/org/projects.org', not even including the diary.
+
 
 File: org,  Node: Embedded LaTeX,  Next: Exporting,  Prev: Agenda views,  Up: Top
 
@@ -3946,6 +3974,8 @@ and where to put published files.
 `:base-directory'      Directory containing publishing source files
 `:publishing-directory'Directory (possibly remote) where output files
                        will be published.
+`:preparation-function'Function called before starting publishing
+                       proxess.
 
 
 File: org,  Node: Selecting files,  Next: Publishing action,  Prev: Sources and destinations,  Up: Configuration
@@ -4813,6 +4843,8 @@ if I have forgotten someone, please accept my apologies and let me know.
    * Frank Ruell solved the mystery of the `keymapp nil' bug, a
      conflict with `allout.el'.
 
+   * Jason Riedy sent a patch to fix a bug with export of TODO keywerds.
+
    * Philip Rooke created the Org-mode reference card and provided lots
      of feedback.
 
@@ -5463,147 +5495,148 @@ Key Index
 
 Tag Table:
 Node: Top964
-Node: Introduction10057
-Node: Summary10472
-Node: Installation12739
-Node: Activation14117
-Node: Feedback15366
-Node: Document structure16135
-Node: Outlines16909
-Node: Headlines17569
-Node: Visibility cycling18192
-Ref: Visibility cycling-Footnote-119667
-Ref: Visibility cycling-Footnote-219725
-Node: Motion19775
-Node: Structure editing20559
-Node: Archiving22668
-Node: ARCHIVE tag23226
-Node: Moving subtrees25019
-Node: Sparse trees26060
-Ref: Sparse trees-Footnote-128039
-Ref: Sparse trees-Footnote-228131
-Node: Plain lists28246
-Ref: Plain lists-Footnote-131771
-Ref: Plain lists-Footnote-232128
-Node: Tables32310
-Node: Built-in table editor32858
-Node: Narrow columns40466
-Ref: Narrow columns-Footnote-142405
-Node: Table calculations42451
-Node: Formula syntax43771
-Ref: Formula syntax-Footnote-146676
-Node: Lisp formulas46976
-Node: Column formulas47765
-Node: Advanced features49527
-Node: Named-field formulas52781
-Node: Editing/debugging formulas53421
-Node: Appetizer55179
-Node: orgtbl-mode56282
-Node: table.el56773
-Node: Hyperlinks57750
-Node: Link format58455
-Node: Internal links59748
-Ref: Internal links-Footnote-161737
-Node: Radio targets61869
-Node: CamelCase links62584
-Node: External links63082
-Node: Handling links65213
-Ref: Handling links-Footnote-169799
-Node: Search options70036
-Ref: Search options-Footnote-171810
-Node: Custom searches71891
-Node: Remember72939
-Node: TODO items76629
-Node: TODO basics77611
-Node: TODO extensions79138
-Node: Workflow states79933
-Node: TODO types80801
-Ref: TODO types-Footnote-182459
-Node: Per file keywords82541
-Ref: Per file keywords-Footnote-183995
-Node: Priorities84196
-Node: Breaking down tasks85440
-Ref: Breaking down tasks-Footnote-185960
-Node: Checkboxes86056
-Node: Timestamps88792
-Node: Time stamps89182
-Node: Creating timestamps92279
-Node: Progress logging95625
-Node: Closing items96155
-Node: Clocking work time96950
-Ref: Clocking work time-Footnote-1100386
-Node: Tags100512
-Node: Tag inheritance101274
-Node: Setting tags102211
-Ref: Setting tags-Footnote-1105341
-Ref: Setting tags-Footnote-2105453
-Node: Tag searches105533
-Node: Agenda views106742
-Node: Agenda files108631
-Ref: Agenda files-Footnote-1109591
-Ref: Agenda files-Footnote-2109740
-Node: Agenda dispatcher109933
-Node: Weekly/Daily agenda111550
-Node: Calendar/Diary integration112515
-Node: Global TODO list113853
-Node: Matching headline tags115905
-Node: Timeline116849
-Node: Presentation and sorting117512
-Node: Categories118290
-Node: Time-of-day specifications118954
-Node: Sorting of agenda items120932
-Node: Agenda commands122214
-Node: Custom agenda views128102
-Node: Storing searches128710
-Node: Block agenda130622
-Node: Setting Options131852
-Node: Embedded LaTeX134539
-Ref: Embedded LaTeX-Footnote-1135631
-Node: Math symbols135821
-Node: Subscripts and Superscripts136586
-Node: LaTeX fragments137430
-Node: Processing LaTeX fragments139499
-Node: CDLaTeX mode140445
-Ref: CDLaTeX mode-Footnote-1142929
-Node: Exporting143077
-Node: ASCII export144391
-Node: HTML export145681
-Node: XOXO export148517
-Node: iCalendar export148956
-Node: Text interpretation150779
-Node: Comment lines151258
-Node: Enhancing text151729
-Node: Export options153421
-Node: Publishing155088
-Ref: Publishing-Footnote-1155884
-Node: Configuration156080
-Node: Project alist156798
-Node: Sources and destinations157864
-Node: Selecting files158411
-Node: Publishing action159159
-Node: Publishing options160274
-Node: Publishing links162426
-Node: Project page index163939
-Node: Sample configuration164717
-Node: Simple example165209
-Node: Complex example165882
-Node: Triggering publication167958
-Node: Miscellaneous168643
-Node: Completion169277
-Node: Customization170658
-Node: In-buffer settings171243
-Node: The very busy C-c C-c key174474
-Node: Clean view176118
-Node: TTY keys178695
-Node: Interaction180304
-Node: Cooperation180701
-Node: Conflicts182568
-Node: Bugs184160
-Node: Extensions and Hacking185783
-Node: Extensions186269
-Node: Dynamic blocks187839
-Node: History and Acknowledgments189766
-Node: Index194654
-Node: Key Index219013
+Node: Introduction10124
+Node: Summary10539
+Node: Installation12806
+Node: Activation14184
+Node: Feedback15433
+Node: Document structure16202
+Node: Outlines16976
+Node: Headlines17636
+Node: Visibility cycling18259
+Ref: Visibility cycling-Footnote-119734
+Ref: Visibility cycling-Footnote-219792
+Node: Motion19842
+Node: Structure editing20626
+Node: Archiving22735
+Node: ARCHIVE tag23293
+Node: Moving subtrees25086
+Node: Sparse trees26127
+Ref: Sparse trees-Footnote-128106
+Ref: Sparse trees-Footnote-228198
+Node: Plain lists28313
+Ref: Plain lists-Footnote-131838
+Ref: Plain lists-Footnote-232195
+Node: Tables32377
+Node: Built-in table editor32925
+Node: Narrow columns40533
+Ref: Narrow columns-Footnote-142472
+Node: Table calculations42518
+Node: Formula syntax43838
+Ref: Formula syntax-Footnote-146743
+Node: Lisp formulas47043
+Node: Column formulas47832
+Node: Advanced features49594
+Node: Named-field formulas52848
+Node: Editing/debugging formulas53488
+Node: Appetizer55246
+Node: orgtbl-mode56349
+Node: table.el56840
+Node: Hyperlinks57817
+Node: Link format58522
+Node: Internal links59815
+Ref: Internal links-Footnote-161804
+Node: Radio targets61936
+Node: CamelCase links62651
+Node: External links63149
+Node: Handling links65280
+Ref: Handling links-Footnote-169866
+Node: Search options70103
+Ref: Search options-Footnote-171877
+Node: Custom searches71958
+Node: Remember73006
+Node: TODO items76696
+Node: TODO basics77678
+Node: TODO extensions79205
+Node: Workflow states80000
+Node: TODO types80868
+Ref: TODO types-Footnote-182526
+Node: Per file keywords82608
+Ref: Per file keywords-Footnote-184062
+Node: Priorities84263
+Node: Breaking down tasks85507
+Ref: Breaking down tasks-Footnote-186027
+Node: Checkboxes86123
+Node: Timestamps88859
+Node: Time stamps89249
+Node: Creating timestamps92346
+Node: Progress logging95692
+Node: Closing items96222
+Node: Clocking work time97017
+Ref: Clocking work time-Footnote-1100453
+Node: Tags100579
+Node: Tag inheritance101341
+Node: Setting tags102278
+Ref: Setting tags-Footnote-1105408
+Ref: Setting tags-Footnote-2105520
+Node: Tag searches105600
+Node: Agenda views106809
+Node: Agenda files108698
+Ref: Agenda files-Footnote-1109658
+Ref: Agenda files-Footnote-2109807
+Node: Agenda dispatcher110000
+Node: Weekly/Daily agenda111617
+Node: Calendar/Diary integration112582
+Node: Global TODO list113920
+Node: Matching headline tags115972
+Node: Timeline116916
+Node: Presentation and sorting117579
+Node: Categories118357
+Node: Time-of-day specifications119021
+Node: Sorting of agenda items120999
+Node: Agenda commands122281
+Node: Custom agenda views128169
+Node: Storing searches128844
+Node: Block agenda130756
+Node: Setting Options131986
+Node: Batch processing134698
+Node: Embedded LaTeX135828
+Ref: Embedded LaTeX-Footnote-1136920
+Node: Math symbols137110
+Node: Subscripts and Superscripts137875
+Node: LaTeX fragments138719
+Node: Processing LaTeX fragments140788
+Node: CDLaTeX mode141734
+Ref: CDLaTeX mode-Footnote-1144218
+Node: Exporting144366
+Node: ASCII export145680
+Node: HTML export146970
+Node: XOXO export149806
+Node: iCalendar export150245
+Node: Text interpretation152068
+Node: Comment lines152547
+Node: Enhancing text153018
+Node: Export options154710
+Node: Publishing156377
+Ref: Publishing-Footnote-1157173
+Node: Configuration157369
+Node: Project alist158087
+Node: Sources and destinations159153
+Node: Selecting files159798
+Node: Publishing action160546
+Node: Publishing options161661
+Node: Publishing links163813
+Node: Project page index165326
+Node: Sample configuration166104
+Node: Simple example166596
+Node: Complex example167269
+Node: Triggering publication169345
+Node: Miscellaneous170030
+Node: Completion170664
+Node: Customization172045
+Node: In-buffer settings172630
+Node: The very busy C-c C-c key175861
+Node: Clean view177505
+Node: TTY keys180082
+Node: Interaction181691
+Node: Cooperation182088
+Node: Conflicts183955
+Node: Bugs185547
+Node: Extensions and Hacking187170
+Node: Extensions187656
+Node: Dynamic blocks189226
+Node: History and Acknowledgments191153
+Node: Index196115
+Node: Key Index220474
 
 End Tag Table

+ 1 - 1
org-install.el

@@ -18,10 +18,10 @@
   "Export all files in `org-agenda-files' to iCalendar .ics files." t)
 (autoload 'org-export-icalendar-combine-agenda-files "org"
   "Export all files in `org-agenda-files' to a single combined iCalendar file." t)
+(autoload 'org-batch-agenda "org")
 (autoload 'org-publish-current-file "org-publish" "Publish current file." t)
 (autoload 'org-publish-current-project "org-publish"
   "Publish all files of current project." t)
 (autoload 'org-publish "org-publish" "Publish a project." t)
 (autoload 'org-publish-all "org-publish" "Publish all projects." t)
-
 (provide 'org-install)

+ 36 - 19
org-publish.el

@@ -6,7 +6,7 @@
 ;; Keywords: hypermedia, outlines
 ;; Version:
 
-;; $Id: org-publish.el,v 1.73 2006/06/15 12:43:48 dto Exp $
+;; $Id: org-publish.el,v 1.77 2006/09/07 14:20:05 dto Exp $
 
 ;; This file is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -138,6 +138,7 @@
 
 ;;; List of user-visible changes since version 1.27
 
+;; 1.77: Added :preparation-function, this allows you to use GNU Make etc.
 ;; 1.65: Remove old "composite projects". They're redundant.
 ;; 1.64: Allow meta-projects with :components
 ;; 1.57: Timestamps flag is now called "org-publish-use-timestamps-flag"
@@ -216,6 +217,13 @@ of output formats.
                              org-publish-org-to-html, but other
                              values are possible.
 
+Another property allows you to insert code that prepares a
+project for publishing. For example, you could call GNU Make on a
+certain makefile, to ensure published files are built up to date. 
+
+    :preparation-function   Function to be called before publishing
+                              this project.
+
 Some properties control details of the Org publishing process,
 and are equivalent to the corresponding user variables listed in
 the right column. See the documentation for those variables to
@@ -316,7 +324,10 @@ whether file should be published."
 (defun org-publish-update-timestamp (filename)
   "Update publishing timestamp for file FILENAME."
   (let ((timestamp (org-publish-timestamp-filename filename)))
-    (set-file-times timestamp)))
+    ;; Emacs 21 doesn't have set-file-times
+    (if (fboundp 'set-file-times)
+        (set-file-times timestamp)
+      (call-process "touch" nil 0 nil timestamp))))
 
 
 ;;;; A hash mapping files to project names
@@ -329,42 +340,45 @@ table mapping file names to project names.")
 ;;;; Checking filenames against this hash
 
 
-(defun org-publish-validate-link (link)
-  (gethash (file-truename link) org-publish-files))
+(defun org-publish-validate-link (link &optional directory)
+  (gethash (file-truename (expand-file-name link directory))
+	   org-publish-files))
 
 
 ;;;; Getting project information out of org-publish-project-alist
 
 
 (defun org-publish-get-plists (&optional project-name)
-  "Return a list of property lists for project PROJECT-NAME.
+ "Return a list of property lists for project PROJECT-NAME.
 When argument is not given, return all property lists for all projects."
-  (let ((alist (if project-name
+ (let ((alist (if project-name
 		   (list (assoc project-name org-publish-project-alist))
 		 org-publish-project-alist))
 	(project nil)
 	(plists nil)
+	(single nil)
 	(components nil))
 
-    ;;
-    ;;
-    (while (setq project (pop alist))
-      ;; what kind of project is it?
-      (if (setq components (plist-get (cdr project) :components))
+   ;;
+   ;;
+   (while (setq project (pop alist))
+     ;; what kind of project is it?
+     (if (setq components (plist-get (cdr project) :components))
 	  ;; meta project. annotate each plist with name of enclosing project
-	  (setq plists
-		(append plists
-			(apply 'append
-			       (mapcar 'org-publish-get-plists components))))
+	  (setq single
+		(apply 'append
+		       (mapcar 'org-publish-get-plists components)))
 	;; normal project
-	(setq plists (append plists (list (cdr project)))))
-      ;;
-      (dolist (p plists)
+	(setq single (list (cdr project))))
+     ;;
+     (setq plists (append plists single))
+     (dolist (p single)
 	(let* ((exclude (plist-get p :exclude))
 	       (files (org-publish-get-base-files p exclude)))
 	  (dolist (f files)
 	    (puthash (file-truename f) (car project) org-publish-files)))))
-    plists))
+   plists))
+
 
 
 (defun org-publish-get-base-files (plist &optional exclude-regexp)
@@ -466,8 +480,11 @@ FILENAME is the filename of the file to be published."
 	 (index-p (plist-get plist :auto-index))
          (index-filename (or (plist-get plist :index-filename) "index.org"))
 	 (index-function (or (plist-get plist :index-function) 'org-publish-org-index))
+	 (preparation-function (plist-get plist :preparation-function))
 	 (f nil))
     ;;
+    (when preparation-function
+      (funcall preparation-function))
     (if index-p
 	(funcall index-function plist index-filename))
     (let ((files (org-publish-get-base-files plist exclude-regexp)))

+ 84 - 29
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: 4.46
+;; Version: 4.48
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -61,7 +61,14 @@
 ;;
 ;; Recent changes
 ;; --------------
-;; Version 4.46
+;; Version 4.48
+;;    - Agenda views can be made in batch mode from the command line.
+;;    - `org-store-link' does the right thing in dired-mode.
+;;    - File links can contain environment variables (thanks to Ed Hirgelt).
+;;    - Full Emacs 21 compatibility has been restored.
+;;    - Bug fixes.
+;;
+;; Version 4.47
 ;;    - Custom commands may produce an agenda which contains several blocks,
 ;;      each block created by a different agenda command.  
 ;;    - Agenda commands can be restricted to the current file, region, subtree.
@@ -116,7 +123,7 @@
 
 ;;; Customization variables
 
-(defvar org-version "4.46"
+(defvar org-version "4.47"
   "The version number of the file org.el.")
 (defun org-version ()
   (interactive)
@@ -1917,10 +1924,15 @@ headline  Only export the headline, but skip the tree below it."
   :group 'org-export-general
   :type 'boolean)
 
-(defcustom org-export-with-tags t
-  "Nil means, do not export tags, just remove them from headlines."
+(defcustom org-export-with-tags 'not-in-toc
+  "Nil means, do not export tags, just remove them from headlines.
+If this is the sysmbol `not-in-toc', tags will be removed from table of
+contents entries, but still be shown in the headlines of the document."
   :group 'org-export-general
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Off" nil)
+	  (const :tag "Not in TOC" not-in-toc)
+	  (const :tag "On" t)))
 
 (defgroup org-export-translation nil
   "Options for translating special ascii sequences for the export backends."
@@ -2304,9 +2316,9 @@ Changing this variable requires a restart of Emacs to take effect."
 		    "\\("
 		    "\\([" markers "]\\)"
 		    "\\("
-		    "[^" border markers "]"
+		    (if stacked (concat "[^" border markers "]")) ; FIXME: correct?
 		    body1
-		    "[^" border markers "]"
+		    (if stacked (concat "[^" border markers "]")) ; FIXME: correct?
 		    "\\)"
 		    "\\3\\)"
 		    "\\([" post (if stacked markers) "]\\|$\\)")))))
@@ -2701,6 +2713,10 @@ Also put tags into group 4 if tags are present.")
   "Check if the current buffer is in Org-mode."
   (eq major-mode 'org-mode))
 
+(defsubst org-last (list)
+  "Return the last element of LIST."
+  (car (last list)))
+
 (defun org-let (list &rest body)
   (eval (cons 'let (cons list body))))
 (put 'org-let 'lisp-indent-function 1)
@@ -2806,15 +2822,15 @@ Also put tags into group 4 if tags are present.")
 			     "\\|")
 		  "\\)\\>")
 	  org-todo-line-regexp
-	  (concat "^\\(\\*+\\)[ \t]*\\("
+	  (concat "^\\(\\*+\\)[ \t]*\\(?:\\("
 		  (mapconcat 'regexp-quote org-todo-keywords "\\|")
-		  "\\)? *\\(.*\\)")
+		  "\\)\\>\\)? *\\(.*\\)")
 	  org-nl-done-regexp
 	  (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>")
 	  org-todo-line-tags-regexp
-	  (concat "^\\(\\*+\\)[ \t]*\\("
+	  (concat "^\\(\\*+\\)[ \t]*\\(?:\\("
 		  (mapconcat 'regexp-quote org-todo-keywords "\\|")
-		  "\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)")
+		  "\\)\\>\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)")
 	  org-looking-at-done-regexp (concat "^" org-done-string "\\>")
 	  org-deadline-regexp (concat "\\<" org-deadline-string)
 	  org-deadline-time-regexp
@@ -6325,15 +6341,15 @@ the returned times will be formatted strings."
     (while (setq p (next-single-property-change (point) :org-clock-minutes))
       (goto-char p)
       (when (setq time (get-text-property p :org-clock-minutes))
-	(beginning-of-line 1)
-	(when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$")
-		   (setq level (- (match-end 1) (match-beginning 1)))
-		   (<= level maxlevel))
-	  (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "")
-		hdl (match-string 2)
-		h (/ time 60)
-		m (- time (* 60 h)))
-	  (save-excursion
+	(save-excursion
+	  (beginning-of-line 1)
+	  (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$")
+		     (setq level (- (match-end 1) (match-beginning 1)))
+		     (<= level maxlevel))
+	    (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "")
+		  hdl (match-string 2)
+		  h (/ time 60)
+		  m (- time (* 60 h)))
 	    (goto-char ins)
 	    (if (= level 1) (insert-before-markers "|-\n"))
 	    (insert-before-markers
@@ -6741,6 +6757,20 @@ L   Timeline for current buffer          C   Configure custom agenda commands")
     (setq org-agenda-redo-command redo)
     (goto-char (point-min))))
 
+;;;###autoload
+(defmacro org-batch-agenda (cmd-key &rest parameters)
+  "Run an agenda command in batch mode, send result to STDOUT.
+CMD-KEY is a string that is also a key in `org-agenda-custom-commands'.
+Paramters are alternating variable names and values that will be bound
+before running the agenda command."
+  (let (pars)
+    (while parameters
+      (push (list (pop parameters) (if parameters (pop parameters))) pars))
+    (flet ((read-char-exclusive () (string-to-char cmd-key)))
+      (eval (list 'let (nreverse pars) '(org-agenda nil))))
+    (set-buffer "*Org Agenda*")
+    (princ (buffer-string))))
+
 (defun org-check-for-org-mode ()
   "Make sure current buffer is in org-mode.  Error if not."
   (or (org-mode-p)
@@ -10013,7 +10043,7 @@ If the file does not exist, an error is thrown."
   (setq in-emacs (or in-emacs line search))
   (let* ((file (if (equal path "")
 		   buffer-file-name
-		 path))
+		 (substitute-in-file-name (expand-file-name path))))
 	 (apps (append org-file-apps (org-default-apps)))
 	 (remp (and (assq 'remote apps) (org-file-remote-p file)))
 	 (dirp (if remp nil (file-directory-p file)))
@@ -10241,6 +10271,14 @@ For file links, arg negates `org-context-in-file-links'."
 			   (abbreviate-file-name buffer-file-name))
 	    link (org-make-link cpltxt)))      
 
+     ((eq major-mode 'dired-mode)
+      ;; link to the file in the current line
+      (setq cpltxt (concat "file:"
+			   (abbreviate-file-name
+			    (expand-file-name
+			     (dired-get-filename nil t))))
+	    link (org-make-link cpltxt)))      
+
      ((org-mode-p)
       ;; Just link to current headline
       (setq cpltxt (concat "file:"
@@ -13751,6 +13789,8 @@ underlined headlines.  The default is 3."
 			   (file-name-nondirectory buffer-file-name))))
 	 (email       (plist-get opt-plist :email))
 	 (language    (plist-get opt-plist :language))
+	 (quote-re0   (concat "^[ \t]*" org-quote-string "\\>"))
+	 (quote-re    (concat "^\\(\\*+\\)\\([ \t]*" org-quote-string "\\>\\)"))
 	 (text        nil)
 	 (todo nil)
 	 (lang-words nil))
@@ -13814,6 +13854,12 @@ underlined headlines.  The default is 3."
 					   line lines level))))
 			   (setq txt (org-html-expand-for-ascii txt))
 
+			   (if (and (memq org-export-with-tags '(not-in-toc nil))
+				    (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt))
+			       (setq txt (replace-match "" t t txt)))
+			   (if (string-match quote-re0 txt)
+			       (setq txt (replace-match "" t t txt)))
+
 			   (if org-export-with-section-numbers
 			       (setq txt (concat (org-section-number level)
 						 " " txt)))
@@ -13918,6 +13964,9 @@ underlined headlines.  The default is 3."
 	      (not (equal (char-before (1- (point))) ?\n)))
 	  (insert "\n"))
       (setq char (nth (- umax level) (reverse org-export-ascii-underline)))
+      (unless org-export-with-tags
+	(if (string-match "[ \t]+\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title)
+	    (setq title (replace-match "" t t title))))
       (if org-export-with-section-numbers
 	  (setq title (concat (org-section-number level) " " title)))
       (insert title "\n" (make-string (string-width title) char) "\n")
@@ -14275,6 +14324,11 @@ lang=\"%s\" xml:lang=\"%s\">
 					    (= level umax)
 					    (org-search-todo-below
 					     line lines level))))
+			     (if (and (memq org-export-with-tags '(not-in-toc nil))
+				      (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt))
+				 (setq txt (replace-match "" t t txt)))
+			     (if (string-match quote-re0 txt)
+				 (setq txt (replace-match "" t t txt)))
 			     (if org-export-with-section-numbers
 				 (setq txt (concat (org-section-number level)
 						   " " txt)))
@@ -16162,13 +16216,14 @@ See the individual commands for more information."
      ["Priority Up" org-shiftup t]
      ["Priority Down" org-shiftdown t]
      "--"
-     ["Insert Checkbox" org-insert-todo-heading (org-in-item-p) t]
-     ["Toggle Checkbox" org-ctrl-c-ctrl-c (org-at-item-checkbox-p)]
-     ["Insert [n/m] cookie" (progn (insert "[/]") (org-update-checkbox-count))
-      (or (org-on-heading-p) (org-at-item-p))]
-     ["Insert [%] cookie" (progn (insert "[%]") (org-update-checkbox-count))
-      (or (org-on-heading-p) (org-at-item-p))]
-     ["Update Statistics" org-update-checkbox-count t])
+;     ["Insert Checkbox" org-insert-todo-heading (org-in-item-p)]
+;     ["Toggle Checkbox" org-ctrl-c-ctrl-c (org-at-item-checkbox-p)]
+;     ["Insert [n/m] cookie" (progn (insert "[/]") (org-update-checkbox-count))
+;      (or (org-on-heading-p) (org-at-item-p))]
+;     ["Insert [%] cookie" (progn (insert "[%]") (org-update-checkbox-count))
+;      (or (org-on-heading-p) (org-at-item-p))]
+;     ["Update Statistics" org-update-checkbox-count t]
+     )
     ("Dates and Scheduling"
      ["Timestamp" org-time-stamp t]
      ["Timestamp (inactive)" org-time-stamp-inactive t]

BIN
org.pdf


+ 38 - 3
org.texi

@@ -3,8 +3,8 @@
 @setfilename ../info/org
 @settitle Org Mode Manual
 
-@set VERSION 4.46
-@set DATE August 2006
+@set VERSION 4.48
+@set DATE September 2006
 
 @dircategory Emacs
 @direntry
@@ -209,6 +209,7 @@ Custom agenda views
 * Storing searches::            Type once, use often
 * Block agenda::                All the stuff you need in a single buffer
 * Setting Options::             Changing the rules
+* Batch processing::            Agenda views from the command line
 
 Embedded LaTeX
 
@@ -3541,6 +3542,7 @@ dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
 * Storing searches::            Type once, use often
 * Block agenda::                All the stuff you need in a single buffer
 * Setting Options::             Changing the rules
+* Batch processing::            Agenda views from the command line
 @end menu
 
 @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
@@ -3632,7 +3634,7 @@ your agenda for the current week, all TODO items that carry the tag
 command @kbd{C-c a o} provides a similar view for office tasks.
 
 
-@node Setting Options,  , Block agenda, Custom agenda views
+@node Setting Options, Batch processing, Block agenda, Custom agenda views
 @subsection Setting Options for custom commands
 @cindex options, for custom agenda views
 
@@ -3696,6 +3698,35 @@ this interface, the @emph{values} are just lisp expressions.  So if the
 value is a string, you need to add the double quotes around the value
 yourself.
 
+@node Batch processing,  , Setting Options, Custom agenda views
+@subsection Creating agenda views in batch processing
+
+If you want to print or otherwise reprocess agenda views, it can be
+useful to create an agenda from the command line.  This is the purpose
+of the function @code{org-batch-agenda}.  It takes as a parameter one of
+the strings that are the keys in @code{org-agenda-custom-commands}.  For
+example, to directly print the current TODO list, you could use
+
+@example
+emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
+@end example
+
+@noindent
+You may also modify parameters on the fly like this:
+
+@example
+emacs -batch -l ~/.emacs                                      \
+   -eval '(org-batch-agenda "a"                               \
+            org-agenda-ndays 300                              \
+            org-agenda-include-diary nil                      \
+            org-agenda-files (quote ("~/org/project.org")))'  \
+   | lpr
+@end example
+
+@noindent
+which will produce a 300 day agenda, fully restricted to the Org file
+@file{~/org/projects.org}, not even including the diary.
+
 @node Embedded LaTeX, Exporting, Agenda views, Top
 @chapter Embedded LaTeX
 @cindex @TeX{} interpretation
@@ -4354,6 +4385,8 @@ and where to put published files.
 @tab Directory containing publishing source files
 @item @code{:publishing-directory}
 @tab Directory (possibly remote) where output files will be published.
+@item @code{:preparation-function}
+@tab Function called before starting publishing proxess.
 @end multitable
 @noindent
 
@@ -5265,6 +5298,8 @@ control.
 @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
 conflict with @file{allout.el}.
 @item
+@i{Jason Riedy} sent a patch to fix a bug with export of TODO keywerds.
+@item
 @i{Philip Rooke} created the Org-mode reference card and provided lots
 of feedback.
 @item

BIN
orgcard.pdf


+ 1 - 1
orgcard.tex

@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{4.46}
+\def\orgversionnumber{4.48}
 \def\year{2006}
 g%
 %**start of header