comparison lisp/org/org.el @ 105166:172e1951f385

* org.el (org-tree-to-indirect-buffer, org-convert-to-oddeven-levels) (org-shiftselect-error, org-ctrl-c-ctrl-c): * org-agenda.el (org-agenda-undo, org-check-for-org-mode): * org-attach.el (org-attach-check-absolute-path): * org-docbook.el (org-export-as-docbook): * org-html.el (org-export-as-html): * org-id.el (org-id-update-id-locations): * org-table.el (org-table-fedit-lisp-indent, orgtbl-send-table): Fix typos in error messages.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 23 Sep 2009 23:55:26 +0000
parents 86b7fe7d1d8f
children 29697591d45b
comparison
equal deleted inserted replaced
105165:fd22b3e4d41f 105166:172e1951f385
5659 (org-set-frame-title (concat "Indirect: " heading))) 5659 (org-set-frame-title (concat "Indirect: " heading)))
5660 ((eq org-indirect-buffer-display 'current-window) 5660 ((eq org-indirect-buffer-display 'current-window)
5661 (switch-to-buffer ibuf)) 5661 (switch-to-buffer ibuf))
5662 ((eq org-indirect-buffer-display 'other-window) 5662 ((eq org-indirect-buffer-display 'other-window)
5663 (pop-to-buffer ibuf)) 5663 (pop-to-buffer ibuf))
5664 (t (error "Invalid value."))) 5664 (t (error "Invalid value")))
5665 (if (featurep 'xemacs) 5665 (if (featurep 'xemacs)
5666 (save-excursion (org-mode) (turn-on-font-lock))) 5666 (save-excursion (org-mode) (turn-on-font-lock)))
5667 (narrow-to-region beg end) 5667 (narrow-to-region beg end)
5668 (show-all) 5668 (show-all)
5669 (goto-char pos) 5669 (goto-char pos)
6071 (interactive) 6071 (interactive)
6072 (goto-char (point-min)) 6072 (goto-char (point-min))
6073 ;; First check if there are no even levels 6073 ;; First check if there are no even levels
6074 (when (re-search-forward "^\\(\\*\\*\\)+ " nil t) 6074 (when (re-search-forward "^\\(\\*\\*\\)+ " nil t)
6075 (org-show-context t) 6075 (org-show-context t)
6076 (error "Not all levels are odd in this file. Conversion not possible.")) 6076 (error "Not all levels are odd in this file. Conversion not possible"))
6077 (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ") 6077 (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ")
6078 (let ((org-odd-levels-only nil) n) 6078 (let ((org-odd-levels-only nil) n)
6079 (save-excursion 6079 (save-excursion
6080 (goto-char (point-min)) 6080 (goto-char (point-min))
6081 (while (re-search-forward "^\\*\\*+ " nil t) 6081 (while (re-search-forward "^\\*\\*+ " nil t)
7887 (setq org-window-config-before-follow-link (current-window-configuration)) 7887 (setq org-window-config-before-follow-link (current-window-configuration))
7888 (org-remove-occur-highlights nil nil t) 7888 (org-remove-occur-highlights nil nil t)
7889 (cond 7889 (cond
7890 ((and (org-on-heading-p) 7890 ((and (org-on-heading-p)
7891 (not (org-in-regexp 7891 (not (org-in-regexp
7892 (concat org-plain-link-re "\\|" 7892 (concat org-plain-link-re "\\|"
7893 org-bracket-link-regexp "\\|" 7893 org-bracket-link-regexp "\\|"
7894 org-angle-link-re "\\|" 7894 org-angle-link-re "\\|"
7895 "[ \t]:[^ \t\n]+:[ \t]*$")))) 7895 "[ \t]:[^ \t\n]+:[ \t]*$"))))
7896 (org-offer-links-in-entry in-emacs)) 7896 (org-offer-links-in-entry in-emacs))
7897 ((org-at-timestamp-p t) (org-follow-timestamp-link)) 7897 ((org-at-timestamp-p t) (org-follow-timestamp-link))
7956 (if (and org-link-translation-function 7956 (if (and org-link-translation-function
7957 (fboundp org-link-translation-function)) 7957 (fboundp org-link-translation-function))
7958 ;; Check if we need to translate the link 7958 ;; Check if we need to translate the link
7959 (let ((tmp (funcall org-link-translation-function type path))) 7959 (let ((tmp (funcall org-link-translation-function type path)))
7960 (setq type (car tmp) path (cdr tmp)))) 7960 (setq type (car tmp) path (cdr tmp))))
7961 7961
7962 (cond 7962 (cond
7963 7963
7964 ((assoc type org-link-protocols) 7964 ((assoc type org-link-protocols)
7965 (funcall (nth 1 (assoc type org-link-protocols)) path)) 7965 (funcall (nth 1 (assoc type org-link-protocols)) path))
7966 7966
7967 ((equal type "mailto") 7967 ((equal type "mailto")
7968 (let ((cmd (car org-link-mailto-program)) 7968 (let ((cmd (car org-link-mailto-program))
7969 (args (cdr org-link-mailto-program)) args1 7969 (args (cdr org-link-mailto-program)) args1
7970 (address path) (subject "") a) 7970 (address path) (subject "") a)
7971 (if (string-match "\\(.*\\)::\\(.*\\)" path) 7971 (if (string-match "\\(.*\\)::\\(.*\\)" path)
7979 (setq a (replace-match address t t a))) 7979 (setq a (replace-match address t t a)))
7980 (if (string-match "%s" a) 7980 (if (string-match "%s" a)
7981 (setq a (replace-match subject t t a))) 7981 (setq a (replace-match subject t t a)))
7982 (push a args1)))) 7982 (push a args1))))
7983 (apply cmd (nreverse args1)))) 7983 (apply cmd (nreverse args1))))
7984 7984
7985 ((member type '("http" "https" "ftp" "news")) 7985 ((member type '("http" "https" "ftp" "news"))
7986 (browse-url (concat type ":" (org-link-escape 7986 (browse-url (concat type ":" (org-link-escape
7987 path org-link-escape-chars-browser)))) 7987 path org-link-escape-chars-browser))))
7988 7988
7989 ((member type '("message")) 7989 ((member type '("message"))
7990 (browse-url (concat type ":" path))) 7990 (browse-url (concat type ":" path)))
7991 7991
7992 ((string= type "tags") 7992 ((string= type "tags")
7993 (org-tags-view in-emacs path)) 7993 (org-tags-view in-emacs path))
7994 ((string= type "thisfile") 7994 ((string= type "thisfile")
7995 (if in-emacs 7995 (if in-emacs
7996 (switch-to-buffer-other-window 7996 (switch-to-buffer-other-window
8002 ((equal in-emacs '(16)) 'org-occur) 8002 ((equal in-emacs '(16)) 'org-occur)
8003 (t nil)) 8003 (t nil))
8004 ,pos))) 8004 ,pos)))
8005 (condition-case nil (eval cmd) 8005 (condition-case nil (eval cmd)
8006 (error (progn (widen) (eval cmd)))))) 8006 (error (progn (widen) (eval cmd))))))
8007 8007
8008 ((string= type "tree-match") 8008 ((string= type "tree-match")
8009 (org-occur (concat "\\[" (regexp-quote path) "\\]"))) 8009 (org-occur (concat "\\[" (regexp-quote path) "\\]")))
8010 8010
8011 ((string= type "file") 8011 ((string= type "file")
8012 (if (string-match "::\\([0-9]+\\)\\'" path) 8012 (if (string-match "::\\([0-9]+\\)\\'" path)
8013 (setq line (string-to-number (match-string 1 path)) 8013 (setq line (string-to-number (match-string 1 path))
8014 path (substring path 0 (match-beginning 0))) 8014 path (substring path 0 (match-beginning 0)))
8015 (if (string-match "::\\(.+\\)\\'" path) 8015 (if (string-match "::\\(.+\\)\\'" path)
8016 (setq search (match-string 1 path) 8016 (setq search (match-string 1 path)
8017 path (substring path 0 (match-beginning 0))))) 8017 path (substring path 0 (match-beginning 0)))))
8018 (if (string-match "[*?{]" (file-name-nondirectory path)) 8018 (if (string-match "[*?{]" (file-name-nondirectory path))
8019 (dired path) 8019 (dired path)
8020 (org-open-file path in-emacs line search))) 8020 (org-open-file path in-emacs line search)))
8021 8021
8022 ((string= type "news") 8022 ((string= type "news")
8023 (require 'org-gnus) 8023 (require 'org-gnus)
8024 (org-gnus-follow-link path)) 8024 (org-gnus-follow-link path))
8025 8025
8026 ((string= type "shell") 8026 ((string= type "shell")
8027 (let ((cmd path)) 8027 (let ((cmd path))
8028 (if (or (not org-confirm-shell-link-function) 8028 (if (or (not org-confirm-shell-link-function)
8029 (funcall org-confirm-shell-link-function 8029 (funcall org-confirm-shell-link-function
8030 (format "Execute \"%s\" in shell? " 8030 (format "Execute \"%s\" in shell? "
8032 'face 'org-warning)))) 8032 'face 'org-warning))))
8033 (progn 8033 (progn
8034 (message "Executing %s" cmd) 8034 (message "Executing %s" cmd)
8035 (shell-command cmd)) 8035 (shell-command cmd))
8036 (error "Abort")))) 8036 (error "Abort"))))
8037 8037
8038 ((string= type "elisp") 8038 ((string= type "elisp")
8039 (let ((cmd path)) 8039 (let ((cmd path))
8040 (if (or (not org-confirm-elisp-link-function) 8040 (if (or (not org-confirm-elisp-link-function)
8041 (funcall org-confirm-elisp-link-function 8041 (funcall org-confirm-elisp-link-function
8042 (format "Execute \"%s\" as elisp? " 8042 (format "Execute \"%s\" as elisp? "
8045 (message "%s => %s" cmd 8045 (message "%s => %s" cmd
8046 (if (equal (string-to-char cmd) ?\() 8046 (if (equal (string-to-char cmd) ?\()
8047 (eval (read cmd)) 8047 (eval (read cmd))
8048 (call-interactively (read cmd)))) 8048 (call-interactively (read cmd))))
8049 (error "Abort")))) 8049 (error "Abort"))))
8050 8050
8051 (t 8051 (t
8052 (browse-url-at-point)))))) 8052 (browse-url-at-point))))))
8053 (move-marker org-open-link-marker nil) 8053 (move-marker org-open-link-marker nil)
8054 (run-hook-with-args 'org-follow-link-hook))) 8054 (run-hook-with-args 'org-follow-link-hook)))
8055 8055
8835 pa answ parent-target child parent old-hist) 8835 pa answ parent-target child parent old-hist)
8836 (setq old-hist org-refile-history) 8836 (setq old-hist org-refile-history)
8837 (setq answ (funcall cfunc prompt tbl nil (not new-nodes) 8837 (setq answ (funcall cfunc prompt tbl nil (not new-nodes)
8838 nil 'org-refile-history)) 8838 nil 'org-refile-history))
8839 (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl))) 8839 (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
8840 (if pa 8840 (if pa
8841 (progn 8841 (progn
8842 (when (or (not org-refile-history) 8842 (when (or (not org-refile-history)
8843 (not (eq old-hist org-refile-history)) 8843 (not (eq old-hist org-refile-history))
8844 (not (equal (car pa) (car org-refile-history)))) 8844 (not (equal (car pa) (car org-refile-history))))
8845 (setq org-refile-history 8845 (setq org-refile-history
8887 8887
8888 (defun org-olpath-completing-read (prompt collection &rest args) 8888 (defun org-olpath-completing-read (prompt collection &rest args)
8889 "Read an outline path like a file name." 8889 "Read an outline path like a file name."
8890 (let ((thetable collection) 8890 (let ((thetable collection)
8891 (org-completion-use-ido nil) ; does not work with ido. 8891 (org-completion-use-ido nil) ; does not work with ido.
8892 (org-completion-use-iswitchb nil)) ; or iswitchb 8892 (org-completion-use-iswitchb nil)) ; or iswitchb
8893 (apply 8893 (apply
8894 'org-icompleting-read prompt 8894 'org-icompleting-read prompt
8895 (lambda (string predicate &optional flag) 8895 (lambda (string predicate &optional flag)
8896 (let (rtn r f (l (length string))) 8896 (let (rtn r f (l (length string)))
8897 (cond 8897 (cond
9685 (goto-char end) 9685 (goto-char end)
9686 (org-update-parent-todo-statistics)) 9686 (org-update-parent-todo-statistics))
9687 (error "No data for statistics cookie")))) 9687 (error "No data for statistics cookie"))))
9688 (goto-char pos) 9688 (goto-char pos)
9689 (move-marker pos nil))))) 9689 (move-marker pos nil)))))
9690 9690
9691 (defvar org-entry-property-inherited-from) ;; defined below 9691 (defvar org-entry-property-inherited-from) ;; defined below
9692 (defun org-update-parent-todo-statistics () 9692 (defun org-update-parent-todo-statistics ()
9693 "Update any statistics cookie in the parent of the current headline. 9693 "Update any statistics cookie in the parent of the current headline.
9694 When `org-hierarchical-todo-statistics' is nil, statistics will cover 9694 When `org-hierarchical-todo-statistics' is nil, statistics will cover
9695 the entire subtree and this will travel up the hierarchy and update 9695 the entire subtree and this will travel up the hierarchy and update
14587 (error "This command is active in special context like tables, headlines or items")) 14587 (error "This command is active in special context like tables, headlines or items"))
14588 14588
14589 (defun org-shiftselect-error () 14589 (defun org-shiftselect-error ()
14590 "Throw an error because Shift-Cursor command was applied in wrong context." 14590 "Throw an error because Shift-Cursor command was applied in wrong context."
14591 (if (and (boundp 'shift-select-mode) shift-select-mode) 14591 (if (and (boundp 'shift-select-mode) shift-select-mode)
14592 (error "To use shift-selection with Org-mode, customize `org-support-shift-select'.") 14592 (error "To use shift-selection with Org-mode, customize `org-support-shift-select'")
14593 (error "This command works only in special context like headlines or timestamps."))) 14593 (error "This command works only in special context like headlines or timestamps")))
14594 14594
14595 (defun org-call-for-shift-select (cmd) 14595 (defun org-call-for-shift-select (cmd)
14596 (let ((this-command-keys-shift-translated t)) 14596 (let ((this-command-keys-shift-translated t))
14597 (call-interactively cmd))) 14597 (call-interactively cmd)))
14598 14598
15027 ; (org-set-regexps-and-options) 15027 ; (org-set-regexps-and-options)
15028 ; (org-restart-font-lock) 15028 ; (org-restart-font-lock)
15029 (let ((org-inhibit-startup t)) (org-mode-restart)) 15029 (let ((org-inhibit-startup t)) (org-mode-restart))
15030 (message "Local setup has been refreshed")))) 15030 (message "Local setup has been refreshed"))))
15031 ((org-clock-update-time-maybe)) 15031 ((org-clock-update-time-maybe))
15032 (t (error "C-c C-c can do nothing useful at this location."))))) 15032 (t (error "C-c C-c can do nothing useful at this location")))))
15033 15033
15034 (defun org-mode-restart () 15034 (defun org-mode-restart ()
15035 "Restart Org-mode, to scan again for special lines. 15035 "Restart Org-mode, to scan again for special lines.
15036 Also updates the keyword regular expressions." 15036 Also updates the keyword regular expressions."
15037 (interactive) 15037 (interactive)