Changeset 4148 for trunk/lisp/textmodes/org.el
- Timestamp:
- 08/18/06 08:35:31 (2 years ago)
- Files:
-
- trunk/lisp/textmodes/org.el (modified) (56 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/textmodes/org.el
r4111 r4148 6 6 ;; Keywords: outlines, hypermedia, calendar, wp 7 7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 8 ;; Version: 4.4 38 ;; Version: 4.44 9 9 ;; 10 10 ;; This file is part of GNU Emacs. … … 91 91 ;; Recent changes 92 92 ;; -------------- 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 ;; 93 98 ;; Version 4.43 94 ;; - Big fixes95 ;;96 ;; Version 4.4297 99 ;; - Bug fixes 98 100 ;; - `s' key in the agenda saves all org-mode buffers. … … 213 215 ;;; Customization variables 214 216 215 (defvar org-version "4.4 3"217 (defvar org-version "4.44" 216 218 "The version number of the file org.el.") 217 219 (defun org-version () … … 219 221 (message "Org-mode version %s" org-version)) 220 222 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 225 224 (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself 226 225 (defconst org-format-transports-properties-p … … 1133 1132 \"ext\" A string identifying an extension 1134 1133 `directory' Matches a directory 1135 `remote' Matches a remo ve file, accessible through tramp or efs.1134 `remote' Matches a remote file, accessible through tramp or efs. 1136 1135 Remote files most likely should be visited through emacs 1137 1136 because external applications cannot handle such paths. … … 1832 1831 (defcustom org-export-language-setup 1833 1832 '(("en" "Author" "Date" "Table of Contents") 1833 ("cs" "Autor" "Datum" "Obsah") 1834 1834 ("da" "Ophavsmand" "Dato" "Indhold") 1835 1835 ("de" "Autor" "Datum" "Inhaltsverzeichnis") … … 2148 2148 As the value of this option simply gets inserted into the HTML <head> header, 2149 2149 you 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." 2150 2160 :group 'org-export-html 2151 2161 :type 'string) … … 2695 2705 s) 2696 2706 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 2697 2711 (defsubst org-mode-p () 2698 2712 "Check if the current buffer is in Org-mode." … … 2704 2718 (let ((re (org-make-options-regexp 2705 2719 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" 2706 "STARTUP" "ARCHIVE" "TAGS" )))2720 "STARTUP" "ARCHIVE" "TAGS" "CALC"))) 2707 2721 (splitre "[ \t]+") 2708 2722 kwds int key value cat arch tags) … … 2756 2770 '(face t fontified t) arch))) 2757 2771 ))) 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)) 2762 2776 (when tags 2763 2777 (let (e tgs) … … 2771 2785 tgs)) 2772 2786 (t (push (list e) tgs)))) 2773 ( set (make-local-variable 'org-tag-alist)nil)2787 (org-set-local 'org-tag-alist nil) 2774 2788 (while (setq e (pop tgs)) 2775 2789 (or (and (stringp (car e)) … … 2929 2943 ;; the keymap so late. 2930 2944 (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)) 2940 2950 (define-key org-mode-map [menu-bar headings] 'undefined) 2941 2951 (define-key org-mode-map [menu-bar hide] 'undefined) … … 2948 2958 (org-add-to-invisibility-spec '(org-cwidth)) 2949 2959 (when (featurep 'xemacs) 2950 ( set (make-local-variable 'line-move-ignore-invisible)t))2960 (org-set-local 'line-move-ignore-invisible t)) 2951 2961 (setq outline-regexp "\\*+") 2952 2962 ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)") … … 2959 2969 (setq buffer-display-table org-display-table)) 2960 2970 (org-set-regexps-and-options) 2971 ;; Calc embedded 2972 (org-set-local 'calc-embedded-open-mode "# ") 2961 2973 (modify-syntax-entry ?# "<") 2962 2974 (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) 2965 2977 ;; 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) 2967 2979 (org-add-hook 'before-change-functions 'org-before-change-function nil 2968 2980 'local) … … 3108 3120 "Regular expression matching a time stamp or time stamp range.") 3109 3121 3110 (defvar org- §emph-face nil)3122 (defvar org-§emph-face nil) 3111 3123 3112 3124 (defun org-do-emphasis-faces (limit) … … 3341 3353 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) 3342 3354 ;; 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)) 3347 3358 (kill-local-variable 'font-lock-keywords) nil)) 3348 3359 … … 3813 3824 (save-excursion 3814 3825 (org-back-to-heading) 3815 (if org-noutline-p 3816 (outline-previous-heading) 3817 (outline-previous-visible-heading t)) 3826 (outline-previous-heading) 3818 3827 (looking-at org-todo-line-regexp)) 3819 3828 (if (or arg … … 4704 4713 (pall '(:org-archived t :org-comment t)) 4705 4714 (rea (concat ":" org-archive-tag ":")) 4706 bmp file re)4715 bmp file re) 4707 4716 (save-excursion 4708 4717 (while (setq file (pop files)) … … 4776 4785 4777 4786 (defconst org-dblock-start-re 4778 "^#\\+BEGIN:[ \t]+\\(\\S-+\\) [ \t]+\\(.*\\)"4787 "^#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?" 4779 4788 "Matches the startline of a dynamic block, with parameters.") 4780 4789 … … 4804 4813 (name (match-string 1)) 4805 4814 (params (append (list :name name) 4806 (read (concat "(" (match-string 2) ")")))))4815 (read (concat "(" (match-string 3) ")"))))) 4807 4816 (unless (re-search-forward org-dblock-end-re nil t) 4808 4817 (error "Dynamic block not terminated")) … … 5201 5210 (interactive "sRegexp: ") 5202 5211 (org-remove-occur-highlights nil nil t) 5203 (setq regexp (org-check-occur-regexp regexp))5204 5212 (let ((cnt 0)) 5205 5213 (save-excursion … … 5626 5634 days in order to avoid rounding problems." 5627 5635 (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"))))) 5678 5688 5679 5689 (defun org-make-tdiff-string (y d h m) … … 5818 5828 (setq time (apply 'encode-time time0)))) 5819 5829 (insert (setq org-last-changed-timestamp (format-time-string fmt time))) 5830 (org-clock-update-time-maybe) 5820 5831 (goto-char pos) 5821 5832 ;; Try to recenter the calendar window, if any … … 5938 5949 (make-variable-buffer-local 'org-clock-file-total-minutes) 5939 5950 5940 (defun org-clock-sum ( )5951 (defun org-clock-sum (&optional tstart tend) 5941 5952 "Sum the times for each subtree. 5942 5953 Puts the resulting times in minutes as a text property on each headline." … … 5945 5956 (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" 5946 5957 org-clock-string 5947 " .*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$"))5958 "[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)")) 5948 5959 (lmax 30) 5949 5960 (ltimes (make-vector lmax 0)) 5950 5961 (t1 0) 5951 5962 (level 0) 5963 ts te dt 5952 5964 time) 5953 5965 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) … … 5957 5969 (if (match-end 2) 5958 5970 ;; 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)) 5961 5981 ;; A headline 5962 5982 (setq level (- (match-end 1) (match-beginning 1))) … … 6070 6090 (org-remove-clock-overlays) 6071 6091 (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))) 6074 6094 (org-update-dblock)) 6095 6096 (defun org-clock-update-time-maybe () 6097 "If this is a CLOCK line, update it and return t. 6098 Otherwise, 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. 6127 Key is a symbol specifying the range and can be one of `today', `yesterday', 6128 `thisweek', `lastweek', `thismonth', `lastmonth', `thisyear', `lastyear'. 6129 A week starts Monday 0:00 and ends Sunday 24:00. 6130 The range is determined relative to TIME. TIME defaults to the current time. 6131 The return value is a cons cell with two internal times like the ones 6132 returned by `current time' or `encode-time'. if AS-STRINGS is non-nil, 6133 the 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)))) 6075 6166 6076 6167 (defun org-dblock-write:clocktable (params) … … 6079 6170 (emph nil) 6080 6171 (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) 6082 6174 (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))))) 6084 6186 (move-marker ins (point)) 6085 6187 (setq ipos (point)) … … 6088 6190 (format-time-string (cdr org-time-stamp-formats)) 6089 6191 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) 6092 6198 (setq h (/ org-clock-file-total-minutes 60) 6093 6199 m (- org-clock-file-total-minutes (* 60 h))) … … 6476 6582 (let ((cw (current-window-configuration))) 6477 6583 (find-file org-agenda-files) 6478 ( set (make-local-variable 'org-window-configuration)cw)6584 (org-set-local 'org-window-configuration cw) 6479 6585 (org-add-hook 'after-save-hook 6480 6586 (lambda () … … 6604 6710 (erase-buffer) 6605 6711 (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) 6607 6713 (if doclosed (push :closed args)) 6608 6714 (push :timestamp args) … … 6702 6808 (erase-buffer) 6703 6809 (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) 6707 6813 (when (and (or include-all org-agenda-include-all-todo) 6708 6814 (member today day-numbers)) … … 6813 6919 (erase-buffer) 6814 6920 (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)) 6820 6926 (setq files (org-agenda-files) 6821 6927 rtnall nil) … … 7705 7811 (regexp org-tr-regexp) 7706 7812 (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) 7708 7814 (goto-char (point-min)) 7709 7815 (while (re-search-forward regexp nil t) 7710 7816 (catch :skip 7711 7817 (org-agenda-skip) 7818 (setq pos (point)) 7712 7819 (setq timestr (match-string 0) 7713 7820 s1 (match-string 1) … … 7737 7844 'priority (org-get-priority txt) 'category category) 7738 7845 (push txt ee))) 7739 (outline-next-heading))) 7846 (goto-char pos))) 7847 ; (outline-next-heading))) ;FIXME: correct to be removed?????? 7740 7848 ;; Sort the entries by expiration date. 7741 7849 (nreverse ee))) … … 7758 7866 (defconst org-stamp-time-of-day-regexp 7759 7867 (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+ +\\)" 7761 7869 "\\([012][0-9]:[0-5][0-9]\\)>" 7762 7870 "\\(--?" … … 8621 8729 (erase-buffer) 8622 8730 (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)) 8627 8735 (setq files (org-agenda-files) 8628 8736 rtnall nil) … … 10235 10343 (org-mode)) 10236 10344 (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)) 10238 10346 (goto-char (point-min)) 10239 10347 (if (re-search-forward "%\\?" nil t) (replace-match ""))) … … 10241 10349 (org-startup-with-deadline-check nil)) 10242 10350 (org-mode))) 10243 ( set (make-local-variable 'org-finish-function)'remember-buffer))10351 (org-set-local 'org-finish-function 'remember-buffer)) 10244 10352 10245 10353 ;;;###autoload … … 11493 11601 intangible t)) 11494 11602 (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) 11499 11607 (message "Edit and finish with C-c C-c")))) 11500 11608 … … 12099 12207 fmt (concat (cdr (assoc "%" org-table-local-parameters)) 12100 12208 (nth 1 tmp))) 12101 (while (string-match " [pnfse]\\(-?[0-9]+\\)" fmt)12209 (while (string-match "\\([pnfse]\\)\\(-?[0-9]+\\)" fmt) 12102 12210 (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)) 12105 12214 (setq modes (org-set-calc-mode 12106 12215 'calc-float-format … … 12315 12424 (erase-buffer) 12316 12425 (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) 12319 12428 (use-local-map org-edit-formulas-map) 12320 12429 (setq s "# Edit formulas and finish with `C-c C-c'. … … 12482 12591 (and c (setq minor-mode-map-alist 12483 12592 (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) 12485 12594 (org-add-hook 'before-change-functions 'org-before-change-function 12486 12595 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-regexp12491 (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]*|")) 12493 12602 (org-add-to-invisibility-spec '(org-cwidth)) 12494 12603 (easy-menu-add orgtbl-mode-menu) … … 13389 13498 (plist-get opt-plist (car x)))) 13390 13499 org-export-plist-vars) 13391 ( set (make-local-variable 'org-odd-levels-only)odd)13500 (org-set-local 'org-odd-levels-only odd) 13392 13501 (setq umax (if arg (prefix-numeric-value arg) 13393 13502 org-export-headline-levels)) … … 13595 13704 13596 13705 (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)) 13604 13710 (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)) 13613 13715 13614 13716 ;; HTML … … 13860 13962 13861 13963 (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)))) 13865 13966 (if text (insert "<p>\n" (org-html-expand text) "</p>"))) 13866 13967 13867 13968 (if org-export-with-toc 13868 13969 (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)) 13870 13974 (insert "<ul>\n<li>") 13871 13975 (setq lines … … 14554 14658 (if org-export-with-section-numbers 14555 14659 (setq title (concat (org-section-number level) " " title))) 14556 (setq level (+ level 1))14660 (setq level (+ level org-export-html-toplevel-hlevel -1)) 14557 14661 (if with-toc 14558 14662 (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n" … … 15764 15868 ("TODO Lists" 15765 15869 ["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))]) 15766 15874 ["Show TODO Tree" org-show-todo-tree t] 15767 15875 ["Global TODO list" org-todo-list t] … … 16043 16151 ;; text in a line directly attached to a headline would otherwise 16044 16152 ;; 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]*[:|]") 16047 16155 ;; 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]*[:|]") 16050 16158 ;; Inhibit auto-fill for headers, tables and fixed-width lines. 16051 16159 ;; 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 "]")))) 16061 16170 ;; We use our own fill-paragraph function, to make sure that tables 16062 16171 ;; and fixed-width regions are not wrapped. That function will pass 16063 16172 ;; 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 that16173 (org-set-local 'fill-paragraph-function 'org-fill-paragraph) 16174 ; Adaptive filling: To get full control, first make sure that 16066 16175 ;; `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)) 16070 16179 16071 16180 (defun org-fill-paragraph (&optional justify) … … 16146 16255 "\\'")))) 16147 16256 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 16160 16258 16161 16259 ;; C-a should go to the beginning of a *visible* line, also in the … … 16175 16273 (forward-char 1)))) 16176 16274 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) 16179 16276 16180 16277 (defun org-invisible-p () 16181 16278 "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))) 16190 16283 16191 16284 (defun org-invisible-p2 () 16192 16285 "Check if point is at a character currently not visible." 16193 16286 (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) 16231 16295 16232 16296 (defun org-on-target-p () … … 16244 16308 This function considers both visible and invisible heading lines. 16245 16309 With 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 16260 16313 16261 16314 (defun org-show-hidden-entry () 16262 16315 "Show an entry where even the heading is hidden." 16263 16316 (save-excursion 16264 (if (not org-noutline-p)16265 (progn16266 (org-back-to-heading t)16267 (org-flag-heading nil)))16268 16317 (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-p16274 regexp16275 (if (string-match "^\\^" regexp)16276 (concat "[\n\r]" (substring regexp 1))16277 regexp)))16278 16318 16279 16319 (defun org-flag-heading (flag &optional entry) … … 16282 16322 (save-excursion 16283 16323 (org-back-to-heading t) 16284 (if (not org-noutline-p)16285 ;; Make the current headline visible16286 (outline-flag-region (max 1 (1- (point))) (point) (if flag ?\r ?\n)))16287 16324 ;; Check if we should show the entire entry 16288 16325 (if entry … … 16294 16331 (outline-flag-region (max 1 (1- (point))) 16295 16332 (save-excursion (outline-end-of-heading) (point)) 16296 (if org-noutline-p 16297 flag 16298 (if flag ?\r ?\n)))))) 16333 flag)))) 16299 16334 16300 16335 (defun org-end-of-subtree (&optional invisible-OK) … … 16325 16360 (save-excursion 16326 16361 (outline-end-of-subtree) (outline-next-heading) (point)) 16327 (if org-noutline-p nil ?\n)))16362 nil)) 16328 16363 16329 16364 (defun org-show-entry () … … 16338 16373 (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) 16339 16374 (or (match-beginning 1) (point-max))) 16340 (if org-noutline-p nil ?\n))))16375 nil))) 16341 16376 16342 16377 (defun org-make-options-regexp (kwds) 16343 16378 "Make a regular expression for keyword lines." 16344 16379 (concat 16345 (if org-noutline-p "^" "[\n\r]")16380 "^" 16346 16381 "#?[ \t]*\\+\\(" 16347 16382 (mapconcat 'regexp-quote kwds "\\|") 16348 16383 "\\):[ \t]*" 16349 (if org-noutline-p "\\(.+\\)" "\\([^\n\r]+\\)")))16384 "\\(.+\\)")) 16350 16385 16351 16386 ;; Make `bookmark-jump' show the jump location if it was hidden.
