comparison lisp/org/org.el @ 100605:0d3c634e0bd9

2008-12-20 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-get-refile-targets, org-refile-get-location): Use expanded file name to improve comparison. 2008-12-20 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-scan-tags): Rescan for tags, to get the correct upcase/downcase stuff. This slows things down for now, but it works. (org-mode): Make sure the tag-faces regexp is initialized. * org-export-latex.el (org-export-latex-links): Fix bug with undefined label. * org-table.el (org-table-get-specials): Set `org-table-current-last-data-line'. (org-table-current-last-data-line): New variable. (org-table-insert-column, org-table-delete-column) (org-table-move-column, org-table-fix-formulas): Call `org-table-fix-formulas' a second time to fix the $LR references. (org-table-get-specials): Add the $LR references to the tables. (org-table-get-formula): Do not offer last-row names as LHS of formulas. * org.el (org-store-link): Capture link description from `org-id-store-link'. * org-exp.el (org-export-html-format-image): Add the / to the end of the <img> tag. (org-export-format-source-code): Surround example by empty lines, to make sure it will not be inside a paragraph. * org.el (org-ido-switchb): New function. 2008-12-20 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-show): New prefix argument FULL-ENTRY. * org.el (org-sort-entries-or-items): Add a COMPARE-FUNC argument.
author Carsten Dominik <dominik@science.uva.nl>
date Sat, 20 Dec 2008 14:32:06 +0000
parents 3d3aa24c9713
children b095fbcf559e
comparison
equal deleted inserted replaced
100604:bd9f359bf30e 100605:0d3c634e0bd9
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4 ;; 4 ;;
5 ;; Author: Carsten Dominik <carsten at orgmode dot org> 5 ;; Author: Carsten Dominik <carsten at orgmode dot org>
6 ;; Keywords: outlines, hypermedia, calendar, wp 6 ;; Keywords: outlines, hypermedia, calendar, wp
7 ;; Homepage: http://orgmode.org 7 ;; Homepage: http://orgmode.org
8 ;; Version: 6.15d 8 ;; Version: 6.16
9 ;; 9 ;;
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 ;; 11 ;;
12 ;; GNU Emacs is free software: you can redistribute it and/or modify 12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
90 90
91 ;;;; Customization variables 91 ;;;; Customization variables
92 92
93 ;;; Version 93 ;;; Version
94 94
95 (defconst org-version "6.15d" 95 (defconst org-version "6.16"
96 "The version number of the file org.el.") 96 "The version number of the file org.el.")
97 97
98 (defun org-version (&optional here) 98 (defun org-version (&optional here)
99 "Show the org-mode version in the echo area. 99 "Show the org-mode version in the echo area.
100 With prefix arg HERE, insert it at point." 100 With prefix arg HERE, insert it at point."
1338 (defcustom org-refile-targets nil 1338 (defcustom org-refile-targets nil
1339 "Targets for refiling entries with \\[org-refile]. 1339 "Targets for refiling entries with \\[org-refile].
1340 This is list of cons cells. Each cell contains: 1340 This is list of cons cells. Each cell contains:
1341 - a specification of the files to be considered, either a list of files, 1341 - a specification of the files to be considered, either a list of files,
1342 or a symbol whose function or variable value will be used to retrieve 1342 or a symbol whose function or variable value will be used to retrieve
1343 a file name or a list of file names. Nil means, refile to a different 1343 a file name or a list of file names. If you use `org-agenda-files' for
1344 heading in the current buffer. 1344 that, all agenda files will be scanned for targets. Nil means, consider
1345 - A specification of how to find candidate refile targets. This may be 1345 headings in the current buffer.
1346 any of 1346 - A specification of how to select find candidate refile targets. This
1347 may be any of
1347 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag. 1348 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag.
1348 This tag has to be present in all target headlines, inheritance will 1349 This tag has to be present in all target headlines, inheritance will
1349 not be considered. 1350 not be considered.
1350 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by 1351 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by
1351 todo keyword. 1352 todo keyword.
3418 (lambda (c) (make-glyph-code c (and (not (stringp org-ellipsis)) 3419 (lambda (c) (make-glyph-code c (and (not (stringp org-ellipsis))
3419 org-ellipsis))) 3420 org-ellipsis)))
3420 (if (stringp org-ellipsis) org-ellipsis "...")))) 3421 (if (stringp org-ellipsis) org-ellipsis "..."))))
3421 (setq buffer-display-table org-display-table)) 3422 (setq buffer-display-table org-display-table))
3422 (org-set-regexps-and-options) 3423 (org-set-regexps-and-options)
3424 (when (and org-tag-faces (not org-tags-special-faces-re))
3425 ;; tag faces set outside customize.... force initialization.
3426 (org-set-tag-faces 'org-tag-faces org-tag-faces))
3423 ;; Calc embedded 3427 ;; Calc embedded
3424 (org-set-local 'calc-embedded-open-mode "# ") 3428 (org-set-local 'calc-embedded-open-mode "# ")
3425 (modify-syntax-entry ?# "<") 3429 (modify-syntax-entry ?# "<")
3426 (modify-syntax-entry ?@ "w") 3430 (modify-syntax-entry ?@ "w")
3427 (if org-startup-truncated (setq truncate-lines t)) 3431 (if org-startup-truncated (setq truncate-lines t))
5432 (match-string 1 s)) t t s))) 5436 (match-string 1 s)) t t s)))
5433 s) 5437 s)
5434 5438
5435 (defvar org-priority-regexp) ; defined later in the file 5439 (defvar org-priority-regexp) ; defined later in the file
5436 5440
5437 (defun org-sort-entries-or-items (&optional with-case sorting-type getkey-func property) 5441 (defun org-sort-entries-or-items
5442 (&optional with-case sorting-type getkey-func compare-func property)
5438 "Sort entries on a certain level of an outline tree. 5443 "Sort entries on a certain level of an outline tree.
5439 If there is an active region, the entries in the region are sorted. 5444 If there is an active region, the entries in the region are sorted.
5440 Else, if the cursor is before the first entry, sort the top-level items. 5445 Else, if the cursor is before the first entry, sort the top-level items.
5441 Else, the children of the entry at point are sorted. 5446 Else, the children of the entry at point are sorted.
5442 5447
5612 (t (error "Invalid sorting type `%c'" sorting-type))))) 5617 (t (error "Invalid sorting type `%c'" sorting-type)))))
5613 nil 5618 nil
5614 (cond 5619 (cond
5615 ((= dcst ?a) 'string<) 5620 ((= dcst ?a) 'string<)
5616 ((= dcst ?t) 'time-less-p) 5621 ((= dcst ?t) 'time-less-p)
5622 ((= dcst ?f) compare-func)
5617 (t nil))))) 5623 (t nil)))))
5618 (message "Sorting entries...done"))) 5624 (message "Sorting entries...done")))
5619 5625
5620 (defun org-do-sort (table what &optional with-case sorting-type) 5626 (defun org-do-sort (table what &optional with-case sorting-type)
5621 "Sort TABLE of WHAT according to SORTING-TYPE. 5627 "Sort TABLE of WHAT according to SORTING-TYPE.
6265 (condition-case nil 6271 (condition-case nil
6266 (org-entry-get nil "ID") 6272 (org-entry-get nil "ID")
6267 (error nil))))) 6273 (error nil)))))
6268 ;; We can make a link using the ID. 6274 ;; We can make a link using the ID.
6269 (setq link (condition-case nil 6275 (setq link (condition-case nil
6270 (org-id-store-link) 6276 (prog1 (org-id-store-link)
6277 (setq desc (plist-get org-store-link-plist
6278 :description)))
6271 (error 6279 (error
6272 ;; probably before first headline, link to file only 6280 ;; probably before first headline, link to file only
6273 (concat "file:" 6281 (concat "file:"
6274 (abbreviate-file-name buffer-file-name)))))) 6282 (abbreviate-file-name buffer-file-name))))))
6275 (t 6283 (t
7499 (t (error "Bad refiling target description %s" desc))) 7507 (t (error "Bad refiling target description %s" desc)))
7500 (while (setq f (pop files)) 7508 (while (setq f (pop files))
7501 (save-excursion 7509 (save-excursion
7502 (set-buffer (if (bufferp f) f (org-get-agenda-file-buffer f))) 7510 (set-buffer (if (bufferp f) f (org-get-agenda-file-buffer f)))
7503 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) 7511 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f))))
7512 (setq f (expand-file-name f))
7504 (save-excursion 7513 (save-excursion
7505 (save-restriction 7514 (save-restriction
7506 (widen) 7515 (widen)
7507 (goto-char (point-min)) 7516 (goto-char (point-min))
7508 (while (re-search-forward descre nil t) 7517 (while (re-search-forward descre nil t)
7662 (cfunc (if (and org-refile-use-outline-path 7671 (cfunc (if (and org-refile-use-outline-path
7663 org-outline-path-complete-in-steps) 7672 org-outline-path-complete-in-steps)
7664 'org-olpath-completing-read 7673 'org-olpath-completing-read
7665 'org-ido-completing-read)) 7674 'org-ido-completing-read))
7666 (extra (if org-refile-use-outline-path "/" "")) 7675 (extra (if org-refile-use-outline-path "/" ""))
7667 (filename (buffer-file-name (buffer-base-buffer cbuf))) 7676 (filename (expand-file-name
7677 (buffer-file-name (buffer-base-buffer cbuf))))
7668 (tbl (mapcar 7678 (tbl (mapcar
7669 (lambda (x) 7679 (lambda (x)
7670 (if (not (equal filename (nth 1 x))) 7680 (if (not (equal filename (nth 1 x)))
7671 (cons (concat (car x) extra " (" 7681 (cons (concat (car x) extra " ("
7672 (file-name-nondirectory (nth 1 x)) ")") 7682 (file-name-nondirectory (nth 1 x)) ")")
9203 "" 9213 ""
9204 (concat 9214 (concat
9205 (if org-tags-match-list-sublevels 9215 (if org-tags-match-list-sublevels
9206 (make-string (1- level) ?.) "") 9216 (make-string (1- level) ?.) "")
9207 (org-get-heading)) 9217 (org-get-heading))
9208 category tags-list) 9218 category (org-get-tags-at))
9209 priority (org-get-priority txt)) 9219 priority (org-get-priority txt))
9210 (goto-char lspos) 9220 (goto-char lspos)
9211 (setq marker (org-agenda-new-marker)) 9221 (setq marker (org-agenda-new-marker))
9212 (org-add-props txt props 9222 (org-add-props txt props
9213 'org-marker marker 'org-hd-marker marker 'org-category category 9223 'org-marker marker 'org-hd-marker marker 'org-category category
11860 (mapcar 'buffer-name blist))))) 11870 (mapcar 'buffer-name blist)))))
11861 (switch-to-buffer 11871 (switch-to-buffer
11862 (iswitchb-read-buffer 11872 (iswitchb-read-buffer
11863 "Switch-to: " nil t)) 11873 "Switch-to: " nil t))
11864 (or enabled (iswitchb-mode -1)))))) 11874 (or enabled (iswitchb-mode -1))))))
11875
11876 ;;;###autoload
11877 (defun org-ido-switchb (&optional arg)
11878 "Use `org-ido-completing-read' to prompt for an Org buffer to switch to.
11879 With a prefix argument, restrict available to files.
11880 With two prefix arguments, restrict available buffers to agenda files."
11881 (interactive "P")
11882 (let ((blist (cond ((equal arg '(4)) (org-buffer-list 'files))
11883 ((equal arg '(16)) (org-buffer-list 'agenda))
11884 (t (org-buffer-list)))))
11885 (switch-to-buffer
11886 (org-ido-completing-read "Org buffer: "
11887 (mapcar 'buffer-name blist)
11888 nil t))))
11865 11889
11866 (defun org-buffer-list (&optional predicate exclude-tmp) 11890 (defun org-buffer-list (&optional predicate exclude-tmp)
11867 "Return a list of Org buffers. 11891 "Return a list of Org buffers.
11868 PREDICATE can be `export', `files' or `agenda'. 11892 PREDICATE can be `export', `files' or `agenda'.
11869 11893