/[emacs]/emacs/lisp/textmodes/org.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/org.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by cdominik, Wed Jun 29 07:01:26 2005 UTC revision 1.26 by lektu, Fri Jul 1 14:38:23 2005 UTC
# Line 1  Line 1 
1  ;; org.el --- Outline-based notes management and organizer  ;; org.el --- Outline-based notes management and organizer
2  ;; Carstens outline-mode for keeping track of everything.  ;; Carstens outline-mode for keeping track of everything.
3  ;; Copyright (c) 2004, 2005 Free Software Foundation  ;; Copyright (c) 2004, 2005 Free Software Foundation
4  ;;  ;;
# Line 455  is used instead.") Line 455  is used instead.")
455            (goto-char (point-min))            (goto-char (point-min))
456            (while (re-search-forward re nil t)            (while (re-search-forward re nil t)
457              (setq key (match-string 1) value (match-string 2))              (setq key (match-string 1) value (match-string 2))
458              (cond              (cond
459               ((equal key "CATEGORY")               ((equal key "CATEGORY")
460                (if (string-match "[ \t]+$" value)                (if (string-match "[ \t]+$" value)
461                    (setq value (replace-match "" t t value)))                    (setq value (replace-match "" t t value)))
# Line 495  is used instead.") Line 495  is used instead.")
495            org-todo-kwd-max-priority (1- (length org-todo-keywords))            org-todo-kwd-max-priority (1- (length org-todo-keywords))
496            org-ds-keyword-length (+ 2 (max (length org-deadline-string)            org-ds-keyword-length (+ 2 (max (length org-deadline-string)
497                                            (length org-scheduled-string)))                                            (length org-scheduled-string)))
498            org-done-string            org-done-string
499            (nth (1- (length org-todo-keywords)) org-todo-keywords)            (nth (1- (length org-todo-keywords)) org-todo-keywords)
500            org-todo-regexp            org-todo-regexp
501            (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords            (concat "\\<\\(" (mapconcat 'regexp-quote org-todo-keywords
# Line 575  When nil, cursor will remain in the curr Line 575  When nil, cursor will remain in the curr
575    
576  (defcustom org-select-agenda-window t  (defcustom org-select-agenda-window t
577    "Non-nil means, after creating an agenda, move cursor into Agenda window.    "Non-nil means, after creating an agenda, move cursor into Agenda window.
578  When nil, cursor will remain in the current window."  When nil, cursor will remain in the current window."
579    :group 'org-agenda    :group 'org-agenda
580    :type 'boolean)    :type 'boolean)
581    
# Line 594  When nil, only the days which actually h Line 594  When nil, only the days which actually h
594  ;; require a variable ndays treatment.  ;; require a variable ndays treatment.
595  (defcustom org-agenda-start-on-weekday 1  (defcustom org-agenda-start-on-weekday 1
596    "Non-nil means, start the overview always on the specified weekday.    "Non-nil means, start the overview always on the specified weekday.
597  0 Denotes Sunday, 1 denotes Monday etc.  0 denotes Sunday, 1 denotes Monday etc.
598  When nil, always start on the current day."  When nil, always start on the current day."
599    :group 'org-agenda    :group 'org-agenda
600    :type '(choice (const :tag "Today" nil)    :type '(choice (const :tag "Today" nil)
# Line 611  When nil, always start on the current da Line 611  When nil, always start on the current da
611  When nil, date-less entries will only be shown if `org-agenda' is called  When nil, date-less entries will only be shown if `org-agenda' is called
612  with a prefix argument.  with a prefix argument.
613  When non-nil, the TODO entries will be listed at the top of the agenda, before  When non-nil, the TODO entries will be listed at the top of the agenda, before
614  the entries for specific days."  the entries for specific days."
615    :group 'org-agenda    :group 'org-agenda
616    :type 'boolean)    :type 'boolean)
617    
# Line 623  the entries for specific days." Line 623  the entries for specific days."
623  (defcustom org-calendar-to-agenda-key [?c]  (defcustom org-calendar-to-agenda-key [?c]
624    "The key to be installed in `calendar-mode-map' for switching to the agenda.    "The key to be installed in `calendar-mode-map' for switching to the agenda.
625  The command `org-calendar-goto-agenda' will be bound to this key.  The  The command `org-calendar-goto-agenda' will be bound to this key.  The
626  default is the character `c' because then`c' can be used to switch back and  default is the character `c' because then `c' can be used to switch back and
627  force between agenda and calendar."  forth between agenda and calendar."
628    :group 'org-agenda    :group 'org-agenda
629    :type 'sexp)    :type 'sexp)
630    
# Line 632  force between agenda and calendar." Line 632  force between agenda and calendar."
632    "Sorting structure for the agenda items of a single day.    "Sorting structure for the agenda items of a single day.
633  This is a list of symbols which will be used in sequence to determine  This is a list of symbols which will be used in sequence to determine
634  if an entry should be listed before another entry.  The following  if an entry should be listed before another entry.  The following
635  symbols are recognized.  symbols are recognized:
636    
637  time-up         Put entries with time-of-day indications first, early first  time-up         Put entries with time-of-day indications first, early first
638  time-down       Put entries with time-of-day indications first, late first  time-down       Put entries with time-of-day indications first, late first
# Line 656  priority. Line 656  priority.
656  Leaving out `category-keep' would mean that items will be sorted across  Leaving out `category-keep' would mean that items will be sorted across
657  categories by priority."  categories by priority."
658    :group 'org-agenda    :group 'org-agenda
659    :type '(repeat    :type '(repeat
660            (choice            (choice
661             (const time-up)             (const time-up)
662             (const time-down)             (const time-down)
# Line 725  of `org-agenda-prefix-format' or `org-ti Line 725  of `org-agenda-prefix-format' or `org-ti
725  (defcustom org-agenda-use-time-grid t  (defcustom org-agenda-use-time-grid t
726    "Non-nil means, show a time grid in the agenda schedule.    "Non-nil means, show a time grid in the agenda schedule.
727  A time grid is a set of lines for specific times (like every two hours between  A time grid is a set of lines for specific times (like every two hours between
728  8:00 and 20:00.  The items scheduled for a day at specific times are  8:00 and 20:00).  The items scheduled for a day at specific times are
729  sorted in between these lines.  sorted in between these lines.
730  For deails about when the grid will be shown, and what it will look like, see  For details about when the grid will be shown, and what it will look like, see
731  the variable `org-agenda-time-grid'."  the variable `org-agenda-time-grid'."
732    :group 'org-agenda    :group 'org-agenda
733    :type 'boolean)    :type 'boolean)
734    
735  (defcustom org-agenda-time-grid  (defcustom org-agenda-time-grid
736    '((daily today require-timed)    '((daily today require-timed)
737      "----------------"      "----------------"
738      (800 1000 1200 1400 1600 1800 2000))      (800 1000 1200 1400 1600 1800 2000))
# Line 751  The second item is a string which will b Line 751  The second item is a string which will b
751  The third item is a list of integers, indicating the times that should have  The third item is a list of integers, indicating the times that should have
752  a grid line."  a grid line."
753    :group 'org-agenda    :group 'org-agenda
754    :type    :type
755    '(list    '(list
756      (set :greedy t :tag "Grid Display Options"      (set :greedy t :tag "Grid Display Options"
757           (const :tag "Show grid in single day agenda display" daily)           (const :tag "Show grid in single day agenda display" daily)
# Line 845  unnecessary clutter." Line 845  unnecessary clutter."
845    
846  (defcustom org-archive-location "%s_archive::"  (defcustom org-archive-location "%s_archive::"
847    "The location where subtrees should be archived.    "The location where subtrees should be archived.
848  This string consists of two parts, separated by a double-colon.    This string consists of two parts, separated by a double-colon.
849    
850  The first part is a file name - when omitted, archiving happens in the same  The first part is a file name - when omitted, archiving happens in the same
851  file.  %s will be replaced by the current file name (without directory part).  file.  `%s' will be replaced by the current file name (without directory part).
852  Archiving to a different file is useful to keep archived entries from  Archiving to a different file is useful to keep archived entries from
853  contributing to the Org-mode Agenda.  contributing to the Org-mode Agenda.
854    
# Line 874  Here are a few examples: Line 874  Here are a few examples:
874    
875  You may set this option on a per-file basis by adding to the buffer a  You may set this option on a per-file basis by adding to the buffer a
876  line like  line like
877    
878  #+ARCHIVE: basement::** Finished Tasks"  #+ARCHIVE: basement::** Finished Tasks"
879    :group 'org-structure    :group 'org-structure
880    :type 'string)    :type 'string)
# Line 915  recommend an additional URL: prefix, so Line 915  recommend an additional URL: prefix, so
915  When nil, it becomes possible to put several links into a line.  When nil, it becomes possible to put several links into a line.
916  Note that in tables, a link never extends accross fields, so in a table  Note that in tables, a link never extends accross fields, so in a table
917  it is always possible to put several links into a line.  it is always possible to put several links into a line.
918  Changing this varable requires a re-launch of Emacs of become effective."  Changing this variable requires a re-launch of Emacs to become effective."
919    :group 'org-link    :group 'org-link
920    :type 'boolean)    :type 'boolean)
921    
# Line 980  another window." Line 980  another window."
980                   (const find-file-other-frame)))))                   (const find-file-other-frame)))))
981    
982  (defcustom org-usenet-links-prefer-google nil  (defcustom org-usenet-links-prefer-google nil
983    "Non-nil means, `org-store-link' will create web links to google groups.    "Non-nil means, `org-store-link' will create web links to Google groups.
984  When nil, Gnus will be used for such links.  When nil, Gnus will be used for such links.
985  Using a prefix arg to the command \\[org-store-link] (`org-store-link')  Using a prefix arg to the command \\[org-store-link] (`org-store-link')
986  negates this setting for the duration of the command."  negates this setting for the duration of the command."
# Line 1119  When nil, new notes will be filed to the Line 1119  When nil, new notes will be filed to the
1119  When nil, such lines will be treated like ordinary lines.  When nil, such lines will be treated like ordinary lines.
1120    
1121  When equal to the symbol `optimized', the table editor will be optimized to  When equal to the symbol `optimized', the table editor will be optimized to
1122  do the following  do the following:
1123  - Use automatic overwrite mode in front of whitespace in table fields.  - Use automatic overwrite mode in front of whitespace in table fields.
1124    This make the structure of the table stay in tact as long as the edited    This makes the structure of the table stay intact as long as the edited
1125    field does not exceed the column width.    field does not exceed the column width.
1126  - Minimize the number of realigns.  Normally, the table is aligned each time  - Minimize the number of realigns.  Normally, the table is aligned each time
1127    TAB or RET are pressed to move to another field.  With optimization this    TAB or RET are pressed to move to another field.  With optimization this
1128    happens only if changes to a field might have  changed the column width.    happens only if changes to a field might have changed the column width.
1129  Optimization requires replacing the functions `self-insert-command',  Optimization requires replacing the functions `self-insert-command',
1130  `delete-char', and `backward-delete-char' in Org-mode buffers, with a  `delete-char', and `backward-delete-char' in Org-mode buffers, with a
1131  slight (in fact: unnoticeable) speed impact for normal typing.  Org-mode is  slight (in fact: unnoticeable) speed impact for normal typing.  Org-mode is
# Line 1330  or use the +OPTION lines for a per-file Line 1330  or use the +OPTION lines for a per-file
1330    
1331  (defcustom org-export-default-language "en"  (defcustom org-export-default-language "en"
1332    "The default language of HTML export, as a string.    "The default language of HTML export, as a string.
1333  This should have an association in `org-export-language-setup'"  This should have an association in `org-export-language-setup'."
1334    :group 'org-export    :group 'org-export
1335    :type 'string)    :type 'string)
1336    
# Line 1498  Otherwise the buffer will just be saved Line 1498  Otherwise the buffer will just be saved
1498    :type 'boolean)    :type 'boolean)
1499    
1500  (defcustom org-export-html-show-new-buffer nil  (defcustom org-export-html-show-new-buffer nil
1501    "Non-nil means,  popup buffer containing the exported html text.    "Non-nil means, popup buffer containing the exported HTML text.
1502  Otherwise, the buffer will just be saved to a file and stay hidden."  Otherwise, the buffer will just be saved to a file and stay hidden."
1503    :group 'org-export    :group 'org-export
1504    :type 'boolean)    :type 'boolean)
# Line 1635  When this is non-nil, the headline after Line 1635  When this is non-nil, the headline after
1635    "Face for items scheduled previously, and not yet done."    "Face for items scheduled previously, and not yet done."
1636    :group 'org-faces)    :group 'org-faces)
1637    
1638  (defface org-link  (defface org-link
1639    '((((type tty) (class color)) (:foreground "cyan" :weight bold))    '((((type tty) (class color)) (:foreground "cyan" :weight bold))
1640      (((class color) (background light)) (:foreground "Purple"))      (((class color) (background light)) (:foreground "Purple"))
1641      (((class color) (background dark)) (:foreground "Cyan"))      (((class color) (background dark)) (:foreground "Cyan"))
# Line 1664  When this is non-nil, the headline after Line 1664  When this is non-nil, the headline after
1664      (((class color) (background light)) (:foreground "DarkGoldenrod"))      (((class color) (background light)) (:foreground "DarkGoldenrod"))
1665      (((class color) (background dark)) (:foreground "LightGoldenrod"))      (((class color) (background dark)) (:foreground "LightGoldenrod"))
1666      (t (:bold t :italic t)))      (t (:bold t :italic t)))
1667    "Face used for level 2 headlines."    "Face used for time grids."
1668    :group 'org-faces)    :group 'org-faces)
1669    
1670  (defvar org-level-faces  (defvar org-level-faces
# Line 1742  sets it back to nil.") Line 1742  sets it back to nil.")
1742    
1743  ;;;###autoload  ;;;###autoload
1744  (define-derived-mode org-mode outline-mode "Org"  (define-derived-mode org-mode outline-mode "Org"
1745    "Outline-based notes management and organizer, alias    "Outline-based notes management and organizer, alias
1746  \"Carstens outline-mode for keeping track of everything.\"  \"Carstens outline-mode for keeping track of everything.\"
1747    
1748  Org-mode develops organizational tasks around a NOTES file which  Org-mode develops organizational tasks around a NOTES file which
# Line 1814  The following commands are available: Line 1814  The following commands are available:
1814            (org-cycle '(4)) (org-cycle '(4))))))))            (org-cycle '(4)) (org-cycle '(4))))))))
1815    
1816  (defun org-fill-paragraph (&optional justify)  (defun org-fill-paragraph (&optional justify)
1817    "Re-align a table, pass through to fill-paragraph if no table."    "Re-align a table, pass through to `fill-paragraph' if no table."
1818    (save-excursion    (save-excursion
1819      (beginning-of-line 1)      (beginning-of-line 1)
1820      (looking-at "\\s-*\\(|\\|\\+-+\\)")))      (looking-at "\\s-*\\(|\\|\\+-+\\)")))
# Line 1825  The following commands are available: Line 1825  The following commands are available:
1825  ;;; Font-Lock stuff  ;;; Font-Lock stuff
1826    
1827  (defvar org-mouse-map (make-sparse-keymap))  (defvar org-mouse-map (make-sparse-keymap))
1828  (define-key org-mouse-map  (define-key org-mouse-map
1829    (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse)    (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse)
1830  (define-key org-mouse-map  (define-key org-mouse-map
1831    (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse)    (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse)
# Line 1901  The following commands are available: Line 1901  The following commands are available:
1901            (list (concat "\\<" org-scheduled-string) '(0 'org-warning t))            (list (concat "\\<" org-scheduled-string) '(0 'org-warning t))
1902            ;; '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)"            ;; '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)"
1903            ;; (3 'bold))            ;; (3 'bold))
1904            ;; '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)"            ;; '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)"
1905            ;; (3 'italic))            ;; (3 'italic))
1906            ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)"            ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)"
1907            ;; (3 'underline))            ;; (3 'underline))
1908            (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>")            (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>")
1909                  '(1 'org-warning t))                  '(1 'org-warning t))
# Line 1924  The following commands are available: Line 1924  The following commands are available:
1924            (if org-noutline-p     ; FIXME:  I am not sure if eval will work            (if org-noutline-p     ; FIXME:  I am not sure if eval will work
1925                                   ; on XEmacs if noutline is ever ported                                   ; on XEmacs if noutline is ever ported
1926                '((eval . (list "^\\(\\*+\\).*"                '((eval . (list "^\\(\\*+\\).*"
1927                                0 '(nth                                0 '(nth
1928                                    (% (- (match-end 1) (match-beginning 1) 1)                                    (% (- (match-end 1) (match-beginning 1) 1)
1929                                       org-n-levels)                                       org-n-levels)
1930                                    org-level-faces)                                    org-level-faces)
# Line 1938  The following commands are available: Line 1938  The following commands are available:
1938      (set (make-local-variable 'font-lock-defaults)      (set (make-local-variable 'font-lock-defaults)
1939           '(org-font-lock-keywords t nil nil backward-paragraph))           '(org-font-lock-keywords t nil nil backward-paragraph))
1940      (kill-local-variable 'font-lock-keywords) nil))      (kill-local-variable 'font-lock-keywords) nil))
1941        
1942  (defun org-unfontify-region (beg end &optional maybe_loudly)  (defun org-unfontify-region (beg end &optional maybe_loudly)
1943    "Remove fontification and activation overlays from links."    "Remove fontification and activation overlays from links."
1944    (font-lock-default-unfontify-region beg end)    (font-lock-default-unfontify-region beg end)
# Line 1956  The following commands are available: Line 1956  The following commands are available:
1956    "Visibility cycling for Org-mode.    "Visibility cycling for Org-mode.
1957    
1958  - When this function is called with a prefix argument, rotate the entire  - When this function is called with a prefix argument, rotate the entire
1959    buffer through 3 states (global cycling)    buffer through 3 states (global cycling):
1960    1. OVERVIEW: Show only top-level headlines.    1. OVERVIEW: Show only top-level headlines.
1961    2. CONTENTS: Show all headlines of all levels, but no body text.    2. CONTENTS: Show all headlines of all levels, but no body text.
1962    3. SHOW ALL: Show everything.    3. SHOW ALL: Show everything.
1963    
1964  - When point is at the beginning of a headline, rotate the subtree started  - When point is at the beginning of a headline, rotate the subtree started
1965    by this line through 3 different states (local cycling)    by this line through 3 different states (local cycling):
1966    1. FOLDED:   Only the main headline is shown.    1. FOLDED:   Only the main headline is shown.
1967    2. CHILDREN: The main headline and the direct children are shown.  From    2. CHILDREN: The main headline and the direct children are shown.  From
1968                 this state, you can move to one of the children and                 this state, you can move to one of the children and
# Line 2218  or nil." Line 2218  or nil."
2218    
2219  ;;  FIXME:  It may not be a good idea to temper with the prefix argument...  ;;  FIXME:  It may not be a good idea to temper with the prefix argument...
2220  (defun org-goto-ret (&optional arg)  (defun org-goto-ret (&optional arg)
2221    "Finish org-goto by going to the new location."    "Finish `org-goto' by going to the new location."
2222    (interactive "P")    (interactive "P")
2223    (setq org-selected-point (point)    (setq org-selected-point (point)
2224          current-prefix-arg arg)          current-prefix-arg arg)
2225    (throw 'exit nil))    (throw 'exit nil))
2226    
2227  (defun org-goto-left ()  (defun org-goto-left ()
2228    "Finish org-goto by going to the new location."    "Finish `org-goto' by going to the new location."
2229    (interactive)    (interactive)
2230    (if (org-on-heading-p)    (if (org-on-heading-p)
2231        (progn        (progn
# Line 2236  or nil." Line 2236  or nil."
2236      (error "Not on a heading")))      (error "Not on a heading")))
2237    
2238  (defun org-goto-right ()  (defun org-goto-right ()
2239    "Finish org-goto by going to the new location."    "Finish `org-goto' by going to the new location."
2240    (interactive)    (interactive)
2241    (if (org-on-heading-p)    (if (org-on-heading-p)
2242        (progn        (progn
# Line 2248  or nil." Line 2248  or nil."
2248      (error "Not on a heading")))      (error "Not on a heading")))
2249    
2250  (defun org-goto-quit ()  (defun org-goto-quit ()
2251    "Finish org-goto without cursor motion."    "Finish `org-goto' without cursor motion."
2252    (interactive)    (interactive)
2253    (setq org-selected-point nil)    (setq org-selected-point nil)
2254    (throw 'exit nil))    (throw 'exit nil))
# Line 2657  heading be marked DONE, and the current Line 2657  heading be marked DONE, and the current
2657                  (end-of-line 0))                  (end-of-line 0))
2658                ;; Make the heading visible, and the following as well                ;; Make the heading visible, and the following as well
2659                (let ((org-show-following-heading t)) (org-show-hierarchy-above))                (let ((org-show-following-heading t)) (org-show-hierarchy-above))
2660                (if (re-search-forward                (if (re-search-forward
2661                     (concat "^" (regexp-quote (make-string level ?*)) "[ \t]")                     (concat "^" (regexp-quote (make-string level ?*)) "[ \t]")
2662                     nil t)                     nil t)
2663                    (progn (goto-char (match-beginning 0)) (insert "\n")                    (progn (goto-char (match-beginning 0)) (insert "\n")
# Line 2717  At all other locations, this simply call Line 2717  At all other locations, this simply call
2717             (table (cond             (table (cond
2718                     (opt                     (opt
2719                      (setq type :opt)                      (setq type :opt)
2720                      (mapcar (lambda (x)                      (mapcar (lambda (x)
2721                                (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)                                (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
2722                                (cons (match-string 2 x) (match-string 1 x)))                                (cons (match-string 2 x) (match-string 1 x)))
2723                              (org-split-string (org-get-current-options) "\n")))                              (org-split-string (org-get-current-options) "\n")))
2724                     (texp                     (texp
2725                      (setq type :tex)                      (setq type :tex)
2726                      org-html-entities)                      org-html-entities)
2727                     (form                     (form
2728                      (setq type :form)                      (setq type :form)
2729                      '(("sum") ("sumv") ("sumh")))                      '(("sum") ("sumv") ("sumh")))
2730                     ((string-match "\\`\\*+[ \t]*\\'"                     ((string-match "\\`\\*+[ \t]*\\'"
# Line 2734  At all other locations, this simply call Line 2734  At all other locations, this simply call
2734                     (t (progn (ispell-complete-word arg) (throw 'exit nil)))))                     (t (progn (ispell-complete-word arg) (throw 'exit nil)))))
2735             (completion (try-completion pattern table)))             (completion (try-completion pattern table)))
2736        (cond ((eq completion t)        (cond ((eq completion t)
2737               (if (equal type :opt)               (if (equal type :opt)
2738                   (insert (substring (cdr (assoc (upcase pattern) table))                   (insert (substring (cdr (assoc (upcase pattern) table))
2739                                      (length pattern)))))                                      (length pattern)))))
2740              ((null completion)              ((null completion)
# Line 2742  At all other locations, this simply call Line 2742  At all other locations, this simply call
2742               (ding))               (ding))
2743              ((not (string= pattern completion))              ((not (string= pattern completion))
2744               (delete-region beg end)               (delete-region beg end)
2745               (if (string-match " +$" completion)               (if (string-match " +$" completion)
2746                   (setq completion (replace-match "" t t completion)))                   (setq completion (replace-match "" t t completion)))
2747               (insert completion)               (insert completion)
2748               (if (get-buffer-window "*Completions*")               (if (get-buffer-window "*Completions*")
# Line 2879  to modify it to the correct date." Line 2879  to modify it to the correct date."
2879  The tree will show the lines where the regexp matches, and all higher  The tree will show the lines where the regexp matches, and all higher
2880  headlines above the match.  It will also show the heading after the match,  headlines above the match.  It will also show the heading after the match,
2881  to make sure editing the matching entry is easy.  to make sure editing the matching entry is easy.
2882  if CALLBACK is non-nil, it is a function which is called to confirm  If CALLBACK is non-nil, it is a function which is called to confirm
2883  that the match should indeed be shown."  that the match should indeed be shown."
2884    (interactive "sRegexp: ")    (interactive "sRegexp: ")
2885    (setq regexp (org-check-occur-regexp regexp))    (setq regexp (org-check-occur-regexp regexp))
# Line 2979  ACTION can be set, up, or down." Line 2979  ACTION can be set, up, or down."
2979    (save-match-data    (save-match-data
2980      (if (not (string-match org-priority-regexp s))      (if (not (string-match org-priority-regexp s))
2981          (* 1000 (- org-lowest-priority org-default-priority))          (* 1000 (- org-lowest-priority org-default-priority))
2982        (* 1000 (- org-lowest-priority        (* 1000 (- org-lowest-priority
2983                   (string-to-char (match-string 2 s)))))))                   (string-to-char (match-string 2 s)))))))
2984          
2985  ;;; Timestamps  ;;; Timestamps
2986    
2987  (defvar org-last-changed-timestamp nil)  (defvar org-last-changed-timestamp nil)
# Line 3013  at the cursor, it will be modified." Line 3013  at the cursor, it will be modified."
3013        (setq time (let ((this-command this-command))        (setq time (let ((this-command this-command))
3014                     (org-read-date arg 'totime)))                     (org-read-date arg 'totime)))
3015        (and (org-at-timestamp-p) (replace-match        (and (org-at-timestamp-p) (replace-match
3016                                   (setq org-last-changed-timestamp                                   (setq org-last-changed-timestamp
3017                                         (format-time-string fmt time))                                         (format-time-string fmt time))
3018                                   t t))                                   t t))
3019        (message "Timestamp updated"))        (message "Timestamp updated"))
# Line 3043  but this can be configured with the vari Line 3043  but this can be configured with the vari
3043    
3044  While prompting, a calendar is popped up - you can also select the  While prompting, a calendar is popped up - you can also select the
3045  date with the mouse (button 1).  The calendar shows a period of three  date with the mouse (button 1).  The calendar shows a period of three
3046  month.  To scroll it to other months, use the keys `>' and `<'.    month.  To scroll it to other months, use the keys `>' and `<'.
3047  If you don't like the calendar, turn it off with  If you don't like the calendar, turn it off with
3048         \(setq org-popup-calendar-for-date-prompt nil).         \(setq org-popup-calendar-for-date-prompt nil).
3049    
3050  With optional argument TO-TIME, the date will immediately be converted  With optional argument TO-TIME, the date will immediately be converted
# Line 3058  used to insert the time stamp into the b Line 3058  used to insert the time stamp into the b
3058             ;; Default time is either today, or, when entering a range,             ;; Default time is either today, or, when entering a range,
3059             ;; the range start.             ;; the range start.
3060             (if (save-excursion             (if (save-excursion
3061                   (re-search-backward                   (re-search-backward
3062                    (concat org-ts-regexp "--\\=")                    (concat org-ts-regexp "--\\=")
3063                    (- (point) 20) t))                    (- (point) 20) t))
3064                 (apply                 (apply
# Line 3150  used to insert the time stamp into the b Line 3150  used to insert the time stamp into the b
3150    
3151  (defun org-eval-in-calendar (form)  (defun org-eval-in-calendar (form)
3152    "Eval FORM in the calendar window and return to current window.    "Eval FORM in the calendar window and return to current window.
3153  Also, store the cursor date in variable ans2."  Also, store the cursor date in variable `ans2'."
3154    (let ((sw (selected-window)))    (let ((sw (selected-window)))
3155      (select-window (get-buffer-window "*Calendar*"))      (select-window (get-buffer-window "*Calendar*"))
3156      (eval form)      (eval form)
# Line 3169  This is used by `org-read-date' in a tem Line 3169  This is used by `org-read-date' in a tem
3169             (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))             (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
3170        (setq ans1 (format-time-string "%Y-%m-%d" time)))        (setq ans1 (format-time-string "%Y-%m-%d" time)))
3171      (if (active-minibuffer-window) (exit-minibuffer))))      (if (active-minibuffer-window) (exit-minibuffer))))
3172              
3173  (defun org-check-deadlines (ndays)  (defun org-check-deadlines (ndays)
3174    "Check if there are any deadlines due or past due.    "Check if there are any deadlines due or past due.
3175  A deadline is considered due if it happens within `org-deadline-warning-days'  A deadline is considered due if it happens within `org-deadline-warning-days'
# Line 3324  With prefix ARG, change that many days." Line 3324  With prefix ARG, change that many days."
3324         (>= (match-end n) pos)))         (>= (match-end n) pos)))
3325    
3326  (defun org-at-timestamp-p ()  (defun org-at-timestamp-p ()
3327    "Determine if the cursor is  or at a timestamp."    "Determine if the cursor is at a timestamp."
3328    (interactive)    (interactive)
3329    (let* ((tsr org-ts-regexp2)    (let* ((tsr org-ts-regexp2)
3330           (pos (point))           (pos (point))
# Line 3461  The following commands are available: Line 3461  The following commands are available:
3461    (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)    (add-hook 'post-command-hook 'org-agenda-post-command-hook nil 'local)
3462    (add-hook 'pre-command-hook 'org-unhighlight nil 'local)    (add-hook 'pre-command-hook 'org-unhighlight nil 'local)
3463    (setq org-agenda-follow-mode nil)    (setq org-agenda-follow-mode nil)
3464    (easy-menu-change    (easy-menu-change
3465     '("Agenda") "Agenda Files"     '("Agenda") "Agenda Files"
3466     (append     (append
3467      (list      (list
3468       ["Edit File List" (customize-variable 'org-agenda-files) t]       ["Edit File List" (customize-variable 'org-agenda-files) t]
3469       "--")       "--")
3470     (mapcar 'org-file-menu-entry org-agenda-files)))     (mapcar 'org-file-menu-entry org-agenda-files)))
# Line 3526  The following commands are available: Line 3526  The following commands are available:
3526  (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)  (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
3527    "Local keymap for agenda entries from Org-mode.")    "Local keymap for agenda entries from Org-mode.")
3528    
3529  (define-key org-agenda-keymap  (define-key org-agenda-keymap
3530    (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)    (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
3531  (define-key org-agenda-keymap  (define-key org-agenda-keymap
3532    (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)    (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
# Line 3538  The following commands are available: Line 3538  The following commands are available:
3538      ["Show" org-agenda-show t]      ["Show" org-agenda-show t]
3539      ["Go To (other window)" org-agenda-goto t]      ["Go To (other window)" org-agenda-goto t]
3540      ["Go To (one window)" org-agenda-switch-to t]      ["Go To (one window)" org-agenda-switch-to t]
3541      ["Follow Mode" org-agenda-follow-mode      ["Follow Mode" org-agenda-follow-mode
3542       :style toggle :selected org-agenda-follow-mode :active t]       :style toggle :selected org-agenda-follow-mode :active t]
3543      "--"      "--"
3544      ["Cycle TODO" org-agenda-todo t]      ["Cycle TODO" org-agenda-todo t]
# Line 3659  dates." Line 3659  dates."
3659           (org-respect-restriction t)           (org-respect-restriction t)
3660           (past t)           (past t)
3661           s e rtn d)           s e rtn d)
3662      (setq org-agenda-redo-command      (setq org-agenda-redo-command
3663            (list 'progn            (list 'progn
3664                  (list 'switch-to-buffer-other-window (current-buffer))                  (list 'switch-to-buffer-other-window (current-buffer))
3665                  (list 'org-timeline include-all)))                  (list 'org-timeline include-all)))
# Line 3668  dates." Line 3668  dates."
3668          (setq day-numbers (delq nil (mapcar (lambda(x)          (setq day-numbers (delq nil (mapcar (lambda(x)
3669                                                (if (>= x today) x nil))                                                (if (>= x today) x nil))
3670                                              day-numbers))))                                              day-numbers))))
3671      (switch-to-buffer-other-window      (switch-to-buffer-other-window
3672       (get-buffer-create org-agenda-buffer-name))       (get-buffer-create org-agenda-buffer-name))
3673      (setq buffer-read-only nil)      (setq buffer-read-only nil)
3674      (erase-buffer)      (erase-buffer)
# Line 3683  dates." Line 3683  dates."
3683        (setq date (calendar-gregorian-from-absolute d))        (setq date (calendar-gregorian-from-absolute d))
3684        (setq s (point))        (setq s (point))
3685        (if dotodo        (if dotodo
3686            (setq rtn (org-agenda-get-day-entries            (setq rtn (org-agenda-get-day-entries
3687                       entry date :todo :timestamp))                       entry date :todo :timestamp))
3688          (setq rtn (org-agenda-get-day-entries entry date :timestamp)))          (setq rtn (org-agenda-get-day-entries entry date :timestamp)))
3689        (if (or rtn (equal d today))        (if (or rtn (equal d today))
# Line 3739  NDAYS defaults to `org-agenda-ndays'." Line 3739  NDAYS defaults to `org-agenda-ndays'."
3739           (day-numbers (list start))           (day-numbers (list start))
3740           (inhibit-redisplay t)           (inhibit-redisplay t)
3741           s e rtn rtnall file date d start-pos end-pos todayp nd)           s e rtn rtnall file date d start-pos end-pos todayp nd)
3742      (setq org-agenda-redo-command      (setq org-agenda-redo-command
3743            (list 'org-agenda include-all start-day ndays))            (list 'org-agenda include-all start-day ndays))
3744      ;; Make the list of days      ;; Make the list of days
3745      (setq ndays (or ndays org-agenda-ndays)      (setq ndays (or ndays org-agenda-ndays)
# Line 3751  NDAYS defaults to `org-agenda-ndays'." Line 3751  NDAYS defaults to `org-agenda-ndays'."
3751      (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))      (if (not (equal (current-buffer) (get-buffer org-agenda-buffer-name)))
3752          (progn          (progn
3753            (delete-other-windows)            (delete-other-windows)
3754            (switch-to-buffer-other-window            (switch-to-buffer-other-window
3755             (get-buffer-create org-agenda-buffer-name))))             (get-buffer-create org-agenda-buffer-name))))
3756      (setq buffer-read-only nil)      (setq buffer-read-only nil)
3757      (erase-buffer)      (erase-buffer)
# Line 3769  NDAYS defaults to `org-agenda-ndays'." Line 3769  NDAYS defaults to `org-agenda-ndays'."
3769                  rtn (org-agenda-get-day-entries                  rtn (org-agenda-get-day-entries
3770                       file date :todo))                       file date :todo))
3771            (setq rtnall (append rtnall rtn))))            (setq rtnall (append rtnall rtn))))
3772        (when rtnall        (when rtnall
3773          (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")          (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
3774          (add-text-properties (point-min) (1- (point))          (add-text-properties (point-min) (1- (point))
3775                               (list 'face 'org-link))                               (list 'face 'org-link))
# Line 3803  NDAYS defaults to `org-agenda-ndays'." Line 3803  NDAYS defaults to `org-agenda-ndays'."
3803                              (extract-calendar-year date)))                              (extract-calendar-year date)))
3804              (put-text-property s (1- (point)) 'face              (put-text-property s (1- (point)) 'face
3805                                 'org-link)                                 'org-link)
3806              (if rtnall (insert              (if rtnall (insert
3807                          (org-finalize-agenda-entries ;; FIXME: condition needed                          (org-finalize-agenda-entries ;; FIXME: condition needed
3808                           (org-agenda-add-time-grid-maybe                           (org-agenda-add-time-grid-maybe
3809                            rtnall nd todayp))                            rtnall nd todayp))
3810                          "\n"))                          "\n"))
3811              (put-text-property s (1- (point)) 'day d))))                          (put-text-property s (1- (point)) 'day d))))
3812      (goto-char (point-min))      (goto-char (point-min))
3813      (setq buffer-read-only t)      (setq buffer-read-only t)
3814      (if org-fit-agenda-window      (if org-fit-agenda-window
# Line 3897  With prefix ARG, go back that many times Line 3897  With prefix ARG, go back that many times
3897    (unless (boundp 'starting-day)    (unless (boundp 'starting-day)
3898      (error "Not allowed"))      (error "Not allowed"))
3899    (setq org-agenda-ndays 7)    (setq org-agenda-ndays 7)
3900    (org-agenda include-all-loc    (org-agenda include-all-loc
3901                (or (get-text-property (point) 'day)                (or (get-text-property (point) 'day)
3902                    starting-day))                    starting-day))
3903    (org-agenda-set-mode-name)    (org-agenda-set-mode-name)
3904    (message "Switched to week view"))    (message "Switched to week view"))
3905    
3906  (defun org-agenda-day-view ()  (defun org-agenda-day-view ()
3907    "Switch to weekly view for agenda."    "Switch to daily view for agenda."
3908    (interactive)    (interactive)
3909    (unless (boundp 'starting-day)    (unless (boundp 'starting-day)
3910      (error "Not allowed"))      (error "Not allowed"))
3911    (setq org-agenda-ndays 1)    (setq org-agenda-ndays 1)
3912    (org-agenda include-all-loc    (org-agenda include-all-loc
3913                (or (get-text-property (point) 'day)                (or (get-text-property (point) 'day)
3914                    starting-day))                    starting-day))
3915    (org-agenda-set-mode-name)    (org-agenda-set-mode-name)
# Line 3957  With prefix ARG, go back that many times Line 3957  With prefix ARG, go back that many times
3957             (if org-agenda-follow-mode "on" "off")))             (if org-agenda-follow-mode "on" "off")))
3958    
3959  (defun org-agenda-toggle-diary ()  (defun org-agenda-toggle-diary ()
3960    "Toggle follow mode in an agenda buffer."    "Toggle diary inclusion in an agenda buffer."
3961    (interactive)    (interactive)
3962    (setq org-agenda-include-diary (not org-agenda-include-diary))    (setq org-agenda-include-diary (not org-agenda-include-diary))
3963    (org-agenda-redo)    (org-agenda-redo)
# Line 3966  With prefix ARG, go back that many times Line 3966  With prefix ARG, go back that many times
3966             (if org-agenda-include-diary "on" "off")))             (if org-agenda-include-diary "on" "off")))
3967    
3968  (defun org-agenda-toggle-time-grid ()  (defun org-agenda-toggle-time-grid ()
3969    "Toggle follow mode in an agenda buffer."    "Toggle time-grid in an agenda buffer."
3970    (interactive)    (interactive)
3971    (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))    (setq org-agenda-use-time-grid (not org-agenda-use-time-grid))
3972    (org-agenda-redo)    (org-agenda-redo)
# Line 3997  With prefix ARG, go back that many times Line 3997  With prefix ARG, go back that many times
3997    "Get the (Emacs Calendar) diary entries for DATE."    "Get the (Emacs Calendar) diary entries for DATE."
3998    (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*")    (let* ((fancy-diary-buffer "*temporary-fancy-diary-buffer*")
3999           (diary-display-hook '(fancy-diary-display))           (diary-display-hook '(fancy-diary-display))
4000           (list-diary-entries-hook           (list-diary-entries-hook
4001            (cons 'org-diary-default-entry list-diary-entries-hook))            (cons 'org-diary-default-entry list-diary-entries-hook))
4002           entries           entries
4003           (org-disable-diary t))           (org-disable-diary t))
# Line 4021  With prefix ARG, go back that many times Line 4021  With prefix ARG, go back that many times
4021          (kill-buffer fancy-diary-buffer)))          (kill-buffer fancy-diary-buffer)))
4022      (when entries      (when entries
4023        (setq entries (org-split-string entries "\n"))        (setq entries (org-split-string entries "\n"))
4024        (setq entries        (setq entries
4025              (mapcar              (mapcar
4026               (lambda (x)               (lambda (x)
4027                 (setq x (org-format-agenda-item "" x "Diary" 'time))                 (setq x (org-format-agenda-item "" x "Diary" 'time))
4028                 ;; Extend the text properties to the beginning of the line                 ;; Extend the text properties to the beginning of the line
4029                 (add-text-properties                 (add-text-properties
4030                  0 (length x)                  0 (length x)
4031                  (text-properties-at (1- (length x)) x)                  (text-properties-at (1- (length x)) x)
4032                  x)                  x)
# Line 4034  With prefix ARG, go back that many times Line 4034  With prefix ARG, go back that many times
4034               entries)))))               entries)))))
4035    
4036  (defun org-agenda-cleanup-fancy-diary ()  (defun org-agenda-cleanup-fancy-diary ()
4037    "Remove unwanted stuff in buffer created by fancy-diary-display.    "Remove unwanted stuff in buffer created by `fancy-diary-display'.
4038  This gets rid of the date, the underline under the date, and  This gets rid of the date, the underline under the date, and
4039  the dummy entry installed by `org-mode' to ensure non-empty diary for each  the dummy entry installed by `org-mode' to ensure non-empty diary for each
4040  date.  Itt also removes lines that contain only whitespace."  date.  It also removes lines that contain only whitespace."
4041    (goto-char (point-min))    (goto-char (point-min))
4042    (if (looking-at ".*?:[ \t]*")    (if (looking-at ".*?:[ \t]*")
4043        (progn        (progn
# Line 4067  date.  Itt also removes lines that conta Line 4067  date.  Itt also removes lines that conta
4067            0 (length string)            0 (length string)
4068            (list 'mouse-face 'highlight            (list 'mouse-face 'highlight
4069                  'keymap org-agenda-keymap                  'keymap org-agenda-keymap
4070                  'help-echo                  'help-echo
4071                  (format                  (format
4072                   "mouse-2 or RET jump to diary file %s"                   "mouse-2 or RET jump to diary file %s"
4073                   (abbreviate-file-name (buffer-file-name)))                   (abbreviate-file-name (buffer-file-name)))
# Line 4089  Needed to avoid empty dates which mess u Line 4089  Needed to avoid empty dates which mess u
4089  These are the files which are being checked for agenda entries.  These are the files which are being checked for agenda entries.
4090  Optional argument FILE means, use this file instead of the current.  Optional argument FILE means, use this file instead of the current.
4091  It is possible (but not recommended) to add this function to the  It is possible (but not recommended) to add this function to the
4092  `org-mode-hook'."  `org-mode-hook'."
4093    (interactive)    (interactive)
4094    (catch 'exit    (catch 'exit
4095      (let* ((file (or file (buffer-file-name)      (let* ((file (or file (buffer-file-name)
# Line 4104  It is possible (but not recommended) to Line 4104  It is possible (but not recommended) to
4104                                 org-agenda-files))))                                 org-agenda-files))))
4105        (if (not present)        (if (not present)
4106            (progn            (progn
4107              (setq org-agenda-files              (setq org-agenda-files
4108                    (cons afile org-agenda-files))                    (cons afile org-agenda-files))
4109              ;; Make sure custom.el does not end up with Org-mode              ;; Make sure custom.el does not end up with Org-mode
4110              (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))              (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
# Line 4121  Optional argument FILE means, use this f Line 4121  Optional argument FILE means, use this f
4121    (let* ((file (or file (buffer-file-name)))    (let* ((file (or file (buffer-file-name)))
4122           (true-file (file-truename file))           (true-file (file-truename file))
4123           (afile (abbreviate-file-name file))           (afile (abbreviate-file-name file))
4124           (files (delq nil (mapcar           (files (delq nil (mapcar
4125                             (lambda (x)                             (lambda (x)
4126                               (if (equal true-file                               (if (equal true-file
4127                                          (file-truename x))                                          (file-truename x))
# Line 4168  sure that TODAY is included in the list. Line 4168  sure that TODAY is included in the list.
4168    "Return diary information from org-files.    "Return diary information from org-files.
4169  This function can be used in a \"sexp\" diary entry in the Emacs calendar.  This function can be used in a \"sexp\" diary entry in the Emacs calendar.
4170  It accesses org files and extracts information from those files to be  It accesses org files and extracts information from those files to be
   
4171  listed in the diary.  The function accepts arguments specifying what  listed in the diary.  The function accepts arguments specifying what
4172  items should be listed.  The following arguments are allowed:  items should be listed.  The following arguments are allowed:
4173    
# Line 4207  also be written as Line 4206  also be written as
4206    
4207  The function expects the lisp variables `entry' and `date' to be provided  The function expects the lisp variables `entry' and `date' to be provided
4208  by the caller, because this is how the calendar works.  Don't use this  by the caller, because this is how the calendar works.  Don't use this
4209  function from a program - use `org-agenda-get-day-entries' instead."  function from a program - use `org-agenda-get-day-entries' instead."
4210    (org-agenda-maybe-reset-markers)    (org-agenda-maybe-reset-markers)
4211    (org-compile-prefix-format org-agenda-prefix-format)    (org-compile-prefix-format org-agenda-prefix-format)
4212    (setq args (or args '(:deadline :scheduled :timestamp)))    (setq args (or args '(:deadline :scheduled :timestamp)))
# Line 4249  the documentation of `org-diary'." Line 4248  the documentation of `org-diary'."
4248                    (if (org-region-active-p)                    (if (org-region-active-p)
4249                        ;; Respect a region to restrict search                        ;; Respect a region to restrict search
4250                        (narrow-to-region (region-beginning) (region-end)))                        (narrow-to-region (region-beginning) (region-end)))
4251                  ;; If we work for the calendar or many files,                  ;; If we work for the calendar or many files,
4252                  ;; get rid of any restriction                  ;; get rid of any restriction
4253                  (widen))                  (widen))
4254                ;; The way we repeatedly append to `results' makes it O(n^2) :-(                ;; The way we repeatedly append to `results' makes it O(n^2) :-(
# Line 4315  the documentation of `org-diary'." Line 4314  the documentation of `org-diary'."
4314        (goto-char (match-beginning 1))        (goto-char (match-beginning 1))
4315        (setq marker (org-agenda-new-marker (point-at-bol))        (setq marker (org-agenda-new-marker (point-at-bol))
4316              txt (org-format-agenda-item "" (match-string 1))              txt (org-format-agenda-item "" (match-string 1))
4317              priority              priority
4318              (+ (org-get-priority txt)              (+ (org-get-priority txt)
4319                 (if org-todo-kwd-priority-p                 (if org-todo-kwd-priority-p
4320                           (- org-todo-kwd-max-priority -2                           (- org-todo-kwd-max-priority -2
# Line 4332  the documentation of `org-diary'." Line 4331  the documentation of `org-diary'."
4331      (nreverse ee)))      (nreverse ee)))
4332    
4333  (defconst org-agenda-no-heading-message  (defconst org-agenda-no-heading-message
4334    "No heading for this item in buffer or region")    "No heading for this item in buffer or region.")
4335    
4336  (defun org-agenda-get-timestamps ()  (defun org-agenda-get-timestamps ()
4337    "Return the date stamp information for agenda display."    "Return the date stamp information for agenda display."
# Line 4387  the documentation of `org-diary'." Line 4386  the documentation of `org-diary'."
4386                (if deadlinep                (if deadlinep
4387                    (add-text-properties                    (add-text-properties
4388                     0 (length txt)                     0 (length txt)
4389                     (list 'face                     (list 'face
4390                           (if donep 'org-done 'org-warning)                           (if donep 'org-done 'org-warning)
4391                           'undone-face 'org-warning                           'undone-face 'org-warning
4392                           'done-face 'org-done                           'done-face 'org-done
# Line 4447  the documentation of `org-diary'." Line 4446  the documentation of `org-diary'."
4446                (setq txt org-agenda-no-heading-message))                (setq txt org-agenda-no-heading-message))
4447              (when txt              (when txt
4448                (add-text-properties                (add-text-properties
4449                 0 (length txt)                 0 (length txt)
4450                 (append                 (append
4451                  (list 'org-marker (org-agenda-new-marker pos)                  (list 'org-marker (org-agenda-new-marker pos)
4452                        'org-hd-marker (org-agenda-new-marker pos1)                        'org-hd-marker (org-agenda-new-marker pos1)
4453                        'priority (+ (- 10 diff) (org-get-priority txt))                        'priority (+ (- 10 diff) (org-get-priority txt))
# Line 4540  the documentation of `org-diary'." Line 4539  the documentation of `org-diary'."
4539                    (setq hdmarker (org-agenda-new-marker (match-end 1)))                    (setq hdmarker (org-agenda-new-marker (match-end 1)))
4540                    (goto-char (match-end 1))                    (goto-char (match-end 1))
4541                    (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")                    (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
4542                    (setq txt (org-format-agenda-item                    (setq txt (org-format-agenda-item
4543                               (format (if (= d1 d2) "" "(%d/%d): ")                               (format (if (= d1 d2) "" "(%d/%d): ")
4544                                       (1+ (- d0 d1)) (1+ (- d2 d1)))                                       (1+ (- d0 d1)) (1+ (- d2 d1)))
4545                               (match-string 1) nil (if (= d0 d1) timestr))))                               (match-string 1) nil (if (= d0 d1) timestr))))
# Line 4622  only the correctly processes TXT should Line 4621  only the correctly processes TXT should
4621            (setq s0 (match-string 0 ts)            (setq s0 (match-string 0 ts)
4622                  s1 (match-string (if plain 1 2) ts)                  s1 (match-string (if plain 1 2) ts)
4623                  s2 (match-string (if plain 8 4) ts))                  s2 (match-string (if plain 8 4) ts))
4624              
4625            ;; If the times are in TXT (not in DOTIMES), and the prefix will list            ;; If the times are in TXT (not in DOTIMES), and the prefix will list
4626            ;; them, we might want to remove them there to avoid duplication.            ;; them, we might want to remove them there to avoid duplication.
4627            ;; The user can turn this off with a variable.            ;; The user can turn this off with a variable.
# Line 4635  only the correctly processes TXT should Line 4634  only the correctly processes TXT should
4634          ;; Normalize the time(s) to 24 hour          ;; Normalize the time(s) to 24 hour
4635          (if s1 (setq s1 (org-get-time-of-day s1 'string)))          (if s1 (setq s1 (org-get-time-of-day s1 'string)))
4636          (if s2 (setq s2 (org-get-time-of-day s2 'string))))          (if s2 (setq s2 (org-get-time-of-day s2 'string))))
4637          
4638        ;; Create the final string        ;; Create the final string
4639        (if noprefix        (if noprefix
4640            (setq rtn txt)            (setq rtn txt)
# Line 4647  only the correctly processes TXT should Line 4646  only the correctly processes TXT should
4646                category (if (symbolp category) (symbol-name category) category))                category (if (symbolp category) (symbol-name category) category))
4647          ;; Evaluate the compiled format          ;; Evaluate the compiled format
4648          (setq rtn (concat (eval org-prefix-format-compiled) txt)))          (setq rtn (concat (eval org-prefix-format-compiled) txt)))
4649          
4650        ;; And finally add the text properties        ;; And finally add the text properties
4651        (add-text-properties        (add-text-properties
4652         0 (length rtn) (list 'category (downcase category)         0 (length rtn) (list 'category (downcase category)
# Line 4678  only the correctly processes TXT should Line 4677  only the correctly processes TXT should
4677        (while (setq time (pop gridtimes))        (while (setq time (pop gridtimes))
4678          (unless (and remove (member time have))          (unless (and remove (member time have))
4679            (setq time (int-to-string time))            (setq time (int-to-string time))
4680            (push (org-format-agenda-item            (push (org-format-agenda-item
4681                   nil string "" ;; FIXME: put a category?                   nil string "" ;; FIXME: put a category?
4682                   (concat (substring time 0 -2) ":" (substring time -2)))                   (concat (substring time 0 -2) ":" (substring time -2)))
4683                  new)                  new)
4684            (put-text-property            (put-text-property
4685             1 (length (car new)) 'face 'org-time-grid (car new))))             1 (length (car new)) 'face 'org-time-grid (car new))))
4686        (if (member 'time-up org-agenda-sorting-strategy)        (if (member 'time-up org-agenda-sorting-strategy)
4687            (append new list)            (append new list)
# Line 4721  If not found, return nil. Line 4720  If not found, return nil.
4720  The optional STRING argument forces conversion into a 5 character wide string  The optional STRING argument forces conversion into a 5 character wide string
4721  HH:MM."  HH:MM."
4722    (save-match-data    (save-match-data
4723      (when      (when
4724       (or       (or
4725        (string-match        (string-match
4726         "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)         "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)
# Line 4743  HH:MM." Line 4742  HH:MM."
4742    (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))    (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))
4743    
4744  (defsubst org-cmp-priority (a b)  (defsubst org-cmp-priority (a b)
4745    "Compare the priorities of string a and b."    "Compare the priorities of strings A and B."
4746    (let ((pa (or (get-text-property 1 'priority a) 0))    (let ((pa (or (get-text-property 1 'priority a) 0))
4747          (pb (or (get-text-property 1 'priority b) 0)))          (pb (or (get-text-property 1 'priority b) 0)))
4748      (cond ((> pa pb) +1)      (cond ((> pa pb) +1)
# Line 4751  HH:MM." Line 4750  HH:MM."
4750            (t nil))))            (t nil))))
4751    
4752  (defsubst org-cmp-category (a b)  (defsubst org-cmp-category (a b)
4753    "Compare the string values of categories of strings a and b."    "Compare the string values of categories of strings A and B."
4754    (let ((ca (or (get-text-property 1 'category a) ""))    (let ((ca (or (get-text-property 1 'category a) ""))
4755          (cb (or (get-text-property 1 'category b) "")))          (cb (or (get-text-property 1 'category b) "")))
4756      (cond ((string-lessp ca cb) -1)      (cond ((string-lessp ca cb) -1)
# Line 4759  HH:MM." Line 4758  HH:MM."
4758            (t nil))))            (t nil))))
4759    
4760  (defsubst org-cmp-time (a b)  (defsubst org-cmp-time (a b)
4761    "Compare the time-of-day values of strings a and b."    "Compare the time-of-day values of strings A and B."
4762    (let* ((def (if org-sort-agenda-notime-is-late 2401 -1))    (let* ((def (if org-sort-agenda-notime-is-late 2401 -1))
4763           (ta (or (get-text-property 1 'time-of-day a) def))           (ta (or (get-text-property 1 'time-of-day a) def))
4764           (tb (or (get-text-property 1 'time-of-day b) def)))           (tb (or (get-text-property 1 'time-of-day b) def)))
# Line 4777  HH:MM." Line 4776  HH:MM."
4776           (category-up (org-cmp-category a b))           (category-up (org-cmp-category a b))
4777           (category-down (if category-up (- category-up) nil))           (category-down (if category-up (- category-up) nil))
4778           (category-keep (if category-up +1 nil)))  ; FIXME +1 or -1?           (category-keep (if category-up +1 nil)))  ; FIXME +1 or -1?
4779      (cdr (assoc      (cdr (assoc
4780            (eval (cons 'or org-agenda-sorting-strategy))            (eval (cons 'or org-agenda-sorting-strategy))
4781            '((-1 . t) (1 . nil) (nil . nil))))))            '((-1 . t) (1 . nil) (nil . nil))))))
4782    
# Line 4792  and by additional input from the age of Line 4791  and by additional input from the age of
4791  (defun org-agenda-goto (&optional highlight)  (defun org-agenda-goto (&optional highlight)
4792    "Go to the Org-mode file which contains the item at point."    "Go to the Org-mode file which contains the item at point."
4793    (interactive)    (interactive)
4794    (let* ((marker (or (get-text-property (point) 'org-marker)    (let* ((marker (or (get-text-property (point) 'org-marker)
4795                       (org-agenda-error)))                       (org-agenda-error)))
4796           (buffer (marker-buffer marker))           (buffer (marker-buffer marker))
4797           (pos (marker-position marker)))           (pos (marker-position marker)))
# Line 4809  and by additional input from the age of Line 4808  and by additional input from the age of
4808  (defun org-agenda-switch-to ()  (defun org-agenda-switch-to ()
4809    "Go to the Org-mode file which contains the item at point."    "Go to the Org-mode file which contains the item at point."
4810    (interactive)    (interactive)
4811    (let* ((marker (or (get-text-property (point) 'org-marker)    (let* ((marker (or (get-text-property (point) 'org-marker)
4812                       (org-agenda-error)))                       (org-agenda-error)))
4813           (buffer (marker-buffer marker))           (buffer (marker-buffer marker))
4814           (pos (marker-position marker)))           (pos (marker-position marker)))
# Line 4895  the same tree node, and the headline of Line 4894  the same tree node, and the headline of
4894      (move-to-column col)))      (move-to-column col)))
4895    
4896  (defun org-agenda-change-all-lines (newhead hdmarker &optional fixface)  (defun org-agenda-change-all-lines (newhead hdmarker &optional fixface)
4897    "Change all lines in the agenda buffer which match hdmarker.    "Change all lines in the agenda buffer which match HDMARKER.
4898  The new content of the line will be NEWHEAD (as modified by  The new content of the line will be NEWHEAD (as modified by
4899  `org-format-agenda-item').  HDMARKER is checked with  `org-format-agenda-item').  HDMARKER is checked with
4900  `equal' against all `org-hd-marker' text properties in the file.  `equal' against all `org-hd-marker' text properties in the file.
# Line 4923  the new TODO state." Line 4922  the new TODO state."
4922                  (beginning-of-line 1)                  (beginning-of-line 1)
4923                  (add-text-properties (point-at-bol) (point-at-eol) props)                  (add-text-properties (point-at-bol) (point-at-eol) props)
4924                  (if fixface                  (if fixface
4925                      (add-text-properties                      (add-text-properties
4926                       (point-at-bol) (point-at-eol)                       (point-at-bol) (point-at-eol)
4927                       (list 'face                       (list 'face
4928                             (if org-last-todo-state-is-todo                             (if org-last-todo-state-is-todo
# Line 5017  be used to request time specification in Line 5016  be used to request time specification in
5016    
5017  (defun org-agenda-diary-entry ()  (defun org-agenda-diary-entry ()
5018    "Make a diary entry, like the `i' command from the calendar.    "Make a diary entry, like the `i' command from the calendar.
5019  All the standard commands work: block, weekly etc"  All the standard commands work: block, weekly etc."
5020    (interactive)    (interactive)
5021    (require 'diary-lib)    (require 'diary-lib)
5022    (let* ((char (progn    (let* ((char (progn
5023                   (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")                   (message "Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic")
5024                   (read-char-exclusive)))                   (read-char-exclusive)))
5025           (cmd (cdr (assoc char           (cmd (cdr (assoc char
# Line 5050  All the standard commands work: block, w Line 5049  All the standard commands work: block, w
5049            (progn            (progn
5050              (fset 'calendar-cursor-to-date              (fset 'calendar-cursor-to-date
5051                    (lambda (&optional error)                    (lambda (&optional error)
5052                      (calendar-gregorian-from-absolute                      (calendar-gregorian-from-absolute
5053                       (get-text-property point 'day))))                       (get-text-property point 'day))))
5054              (call-interactively cmd))              (call-interactively cmd))
5055          (fset 'calendar-cursor-to-date oldf)))))          (fset 'calendar-cursor-to-date oldf)))))
# Line 5073  the cursor position." Line 5072  the cursor position."
5072            (progn            (progn
5073              (fset 'calendar-cursor-to-date              (fset 'calendar-cursor-to-date
5074                    (lambda (&optional error)                    (lambda (&optional error)
5075                      (calendar-gregorian-from-absolute                      (calendar-gregorian-from-absolute
5076                       (get-text-property point 'day))))                       (get-text-property point 'day))))
5077              (call-interactively cmd))              (call-interactively cmd))
5078          (fset 'calendar-cursor-to-date oldf))))          (fset 'calendar-cursor-to-date oldf))))
# Line 5123  This is a command that has to be install Line 5122  This is a command that has to be install
5122      (unless day      (unless day
5123        (error "Don't know which date to convert"))        (error "Don't know which date to convert"))
5124      (setq date (calendar-gregorian-from-absolute day))      (setq date (calendar-gregorian-from-absolute day))
5125      (setq s (concat      (setq s (concat
5126               "Gregorian:  " (calendar-date-string date) "\n"               "Gregorian:  " (calendar-date-string date) "\n"
5127               "ISO:        " (calendar-iso-date-string date) "\n"               "ISO:        " (calendar-iso-date-string date) "\n"
5128               "Day of Yr:  " (calendar-day-of-year-string date) "\n"               "Day of Yr:  " (calendar-day-of-year-string date) "\n"
# Line 5236  optional argument IN-EMACS is non-nil, E Line 5235  optional argument IN-EMACS is non-nil, E
5235    
5236           ((string= type "shell")           ((string= type "shell")
5237            (let ((cmd path))            (let ((cmd path))
5238              (while (string-match "@{" cmd)              (while (string-match "@{" cmd)
5239                (setq cmd (replace-match "<" t t cmd)))                (setq cmd (replace-match "<" t t cmd)))
5240              (while (string-match "@}" cmd)              (while (string-match "@}" cmd)
5241                (setq cmd (replace-match ">" t t cmd)))                (setq cmd (replace-match ">" t t cmd)))
5242              (if (or (not org-confirm-shell-links)              (if (or (not org-confirm-shell-links)
5243                      (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd)))                      (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd)))
# Line 5335  optional argument IN-EMACS is non-nil, E Line 5334  optional argument IN-EMACS is non-nil, E
5334                  (widen)                  (widen)
5335                  (goto-char (point-max))                  (goto-char (point-max))
5336                  (if (re-search-backward                  (if (re-search-backward
5337                       (concat "^Message-ID:\\s-+" (regexp-quote                       (concat "^Message-ID:\\s-+" (regexp-quote
5338                                                    (or article "")))                                                    (or article "")))
5339                       nil t)                       nil t)
5340                      (rmail-what-message))))))                      (rmail-what-message))))))
# Line 5422  For file links, arg negates `org-line-nu Line 5421  For file links, arg negates `org-line-nu
5421                      (or (bbdb-record-name (bbdb-current-record))                      (or (bbdb-record-name (bbdb-current-record))
5422                          (bbdb-record-company (bbdb-current-record))))                          (bbdb-record-company (bbdb-current-record))))
5423              link (org-make-link cpltxt)))              link (org-make-link cpltxt)))
5424        
5425       ((eq major-mode 'calendar-mode)       ((eq major-mode 'calendar-mode)
5426        (let ((cd (calendar-cursor-to-date)))        (let ((cd (calendar-cursor-to-date)))
5427          (setq link          (setq link
# Line 5448  For file links, arg negates `org-line-nu Line 5447  For file links, arg negates `org-line-nu
5447                             folder)                             folder)
5448               (setq folder (replace-match "" t t folder)))               (setq folder (replace-match "" t t folder)))
5449           (setq cpltxt (concat author " on: " subject))           (setq cpltxt (concat author " on: " subject))
5450           (setq link (concat cpltxt "\n  "           (setq link (concat cpltxt "\n  "
5451                              (org-make-link                              (org-make-link
5452                               "vm:" folder "#" message-id))))))                               "vm:" folder "#" message-id))))))
5453    
5454       ((eq major-mode 'wl-summary-mode)       ((eq major-mode 'wl-summary-mode)
# Line 5461  For file links, arg negates `org-line-nu Line 5460  For file links, arg negates `org-line-nu
5460               (author (wl-summary-line-from)) ; FIXME: how to get author name?               (author (wl-summary-line-from)) ; FIXME: how to get author name?
5461               (subject "???"))   ; FIXME: How to get subject of email?               (subject "???"))   ; FIXME: How to get subject of email?
5462          (setq cpltxt (concat author  " on: " subject))          (setq cpltxt (concat author  " on: " subject))
5463          (setq link (concat cpltxt "\n  "          (setq link (concat cpltxt "\n  "
5464                             (org-make-link                             (org-make-link
5465                              "wl:" wl-summary-buffer-folder-name                              "wl:" wl-summary-buffer-folder-name
5466                             "#" message-id)))))                             "#" message-id)))))
# Line 5475  For file links, arg negates `org-line-nu Line 5474  For file links, arg negates `org-line-nu
5474                  (author (mail-fetch-field "from"))                  (author (mail-fetch-field "from"))
5475                  (subject (mail-fetch-field "subject")))                  (subject (mail-fetch-field "subject")))
5476              (setq cpltxt (concat author  " on: " subject))              (setq cpltxt (concat author  " on: " subject))
5477              (setq link (concat cpltxt "\n  "              (setq link (concat cpltxt "\n  "
5478                                 (org-make-link                                 (org-make-link
5479                                  "rmail:" folder "#" message-id)))))))                                  "rmail:" folder "#" message-id)))))))
5480    
# Line 5529  For file links, arg negates `org-line-nu Line 5528  For file links, arg negates `org-line-nu
5528        (if (org-xor org-line-numbers-in-file-links arg)        (if (org-xor org-line-numbers-in-file-links arg)
5529            (setq cpltxt            (setq cpltxt
5530                  (concat cpltxt                  (concat cpltxt
5531                          ":" (int-to-string                          ":" (int-to-string
5532                               (+ (if (bolp) 1 0) (count-lines                               (+ (if (bolp) 1 0) (count-lines
5533                                                   (point-min) (point)))))))                                                   (point-min) (point)))))))
5534        (setq link (org-make-link cpltxt)))        (setq link (org-make-link cpltxt)))
# Line 5555  For file links, arg negates `org-line-nu Line 5554  For file links, arg negates `org-line-nu
5554    (if a (not b) b))    (if a (not b) b))
5555    
5556  (defun org-get-header (header)  (defun org-get-header (header)
5557    "Find a header field in the current buffer."    "Find a HEADER field in the current buffer."
5558    (save-excursion    (save-excursion
5559      (goto-char (point-min))      (goto-char (point-min))
5560      (let ((case-fold-search t) s)      (let ((case-fold-search t) s)
# Line 5664  conventions in Org-mode.  This function Line 5663  conventions in Org-mode.  This function
5663  UP/DOWN=headline   TAB=cycle visibility  [Q]uit   RET/<left>/<right>=Store  UP/DOWN=headline   TAB=cycle visibility  [Q]uit   RET/<left>/<right>=Store
5664  RET at beg-of-buf -> Append to file as level 2 headline  RET at beg-of-buf -> Append to file as level 2 headline
5665  RET on headline   -> Store as sublevel entry to current headline  RET on headline   -> Store as sublevel entry to current headline
5666  <left>/<right>    -> before/after current headline, same headings level")  <left>/<right>    -> Before/after current headline, same headings level")
5667    
5668  ;;;###autoload  ;;;###autoload
5669  (defun org-remember-handler ()  (defun org-remember-handler ()
# Line 5699  If the variable `org-adapt-indentation' Line 5698  If the variable `org-adapt-indentation'
5698  also indented so that it starts in the same column as the headline  also indented so that it starts in the same column as the headline
5699  \(i.e. after the stars).  \(i.e. after the stars).
5700    
5701  See also the variable `org-reverse-note-order'."    See also the variable `org-reverse-note-order'."
5702    (catch 'quit    (catch 'quit
5703      (let* ((txt (buffer-substring (point-min) (point-max)))      (let* ((txt (buffer-substring (point-min) (point-max)))
5704             (fastp current-prefix-arg)             (fastp current-prefix-arg)
# Line 5874  SIZE is a string Columns x Rows like for Line 5873  SIZE is a string Columns x Rows like for
5873  The region goes from BEG0 to END0, but these borders will be moved  The region goes from BEG0 to END0, but these borders will be moved
5874  slightly, to make sure a beginning of line in the first line is included.  slightly, to make sure a beginning of line in the first line is included.
5875  When NSPACE is non-nil, it indicates the minimum number of spaces that  When NSPACE is non-nil, it indicates the minimum number of spaces that
5876  separate columns (default: just one space)"  separate columns (default: just one space)."
5877    (let* ((beg (min beg0 end0))    (let* ((beg (min beg0 end0))
5878           (end (max beg0 end0))           (end (max beg0 end0))
5879           (tabsep t)           (tabsep t)
# Line 6207  If the field at the cursor is empty, cop Line 6206  If the field at the cursor is empty, cop
6206  non-empty field above.  With argument N, use the Nth non-empty field.  non-empty field above.  With argument N, use the Nth non-empty field.
6207  If the current field is not empty, it is copied down to the next row, and  If the current field is not empty, it is copied down to the next row, and
6208  the cursor is moved with it.  Therefore, repeating this command causes the  the cursor is moved with it.  Therefore, repeating this command causes the
6209  column to be filled row-by-row.    column to be filled row-by-row.
6210  If the variable `org-table-copy-increment' is non-nil and the field is an  If the variable `org-table-copy-increment' is non-nil and the field is an
6211  integer, it will be incremented while copying."  integer, it will be incremented while copying."
6212    (interactive "p")    (interactive "p")
# Line 6305  When called interactively, column is als Line 6304  When called interactively, column is als
6304  (defun org-table-goto-column (n &optional on-delim force)  (defun org-table-goto-column (n &optional on-delim force)
6305    "Move the cursor to the Nth column in the current table line.    "Move the cursor to the Nth column in the current table line.
6306  With optional argument ON-DELIM, stop with point before the left delimiter  With optional argument ON-DELIM, stop with point before the left delimiter
6307  of the field.  of the field.
6308  If there are less than N fields, just go to after the last delimiter.  If there are less than N fields, just go to after the last delimiter.
6309  However, when FORCE is non-nil, create new columns if necessary."  However, when FORCE is non-nil, create new columns if necessary."
6310    (let ((pos (point-at-eol)))    (let ((pos (point-at-eol)))
# Line 6326  However, when FORCE is non-nil, create n Line 6325  However, when FORCE is non-nil, create n
6325    
6326  (defun org-at-table-p (&optional table-type)  (defun org-at-table-p (&optional table-type)
6327    "Return t if the cursor is inside an org-type table.    "Return t if the cursor is inside an org-type table.
6328  If TABLE-TYPE is non-nil, also chack for table.el-type tables."  If TABLE-TYPE is non-nil, also check for table.el-type tables."
6329    (if org-enable-table-editor    (if org-enable-table-editor
6330        (save-excursion        (save-excursion
6331          (beginning-of-line 1)          (beginning-of-line 1)
# Line 6490  If TABLE-TYPE is non-nil, also chack for Line 6489  If TABLE-TYPE is non-nil, also chack for
6489      (org-table-modify-formulas 'swap col (if left (1- col) (1+ col)))))      (org-table-modify-formulas 'swap col (if left (1- col) (1+ col)))))
6490    
6491  (defun org-table-move-row-down ()  (defun org-table-move-row-down ()
6492    "move table row down."    "Move table row down."
6493    (interactive)    (interactive)
6494    (org-table-move-row nil))    (org-table-move-row nil))
6495  (defun org-table-move-row-up ()  (defun org-table-move-row-up ()
6496    "move table row up."    "Move table row up."
6497    (interactive)    (interactive)
6498    (org-table-move-row 'up))    (org-table-move-row 'up))
6499    
# Line 6590  With prefix ARG, insert above the curren Line 6589  With prefix ARG, insert above the curren
6589  (defun org-table-copy-region (beg end &optional cut)  (defun org-table-copy-region (beg end &optional cut)
6590    "Copy rectangular region in table to clipboard.    "Copy rectangular region in table to clipboard.
6591  A special clipboard is used which can only be accessed  A special clipboard is used which can only be accessed
6592  with `org-table-paste-rectangle'"  with `org-table-paste-rectangle'."
6593    (interactive "rP")    (interactive "rP")
6594    (let* (l01 c01 l02 c02 l1 c1 l2 c2 ic1 ic2    (let* (l01 c01 l02 c02 l1 c1 l2 c2 ic1 ic2
6595           region cols           region cols
# Line 6598  with `org-table-paste-rectangle'" Line 6597  with `org-table-paste-rectangle'"
6597      (goto-char beg)      (goto-char beg)
6598      (org-table-check-inside-data-field)      (org-table-check-inside-data-field)
6599      (setq l01 (count-lines (point-min) (point))      (setq l01 (count-lines (point-min) (point))
6600            c01 (org-table-current-column))            c01 (org-table-current-column))
6601      (goto-char end)      (goto-char end)
6602      (org-table-check-inside-data-field)      (org-table-check-inside-data-field)
6603      (setq l02 (count-lines (point-min) (point))      (setq l02 (count-lines (point-min) (point))
# Line 6620  with `org-table-paste-rectangle'" Line 6619  with `org-table-paste-rectangle'"
6619      (setq org-table-clip (nreverse region))      (setq org-table-clip (nreverse region))
6620      (if cut (org-table-align))      (if cut (org-table-align))
6621      org-table-clip))      org-table-clip))
6622      
6623  (defun org-table-paste-rectangle ()  (defun org-table-paste-rectangle ()
6624    "Paste a rectangular region into a table.    "Paste a rectangular region into a table.
6625  The upper right corner ends up in the current field.  All involved fields  The upper right corner ends up in the current field.  All involved fields
# Line 6731  blank, and the content is appended to th Line 6730  blank, and the content is appended to th
6730                               (+ (length org-table-clip) arg)                               (+ (length org-table-clip) arg)
6731                             arg)                             arg)
6732                         (length org-table-clip)))                         (length org-table-clip)))
6733          (setq org-table-clip          (setq org-table-clip
6734                (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ")                (mapcar 'list (org-wrap (mapconcat 'car org-table-clip " ")
6735                                        nil nlines)))                                        nil nlines)))
6736          (goto-char beg)          (goto-char beg)
# Line 6787  The return value is a list of lines, wit Line 6786  The return value is a list of lines, wit
6786                 (setq ll (org-do-wrap words w)))                 (setq ll (org-do-wrap words w)))
6787               ll))               ll))
6788            (t (error "Cannot wrap this")))))            (t (error "Cannot wrap this")))))
6789              
6790    
6791  (defun org-do-wrap (words width)  (defun org-do-wrap (words width)
6792    "Create lines of maximum width WIDTH (in characters) from word list WORDS."    "Create lines of maximum width WIDTH (in characters) from word list WORDS."
# Line 6851  and end of string." Line 6850  and end of string."
6850    "Toggle the visibility of table vertical lines.    "Toggle the visibility of table vertical lines.
6851  The effect is immediate and on all tables in the file.  The effect is immediate and on all tables in the file.
6852  With prefix ARG, make lines invisible when ARG is positive, make lines  With prefix ARG, make lines invisible when ARG is positive, make lines
6853  visible when ARG is not positive"  visible when ARG is not positive."
6854    (interactive "P")    (interactive "P")
6855    (let ((action (cond    (let ((action (cond
6856                   ((and arg (> (prefix-numeric-value arg) 0)) 'on)                   ((and arg (> (prefix-numeric-value arg) 0)) 'on)
# Line 7003  If NLAST is a number, only the NLAST fie Line 7002  If NLAST is a number, only the NLAST fie
7002              "\n")))              "\n")))
7003    
7004  (defun org-table-get-stored-formulas ()  (defun org-table-get-stored-formulas ()
7005    "Return an alist withh the t=stored formulas directly after current table."    "Return an alist with the stored formulas directly after current table."
7006    (interactive)    (interactive)
7007    (let (col eq eq-alist strings string)    (let (col eq eq-alist strings string)
7008      (save-excursion      (save-excursion
# Line 7069  expected, for the other action only a si Line 7068  expected, for the other action only a si
7068    "Alist with parameter names, derived from the `$' line.")    "Alist with parameter names, derived from the `$' line.")
7069    
7070  (defun org-table-get-specials ()  (defun org-table-get-specials ()
7071    "Get the column nmaes and local parameters for this table."    "Get the column names and local parameters for this table."
7072    (save-excursion    (save-excursion
7073      (let ((beg (org-table-begin)) (end (org-table-end))      (let ((beg (org-table-begin)) (end (org-table-end))
7074            names name fields field cnt)            names name fields field cnt)
# Line 7115  expected, for the other action only a si Line 7114  expected, for the other action only a si
7114                    dfield (match-string 1 dfield)))                    dfield (match-string 1 dfield)))
7115          (cond          (cond
7116           ((equal dfield "=sumh")           ((equal dfield "=sumh")
7117            (org-table-get-field            (org-table-get-field
7118             nil (org-table-sum             nil (org-table-sum
7119                  (save-excursion (org-table-goto-column 1) (point))                  (save-excursion (org-table-goto-column 1) (point))
7120                  (point) nlast)))                  (point) nlast)))
7121           ((member dfield '("=sum" "=sumv"))           ((member dfield '("=sum" "=sumv"))
7122            (setq col (org-table-current-column)            (setq col (org-table-current-column)
7123                  bolpos (point-at-bol))                  bolpos (point-at-bol))
7124            (org-table-get-field            (org-table-get-field
7125             nil (org-table-sum             nil (org-table-sum
7126                  (save-excursion                  (save-excursion
7127                    (goto-char (org-table-begin))                    (goto-char (org-table-begin))
# Line 7144  expected, for the other action only a si Line 7143  expected, for the other action only a si
7143    :type 'boolean)    :type 'boolean)
7144    
7145  (defvar org-recalc-commands nil  (defvar org-recalc-commands nil
7146    "List of commands triggering the reccalculation of a line.    "List of commands triggering the recalculation of a line.
7147  Will be filled automatically during use.")  Will be filled automatically during use.")
7148    
7149  (defvar org-recalc-marks  (defvar org-recalc-marks
# Line 7194  of the new mark." Line 7193  of the new mark."
7193      (setq epos (point-at-eol))      (setq epos (point-at-eol))
7194      (save-excursion      (save-excursion
7195        (beginning-of-line 1)        (beginning-of-line 1)
7196        (org-table-get-field        (org-table-get-field
7197         1 (if (looking-at "^[ \t]*| *\\([#!$* ]\\) *|")         1 (if (looking-at "^[ \t]*| *\\([#!$* ]\\) *|")
7198               (concat " "               (concat " "
7199                       (setq new (or forcenew                       (setq new (or forcenew
7200                                     (cadr (member (match-string 1) marks))))                                     (cadr (member (match-string 1) marks))))
7201                       " ")                       " ")
7202             " # ")))             " # ")))
# Line 7266  A few examples for formulas: Line 7265  A few examples for formulas:
7265    $1+$2;%.2f          Same, and format result to two digits after dec.point    $1+$2;%.2f          Same, and format result to two digits after dec.point
7266    exp($2)+exp($1)     Math functions can be used    exp($2)+exp($1)     Math functions can be used
7267    $;%.1f              Reformat current cell to 1 digit after dec.point    $;%.1f              Reformat current cell to 1 digit after dec.point
7268    ($3-32)*5/9         degrees F -> C conversion    ($3-32)*5/9         Degrees F -> C conversion
7269    
7270  When called with a raw \\[universal-argument] prefix, the formula is applied to the current  When called with a raw \\[universal-argument] prefix, the formula is applied to the current
7271  field, and to the same same column in all following rows, until reaching a  field, and to the same same column in all following rows, until reaching a
# Line 7306  it is a modified equation that should no Line 7305  it is a modified equation that should no
7305                    n (string-to-number (or (match-string 1 fmt) "")))                    n (string-to-number (or (match-string 1 fmt) "")))
7306              (if (= c ?p) (org-set-calc-mode 'calc-internal-prec n)              (if (= c ?p) (org-set-calc-mode 'calc-internal-prec n)
7307                (org-set-calc-mode 'calc-float-format                (org-set-calc-mode 'calc-float-format
7308                                   (list (cdr (assoc c '((?n. float) (?f. fix)                                   (list (cdr (assoc c '((?n. float) (?f. fix)
7309                                                         (?s. sci) (?e. eng))))                                                         (?s. sci) (?e. eng))))
7310                                         n)))                                         n)))
7311              (setq fmt (replace-match "" t t fmt)))              (setq fmt (replace-match "" t t fmt)))
# Line 7350  it is a modified equation that should no Line 7349  it is a modified equation that should no
7349    
7350        (when org-table-formula-debug        (when org-table-formula-debug
7351          (with-output-to-temp-buffer "*Help*"          (with-output-to-temp-buffer "*Help*"
7352            (princ (format "Substitution history of formula                              (princ (format "Substitution history of formula
7353  Orig:   %s  Orig:   %s
7354  $xyz->  %s  $xyz->  %s
7355  $1->    %s\n" orig formula form))  $1->    %s\n" orig formula form))
# Line 7429  $1->    %s\n" orig formula form)) Line 7428  $1->    %s\n" orig formula form))
7428          (and all (message "Re-applying formulas to %d lines...done" cnt)))))          (and all (message "Re-applying formulas to %d lines...done" cnt)))))
7429    
7430  (defun org-table-formula-substitute-names (f)  (defun org-table-formula-substitute-names (f)
7431    "Replace $const with values in stirng F."    "Replace $const with values in string F."
7432    (let ((start 0) a n1 n2 nn1 nn2 s (f1 f))    (let ((start 0) a n1 n2 nn1 nn2 s (f1 f))
7433      ;; First, check for column names      ;; First, check for column names
7434      (while (setq start (string-match org-table-column-name-regexp f start))      (while (setq start (string-match org-table-column-name-regexp f start))
# Line 7451  $1->    %s\n" orig formula form)) Line 7450  $1->    %s\n" orig formula form))
7450      (setq start 0)      (setq start 0)
7451      (while (setq start (string-match "\\$\\([a-zA-Z][a-zA-Z0-9]*\\)" f start))      (while (setq start (string-match "\\$\\([a-zA-Z][a-zA-Z0-9]*\\)" f start))
7452        (setq start (1+ start))        (setq start (1+ start))
7453        (if (setq a (save-match-data        (if (setq a (save-match-data
7454                      (org-table-get-constant (match-string 1 f))))                      (org-table-get-constant (match-string 1 f))))
7455            (setq f (replace-match (concat "(" a ")") t t f))))            (setq f (replace-match (concat "(" a ")") t t f))))
7456      (if org-table-formula-debug      (if org-table-formula-debug
# Line 7523  table editor in arbitrary modes.") Line 7522  table editor in arbitrary modes.")
7522    
7523  ;;;###autoload  ;;;###autoload
7524  (defun orgtbl-mode (&optional arg)  (defun orgtbl-mode (&optional arg)
7525    "The `org-mode' table editor as a minor mode for use in other modes."    "The `org-mode' table editor as a minor mode for use in other modes."
7526    (interactive)    (interactive)
7527    (if (eq major-mode 'org-mode)    (if (eq major-mode 'org-mode)
7528        ;; Exit without error, in case some hook functions calls this        ;; Exit without error, in case some hook functions calls this
# Line 7545  table editor in arbitrary modes.") Line 7544  table editor in arbitrary modes.")
7544            (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)            (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
7545                 auto-fill-inhibit-regexp)                 auto-fill-inhibit-regexp)
7546            (set (make-local-variable 'auto-fill-inhibit-regexp)            (set (make-local-variable 'auto-fill-inhibit-regexp)
7547                 (if auto-fill-inhibit-regexp                 (if auto-fill-inhibit-regexp
7548                     (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)                     (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
7549                   "[ \t]*|"))                   "[ \t]*|"))
7550            (easy-menu-add orgtbl-mode-menu)            (easy-menu-add orgtbl-mode-menu)
# Line 7562  table editor in arbitrary modes.") Line 7561  table editor in arbitrary modes.")
7561    
7562  (defun orgtbl-make-binding (fun n &rest keys)  (defun orgtbl-make-binding (fun n &rest keys)
7563    "Create a function for binding in the table minor mode.    "Create a function for binding in the table minor mode.
7564  FUN is the command to call inside a table. N is used to create a unique  FUN is the command to call inside a table.  N is used to create a unique
7565  command name. KEYS are keys that should be checked in for a command  command name.  KEYS are keys that should be checked in for a command
7566  to execute outside of tables."  to execute outside of tables."
7567    (eval    (eval
7568     (list 'defun     (list 'defun
7569           (intern (concat "orgtbl-hijacker-command-" (int-to-string n)))           (intern (concat "orgtbl-hijacker-command-" (int-to-string n)))
7570           '(arg)           '(arg)
7571           (concat "In tables, run `" (symbol-name fun) "'.\n"           (concat "In tables, run `" (symbol-name fun) "'.\n"
# Line 7588  to execute outside of tables." Line 7587  to execute outside of tables."
7587  (defun orgtbl-error ()  (defun orgtbl-error ()
7588    "Error when there is no default binding for a table key."    "Error when there is no default binding for a table key."
7589    (interactive)    (interactive)
7590    (error "This key is has no function outside tables"))    (error "This key has no function outside tables"))
7591    
7592  (defun orgtbl-setup ()  (defun orgtbl-setup ()
7593    "Setup orgtbl keymaps."    "Setup orgtbl keymaps."
# Line 7628  to execute outside of tables." Line 7627  to execute outside of tables."
7627              cmd (orgtbl-make-binding fun nfunc key))              cmd (orgtbl-make-binding fun nfunc key))
7628        (define-key orgtbl-mode-map key cmd))        (define-key orgtbl-mode-map key cmd))
7629      ;; Special treatment needed for TAB and RET      ;; Special treatment needed for TAB and RET
7630      (define-key orgtbl-mode-map [(return)]      (define-key orgtbl-mode-map [(return)]
7631        (orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))        (orgtbl-make-binding 'orgtbl-ret 100 [(return)] "\C-m"))
7632      (define-key orgtbl-mode-map "\C-m"      (define-key orgtbl-mode-map "\C-m"
7633        (orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))        (orgtbl-make-binding 'orgtbl-ret 101 "\C-m" [(return)]))
7634      (define-key orgtbl-mode-map [(tab)]      (define-key orgtbl-mode-map [(tab)]
7635        (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))        (orgtbl-make-binding 'orgtbl-tab 102 [(tab)] "\C-i"))
7636      (define-key orgtbl-mode-map "\C-i"      (define-key orgtbl-mode-map "\C-i"
7637        (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)])))        (orgtbl-make-binding 'orgtbl-tab 103 "\C-i" [(tab)])))
# Line 7680  to execute outside of tables." Line 7679  to execute outside of tables."
7679          ["Recalculate line" org-table-recalculate :active (org-at-table-p) :keys "C-c *"]          ["Recalculate line" org-table-recalculate :active (org-at-table-p) :keys "C-c *"]
7680          ["Recalculate all" (org-table-recalculate '(4)) :active (org-at-table-p) :keys "C-u C-c *"]          ["Recalculate all" (org-table-recalculate '(4)) :active (org-at-table-p) :keys "C-u C-c *"]
7681          ["Toggle Recalculate Mark" org-table-rotate-recalc-marks :active (org-at-table-p) :keys "C-c #"]          ["Toggle Recalculate Mark" org-table-rotate-recalc-marks :active (org-at-table-p) :keys "C-c #"]
7682          ["Sum Column/Rectangle" org-table-sum          ["Sum Column/Rectangle" org-table-sum
7683           :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"]           :active (or (org-at-table-p) (org-region-active-p)) :keys "C-c +"]
7684          ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"]          ["Which Column?" org-table-current-column :active (org-at-table-p) :keys "C-c ?"]
7685          ["Debug Formulas"          ["Debug Formulas"
# Line 8262  and all options lines." Line 8261  and all options lines."
8261    (let* ((filename (concat (file-name-sans-extension (buffer-file-name))    (let* ((filename (concat (file-name-sans-extension (buffer-file-name))
8262                             ".txt"))                             ".txt"))
8263           (buffer (find-file-noselect filename))           (buffer (find-file-noselect filename))
8264           (ore (concat           (ore (concat
8265                 (org-make-options-regexp                 (org-make-options-regexp
8266                  '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"                  '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
8267                    "STARTUP" "ARCHIVE"                    "STARTUP" "ARCHIVE"
# Line 8494  headlines.  The default is 3.  Lower lev Line 8493  headlines.  The default is 3.  Lower lev
8493                             ;; This is a headline                             ;; This is a headline
8494                             (progn                             (progn
8495                               (setq level (- (match-end 1) (match-beginning 1))                               (setq level (- (match-end 1) (match-beginning 1))
8496                                     txt (save-match-data                                     txt (save-match-data
8497                                           (org-html-expand                                           (org-html-expand
8498                                            (match-string 3 line)))                                            (match-string 3 line)))
8499                                     todo                                     todo
# Line 8681  headlines.  The default is 3.  Lower lev Line 8680  headlines.  The default is 3.  Lower lev
8680          (org-format-table-table-html-using-table-generate-source olines)))))          (org-format-table-table-html-using-table-generate-source olines)))))
8681    
8682  (defun org-format-org-table-html (lines)  (defun org-format-org-table-html (lines)
8683    "Format a table into html."    "Format a table into HTML."
8684    (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))    (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
8685    (setq lines (nreverse lines))    (setq lines (nreverse lines))
8686    (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))    (if (string-match "^[ \t]*|-" (car lines)) (setq lines (cdr lines)))
# Line 8724  headlines.  The default is 3.  Lower lev Line 8723  headlines.  The default is 3.  Lower lev
8723      newstr))      newstr))
8724    
8725  (defun org-format-table-table-html (lines)  (defun org-format-table-table-html (lines)
8726    "Format a table generated by table.el into html.    "Format a table generated by table.el into HTML.
8727  This conversion does *not* use `table-generate-source' from table.el.  This conversion does *not* use `table-generate-source' from table.el.
8728  This has the advantage that Org-mode's HTML conversions can be used.  This has the advantage that Org-mode's HTML conversions can be used.
8729  But it has the disadvantage, that no cell- or row-spanning is allowed."  But it has the disadvantage, that no cell- or row-spanning is allowed."
# Line 8768  But it has the disadvantage, that no cel Line 8767  But it has the disadvantage, that no cel
8767      html))      html))
8768    
8769  (defun org-format-table-table-html-using-table-generate-source (lines)  (defun org-format-table-table-html-using-table-generate-source (lines)
8770    "Format a table into html, using `table-generate-source' from table.el.    "Format a table into HTML, using `table-generate-source' from table.el.
8771  This has the advantage that cell- or row-spanning is allowed.  This has the advantage that cell- or row-spanning is allowed.
8772  But it has the disadvantage, that Org-mode's HTML conversions cannot be used."  But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
8773    (require 'table)    (require 'table)
# Line 9109  reduced column width." Line 9108  reduced column width."
9108    (if (and (org-table-p)    (if (and (org-table-p)
9109             (eq N 1)             (eq N 1)
9110             (string-match "|" (buffer-substring (point-at-bol) (point)))             (string-match "|" (buffer-substring (point-at-bol) (point)))
9111             (looking-at ".*?|"))                       (looking-at ".*?|"))
9112        (let ((pos (point)))        (let ((pos (point)))
9113          (backward-delete-char N)          (backward-delete-char N)
9114          (skip-chars-forward "^|")          (skip-chars-forward "^|")
# Line 9241  a reduced column width." Line 9240  a reduced column width."
9240  (defun org-copy-special ()  (defun org-copy-special ()
9241    "Call either `org-table-copy' or `org-copy-subtree'."    "Call either `org-table-copy' or `org-copy-subtree'."
9242    (interactive)    (interactive)
9243    (call-interactively    (call-interactively
9244     (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree)))     (if (org-at-table-p) 'org-table-copy-region 'org-copy-subtree)))
9245    
9246  (defun org-cut-special ()  (defun org-cut-special ()
# Line 9262  a reduced column width." Line 9261  a reduced column width."
9261  When the cursor is inside a table created by the table.el package,  When the cursor is inside a table created by the table.el package,
9262  activate that table.  Otherwise, if the cursor is at a normal table  activate that table.  Otherwise, if the cursor is at a normal table
9263  created with org.el, re-align that table.  This command works even if  created with org.el, re-align that table.  This command works even if
9264  the automatic table editor has been turned off.  the automatic table editor has been turned off.
9265  If the cursor is in one of the special #+KEYWORD lines, this triggers  If the cursor is in one of the special #+KEYWORD lines, this triggers
9266  scanning the buffer for these lines and updating the information."  scanning the buffer for these lines and updating the information."
9267    (interactive "P")    (interactive "P")
# Line 9351  scanning the buffer for these lines and Line 9350  scanning the buffer for these lines and
9350       ["Recalculate line" org-table-recalculate (org-at-table-p)]       ["Recalculate line" org-table-recalculate (org-at-table-p)]
9351       ["Recalculate all" (lambda () (interactive) (org-table-recalculate '(4))) :active (org-at-table-p) :keys "C-u C-c *"]       ["Recalculate all" (lambda () (interactive) (org-table-recalculate '(4))) :active (org-at-table-p) :keys "C-u C-c *"]
9352       ["Toggle Recalculate Mark" org-table-rotate-recalc-marks (org-at-table-p)]       ["Toggle Recalculate Mark" org-table-rotate-recalc-marks (org-at-table-p)]
9353       ["Sum Column/Rectangle" org-table-sum       ["Sum Column/Rectangle" org-table-sum
9354        (or (org-at-table-p) (org-region-active-p))]        (or (org-at-table-p) (org-region-active-p))]
9355       ["Which Column?" org-table-current-column (org-at-table-p)])       ["Which Column?" org-table-current-column (org-at-table-p)])
9356      ["Debug Formulas"      ["Debug Formulas"
# Line 9461  With optional NODE, go directly to that Line 9460  With optional NODE, go directly to that
9460    (Info-goto-node (format "(org)%s" (or node ""))))    (Info-goto-node (format "(org)%s" (or node ""))))
9461    
9462  (defun org-install-agenda-files-menu ()  (defun org-install-agenda-files-menu ()
9463    (easy-menu-change    (easy-menu-change
9464     '("Org") "File List for Agenda"     '("Org") "File List for Agenda"
9465     (append     (append
9466      (list      (list
9467       ["Edit File List" (customize-variable 'org-agenda-files) t]       ["Edit File List" (customize-variable 'org-agenda-files) t]
9468       ["Add Current File to List" org-add-file t]       ["Add Current File to List" org-add-file t]
9469       ["Remove Current File from List" org-remove-file t]       ["Remove Current File from List" org-remove-file t]
# Line 9474  With optional NODE, go directly to that Line 9473  With optional NODE, go directly to that
9473  ;;; Documentation  ;;; Documentation
9474    
9475  (defun org-customize ()  (defun org-customize ()
9476    "Call the customize function with org as argument."    "Call the customize function with `org' as argument."
9477    (interactive)    (interactive)
9478    (customize-browse 'org))    (customize-browse 'org))
9479    
# Line 9579  that can be added." Line 9578  that can be added."
9578  ;; Functions needed for compatibility with old outline.el  ;; Functions needed for compatibility with old outline.el
9579    
9580  ;; The following functions capture almost the entire compatibility code  ;; The following functions capture almost the entire compatibility code
9581  ;; between the different versions of outline-mode.  The only other place  ;; between the different versions of outline-mode.  The only other place
9582  ;; where this is important are the font-lock-keywords.  Search for  ;; where this is important are the font-lock-keywords.  Search for
9583  ;; `org-noutline-p' to find it.  ;; `org-noutline-p' to find it.
9584    
# Line 9613  to a visible line beginning.  This makes Line 9612  to a visible line beginning.  This makes
9612        (equal (char-before) ?\r))))        (equal (char-before) ?\r))))
9613    
9614  (defun org-back-to-heading (&optional invisible-ok)  (defun org-back-to-heading (&optional invisible-ok)
9615    "Move to previous heading line, or beg of this line if it's a heading.    "Move to previous heading line, or beginning of this line if it's a heading.
9616  Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."  Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
9617    (if org-noutline-p    (if org-noutline-p
9618        (outline-back-to-heading invisible-ok)        (outline-back-to-heading invisible-ok)
# Line 9644  If INVISIBLE-OK is non-nil, an invisible Line 9643  If INVISIBLE-OK is non-nil, an invisible
9643  This function considers both visible and invisible heading lines.  This function considers both visible and invisible heading lines.
9644  With argument, move up ARG levels."  With argument, move up ARG levels."
9645    (if org-noutline-p    (if org-noutline-p
9646        (if (fboundp 'outline-up-heading-all)        (if (fboundp 'outline-up-heading-all)
9647            (outline-up-heading-all arg)   ; emacs 21 version of outline.el            (outline-up-heading-all arg)   ; emacs 21 version of outline.el
9648          (outline-up-heading arg t))      ; emacs 22 version of outline.el          (outline-up-heading arg t))      ; emacs 22 version of outline.el
9649      (org-back-to-heading t)      (org-back-to-heading t)
# Line 9700  When ENTRY is non-nil, show the entire e Line 9699  When ENTRY is non-nil, show the entire e
9699    
9700  (defun org-show-subtree ()  (defun org-show-subtree ()
9701    "Show everything after this heading at deeper levels."    "Show everything after this heading at deeper levels."
9702    (outline-flag-region    (outline-flag-region
9703     (point)     (point)
9704     (save-excursion     (save-excursion
9705       (outline-end-of-subtree) (outline-next-heading) (point))       (outline-end-of-subtree) (outline-next-heading) (point))
9706     (if org-noutline-p nil ?\n)))     (if org-noutline-p nil ?\n)))
# Line 9712  Show the heading too, if it is currently Line 9711  Show the heading too, if it is currently
9711    (interactive)    (interactive)
9712    (save-excursion    (save-excursion
9713      (org-back-to-heading t)      (org-back-to-heading t)
9714      (outline-flag-region      (outline-flag-region
9715       (1- (point))       (1- (point))
9716       (save-excursion       (save-excursion
9717         (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)         (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26