Show
Ignore:
Timestamp:
08/18/06 08:35:31 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/textmodes/org.el

    r4111 r4148  
    66;; Keywords: outlines, hypermedia, calendar, wp 
    77;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 
    8 ;; Version: 4.43 
     8;; Version: 4.44 
    99;; 
    1010;; This file is part of GNU Emacs. 
     
    9191;; Recent changes 
    9292;; -------------- 
     93;; Version 4.44 
     94;;    - Clock table can be done for a limited time interval. 
     95;;    - Obsolete support for the old outline mode has been removed. 
     96;;    - Bug fixes and code cleaning. 
     97;; 
    9398;; Version 4.43 
    94 ;;    - Big fixes 
    95 ;; 
    96 ;; Version 4.42 
    9799;;    - Bug fixes 
    98100;;    - `s' key in the agenda saves all org-mode buffers. 
     
    213215;;; Customization variables 
    214216 
    215 (defvar org-version "4.43
     217(defvar org-version "4.44
    216218  "The version number of the file org.el.") 
    217219(defun org-version () 
     
    219221  (message "Org-mode version %s" org-version)) 
    220222 
    221 ;; The following constant is for compatibility with different versions 
    222 ;; of outline.el. 
    223 (defconst org-noutline-p (featurep 'noutline) 
    224   "Are we using the new outline mode?") 
     223;; Compatibility constants 
    225224(defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself 
    226225(defconst org-format-transports-properties-p 
     
    11331132 \"ext\"         A string identifying an extension 
    11341133 `directory'   Matches a directory 
    1135  `remote'      Matches a remove file, accessible through tramp or efs. 
     1134 `remote'      Matches a remote file, accessible through tramp or efs. 
    11361135               Remote files most likely should be visited through emacs 
    11371136               because external applications cannot handle such paths. 
     
    18321831(defcustom org-export-language-setup 
    18331832  '(("en"  "Author"          "Date"  "Table of Contents") 
     1833    ("cs"  "Autor"           "Datum" "Obsah") 
    18341834    ("da"  "Ophavsmand"      "Dato"  "Indhold") 
    18351835    ("de"  "Autor"           "Datum" "Inhaltsverzeichnis") 
     
    21482148As the value of this option simply gets inserted into the HTML <head> header, 
    21492149you can \"misuse\" it to add arbitrary text to the header." 
     2150  :group 'org-export-html 
     2151  :type 'string) 
     2152 
     2153(defcustom org-export-html-title-format "<h1 class=\"title\">%s</h1>\n" 
     2154  "Format for typesetting the document title in HTML export." 
     2155  :group 'org-export-html 
     2156  :type 'string) 
     2157 
     2158(defcustom org-export-html-toplevel-hlevel 2 
     2159  "The <H> level for level 1 headings in HTML export." 
    21502160  :group 'org-export-html 
    21512161  :type 'string) 
     
    26952705  s) 
    26962706 
     2707(defsubst org-set-local (var value) 
     2708  "Make VAR local in current buffer and set it to VALUE." 
     2709  (set (make-variable-buffer-local var) value)) 
     2710 
    26972711(defsubst org-mode-p () 
    26982712  "Check if the current buffer is in Org-mode." 
     
    27042718    (let ((re (org-make-options-regexp 
    27052719               '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" 
    2706                  "STARTUP" "ARCHIVE" "TAGS"))) 
     2720                 "STARTUP" "ARCHIVE" "TAGS" "CALC"))) 
    27072721          (splitre "[ \t]+") 
    27082722          kwds int key value cat arch tags) 
     
    27562770                                      '(face t fontified t) arch))) 
    27572771            ))) 
    2758       (and cat (set (make-local-variable 'org-category) cat)) 
    2759       (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) 
    2760       (and arch (set (make-local-variable 'org-archive-location) arch)) 
    2761       (and int (set (make-local-variable 'org-todo-interpretation) int)) 
     2772      (and cat (org-set-local 'org-category cat)) 
     2773      (and kwds (org-set-local 'org-todo-keywords kwds)) 
     2774      (and arch (org-set-local 'org-archive-location arch)) 
     2775      (and int (org-set-local 'org-todo-interpretation int)) 
    27622776      (when tags 
    27632777        (let (e tgs) 
     
    27712785                    tgs)) 
    27722786             (t (push (list e) tgs)))) 
    2773           (set (make-local-variable 'org-tag-alist) nil) 
     2787          (org-set-local 'org-tag-alist nil) 
    27742788          (while (setq e (pop tgs)) 
    27752789            (or (and (stringp (car e)) 
     
    29292943  ;; the keymap so late. 
    29302944  (if (featurep 'xemacs) 
    2931       (if org-noutline-p 
    2932           (progn 
    2933             (easy-menu-remove outline-mode-menu-heading) 
    2934             (easy-menu-remove outline-mode-menu-show) 
    2935             (easy-menu-remove outline-mode-menu-hide)) 
    2936         (delete-menu-item '("Headings")) 
    2937         (delete-menu-item '("Show")) 
    2938         (delete-menu-item '("Hide")) 
    2939         (set-menubar-dirty-flag)) 
     2945      (progn 
     2946        ;; Assume this is Greg's port, it used easymenu 
     2947        (easy-menu-remove outline-mode-menu-heading) 
     2948        (easy-menu-remove outline-mode-menu-show) 
     2949        (easy-menu-remove outline-mode-menu-hide)) 
    29402950    (define-key org-mode-map [menu-bar headings] 'undefined) 
    29412951    (define-key org-mode-map [menu-bar hide] 'undefined) 
     
    29482958  (org-add-to-invisibility-spec '(org-cwidth)) 
    29492959  (when (featurep 'xemacs) 
    2950     (set (make-local-variable 'line-move-ignore-invisible) t)) 
     2960    (org-set-local 'line-move-ignore-invisible t)) 
    29512961  (setq outline-regexp "\\*+") 
    29522962  ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)") 
     
    29592969    (setq buffer-display-table org-display-table)) 
    29602970  (org-set-regexps-and-options) 
     2971  ;; Calc embedded 
     2972  (org-set-local 'calc-embedded-open-mode "# ") 
    29612973  (modify-syntax-entry ?# "<") 
    29622974  (if org-startup-truncated (setq truncate-lines t)) 
    2963   (set (make-local-variable 'font-lock-unfontify-region-function) 
    2964       'org-unfontify-region) 
     2975  (org-set-local 'font-lock-unfontify-region-function 
     2976                'org-unfontify-region) 
    29652977  ;; Activate before-change-function 
    2966   (set (make-local-variable 'org-table-may-need-update) t) 
     2978  (org-set-local 'org-table-may-need-update t) 
    29672979  (org-add-hook 'before-change-functions 'org-before-change-function nil 
    29682980                'local) 
     
    31083120  "Regular expression matching a time stamp or time stamp range.") 
    31093121 
    3110 (defvar org-§emph-face nil) 
     3122(defvar org-§emph-face nil) 
    31113123 
    31123124(defun org-do-emphasis-faces (limit) 
     
    33413353    (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) 
    33423354    ;; Now set the full font-lock-keywords 
    3343     (set (make-local-variable 'org-font-lock-keywords) 
    3344          org-font-lock-extra-keywords) 
    3345     (set (make-local-variable 'font-lock-defaults) 
    3346          '(org-font-lock-keywords t nil nil backward-paragraph)) 
     3355    (org-set-local 'org-font-lock-keywords org-font-lock-extra-keywords) 
     3356    (org-set-local 'font-lock-defaults 
     3357                   '(org-font-lock-keywords t nil nil backward-paragraph)) 
    33473358    (kill-local-variable 'font-lock-keywords) nil)) 
    33483359 
     
    38133824    (save-excursion 
    38143825      (org-back-to-heading) 
    3815       (if org-noutline-p 
    3816           (outline-previous-heading) 
    3817         (outline-previous-visible-heading t)) 
     3826      (outline-previous-heading) 
    38183827      (looking-at org-todo-line-regexp)) 
    38193828    (if (or arg 
     
    47044713        (pall '(:org-archived t :org-comment t)) 
    47054714        (rea (concat ":" org-archive-tag ":")) 
    4706         bmp file re) 
     4715             bmp file re) 
    47074716    (save-excursion 
    47084717      (while (setq file (pop files)) 
     
    47764785 
    47774786(defconst org-dblock-start-re 
    4778   "^#\\+BEGIN:[ \t]+\\(\\S-+\\)[ \t]+\\(.*\\)
     4787  "^#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?
    47794788  "Matches the startline of a dynamic block, with parameters.") 
    47804789 
     
    48044813         (name (match-string 1)) 
    48054814         (params (append (list :name name) 
    4806                          (read (concat "(" (match-string 2) ")"))))) 
     4815                         (read (concat "(" (match-string 3) ")"))))) 
    48074816    (unless (re-search-forward org-dblock-end-re nil t) 
    48084817      (error "Dynamic block not terminated")) 
     
    52015210  (interactive "sRegexp: ") 
    52025211  (org-remove-occur-highlights nil nil t) 
    5203   (setq regexp (org-check-occur-regexp regexp)) 
    52045212  (let ((cnt 0)) 
    52055213    (save-excursion 
     
    56265634days in order to avoid rounding problems." 
    56275635  (interactive "P") 
    5628   (save-excursion 
    5629     (unless (org-at-date-range-p) 
    5630       (goto-char (point-at-bol)) 
    5631       (re-search-forward org-tr-regexp (point-at-eol) t)) 
    5632     (if (not (org-at-date-range-p)) 
    5633         (error "Not at a time-stamp range, and none found in current line"))) 
    5634   (let* ((ts1 (match-string 1)) 
    5635          (ts2 (match-string 2)) 
    5636          (havetime (or (> (length ts1) 15) (> (length ts2) 15))) 
    5637          (match-end (match-end 0)) 
    5638          (time1 (org-time-string-to-time ts1)) 
    5639          (time2 (org-time-string-to-time ts2)) 
    5640          (t1 (time-to-seconds time1)) 
    5641          (t2 (time-to-seconds time2)) 
    5642          (diff (abs (- t2 t1))) 
    5643          (negative (< (- t2 t1) 0)) 
    5644          ;; (ys (floor (* 365 24 60 60))) 
    5645          (ds (* 24 60 60)) 
    5646          (hs (* 60 60)) 
    5647          (fy "%dy %dd %02d:%02d") 
    5648          (fy1 "%dy %dd") 
    5649          (fd "%dd %02d:%02d") 
    5650          (fd1 "%dd") 
    5651          (fh "%02d:%02d") 
    5652          y d h m align) 
    5653     (if havetime 
    5654         (setq ; y (floor (/ diff ys))  diff (mod diff ys) 
    5655          y 0 
    5656          d (floor (/ diff ds))  diff (mod diff ds) 
    5657          h (floor (/ diff hs))  diff (mod diff hs) 
    5658          m (floor (/ diff 60))) 
    5659       (setq ; y (floor (/ diff ys))  diff (mod diff ys) 
    5660        y 0 
    5661        d (floor (+ (/ diff ds) 0.5)) 
    5662        h 0 m 0)) 
    5663     (if (not to-buffer) 
    5664         (message (org-make-tdiff-string y d h m)) 
    5665       (when (org-at-table-p) 
    5666         (goto-char match-end) 
    5667         (setq align t) 
    5668         (and (looking-at " *|") (goto-char (match-end 0)))) 
    5669       (if (looking-at 
    5670            "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") 
    5671           (replace-match "")) 
    5672       (if negative (insert " -")) 
    5673       (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) 
    5674         (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) 
    5675           (insert " " (format fh h m)))) 
    5676       (if align (org-table-align)) 
    5677       (message "Time difference inserted")))) 
     5636  (or 
     5637   (org-clock-update-time-maybe) 
     5638   (save-excursion 
     5639     (unless (org-at-date-range-p) 
     5640       (goto-char (point-at-bol)) 
     5641       (re-search-forward org-tr-regexp (point-at-eol) t)) 
     5642     (if (not (org-at-date-range-p)) 
     5643         (error "Not at a time-stamp range, and none found in current line"))) 
     5644   (let* ((ts1 (match-string 1)) 
     5645          (ts2 (match-string 2)) 
     5646          (havetime (or (> (length ts1) 15) (> (length ts2) 15))) 
     5647          (match-end (match-end 0)) 
     5648          (time1 (org-time-string-to-time ts1)) 
     5649          (time2 (org-time-string-to-time ts2)) 
     5650          (t1 (time-to-seconds time1)) 
     5651          (t2 (time-to-seconds time2)) 
     5652          (diff (abs (- t2 t1))) 
     5653          (negative (< (- t2 t1) 0)) 
     5654          ;; (ys (floor (* 365 24 60 60))) 
     5655          (ds (* 24 60 60)) 
     5656          (hs (* 60 60)) 
     5657          (fy "%dy %dd %02d:%02d") 
     5658          (fy1 "%dy %dd") 
     5659          (fd "%dd %02d:%02d") 
     5660          (fd1 "%dd") 
     5661          (fh "%02d:%02d") 
     5662          y d h m align) 
     5663     (if havetime 
     5664         (setq ; y (floor (/ diff ys))  diff (mod diff ys) 
     5665          y 0 
     5666          d (floor (/ diff ds))  diff (mod diff ds) 
     5667          h (floor (/ diff hs))  diff (mod diff hs) 
     5668          m (floor (/ diff 60))) 
     5669       (setq ; y (floor (/ diff ys))  diff (mod diff ys) 
     5670        y 0 
     5671        d (floor (+ (/ diff ds) 0.5)) 
     5672        h 0 m 0)) 
     5673     (if (not to-buffer) 
     5674         (message (org-make-tdiff-string y d h m)) 
     5675       (when (org-at-table-p) 
     5676         (goto-char match-end) 
     5677         (setq align t) 
     5678         (and (looking-at " *|") (goto-char (match-end 0)))) 
     5679       (if (looking-at 
     5680            "\\( *-? *[0-9]+y\\)?\\( *[0-9]+d\\)? *[0-9][0-9]:[0-9][0-9]") 
     5681           (replace-match "")) 
     5682       (if negative (insert " -")) 
     5683       (if (> y 0) (insert " " (format (if havetime fy fy1) y d h m)) 
     5684         (if (> d 0) (insert " " (format (if havetime fd fd1) d h m)) 
     5685           (insert " " (format fh h m)))) 
     5686       (if align (org-table-align)) 
     5687       (message "Time difference inserted"))))) 
    56785688 
    56795689(defun org-make-tdiff-string (y d h m) 
     
    58185828          (setq time (apply 'encode-time time0)))) 
    58195829    (insert (setq org-last-changed-timestamp (format-time-string fmt time))) 
     5830    (org-clock-update-time-maybe) 
    58205831    (goto-char pos) 
    58215832    ;; Try to recenter the calendar window, if any 
     
    59385949  (make-variable-buffer-local 'org-clock-file-total-minutes) 
    59395950 
    5940 (defun org-clock-sum (
     5951(defun org-clock-sum (&optional tstart tend
    59415952  "Sum the times for each subtree. 
    59425953Puts the resulting times in minutes as a text property on each headline." 
     
    59455956         (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" 
    59465957                     org-clock-string 
    5947                      ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$")) 
     5958                     "[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)")) 
    59485959         (lmax 30) 
    59495960         (ltimes (make-vector lmax 0)) 
    59505961         (t1 0) 
    59515962         (level 0) 
     5963         ts te dt 
    59525964         time) 
    59535965    (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) 
     
    59575969        (if (match-end 2) 
    59585970            ;; A time 
    5959             (setq t1 (+ t1 (* 60 (string-to-number (match-string 2))) 
    5960                         (string-to-number (match-string 3)))) 
     5971            (setq ts (match-string 2) 
     5972                  te (match-string 3) 
     5973                  ts (time-to-seconds 
     5974                      (apply 'encode-time (org-parse-time-string ts))) 
     5975                  te (time-to-seconds 
     5976                      (apply 'encode-time (org-parse-time-string te))) 
     5977                  ts (if tstart (max ts tstart) ts) 
     5978                  te (if tend (min te tend) te) 
     5979                  dt (- te ts) 
     5980                  t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1)) 
    59615981          ;; A headline 
    59625982          (setq level (- (match-end 1) (match-beginning 1))) 
     
    60706090  (org-remove-clock-overlays) 
    60716091  (unless (org-find-dblock "clocktable") 
    6072     (org-create-dblock (list :name "clocktable" 
    6073                               :maxlevel 2 :emphasize nil))) 
     6092    (org-create-dblock (list :name "clocktable" 
     6093                             :maxlevel 2 :emphasize nil))) 
    60746094  (org-update-dblock)) 
     6095 
     6096(defun org-clock-update-time-maybe () 
     6097  "If this is a CLOCK line, update it and return t. 
     6098Otherwise, return nil." 
     6099  (interactive) 
     6100  (save-excursion 
     6101    (beginning-of-line 1) 
     6102    (skip-chars-forward " \t") 
     6103    (when (looking-at org-clock-string) 
     6104      (let ((re (concat "[ \t]*" org-clock-string 
     6105                        " *[[<]\\([^]>]+\\)[]>]-+[[<]\\([^]>]+\\)[]>]" 
     6106                        "\\([ \t]*=>.*\\)?")) 
     6107            ts te h m s) 
     6108        (if (not (looking-at re)) 
     6109            nil 
     6110          (and (match-end 3) (delete-region (match-beginning 3) (match-end 3))) 
     6111          (end-of-line 1) 
     6112          (setq ts (match-string 1) 
     6113                te (match-string 2)) 
     6114          (setq s (- (time-to-seconds 
     6115                      (apply 'encode-time (org-parse-time-string te))) 
     6116                     (time-to-seconds 
     6117                      (apply 'encode-time (org-parse-time-string ts)))) 
     6118                h (floor (/ s 3600)) 
     6119                s (- s (* 3600 h)) 
     6120                m (floor (/ s 60)) 
     6121                s (- s (* 60 s))) 
     6122          (insert " => " (format "%2d:%02d" h m)) 
     6123          t))))) 
     6124 
     6125(defun org-clock-special-range (key &optional time as-strings) 
     6126  "Return two times bordering a special time range. 
     6127Key is a symbol specifying the range and can be one of `today', `yesterday', 
     6128`thisweek', `lastweek', `thismonth', `lastmonth', `thisyear', `lastyear'. 
     6129A week starts Monday 0:00 and ends Sunday 24:00. 
     6130The range is determined relative to TIME.  TIME defaults to the current time. 
     6131The return value is a cons cell with two internal times like the ones 
     6132returned by `current time' or `encode-time'. if AS-STRINGS is non-nil, 
     6133the returned times will be formatted strings." 
     6134  (let* ((tm (decode-time (or time (current-time)))) 
     6135         (s 0) (m (nth 1 tm)) (h (nth 2 tm)) 
     6136         (d (nth 3 tm)) (month (nth 4 tm)) (y (nth 5 tm)) 
     6137         (dow (nth 6 tm)) 
     6138         s1 m1 h1 d1 month1 y1 diff ts te fm) 
     6139    (cond 
     6140     ((eq key 'today) 
     6141      (setq h 0 m 0 h1 24 m1 0)) 
     6142     ((eq key 'yesterday) 
     6143      (setq d (1- d) h 0 m 0 h1 24 m1 0)) 
     6144     ((eq key 'thisweek) 
     6145      (setq diff (if (= dow 0) 6 (1- dow)) 
     6146            m 0 h 0 d (- d diff) d1 (+ 7 d))) 
     6147     ((eq key 'lastweek) 
     6148      (setq diff (+ 7 (if (= dow 0) 6 (1- dow))) 
     6149            m 0 h 0 d (- d diff) d1 (+ 7 d))) 
     6150     ((eq key 'thismonth) 
     6151      (setq d 1 h 0 m 0 d1 1 month1 (1+ month) h1 0 m1 0)) 
     6152     ((eq key 'lastmonth) 
     6153      (setq d 1 h 0 m 0 d1 1 month (1- month) month1 (1+ month) h1 0 m1 0)) 
     6154     ((eq key 'thisyear) 
     6155      (setq m 0 h 0 d 1 month 1 y1 (1+ y))) 
     6156     ((eq key 'lastyear) 
     6157      (setq m 0 h 0 d 1 month 1 y (1- y) y1 (1+ y))) 
     6158     (t (error "No such time block %s" key))) 
     6159    (setq ts (encode-time s m h d month y) 
     6160          te (encode-time (or s1 s) (or m1 m) (or h1 h) 
     6161                          (or d1 d) (or month1 month) (or y1 y))) 
     6162    (setq fm (cdr org-time-stamp-formats)) 
     6163    (if as-strings 
     6164        (cons (format-time-string fm ts) (format-time-string fm te)) 
     6165      (cons ts te)))) 
    60756166 
    60766167(defun org-dblock-write:clocktable (params) 
     
    60796170        (emph nil) 
    60806171        (ins (make-marker)) 
    6081         ipos time h m p level hlc hdl maxlevel) 
     6172        ipos time h m p level hlc hdl maxlevel 
     6173        ts te cc block) 
    60826174    (setq maxlevel (or (plist-get params :maxlevel) 3) 
    6083           emph (plist-get params :emphasize)) 
     6175          emph (plist-get params :emphasize) 
     6176          ts (plist-get params :tstart) 
     6177          te (plist-get params :tend) 
     6178          block (plist-get params :block)) 
     6179    (when block 
     6180      (setq cc (org-clock-special-range block nil t) 
     6181            ts (car cc) te (cdr cc))) 
     6182    (if ts (setq ts (time-to-seconds 
     6183                     (apply 'encode-time (org-parse-time-string ts))))) 
     6184    (if te (setq te (time-to-seconds 
     6185                     (apply 'encode-time (org-parse-time-string te))))) 
    60846186    (move-marker ins (point)) 
    60856187    (setq ipos (point)) 
     
    60886190                            (format-time-string (cdr org-time-stamp-formats)) 
    60896191                            1 -1) 
    6090                            "]\n|L|Headline|Time|\n") 
    6091     (org-clock-sum) 
     6192                           "]." 
     6193                           (if block  
     6194                               (format "  Considered range is /%s/." block) 
     6195                             "") 
     6196                           "\n\n|L|Headline|Time|\n") 
     6197    (org-clock-sum ts te) 
    60926198    (setq h (/ org-clock-file-total-minutes 60) 
    60936199          m (- org-clock-file-total-minutes (* 60 h))) 
     
    64766582      (let ((cw (current-window-configuration))) 
    64776583        (find-file org-agenda-files) 
    6478         (set (make-local-variable 'org-window-configuration) cw) 
     6584        (org-set-local 'org-window-configuration cw) 
    64796585        (org-add-hook 'after-save-hook 
    64806586                      (lambda () 
     
    66046710    (erase-buffer) 
    66056711    (org-agenda-mode) (setq buffer-read-only nil) 
    6606     (set (make-local-variable 'org-agenda-type) 'timeline) 
     6712    (org-set-local 'org-agenda-type 'timeline) 
    66076713    (if doclosed (push :closed args)) 
    66086714    (push :timestamp args) 
     
    67026808    (erase-buffer) 
    67036809    (org-agenda-mode) (setq buffer-read-only nil) 
    6704     (set (make-local-variable 'org-agenda-type) 'agenda) 
    6705     (set (make-local-variable 'starting-day) (car day-numbers)) 
    6706     (set (make-local-variable 'include-all-loc) include-all) 
     6810    (org-set-local 'org-agenda-type 'agenda) 
     6811    (org-set-local 'starting-day (car day-numbers)) 
     6812    (org-set-local 'include-all-loc include-all) 
    67076813    (when (and (or include-all org-agenda-include-all-todo) 
    67086814               (member today day-numbers)) 
     
    68136919    (erase-buffer) 
    68146920    (org-agenda-mode) (setq buffer-read-only nil) 
    6815     (set (make-local-variable 'org-agenda-type) 'todo) 
    6816     (set (make-local-variable 'last-arg) arg) 
    6817     (set (make-local-variable 'org-todo-keywords) kwds) 
    6818     (set (make-local-variable 'org-agenda-redo-command) 
    6819         '(org-todo-list (or current-prefix-arg last-arg) t)) 
     6921    (org-set-local 'org-agenda-type 'todo) 
     6922    (org-set-local 'last-arg arg) 
     6923    (org-set-local 'org-todo-keywords kwds) 
     6924    (org-set-local 'org-agenda-redo-command 
     6925                  '(org-todo-list (or current-prefix-arg last-arg) t)) 
    68206926    (setq files (org-agenda-files) 
    68216927          rtnall nil) 
     
    77057811         (regexp org-tr-regexp) 
    77067812         (d0 (calendar-absolute-from-gregorian date)) 
    7707          marker hdmarker ee txt d1 d2 s1 s2 timestr category tags
     7813         marker hdmarker ee txt d1 d2 s1 s2 timestr category tags pos
    77087814    (goto-char (point-min)) 
    77097815    (while (re-search-forward regexp nil t) 
    77107816      (catch :skip 
    77117817        (org-agenda-skip) 
     7818        (setq pos (point)) 
    77127819        (setq timestr (match-string 0) 
    77137820              s1 (match-string 1) 
     
    77377844                'priority (org-get-priority txt) 'category category) 
    77387845              (push txt ee))) 
    7739         (outline-next-heading))) 
     7846        (goto-char pos))) 
     7847;       (outline-next-heading))) ;FIXME: correct to be removed?????? 
    77407848    ;; Sort the entries by expiration date. 
    77417849    (nreverse ee))) 
     
    77587866(defconst org-stamp-time-of-day-regexp 
    77597867  (concat 
    7760    "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +[a-zA-Z]+ +\\)" 
     7868   "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" 
    77617869   "\\([012][0-9]:[0-5][0-9]\\)>" 
    77627870   "\\(--?" 
     
    86218729    (erase-buffer) 
    86228730    (org-agenda-mode) (setq buffer-read-only nil) 
    8623     (set (make-local-variable 'org-agenda-type) 'tags) 
    8624     (set (make-local-variable 'org-agenda-redo-command) 
    8625         (list 'org-tags-view (list 'quote todo-only) 
    8626               (list 'if 'current-prefix-arg nil match) t)) 
     8731    (org-set-local 'org-agenda-type 'tags) 
     8732    (org-set-local 'org-agenda-redo-command 
     8733                  (list 'org-tags-view (list 'quote todo-only) 
     8734                        (list 'if 'current-prefix-arg nil match) t)) 
    86278735    (setq files (org-agenda-files) 
    86288736          rtnall nil) 
     
    1023510343          (org-mode)) 
    1023610344        (if (and file (string-match "\\S-" file) (not (file-directory-p file))) 
    10237             (set (make-local-variable 'org-default-notes-file) file)) 
     10345            (org-set-local 'org-default-notes-file file)) 
    1023810346        (goto-char (point-min)) 
    1023910347        (if (re-search-forward "%\\?" nil t) (replace-match ""))) 
     
    1024110349          (org-startup-with-deadline-check nil)) 
    1024210350      (org-mode))) 
    10243   (set (make-local-variable 'org-finish-function) 'remember-buffer)) 
     10351  (org-set-local 'org-finish-function 'remember-buffer)) 
    1024410352 
    1024510353;;;###autoload 
     
    1149311601                                          intangible t)) 
    1149411602      (goto-char p) 
    11495       (set (make-local-variable 'org-finish-function) 
    11496            'org-table-finish-edit-field) 
    11497       (set (make-local-variable 'org-window-configuration) cw) 
    11498       (set (make-local-variable 'org-field-marker) pos) 
     11603      (org-set-local 'org-finish-function 
     11604                    'org-table-finish-edit-field) 
     11605      (org-set-local 'org-window-configuration cw) 
     11606      (org-set-local 'org-field-marker pos) 
    1149911607      (message "Edit and finish with C-c C-c")))) 
    1150011608 
     
    1209912207                fmt (concat (cdr (assoc "%" org-table-local-parameters)) 
    1210012208                            (nth 1 tmp))) 
    12101           (while (string-match "[pnfse]\\(-?[0-9]+\\)" fmt) 
     12209          (while (string-match "\\([pnfse]\\)\\(-?[0-9]+\\)" fmt) 
    1210212210            (setq c (string-to-char (match-string 1 fmt)) 
    12103                   n (string-to-number (or (match-string 1 fmt) ""))) 
    12104             (if (= c ?p) (setq modes (org-set-calc-mode 'calc-internal-prec n)) 
     12211                  n (string-to-number (match-string 2 fmt))) 
     12212            (if (= c ?p) 
     12213                (setq modes (org-set-calc-mode 'calc-internal-prec n)) 
    1210512214              (setq modes (org-set-calc-mode 
    1210612215                           'calc-float-format 
     
    1231512424    (erase-buffer) 
    1231612425    (fundamental-mode) 
    12317     (set (make-local-variable 'org-pos) pos) 
    12318     (set (make-local-variable 'org-window-configuration) wc) 
     12426    (org-set-local 'org-pos pos) 
     12427    (org-set-local 'org-window-configuration wc) 
    1231912428    (use-local-map org-edit-formulas-map) 
    1232012429    (setq s "# Edit formulas and finish with `C-c C-c'. 
     
    1248212591            (and c (setq minor-mode-map-alist 
    1248312592                         (cons c (delq c minor-mode-map-alist))))) 
    12484           (set (make-local-variable (quote org-table-may-need-update)) t) 
     12593          (org-set-local (quote org-table-may-need-update) t) 
    1248512594          (org-add-hook 'before-change-functions 'org-before-change-function 
    1248612595                        nil 'local) 
    12487           (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) 
    12488               auto-fill-inhibit-regexp) 
    12489           (set (make-local-variable 'auto-fill-inhibit-regexp) 
    12490               (if auto-fill-inhibit-regexp 
    12491                    (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) 
    12492                 "[ \t]*|")) 
     12596          (org-set-local 'org-old-auto-fill-inhibit-regexp 
     12597                        auto-fill-inhibit-regexp) 
     12598          (org-set-local 'auto-fill-inhibit-regexp 
     12599                        (if auto-fill-inhibit-regexp 
     12600                            (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) 
     12601                          "[ \t]*|")) 
    1249312602          (org-add-to-invisibility-spec '(org-cwidth)) 
    1249412603          (easy-menu-add orgtbl-mode-menu) 
     
    1338913498                   (plist-get opt-plist (car x)))) 
    1339013499            org-export-plist-vars) 
    13391     (set (make-local-variable 'org-odd-levels-only) odd) 
     13500    (org-set-local 'org-odd-levels-only odd) 
    1339213501    (setq umax (if arg (prefix-numeric-value arg) 
    1339313502                 org-export-headline-levels)) 
     
    1359513704 
    1359613705(defun org-find-visible () 
    13597   (if (featurep 'noutline) 
    13598       (let ((s (point))) 
    13599         (while (and (not (= (point-max) (setq s (next-overlay-change s)))) 
    13600                     (get-char-property s 'invisible))) 
    13601         s) 
    13602     (skip-chars-forward "^\n") 
    13603     (point))) 
     13706  (let ((s (point))) 
     13707    (while (and (not (= (point-max) (setq s (next-overlay-change s)))) 
     13708                (get-char-property s 'invisible))) 
     13709    s)) 
    1360413710(defun org-find-invisible () 
    13605   (if (featurep 'noutline) 
    13606       (let ((s (point))) 
    13607         (while (and (not (= (point-max) (setq s (next-overlay-change s)))) 
    13608                     (not (get-char-property s 'invisible)))) 
    13609         s) 
    13610     (skip-chars-forward "^\r") 
    13611     (point))) 
    13612  
     13711  (let ((s (point))) 
     13712    (while (and (not (= (point-max) (setq s (next-overlay-change s)))) 
     13713                (not (get-char-property s 'invisible)))) 
     13714    s)) 
    1361313715 
    1361413716;; HTML 
     
    1386013962 
    1386113963      (when (plist-get opt-plist :auto-preamble) 
    13862         (if title     (insert (concat "<h1 class=\"title\">" 
    13863                                       (org-html-expand title) "</h1>\n"))) 
    13864  
     13964        (if title     (insert (format org-export-html-title-format 
     13965                                      (org-html-expand title)))) 
    1386513966        (if text      (insert "<p>\n" (org-html-expand text) "</p>"))) 
    1386613967 
    1386713968      (if org-export-with-toc 
    1386813969          (progn 
    13869             (insert (format "<h2>%s</h2>\n" (nth 3 lang-words))) 
     13970            (insert (format "<h%d>%s</h%d>\n" 
     13971                            org-export-html-toplevel-hlevel 
     13972                            (nth 3 lang-words) 
     13973                            org-export-html-toplevel-hlevel)) 
    1387013974            (insert "<ul>\n<li>") 
    1387113975            (setq lines 
     
    1455414658        (if org-export-with-section-numbers 
    1455514659            (setq title (concat (org-section-number level) " " title))) 
    14556         (setq level (+ level 1)) 
     14660        (setq level (+ level org-export-html-toplevel-hlevel -1)) 
    1455714661        (if with-toc 
    1455814662            (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n" 
     
    1576415868    ("TODO Lists" 
    1576515869     ["TODO/DONE/-" org-todo t] 
     15870     ("Select keyword" 
     15871      ["Next keyword" org-shiftright (org-on-heading-p)] 
     15872      ["Previous keyword" org-shiftleft (org-on-heading-p)] 
     15873      ["Complete Keyword" org-complete (assq :todo-keyword (org-context))]) 
    1576615874     ["Show TODO Tree" org-show-todo-tree t] 
    1576715875     ["Global TODO list" org-todo-list t] 
     
    1604316151  ;; text in a line directly attached to a headline would otherwise 
    1604416152  ;; fill the headline as well. 
    16045   (set (make-local-variable 'comment-start-skip) "^#+[ \t]*") 
    16046   (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[        ]*$\\|[ \t]*[:|]") 
     16153  (org-set-local 'comment-start-skip "^#+[ \t]*") 
     16154  (org-set-local 'paragraph-separate "\f\\|\\*\\|[    ]*$\\|[ \t]*[:|]") 
    1604716155  ;; The paragraph starter includes hand-formatted lists. 
    16048   (set (make-local-variable 'paragraph-start) 
    16049       "\f\\|[        ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") 
     16156  (org-set-local 'paragraph-start 
     16157                "\f\\|[       ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") 
    1605016158  ;; Inhibit auto-fill for headers, tables and fixed-width lines. 
    1605116159  ;; But only if the user has not turned off tables or fixed-width regions 
    16052   (set (make-local-variable 'auto-fill-inhibit-regexp) 
    16053        (concat "\\*\\|#" 
    16054                "\\|[ \t]*" org-keyword-time-regexp 
    16055                (if (or org-enable-table-editor org-enable-fixed-width-editor) 
    16056                    (concat 
    16057                     "\\|[ \t]*[" 
    16058                     (if org-enable-table-editor "|" "") 
    16059                     (if org-enable-fixed-width-editor ":"  "") 
    16060                     "]")))) 
     16160  (org-set-local 
     16161   'auto-fill-inhibit-regexp 
     16162   (concat "\\*\\|#" 
     16163           "\\|[ \t]*" org-keyword-time-regexp 
     16164           (if (or org-enable-table-editor org-enable-fixed-width-editor) 
     16165               (concat 
     16166                "\\|[ \t]*[" 
     16167                (if org-enable-table-editor "|" "") 
     16168                (if org-enable-fixed-width-editor ":"  "") 
     16169                "]")))) 
    1606116170  ;; We use our own fill-paragraph function, to make sure that tables 
    1606216171  ;; and fixed-width regions are not wrapped.  That function will pass 
    1606316172  ;; through to `fill-paragraph' when appropriate. 
    16064   (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph) 
    16065   ;; Adaptive filling: To get full control, first make sure that 
     16173  (org-set-local 'fill-paragraph-function 'org-fill-paragraph) 
     16174  ; Adaptive filling: To get full control, first make sure that 
    1606616175  ;; `adaptive-fill-regexp' never matches.  Then install our own matcher. 
    16067   (set (make-local-variable 'adaptive-fill-regexp) "\000") 
    16068   (set (make-local-variable 'adaptive-fill-function) 
    16069       'org-adaptive-fill-function)) 
     16176  (org-set-local 'adaptive-fill-regexp "\000") 
     16177  (org-set-local 'adaptive-fill-function 
     16178                'org-adaptive-fill-function)) 
    1607016179 
    1607116180(defun org-fill-paragraph (&optional justify) 
     
    1614616255              "\\'")))) 
    1614716256 
    16148 ;; Functions needed for compatibility with old outline.el. 
    16149  
    16150 ;; Programming for the old outline.el (that uses selective display 
    16151 ;; instead of `invisible' text properties) is a nightmare, mostly 
    16152 ;; because regular expressions can no longer be anchored at 
    16153 ;; beginning/end of line.  Therefore a number of function need special 
    16154 ;; treatment when the old outline.el is being used. 
    16155  
    16156 ;; The following functions capture almost the entire compatibility code 
    16157 ;; between the different versions of outline-mode.  The only other 
    16158 ;; places where this is important are the font-lock-keywords, and in 
    16159 ;; `org-export-visible'.  Search for `org-noutline-p' to find them. 
     16257;; Functions extending outline functionality 
    1616016258 
    1616116259;; C-a should go to the beginning of a *visible* line, also in the 
     
    1617516273      (forward-char 1)))) 
    1617616274 
    16177 (when org-noutline-p 
    16178   (define-key org-mode-map "\C-a" 'org-beginning-of-line)) 
     16275(define-key org-mode-map "\C-a" 'org-beginning-of-line) 
    1617916276 
    1618016277(defun org-invisible-p () 
    1618116278  "Check if point is at a character currently not visible." 
    16182   (if org-noutline-p 
    16183       ;; Early versions of noutline don't have `outline-invisible-p'. 
    16184       (if (fboundp 'outline-invisible-p) 
    16185           (outline-invisible-p) 
    16186         (get-char-property (point) 'invisible)) 
    16187     (save-excursion 
    16188       (skip-chars-backward "^\r\n") 
    16189       (equal (char-before) ?\r)))) 
     16279  ;; Early versions of noutline don't have `outline-invisible-p'. 
     16280  (if (fboundp 'outline-invisible-p) 
     16281      (outline-invisible-p) 
     16282    (get-char-property (point) 'invisible))) 
    1619016283 
    1619116284(defun org-invisible-p2 () 
    1619216285  "Check if point is at a character currently not visible." 
    1619316286  (save-excursion 
    16194     (if org-noutline-p 
    16195         (progn 
    16196           (if (and (eolp) (not (bobp))) (backward-char 1)) 
    16197           ;; Early versions of noutline don't have `outline-invisible-p'. 
    16198           (if (fboundp 'outline-invisible-p) 
    16199               (outline-invisible-p) 
    16200             (get-char-property (point) 'invisible))) 
    16201       (skip-chars-backward "^\r\n") 
    16202       (equal (char-before) ?\r)))) 
    16203  
    16204 (defun org-back-to-heading (&optional invisible-ok) 
    16205   "Move to previous heading line, or beg of this line if it's a heading. 
    16206 Only visible heading lines are considered, unless INVISIBLE-OK is non-nil." 
    16207   (if org-noutline-p 
    16208       (outline-back-to-heading invisible-ok) 
    16209     (if (and (or (bobp) (memq (char-before) '(?\n ?\r))) 
    16210              (looking-at outline-regexp)) 
    16211         t 
    16212       (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^") 
    16213                                       outline-regexp) 
    16214                               nil t) 
    16215           (if invisible-ok 
    16216               (progn (goto-char (or (match-end 1) (match-beginning 0))) 
    16217                      (looking-at outline-regexp))) 
    16218         (error "Before first heading"))))) 
    16219  
    16220 (defun org-on-heading-p (&optional invisible-ok) 
    16221   "Return t if point is on a (visible) heading line. 
    16222 If INVISIBLE-OK is non-nil, an invisible heading line is ok too." 
    16223   (if org-noutline-p 
    16224       (outline-on-heading-p 'invisible-ok) 
    16225     (save-excursion 
    16226       (skip-chars-backward "^\n\r") 
    16227       (and (looking-at outline-regexp) 
    16228            (or invisible-ok 
    16229                (bobp) 
    16230                (equal (char-before) ?\n)))))) 
     16287    (if (and (eolp) (not (bobp))) (backward-char 1)) 
     16288    ;; Early versions of noutline don't have `outline-invisible-p'. 
     16289    (if (fboundp 'outline-invisible-p) 
     16290        (outline-invisible-p) 
     16291      (get-char-property (point) 'invisible)))) 
     16292 
     16293(defalias 'org-back-to-heading 'outline-back-to-heading) 
     16294(defalias 'org-on-heading-p 'outline-on-heading-p) 
    1623116295 
    1623216296(defun org-on-target-p () 
     
    1624416308This function considers both visible and invisible heading lines. 
    1624516309With argument, move up ARG levels." 
    16246   (if org-noutline-p 
    16247       (if (fboundp 'outline-up-heading-all) 
    16248           (outline-up-heading-all arg)   ; emacs 21 version of outline.el 
    16249         (outline-up-heading arg t))      ; emacs 22 version of outline.el 
    16250     (org-back-to-heading t) 
    16251     (looking-at outline-regexp) 
    16252     (if (<= (- (match-end 0) (match-beginning 0)) arg) 
    16253         (error "Cannot move up %d levels" arg) 
    16254     (re-search-backward 
    16255      (concat "[\n\r]" (regexp-quote 
    16256                        (make-string (- (match-end 0) (match-beginning 0) arg) 
    16257                                     ?*)) 
    16258              "[^*]")) 
    16259     (forward-char 1)))) 
     16310  (if (fboundp 'outline-up-heading-all) 
     16311      (outline-up-heading-all arg)   ; emacs 21 version of outline.el 
     16312    (outline-up-heading arg t)))     ; emacs 22 version of outline.el 
    1626016313 
    1626116314(defun org-show-hidden-entry () 
    1626216315  "Show an entry where even the heading is hidden." 
    1626316316  (save-excursion 
    16264     (if (not org-noutline-p) 
    16265         (progn 
    16266           (org-back-to-heading t) 
    16267           (org-flag-heading nil))) 
    1626816317    (org-show-entry))) 
    16269  
    16270 (defun org-check-occur-regexp (regexp) 
    16271   "If REGEXP starts with \"^\", modify it to check for \\r as well. 
    16272 Of course, only for the old outline mode." 
    16273   (if org-noutline-p 
    16274       regexp 
    16275     (if (string-match "^\\^" regexp) 
    16276         (concat "[\n\r]" (substring regexp 1)) 
    16277       regexp))) 
    1627816318 
    1627916319(defun org-flag-heading (flag &optional entry) 
     
    1628216322  (save-excursion 
    1628316323    (org-back-to-heading t) 
    16284     (if (not org-noutline-p) 
    16285         ;; Make the current headline visible 
    16286         (outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n))) 
    1628716324    ;; Check if we should show the entire entry 
    1628816325    (if entry 
     
    1629416331      (outline-flag-region (max 1 (1- (point))) 
    1629516332                           (save-excursion (outline-end-of-heading) (point)) 
    16296                            (if org-noutline-p 
    16297                                flag 
    16298                              (if flag ?\r ?\n)))))) 
     16333                           flag)))) 
    1629916334 
    1630016335(defun org-end-of-subtree (&optional invisible-OK) 
     
    1632516360   (save-excursion 
    1632616361     (outline-end-of-subtree) (outline-next-heading) (point)) 
    16327    (if org-noutline-p nil ?\n))) 
     16362   nil)) 
    1632816363 
    1632916364(defun org-show-entry () 
     
    1633816373       (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) 
    1633916374       (or (match-beginning 1) (point-max))) 
    16340      (if org-noutline-p nil ?\n)))) 
     16375     nil))) 
    1634116376 
    1634216377(defun org-make-options-regexp (kwds) 
    1634316378  "Make a regular expression for keyword lines." 
    1634416379  (concat 
    16345    (if org-noutline-p "^" "[\n\r]") 
     16380   "^" 
    1634616381   "#?[ \t]*\\+\\(" 
    1634716382   (mapconcat 'regexp-quote kwds "\\|") 
    1634816383   "\\):[ \t]*" 
    16349    (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)"))) 
     16384   "\\(.+\\)")) 
    1635016385 
    1635116386;; Make `bookmark-jump' show the jump location if it was hidden.