# HG changeset patch # User John Wiegley # Date 1192060653 0 # Node ID c3969e15712badfeca29292c523074efeddb6861 # Parent a0d3d8180a58a195a9b43c1c419e5eccad4913b5 Installed version 5.11b of org-mode diff -r a0d3d8180a58 -r c3969e15712b lisp/ChangeLog --- a/lisp/ChangeLog Wed Oct 10 23:22:48 2007 +0000 +++ b/lisp/ChangeLog Wed Oct 10 23:57:33 2007 +0000 @@ -1,3 +1,69 @@ +2007-10-10 Carsten Dominik + + * org.el (org-additional-option-like-keywords): New constant. + (org-complete): Use `org-additional-option-like-keywords'. + (org-parse-local-options): New function. + +2007-10-10 Carsten Dominik + + * org.el (org-in-clocktable-p): New function. + (org-clock-report): Only update the table at point, or insert a + new one. + (org-clock-goto): New function. + (org-open-file): Use `start-process-shell-command' instead of + `shell-command' with an ampersand. + (org-deadline, org-schedule): New argument REMOVE to remove the + date from the entry. + (org-agenda-schedule, org-agenda-deadline): Pass the prefix + argument to `org-schedule' and `org-deadline'. + (org-trim): Use the correct expressions for beginning and end of + the string. + (org-get-cleaned-entry): Trim the string before returning it. + (org-clock-find-position): New function. + (org-clock-into-drawer): New option. + (org-agenda-tags-column): Renamed from + `org-agenda-align-tags-to-column'. + (org-agenda-align-tags): Allow negative values for + `org-agenda-tags-column'. + (org-insert-labeled-timestamps-before-properties-drawer): Variable + removed. + (org-agenda-to-appt): new optional argument FILTER. + (org-completion-fallback-command): New variable. + (org-complete): Use `org-completion-fallback-command'. + (org-find-base-buffer-visiting): Catch the case that there is no + buffer visiting the file. + (org-property-or-variable-value): New function. + (org-todo): Use `org-property-or-variable-value' + (org-agenda-compact-blocks): New option. + (org-prepare-agenda, org-agenda-list): Use + `org-agenda-compact-blocks'. + (org-agenda-schedule, org-agenda-deadline): Call + `org-agenda-show-new-time'. + (org-agenda-show-new-time): New argument PREFIX. + (org-colgroup-info-to-vline-list): Fixed but that cause a + shift in the vertical lines. + (org-buffer-property-keys): New argument INCLUDE-DEFAULTS. + (org-maybe-renumber-ordered-list, org-cycle-list-bullet) + (org-indent-item): No arg in call to `org-fix-bullet-type'. + (org-fix-bullet-type): Removed argument. + (org-read-date): Check for am/pm twice, to catch the end time. + (org-goto-map): Use `suppress-keymap'. + (org-remember-apply-template): Respect the dynamically scoped + selection character. + + * org.texi (Appointment reminders): New section. + +2007-10-10 Bastien Guerry + + * org-export-latex.el (org-export-latex-protect-string): + Renaming of `org-latex-protect'. + (org-export-latex-emphasis-alist): By default, don't protect + any emphasis formatter from further conversion. + (org-export-latex-tables): honor column grouping for tables. + (org-export-latex-title-command): New option. + (org-export-latex-treat-backslash-char): Use \textbackslash{} to + export backslash character. + 2007-10-10 Stefan Monnier * frame.el (frame-inherited-parameters): Remove unused `environment' diff -r a0d3d8180a58 -r c3969e15712b lisp/textmodes/org-export-latex.el --- a/lisp/textmodes/org-export-latex.el Wed Oct 10 23:22:48 2007 +0000 +++ b/lisp/textmodes/org-export-latex.el Wed Oct 10 23:57:33 2007 +0000 @@ -1,10 +1,15 @@ -;;; org-export-latex.el --- LaTeX exporter for Org-mode -;; Copyright (C) 2007 Free Software Foundation, Inc. + ;;; org-export-latex.el --- LaTeX exporter for org-mode +;; +;; copyright (c) 2007 free software foundation, inc. ;; +;; Emacs Lisp Archive Entry +;; Filename: org-export-latex.el +;; Version: 5.11 ;; Author: Bastien Guerry -;; Keywords: org organizer latex export convert -;; Homepage: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el -;; Version: 5.09 +;; Maintainer: Bastien Guerry +;; Keywords: org, wp, tex +;; Description: Converts an org-mode buffer into LaTeX +;; URL: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el ;; ;; This file is part of GNU Emacs. ;; @@ -83,12 +88,17 @@ :type 'alist) (defcustom org-export-latex-emphasis-alist - '(("*" "\\textbf{%s}") - ("/" "\\emph{%s}") - ("_" "\\underline{%s}") - ("+" "\\texttt{%s}") - ("=" "\\texttt{%s}")) - "Alist of LaTeX expressions to convert emphasis fontifiers." + '(("*" "\\textbf{%s}" nil) + ("/" "\\emph{%s}" nil) + ("_" "\\underline{%s}" nil) + ("+" "\\texttt{%s}" nil) + ("=" "\\texttt{%s}" nil)) + "Alist of LaTeX expressions to convert emphasis fontifiers. +Each element of the list is a list of three elements. +The first element is the character used as a marker for fontification. +The second element is a formatting string to wrap fontified text with. +The third element decides whether to protect converted text from other +conversions." :group 'org-export-latex :type 'alist) @@ -101,6 +111,14 @@ :group 'org-export-latex :type 'string) +(defcustom org-export-latex-title-command "\\maketitle" + "The command used to insert the title just after \\begin{document}. +If this string contains the formatting specification \"%s\" then +it will be used as a formatting string, passing the title as an +argument." + :group 'org-export-latex + :type 'string) + (defcustom org-export-latex-date-format "%d %B %Y" "Format string for \\date{...}." @@ -124,11 +142,14 @@ :type 'alist) (defcustom org-export-latex-low-levels 'description - "Choice for converting sections that are below the current -admitted level of sectioning. This can be either nil (ignore the -sections), 'description (convert them as description lists) or a -string to be used instead of \\section{%s} (a %s for inserted the -headline is mandatory)." + "How to convert sections below the current level of sectioning, +as specified by `org-export-headline-levels' or the value of \"H:\" +in Org's #+OPTION line. + +This can be either nil (skip the sections), 'description (convert +the sections as descriptive lists) or a string to be used instead +of \\section{%s}. In this latter case, the %s stands here for the +inserted headline and is mandatory." :group 'org-export-latex :type '(choice (const :tag "Ignore" nil) (symbol :tag "Convert as descriptive list" description) @@ -248,7 +269,8 @@ (message "Exporting to LaTeX...") (org-update-radio-target-regexp) (org-export-latex-set-initial-vars ext-plist) - (let* ((opt-plist org-latex-options-plist) + (let* ((wcf (current-window-configuration)) + (opt-plist org-latex-options-plist) (filename (concat (file-name-as-directory (org-export-directory :LaTeX ext-plist)) (file-name-sans-extension @@ -284,15 +306,27 @@ region :emph-multiline t :for-LaTeX t :comments nil - :add-text text + :add-text (if (eq to-buffer 'string) nil text) :skip-before-1st-heading skip :LaTeX-fragments nil))) - (set-buffer buffer) + + (set-buffer buffer) (erase-buffer) - (unless body-only (insert preamble)) - (when text (insert (org-export-latex-content text) "\n\n")) - (unless skip (insert first-lines)) + (and (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) + + ;; insert the preamble and initial document commands + (unless (or (eq to-buffer 'string) body-only) + (insert preamble)) + + ;; insert text found in #+TEXT + (when (and text (not (eq to-buffer 'string))) + (insert (org-export-latex-content text) "\n\n")) + + ;; insert lines before the first headline + (unless (or skip (eq to-buffer 'string)) + (insert first-lines)) ;; handle the case where the region does not begin with a section (when region-p @@ -300,25 +334,30 @@ (insert string-for-export) (org-export-latex-first-lines)))) + ;; export the content of headlines (org-export-latex-global (with-temp-buffer (insert string-for-export) (goto-char (point-min)) - (re-search-forward "^\\(\\*+\\) " nil t) - (let* ((asters (length (match-string 1))) - (level (if odd (- asters 2) (- asters 1)))) - (setq org-latex-add-level - (if odd (1- (/ (1+ asters) 2)) (1- asters))) - (org-export-latex-parse-global level odd)))) - + (when (re-search-forward "^\\(\\*+\\) " nil t) + (let* ((asters (length (match-string 1))) + (level (if odd (- asters 2) (- asters 1)))) + (setq org-latex-add-level + (if odd (1- (/ (1+ asters) 2)) (1- asters))) + (org-export-latex-parse-global level odd))))) + + ;; finalization (unless body-only (insert "\n\\end{document}")) (or to-buffer (save-buffer)) (goto-char (point-min)) (message "Exporting to LaTeX...done") - (if (eq to-buffer 'string) - (prog1 (buffer-substring (point-min) (point-max)) - (kill-buffer (current-buffer))) - (current-buffer)))) + (prog1 + (if (eq to-buffer 'string) + (prog1 (buffer-substring (point-min) (point-max)) + (kill-buffer (current-buffer))) + (current-buffer)) + (set-window-configuration wcf)))) + ;;; Parsing functions: (defun org-export-latex-parse-global (level odd) @@ -484,8 +523,11 @@ ;;; Exporting internals: -(defun org-latex-protect (string) - (add-text-properties 0 (length string) '(org-protected t) string) string) +(defun org-export-latex-protect-string (string) + "Prevent further conversion for STRING by adding the +org-protect property." + (add-text-properties + 0 (length string) '(org-protected t) string) string) (defun org-export-latex-protect-char-in-string (char-list string) "Add org-protected text-property to char from CHAR-LIST in STRING." @@ -518,54 +560,65 @@ "Make the LaTeX preamble and return it as a string. Argument OPT-PLIST is the options plist for current buffer." (let ((toc (plist-get opt-plist :table-of-contents))) - (concat (if (plist-get opt-plist :time-stamp-file) - (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) - - ;; LaTeX custom preamble - org-export-latex-preamble "\n" - - ;; LaTeX packages - (if org-export-latex-packages-alist - (mapconcat (lambda(p) - (if (equal "" (car p)) - (format "\\usepackage{%s}" (cadr p)) - (format "\\usepackage[%s]{%s}" - (car p) (cadr p)))) - org-export-latex-packages-alist "\n") "") - "\n\\begin{document}\n\n" - - ;; title - (format - "\\title{%s}\n" - (or (plist-get opt-plist :title) - (and (not - (plist-get opt-plist :skip-before-1st-heading)) - (org-export-grab-title-from-buffer)) - (and buffer-file-name - (file-name-sans-extension - (file-name-nondirectory buffer-file-name))) - "UNTITLED")) - - ;; author info - (if (plist-get opt-plist :author-info) - (format "\\author{%s}\n" - (or (plist-get opt-plist :author) user-full-name)) - (format "%%\\author{%s}\n" - (or (plist-get opt-plist :author) user-full-name))) - - ;; date - (format "\\date{%s}\n" - (format-time-string - (or (plist-get opt-plist :date) - org-export-latex-date-format))) - - "\\maketitle\n\n" - ;; table of contents - (if (and (plist-get opt-plist :section-numbers) toc) - (format "\\setcounter{tocdepth}{%s}\n" - (plist-get opt-plist :headline-levels)) "") - (if (and (plist-get opt-plist :section-numbers) toc) - "\\tableofcontents\n" "\n")))) + (concat + (if (plist-get opt-plist :time-stamp-file) + (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) + + ;; insert LaTeX custom preamble + org-export-latex-preamble "\n" + + ;; insert information on LaTeX packages + (when org-export-latex-packages-alist + (mapconcat (lambda(p) + (if (equal "" (car p)) + (format "\\usepackage{%s}" (cadr p)) + (format "\\usepackage[%s]{%s}" + (car p) (cadr p)))) + org-export-latex-packages-alist "\n")) + + ;; insert the title + (format + "\\title{%s}\n" + (or (plist-get opt-plist :title) + (and (not + (plist-get opt-plist :skip-before-1st-heading)) + (org-export-grab-title-from-buffer)) + (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name))) + "UNTITLED")) + + ;; insert author info + (if (plist-get opt-plist :author-info) + (format "\\author{%s}\n" + (or (plist-get opt-plist :author) user-full-name)) + (format "%%\\author{%s}\n" + (or (plist-get opt-plist :author) user-full-name))) + + ;; insert the date + (format "\\date{%s}\n" + (format-time-string + (or (plist-get opt-plist :date) + org-export-latex-date-format))) + + ;; beginning of the document + "\n\\begin{document}\n\n" + + ;; insert the title command + (if (string-match "%s" org-export-latex-title-command) + (format org-export-latex-title-command + (plist-get opt-plist :title)) + org-export-latex-title-command) + "\n\n" + + ;; table of contents + (when (and org-export-with-toc + (plist-get opt-plist :section-numbers)) + (cond ((numberp toc) + (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n" + (min toc (plist-get opt-plist :headline-levels)))) + (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n" + (plist-get opt-plist :headline-levels)))))))) (defun org-export-latex-first-lines (&optional comments) "Export the first lines before first headline. @@ -640,6 +693,7 @@ (plist-get org-latex-options-plist :tables)) (org-export-latex-fixed-width (plist-get org-latex-options-plist :fixed-width)) + ;; return string (buffer-substring (point-min) (point-max)))) (defun org-export-latex-quotation-marks () @@ -658,7 +712,7 @@ (mapc (lambda(l) (goto-char (point-min)) (while (re-search-forward (car l) nil t) (let ((rpl (concat (match-string 1) (cadr l)))) - (org-latex-protect rpl) + (org-export-latex-protect-string rpl) (org-if-unprotected (replace-match rpl t t))))) quote-rpl))) @@ -688,42 +742,42 @@ ;; Put the point where to check for org-protected (unless (get-text-property (match-beginning 2) 'org-protected) (cond ((member (match-string 2) '("\\$" "$")) - (if (equal (match-string 2) "\\$") - (replace-match (concat (match-string 1) "$" - (match-string 3)) t t) - (replace-match (concat (match-string 1) "\\$" - (match-string 3)) t t))) - ((member (match-string 2) '("&" "#" "%")) - (if (equal (match-string 1) "\\") - (replace-match (match-string 2) t t) - (replace-match (concat (match-string 1) "\\" - (match-string 2)) t t))) - ((equal (match-string 2) "~") - (cond ((equal (match-string 1) "\\") nil) - ((eq 'org-link (get-text-property 0 'face (match-string 2))) - (replace-match (concat (match-string 1) "\\~") t t)) - (t (replace-match - (org-latex-protect - (concat (match-string 1) "\\~{}")) t t)))) - ((member (match-string 2) '("{" "}")) - (unless (save-match-data (org-inside-LaTeX-fragment-p)) - (if (equal (match-string 1) "\\") - (replace-match (match-string 2) t t) - (replace-match (concat (match-string 1) "\\" - (match-string 2)) t t))))) + (if (equal (match-string 2) "\\$") + (replace-match (concat (match-string 1) "$" + (match-string 3)) t t) + (replace-match (concat (match-string 1) "\\$" + (match-string 3)) t t))) + ((member (match-string 2) '("&" "%" "#")) + (if (equal (match-string 1) "\\") + (replace-match (match-string 2) t t) + (replace-match (concat (match-string 1) "\\" + (match-string 2)) t t))) + ((equal (match-string 2) "~") + (cond ((equal (match-string 1) "\\") nil) + ((eq 'org-link (get-text-property 0 'face (match-string 2))) + (replace-match (concat (match-string 1) "\\~") t t)) + (t (replace-match + (org-export-latex-protect-string + (concat (match-string 1) "\\~{}")) t t)))) + ((member (match-string 2) '("{" "}")) + (unless (save-match-data (org-inside-LaTeX-fragment-p)) + (if (equal (match-string 1) "\\") + (replace-match (match-string 2) t t) + (replace-match (concat (match-string 1) "\\" + (match-string 2)) t t))))) (unless (save-match-data (org-inside-LaTeX-fragment-p)) - (cond ((equal (match-string 2) "\\") - (replace-match (or (save-match-data - (org-export-latex-treat-backslash-char - (match-string 1) - (match-string 3))) "") t t)) - ((member (match-string 2) '("_" "^")) - (replace-match (or (save-match-data - (org-export-latex-treat-sub-super-char - sub-superscript - (match-string 1) - (match-string 2) - (match-string 3))) "") t t))))))) + (cond ((equal (match-string 2) "\\") + (replace-match (or (save-match-data + (org-export-latex-treat-backslash-char + (match-string 1) + (match-string 3))) "") t t)) + ((member (match-string 2) '("_" "^")) + (replace-match (or (save-match-data + (org-export-latex-treat-sub-super-char + sub-superscript + (match-string 1) + (match-string 2) + (match-string 3))) "") t t))))))) '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" @@ -732,7 +786,10 @@ "\\(.\\|^\\)\\(%\\)" "\\(.\\|^\\)\\({\\)" "\\(.\\|^\\)\\(}\\)" - "\\(.\\|^\\)\\(~\\)"))) + "\\(.\\|^\\)\\(~\\)" + ;; (?\< . "\\textless{}") + ;; (?\> . "\\textgreater{}") + ))) (defun org-export-latex-treat-sub-super-char (subsup string-before char string-after) @@ -759,9 +816,9 @@ (format "$%s%s{%s}$" string-before char (match-string 1 string-after))) (subsup (concat "$" string-before char string-after "$")) - (t (org-latex-protect + (t (org-export-latex-protect-string (concat string-before "\\" char "{}" string-after))))) - (t (org-latex-protect + (t (org-export-latex-protect-string (concat string-before "\\" char "{}" string-after))))) (defun org-export-latex-treat-backslash-char (string-before string-after) @@ -775,17 +832,21 @@ ((and (not (string-match "^[ \n\t]" string-after)) (not (string-match "[ \t]\\'\\|^" string-before))) ;; backslash is inside a word - (concat string-before "$\\backslash$" string-after)) + (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))) ((not (or (equal string-after "") (string-match "^[ \t\n]" string-after))) ;; backslash might escape a character (like \#) or a user TeX ;; macro (like \setcounter) - (concat string-before "\\" string-after)) + (org-export-latex-protect-string + (concat string-before "\\" string-after))) ((and (string-match "^[ \t\n]" string-after) (string-match "[ \t\n]\\'" string-before)) ;; backslash is alone, convert it to $\backslash$ - (concat string-before "$\\backslash$" string-after)) - (t (concat string-before "$\\backslash$" string-after)))) + (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))) + (t (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))))) (defun org-export-latex-keywords (timestamps) "Convert special keywords to LaTeX. @@ -801,6 +862,7 @@ (defun org-export-latex-fixed-width (opt) "When OPT is non-nil convert fixed-width sections to LaTeX." (goto-char (point-min)) + ;; FIXME the search shouldn't be performed on already converted text (while (re-search-forward "^[ \t]*:" nil t) (if opt (progn (goto-char (match-beginning 0)) @@ -816,7 +878,6 @@ (match-string 2)) t t) (forward-line)))))) -;; FIXME Use org-export-highlight-first-table-line ? (defun org-export-latex-lists () "Convert lists to LaTeX." (goto-char (point-min)) @@ -883,52 +944,87 @@ ;; Add a trailing \n after list conversion "\n")) -(defun org-export-latex-tables (opt) - "When OPT is non-nil convert tables to LaTeX." +;; FIXME Use org-export-highlight-first-table-line ? +(defun org-export-latex-tables (insert) + "Convert tables to LaTeX and INSERT it." (goto-char (point-min)) (while (re-search-forward "^\\([ \t]*\\)|" nil t) - ;; Re-align the table to update org-table-last-alignment - ;; (save-excursion (save-match-data (org-table-align))) - (let (tbl-list - (beg (match-beginning 0)) - (end (save-excursion - (re-search-forward - (concat "^" (regexp-quote (match-string 1)) - "[^|]\\|\\'") nil t) (match-beginning 0)))) - (beginning-of-line) + ;; FIXME really need to save-excursion? + (save-excursion (org-table-align)) + (let* ((beg (org-table-begin)) + (end (org-table-end)) + (raw-table (buffer-substring-no-properties beg end)) + fnum line lines olines gr colgropen line-fmt alignment) (if org-export-latex-tables-verbatim - (let* ((raw-table (buffer-substring beg end)) - (tbl (concat "\\begin{verbatim}\n" raw-table + (let* ((tbl (concat "\\begin{verbatim}\n" raw-table "\\end{verbatim}\n"))) (apply 'delete-region (list beg end)) (insert tbl)) - (progn - (while (not (eq end (point))) - (if (looking-at "[ \t]*|\\([^-|].+\\)|[ \t]*$") - (push (split-string (org-trim (match-string 1)) "|") tbl-list) - (push 'hline tbl-list)) - (forward-line)) - ;; comment region out instead of deleting it ? + (progn + (setq lines (split-string raw-table "\n" t)) (apply 'delete-region (list beg end)) - (when opt (insert (orgtbl-to-latex (nreverse tbl-list) - nil) "\n\n"))))))) + (when org-export-table-remove-special-lines + (setq lines (org-table-clean-before-export lines))) + ;; make a formatting string to reflect aligment + (setq olines lines) + (while (and (not line-fmt) (setq line (pop olines))) + (unless (string-match "^[ \t]*|-" line) + (setq fields (org-split-string line "[ \t]*|[ \t]*")) + (setq fnum (make-vector (length fields) 0)) + (setq line-fmt + (mapconcat + (lambda (x) + (setq gr (pop org-table-colgroup-info)) + (format "%s%%s%s" + (cond ((eq gr ':start) + (prog1 (if colgropen "|" "") + (setq colgropen t))) + ((eq gr ':startend) + (prog1 (if colgropen "|" "|") + (setq colgropen nil))) + (t "")) + (if (memq gr '(:end :startend)) + (progn (setq colgropen nil) "|") + ""))) + fnum "")))) + ;; maybe remove the first and last "|" + (when (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt) + (setq line-fmt (match-string 2 line-fmt))) + ;; format alignment + (setq align (apply 'format + (cons line-fmt + (mapcar (lambda (x) (if x "r" "l")) + org-table-last-alignment)))) + ;; prepare the table to send to orgtbl-to-latex + (setq lines + (mapcar + (lambda(elem) + (or (and (string-match "[ \t]*|-+" elem) 'hline) + (split-string (org-trim elem) "|" t))) + lines)) + (when insert + (insert (orgtbl-to-latex + lines `(:tstart ,(concat "\\begin{tabular}{" align "}"))) + "\n\n"))))))) (defun org-export-latex-fontify () "Convert fontification to LaTeX." (goto-char (point-min)) (while (re-search-forward org-emph-re nil t) ;; The match goes one char after the *string* - (unless (get-text-property (1- (point)) 'org-protected) - (replace-match - (concat (match-string 1) - (format - (org-export-latex-protect-char-in-string - '("\\" "{" "}") - (cadr (assoc (match-string 3) - org-export-latex-emphasis-alist))) - (match-string 4)) - (match-string 5)) t t) - (backward-char)))) + (let ((emph (assoc (match-string 3) + org-export-latex-emphasis-alist)) + rpl) + (unless (get-text-property (1- (point)) 'org-protected) + (setq rpl (concat (match-string 1) + (format (org-export-latex-protect-char-in-string + '("\\" "{" "}") (cadr emph)) + (match-string 4)) + (match-string 5))) + (if (caddr emph) + (setq rpl (org-export-latex-protect-string rpl))) + (replace-match rpl t t))) + (backward-char))) (defun org-export-latex-links () ;; Make sure to use the LaTeX hyperref and graphicx package @@ -982,12 +1078,6 @@ (&optional commentsp) "Clean stuff in the LaTeX export." - ;; align all tables - (goto-char (point-min)) - (while (re-search-forward "^\\([ \t]*\\)|" nil t) - ;; Re-align the table to update org-table-last-alignment - (org-table-align)) - ;; Preserve line breaks (goto-char (point-min)) (while (re-search-forward "\\\\\\\\" nil t) @@ -998,13 +1088,13 @@ (goto-char (point-min)) (let ((case-fold-search nil) rpl) (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) - (replace-match (org-latex-protect + (replace-match (org-export-latex-protect-string (concat (match-string 1) "\\LaTeX{}")) t t))) ;; Convert horizontal rules (goto-char (point-min)) (while (re-search-forward "^----+.$" nil t) - (replace-match (org-latex-protect "\\hrule") t t)) + (replace-match (org-export-latex-protect-string "\\hrule") t t)) ;; Protect LaTeX \commands{...} (goto-char (point-min)) @@ -1018,7 +1108,7 @@ (concat "<<>>?\\((INVISIBLE)\\)?") nil t) (replace-match - (org-latex-protect + (org-export-latex-protect-string (format "\\label{%s}%s"(match-string 1) (if (match-string 2) "" (match-string 1)))) t t)) @@ -1035,7 +1125,7 @@ (while (re-search-forward "\\[[0-9]+\\]" nil t) (when (save-match-data (save-excursion (beginning-of-line) - (looking-at "[^:|]"))) + (looking-at "[^:|#]"))) (let ((foot-beg (match-beginning 0)) (foot-end (match-end 0)) (foot-prefix (match-string 0)) diff -r a0d3d8180a58 -r c3969e15712b lisp/textmodes/org.el --- a/lisp/textmodes/org.el Wed Oct 10 23:22:48 2007 +0000 +++ b/lisp/textmodes/org.el Wed Oct 10 23:57:33 2007 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 5.08 +;; Version: 5.11b ;; ;; This file is part of GNU Emacs. ;; @@ -83,7 +83,7 @@ ;;; Version -(defconst org-version "5.09" +(defconst org-version "5.11" "The version number of the file org.el.") (defun org-version () (interactive) @@ -120,7 +120,16 @@ (unwind-protect (progn ,@body) (goto-line _line) - (move-to-column _col)))) + (move-to-column _col)))) + +(defmacro org-without-partial-completion (&rest body) + `(let ((pc-mode (and (boundp 'partial-completion-mode) + partial-completion-mode))) + (unwind-protect + (progn + (if pc-mode (partial-completion-mode -1)) + ,@body) + (if pc-mode (partial-completion-mode 1))))) ;;; The custom variables @@ -131,6 +140,13 @@ :group 'hypermedia :group 'calendar) +;; FIXME: Needs a separate group... +(defcustom org-completion-fallback-command 'hippie-expand + "The expansion command called by \\[org-complete] in normal context. +Normal means, no org-mode-specific context." + :group 'org + :type 'function) + (defgroup org-startup nil "Options concerning startup of Org-mode." :tag "Org Startup" @@ -415,7 +431,7 @@ :tag "Org Cycle" :group 'org-structure) -(defcustom org-drawers '("PROPERTIES") +(defcustom org-drawers '("PROPERTIES" "CLOCK") "Names of drawers. Drawers are not opened by cycling on the headline above. Drawers only open with a TAB on the drawer line itself. A drawer looks like this: @@ -714,7 +730,9 @@ (string :tag "Use this keyword"))) (defcustom org-archive-stamp-time t - "Non-nil means, add a time stamp to entries moved to an archive file." + "Non-nil means, add a time stamp to entries moved to an archive file. +This variable is obsolete and has no effect anymore, instead add ot remove +`time' from the variablle `org-archive-save-context-info'." :group 'org-archive :type 'boolean) @@ -736,7 +754,8 @@ the archived entry, with a prefix \"PRE_ARCHIVE_\", to remember this information." :group 'org-archive - :type '(set + :type '(set :greedy t + (const :tag "Time" time) (const :tag "File" file) (const :tag "Category" category) (const :tag "TODO state" todo) @@ -1599,7 +1618,10 @@ #+STARTUP: nologging #+STARTUP: lognotedone #+STARTUP: lognotestate - #+STARTUP: lognoteclock-out" + #+STARTUP: lognoteclock-out + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords." :group 'org-todo :group 'org-progress :type '(choice @@ -1646,11 +1668,32 @@ (defcustom org-log-repeat t "Non-nil means, prompt for a note when REPEAT is resetting a TODO entry. -When nil, no note will be taken." +When nil, no note will be taken. +This option can also be set with on a per-file-basis with + + #+STARTUP: logrepeat + #+STARTUP: nologrepeat + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords." :group 'org-todo :group 'org-progress :type 'boolean) +(defcustom org-clock-into-drawer 2 + "Should clocking info be wrapped into a drawer? +When t, clocking info will always be inserted into a :CLOCK: drawer. +If necessary, the drawer will be created. +When nil, the drawer will not be created, but used when present. +When an integer and the number of clocking entries in an item +reaches or exceeds this number, a drawer will be created." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "Always" t) + (const :tag "Only when drawer exists" nil) + (integer :tag "When at least N clock entries"))) + (defcustom org-clock-out-when-done t "When t, the clock will be stopped when the relevant entry is marked DONE. Nil means, clock will keep running until stopped explicitly with @@ -1681,6 +1724,13 @@ :group 'org-priorities :type 'character) +(defcustom org-priority-start-cycle-with-default t + "Non-nil means, start with default priority when starting to cycle. +When this is nil, the first step in the cycle will be (depending on the +command used) one higher or lower that the default priority." + :group 'org-priorities + :type 'boolean) + (defgroup org-time nil "Options concerning time stamps and deadlines in Org-mode." :tag "Org Time" @@ -1694,15 +1744,6 @@ :group 'org-time :type 'boolean) -(defcustom org-insert-labeled-timestamps-before-properties-drawer t - "Non-nil means, always insert planning info before property drawer. -When this is nil and there is a property drawer *directly* after -the headline, move the planning info into the drawer. If the property -drawer separated from the headline by at least one line, this variable -has no effect." - :group 'org-time - :type 'boolean) - (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") "Formats for `format-time-string' which are used for time stamps. It is not recommended to change this constant.") @@ -1824,11 +1865,11 @@ "Non-nil means, fast tags selection interface will also offer TODO states. This is an undocumented feature, you should not rely on it.") -(defcustom org-tags-column 48 +(defcustom org-tags-column -80 "The column to which tags should be indented in a headline. If this number is positive, it specifies the column. If it is negative, it means that the tags should be flushright to that column. For example, --79 works well for a normal 80 character screen." +-80 works well for a normal 80 character screen." :group 'org-tags :type 'integer) @@ -1962,6 +2003,12 @@ :group 'org-agenda :type 'sexp) +(defcustom org-agenda-compact-blocks nil + "Non-nil means, make the block agenda more compact. +This is done by leaving out unnecessary lines." + :group 'org-agenda + :type nil) + (defgroup org-agenda-export nil "Options concerning exporting agenda views in Org-mode." :tag "Org Agenda Export" @@ -2192,7 +2239,7 @@ (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. And -it applied only to the actualy date of the scheduling. Warnings about +it applies only to the actual 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 @@ -2467,9 +2514,9 @@ :group 'org-agenda-sorting :type 'boolean) -(defgroup org-agenda-prefix nil +(defgroup org-agenda-line-format nil "Options concerning the entry prefix in the Org-mode agenda display." - :tag "Org Agenda Prefix" + :tag "Org Agenda Line Format" :group 'org-agenda) (defcustom org-agenda-prefix-format @@ -2532,7 +2579,7 @@ (cons (const timeline) (string :tag "Format")) (cons (const todo) (string :tag "Format")) (cons (const tags) (string :tag "Format")))) - :group 'org-agenda-prefix) + :group 'org-agenda-line-format) (defvar org-prefix-format-compiled nil "The compiled version of the most recently used prefix format. @@ -2549,7 +2596,7 @@ The option can be t or nil. It may also be the symbol `beg', indicating that the time should only be removed what it is located at the beginning of the headline/diary entry." - :group 'org-agenda-prefix + :group 'org-agenda-line-format :type '(choice (const :tag "Always" t) (const :tag "Never" nil) @@ -2560,7 +2607,7 @@ "Default duration for appointments that only have a starting time. When nil, no duration is specified in such cases. When non-nil, this must be the number of minutes, e.g. 60 for one hour." - :group 'org-agenda-prefix + :group 'org-agenda-line-format :type '(choice (integer :tag "Minutes") (const :tag "No default duration"))) @@ -2570,7 +2617,7 @@ "Non-nil means, remove the tags from the headline copy in the agenda. When this is the symbol `prefix', only remove tags when `org-agenda-prefix-format' contains a `%T' specifier." - :group 'org-agenda-prefix + :group 'org-agenda-line-format :type '(choice (const :tag "Always" t) (const :tag "Never" nil) @@ -2580,11 +2627,17 @@ (defvaralias 'org-agenda-remove-tags-when-in-prefix 'org-agenda-remove-tags)) -(defcustom org-agenda-align-tags-to-column 65 - "Shift tags in agenda items to this column." - :group 'org-agenda-prefix +(defcustom org-agenda-tags-column -80 + "Shift tags in agenda items to this column. +If this number is positive, it specifies the column. If it is negative, +it means that the tags should be flushright to that column. For example, +-80 works well for a normal 80 character screen." + :group 'org-agenda-line-format :type 'integer) +(if (fboundp 'defvaralias) + (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)) + (defgroup org-latex nil "Options for embedding LaTeX code into Org-mode" :tag "Org LaTeX" @@ -2610,7 +2663,7 @@ \"$$\" find math expressions surrounded by $$....$$ \"\\(\" find math expressions surrounded by \\(...\\) \"\\ [\" find math expressions surrounded by \\ [...\\]" - :group 'org-export-latex + :group 'org-latex :type 'plist) (defcustom org-format-latex-header "\\documentclass{article} @@ -2622,7 +2675,7 @@ \\usepackage[mathscr]{eucal} \\pagestyle{empty} % do not remove" "The document header used for processing LaTeX fragments." - :group 'org-export-latex + :group 'org-latex :type 'string) (defgroup org-export nil @@ -2980,6 +3033,11 @@ :group 'org-export-html :type 'coding-system) +(defcustom org-export-html-extension "html" + "The extension for exported HTML files." + :group 'org-export-html + :type 'string) + (defcustom org-export-html-style "