浏览代码

Merge branch 'master' of git://repo.or.cz/org-mode

Dan Davison 15 年之前
父节点
当前提交
324a00c5a7
共有 12 个文件被更改,包括 119 次插入92 次删除
  1. 12 0
      contrib/ChangeLog
  2. 5 5
      contrib/babel/lisp/org-babel.el
  3. 2 2
      contrib/lisp/org-toc.el
  4. 1 0
      doc/org.texi
  5. 38 0
      lisp/ChangeLog
  6. 6 6
      lisp/org-agenda.el
  7. 21 59
      lisp/org-compat.el
  8. 21 5
      lisp/org-inlinetask.el
  9. 0 1
      lisp/org-macs.el
  10. 1 1
      lisp/org-src.el
  11. 1 1
      lisp/org-table.el
  12. 11 12
      lisp/org.el

+ 12 - 0
contrib/ChangeLog

@@ -1,5 +1,17 @@
+2010-04-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* lisp/org-toc.el (org-toc-cycle-subtree)
+	(org-toc-restore-config): Use overlays-in/at.
+
+	* babel/lisp/org-babel.el (org-babel-hash-at-point)
+	(org-babel-hide-result-toggle): Use overlays-in/at.
+
 2010-04-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* babel/lisp/org-babel.el (org-babel-hide-hash): Use
+	`add-to-invisibility-spec'.
+	(org-babel-result-hide-spec): Use `add-to-invisibility-spec'.
+
 	* lisp/org-learn.el (require): `calendar' is now required already
 	by org.el on top level.
 

+ 5 - 5
contrib/babel/lisp/org-babel.el

@@ -394,7 +394,7 @@ added to the header-arguments-alist."
   "Hide the hash in the current results line.  Only the initial
 `org-babel-hash-show' characters of the hash will remain
 visible."
-  (org-add-to-invisibility-spec '(org-babel-hide-hash . t))
+  (add-to-invisibility-spec '(org-babel-hide-hash . t))
   (save-excursion
     (when (and (re-search-forward org-babel-result-regexp nil t)
                (match-string 3))
@@ -427,12 +427,12 @@ with C-c C-c."
   (interactive)
   (let ((hash (car (delq nil (mapcar
                                (lambda (ol) (overlay-get ol 'babel-hash))
-                              (org-overlays-at (or point (point))))))))
+                              (overlays-at (or point (point))))))))
     (when hash (kill-new hash) (message hash))))
 (add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point)
 
 (defun org-babel-result-hide-spec ()
-  (org-add-to-invisibility-spec '(org-babel-hide-result . t)))
+  (add-to-invisibility-spec '(org-babel-hide-result . t)))
 (add-hook 'org-mode-hook 'org-babel-result-hide-spec)
 
 (defvar org-babel-hide-result-overlays nil
@@ -475,7 +475,7 @@ with C-c C-c."
           (if (memq t (mapcar (lambda (overlay)
                                 (eq (overlay-get overlay 'invisible)
 				    'org-babel-hide-result))
-                              (org-overlays-at start)))
+                              (overlays-at start)))
               (if (or (not force) (eq force 'off))
                   (mapc (lambda (ov)
                           (when (member ov org-babel-hide-result-overlays)
@@ -484,7 +484,7 @@ with C-c C-c."
                           (when (eq (overlay-get ov 'invisible)
                                     'org-babel-hide-result)
                             (delete-overlay ov)))
-                        (org-overlays-at start)))
+                        (overlays-at start)))
             (setq ov (make-overlay start end))
             (overlay-put ov 'invisible 'org-babel-hide-result)
             ;; make the block accessible to isearch

+ 2 - 2
contrib/lisp/org-toc.el

@@ -188,7 +188,7 @@ specified, then make `org-toc-recenter' use this value."
   (interactive)
   (let ((beg (point))
 	(end (save-excursion (end-of-line) (point)))
-	(ov (car (org-overlays-at (point))))
+	(ov (car (overlays-at (point))))
 	status)
     (if ov (setq status (overlay-get ov 'status))
       (setq ov (make-overlay beg end)))
@@ -416,7 +416,7 @@ current table of contents to it."
       (save-excursion
 	(goto-char (point-min))
 	(when (search-forward (car hlcfg0) nil t)
-	  (unless (org-overlays-at (match-beginning 0))
+	  (unless (overlays-at (match-beginning 0))
 	    (setq ov (make-overlay (match-beginning 0)
 				   (match-end 0))))
 	  (cond ((eq (cdr hlcfg0) 'children)

+ 1 - 0
doc/org.texi

@@ -2826,6 +2826,7 @@ gnus:group                                @r{Gnus group link}
 gnus:group#id                             @r{Gnus article link}
 bbdb:R.*Stallman                          @r{BBDB link (with regexp)}
 irc:/irc.com/#emacs/bob                   @r{IRC link}
+info:org:External%20links                 @r{Info node link (with encoded space)}
 shell:ls *.org                            @r{A shell command}
 elisp:org-agenda                          @r{Interactive Elisp command}
 elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}

+ 38 - 0
lisp/ChangeLog

@@ -1,3 +1,26 @@
+2010-04-20  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-inlinetask.el (org-inlinetask-defaut-state): New option.
+	(org-inlinetask-insert-task): Use `org-inlinetask-defaut-state'.
+	Obey `org-odd-levels-only'.
+
+	* org-compat.el (org-find-overlays): Use overlays-in/at.
+
+	* org.el (org-remove-empty-overlays-at)
+	(org-outline-overlay-data, org-hide-block-toggle)
+	(org-format-latex, org-context): Use overlays-in/at.
+
+	* org-src.el (org-edit-src-exit): Use overlays-in/at.
+
+	* org-agenda.el (org-agenda-mark-clocking-task)
+	(org-agenda-fontify-priorities, org-agenda-dim-blocked-tasks)
+	(org-agenda-entry-text-hide)
+	(org-agenda-fix-tags-filter-overlays-at)
+	(org-agenda-bulk-remove-overlays): Use overlays-in/at.
+
+	* org-compat.el (org-overlays-at): Function removed.
+	(org-overlays-in): Function removed.
+
 2010-04-19  Bastien Guerry  <bzg@altern.org>
 
 	* org-clock.el (org-clock-set-current): Just return the headline
@@ -5,6 +28,21 @@
 
 2010-04-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-compat.el (org-xemacs-without-invisibility): New macro.
+	(org-xemacs-without-invisibility): New macro.
+	(org-indent-to-column, org-indent-line-to, org-move-to-column):
+	Redefine using the macro `org-xemacs-without-invisibility'.
+
+	* org.el (org-mode, org-org-menu): Use `add-to-invisibility-spec'.
+
+	* org-table.el (orgtbl-mode): Use `add-to-invisibility-spec'.
+
+	* org-compat.el (org-make-overlay, org-delete-overlay)
+	(org-overlay-start, org-overlay-end, org-overlay-put)
+	(org-overlay-get, org-overlay-move, org-overlay-buffer): Functions
+	removed.
+	(org-add-to-invisibility-spec): Function removed.
+
 	* org-html.el (org-export-as-html-and-open): Add argument to
 	kill-buffer.
 

+ 6 - 6
lisp/org-agenda.el

@@ -2797,7 +2797,7 @@ bind it in the options section.")
   (mapc (lambda (o)
 	  (if (eq (overlay-get o 'type) 'org-agenda-clocking)
 	      (delete-overlay o)))
-	(org-overlays-in (point-min) (point-max)))
+	(overlays-in (point-min) (point-max)))
   (when (marker-buffer org-clock-hd-marker)
     (save-excursion
       (goto-char (point-min))
@@ -2817,7 +2817,7 @@ bind it in the options section.")
   (interactive)
   (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-priority)
 			(delete-overlay o)))
-	(org-overlays-in (point-min) (point-max)))
+	(overlays-in (point-min) (point-max)))
   (save-excursion
     (let ((inhibit-read-only t)
 	  b e p ov h l)
@@ -2850,7 +2850,7 @@ bind it in the options section.")
   "Dim currently blocked TODO's in the agenda display."
   (mapc (lambda (o) (if (eq (overlay-get o 'org-type) 'org-blocked-todo)
 			(delete-overlay o)))
-	(org-overlays-in (point-min) (point-max)))
+	(overlays-in (point-min) (point-max)))
   (save-excursion
     (let ((inhibit-read-only t)
 	  (org-depend-tag-blocked nil)
@@ -2979,7 +2979,7 @@ no longer in use."
 		  (if (eq (overlay-get o 'org-overlay-type)
 			  'agenda-entry-content)
 		      (progn (delete-overlay o) t)))
-		(org-overlays-in (point-min) (point-max)))))
+		(overlays-in (point-min) (point-max)))))
 
 ;;; Agenda timeline
 
@@ -5591,7 +5591,7 @@ If the line does not have an effort defined, return nil."
 (defun org-agenda-fix-tags-filter-overlays-at (&optional pos)
   (setq pos (or pos (point)))
   (save-excursion
-    (dolist (ov (org-overlays-at pos))
+    (dolist (ov (overlays-at pos))
       (when (and (overlay-get ov 'invisible)
 		 (eq (overlay-get ov 'type) 'tags-filter))
 	(goto-char pos)
@@ -7409,7 +7409,7 @@ from the list in `org-agenda-bulk-marked-entries'."
   (mapc (lambda (ov)
 	  (and (eq (overlay-get ov 'type) 'org-marked-entry-overlay)
 	       (delete-overlay ov)))
-	(org-overlays-in (or beg (point-min)) (or end (point-max)))))
+	(overlays-in (or beg (point-min)) (or end (point-max)))))
 
 (defun org-agenda-bulk-remove-all-marks ()
   "Remove all marks in the agenda buffer.

+ 21 - 59
lisp/org-compat.el

@@ -110,22 +110,18 @@ any other entries, and any resulting duplicates will be removed entirely."
     (if face (org-add-props text nil 'face face))
     (overlay-put ovl 'before-string text)
     (if evap (overlay-put ovl 'evaporate t))))
-(defun org-overlays-at (pos)
-  (if (featurep 'xemacs) (extents-at pos) (overlays-at pos)))
-(defun org-overlays-in (&optional start end)
-  (if (featurep 'xemacs)
-      (extent-list nil start end)
-    (overlays-in start end)))
 (defun org-find-overlays (prop &optional pos delete)
   "Find all overlays specifying PROP at POS or point.
 If DELETE is non-nil, delete all those overlays."
-  (let ((overlays (org-overlays-at (or pos (point))))
+  (let ((overlays (overlays-at (or pos (point))))
 	ov found)
     (while (setq ov (pop overlays))
       (if (overlay-get ov prop)
           (if delete (delete-overlay ov) (push ov found))))
     found))
 
+;; Miscellaneous functions
+
 (defun org-add-hook (hook function &optional append local)
   "Add-hook, compatible with both Emacsen."
   (if (and local (featurep 'xemacs))
@@ -182,19 +178,6 @@ Works on both Emacs and XEmacs."
 
 ;; Invisibility compatibility
 
-(defun org-add-to-invisibility-spec (arg)
-  "Add elements to `buffer-invisibility-spec'.
-See documentation for `buffer-invisibility-spec' for the kind of elements
-that can be added."
-  (cond
-   ((fboundp 'add-to-invisibility-spec)
-    (add-to-invisibility-spec arg))
-   ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t))
-    (setq buffer-invisibility-spec (list arg)))
-   (t
-    (setq buffer-invisibility-spec
-	  (cons arg buffer-invisibility-spec)))))
-
 (defun org-remove-from-invisibility-spec (arg)
   "Remove elements from `buffer-invisibility-spec'."
   (if (fboundp 'remove-from-invisibility-spec)
@@ -209,57 +192,36 @@ that can be added."
       (member arg buffer-invisibility-spec)
     nil))
 
+(defmacro org-xemacs-without-invisibility (&rest body)
+  "Turn off exents with invisibility while executing BODY."
+  `(let ((ext-inv (extent-list nil (point-at-bol) (point-at-eol)
+			       'all-extents-closed-open 'invisible))
+	 ext-inv-specs)
+     (dolist (ext ext-inv)
+       (when (extent-property ext 'invisible)
+	 (add-to-list 'ext-inv-specs (list ext (extent-property
+						ext 'invisible)))
+	 (set-extent-property ext 'invisible nil)))
+     ,@body
+     (dolist (ext-inv-spec ext-inv-specs)
+       (set-extent-property (car ext-inv-spec) 'invisible
+			    (cadr ext-inv-spec)))))
+
 (defun org-indent-to-column (column &optional minimum buffer)
   "Work around a bug with extents with invisibility in XEmacs."
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-		      nil (point-at-bol) (point-at-eol)
-		      'all-extents-closed-open 'invisible))
-	    ext-inv-specs)
-	(dolist (ext ext-inv)
-	  (when (extent-property ext 'invisible)
-	    (add-to-list 'ext-inv-specs (list ext (extent-property
-						   ext 'invisible)))
-	    (set-extent-property ext 'invisible nil)))
-	(indent-to-column column minimum buffer)
-	(dolist (ext-inv-spec ext-inv-specs)
-	  (set-extent-property (car ext-inv-spec) 'invisible
-			       (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (indent-to-column column minimum buffer))
     (indent-to-column column minimum)))
 
 (defun org-indent-line-to (column)
   "Work around a bug with extents with invisibility in XEmacs."
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-		      nil (point-at-bol) (point-at-eol)
-		      'all-extents-closed-open 'invisible))
-	    ext-inv-specs)
-	(dolist (ext ext-inv)
-	  (when (extent-property ext 'invisible)
-	    (add-to-list 'ext-inv-specs (list ext (extent-property
-						   ext 'invisible)))
-	    (set-extent-property ext 'invisible nil)))
-	(indent-line-to column)
-	(dolist (ext-inv-spec ext-inv-specs)
-	  (set-extent-property (car ext-inv-spec) 'invisible
-			       (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (indent-line-to column))
     (indent-line-to column)))
 
 (defun org-move-to-column (column &optional force buffer)
   (if (featurep 'xemacs)
-      (let ((ext-inv (extent-list
-		      nil (point-at-bol) (point-at-eol)
-		      'all-extents-closed-open 'invisible))
-	    ext-inv-specs)
-	(dolist (ext ext-inv)
-	  (when (extent-property ext 'invisible)
-	    (add-to-list 'ext-inv-specs (list ext (extent-property ext
-								   'invisible)))
-	    (set-extent-property ext 'invisible nil)))
-	(move-to-column column force buffer)
-	(dolist (ext-inv-spec ext-inv-specs)
-	  (set-extent-property (car ext-inv-spec) 'invisible
-			       (cadr ext-inv-spec))))
+      (org-xemacs-without-invisibility (move-to-column column force buffer))
     (move-to-column column force)))
 
 (defun org-get-x-clipboard-compat (value)

+ 21 - 5
lisp/org-inlinetask.el

@@ -105,12 +105,28 @@ When nil, they will not be exported."
 (defvar org-complex-heading-regexp)
 (defvar org-property-end-re)
 
-(defun org-inlinetask-insert-task ()
-  "Insert an inline task."
-  (interactive)
+(defcustom org-inlinetask-defaut-state nil
+  "Non-nil means make inline tasks have a TODO keyword initially.
+This should be the state `org-inlinetask-insert-task' should use by
+default, or nil of no state should be assigned."
+  :group 'org-inlinetask
+  :type (choice
+	 (const :tag "No state" nil)
+	 (string :tag "Specific state")))
+
+(defun org-inlinetask-insert-task (&optional no-state)
+  "Insert an inline task.
+If prefix arg NO-STATE is set, irgnore `org-inlinetask-defaut-state'."
+  (interactive "P")
   (or (bolp) (newline))
-  (insert (make-string org-inlinetask-min-level ?*) " \n"
-	  (make-string org-inlinetask-min-level ?*) " END\n")
+  (let ((indent org-inlinetask-min-level))
+    (if org-odd-levels-only
+        (setq indent (- (* 2 indent) 1)))
+    (insert (make-string indent ?*)
+            (if (or no-state (not org-inlinetask-defaut-state))
+		" \n"
+	      (concat " " org-inlinetask-defaut-state " \n"))
+            (make-string indent ?*) " END\n"))
   (end-of-line -1))
 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)
 

+ 0 - 1
lisp/org-macs.el

@@ -270,7 +270,6 @@ This is in contrast to merely setting it to 0."
       (setq plist (cddr plist)))
     p))
 
-
 (defun org-replace-match-keep-properties (newtext &optional fixedcase
 						  literal string)
   "Like `replace-match', but add the text properties found original text."

+ 1 - 1
lisp/org-src.el

@@ -595,7 +595,7 @@ the language, a switch telling if the content should be in a single line."
     (if (memq t (mapcar (lambda (overlay)
 			  (eq (overlay-get overlay 'invisible)
 			      'org-hide-block))
-			(org-overlays-at (point))))
+			(overlays-at (point))))
 	;; Block is hidden; put point at start of block
 	(beginning-of-line 0)
       ;; Block is visible, put point where it was in the code buffer

+ 1 - 1
lisp/org-table.el

@@ -3454,7 +3454,7 @@ table editor in arbitrary modes.")
 			     (concat orgtbl-line-start-regexp "\\|"
 				     auto-fill-inhibit-regexp)
 			   orgtbl-line-start-regexp))
-	  (org-add-to-invisibility-spec '(org-cwidth))
+	  (add-to-invisibility-spec '(org-cwidth))
 	  (when (fboundp 'font-lock-add-keywords)
 	    (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords)
 	    (org-restart-font-lock))

+ 11 - 12
lisp/org.el

@@ -4365,9 +4365,9 @@ The following commands are available:
   (easy-menu-add org-org-menu)
   (easy-menu-add org-tbl-menu)
   (org-install-agenda-files-menu)
-  (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
-  (org-add-to-invisibility-spec '(org-cwidth))
-  (org-add-to-invisibility-spec '(org-hide-block . t))
+  (if org-descriptive-links (add-to-invisibility-spec '(org-link)))
+  (add-to-invisibility-spec '(org-cwidth))
+  (add-to-invisibility-spec '(org-hide-block . t))
   (when (featurep 'xemacs)
     (org-set-local 'line-move-ignore-invisible t))
   (org-set-local 'outline-regexp org-outline-regexp)
@@ -5660,7 +5660,7 @@ This function is the default value of the hook `org-cycle-hook'."
 	  (not (string-match "\\S-" (buffer-substring (overlay-start o)
 						      (overlay-end o))))
 	  (delete-overlay o)))
-   (org-overlays-at pos)))
+   (overlays-at pos)))
 
 (defun org-clean-visibility-after-subtree-move ()
   "Fix visibility issues after moving a subtree."
@@ -5830,7 +5830,7 @@ If USE-MARKERS is set, return the positions as markers."
 				   (cons (move-marker (make-marker) beg)
 					 (move-marker (make-marker) end))
 				 (cons beg end)))))
-		      (org-overlays-in (point-min) (point-max))))))))
+		      (overlays-in (point-min) (point-max))))))))
 
 (defun org-set-outline-overlay-data (data)
   "Create visibility overlays for all positions in DATA.
@@ -5927,7 +5927,7 @@ the range."
           (if (memq t (mapcar (lambda (overlay)
                                 (eq (overlay-get overlay 'invisible)
 				    'org-hide-block))
-                              (org-overlays-at start)))
+                              (overlays-at start)))
               (if (or (not force) (eq force 'off))
                   (mapc (lambda (ov)
                           (when (member ov org-hide-block-overlays)
@@ -5936,7 +5936,7 @@ the range."
                           (when (eq (overlay-get ov 'invisible)
                                     'org-hide-block)
                             (delete-overlay ov)))
-                        (org-overlays-at start)))
+                        (overlays-at start)))
             (setq ov (make-overlay start end))
             (overlay-put ov 'invisible 'org-hide-block)
             ;; make the block accessible to isearch
@@ -9661,8 +9661,7 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
 	  (when (featurep 'org-inlinetask)
 	    (org-inlinetask-remove-END-maybe))
 	  (setq org-markers-to-move nil)
-	  (message "Refiled to \"%s\"" (car it))))))
-  (org-reveal))
+	  (message "Refiled to \"%s\"" (car it)))))))
 
 (defun org-refile-goto-last-stored ()
   "Go to the location where the last refile was stored."
@@ -15283,7 +15282,7 @@ Some of the options can be changed using the variable
 			  (if (eq (overlay-get o 'org-overlay-type)
 				  'org-latex-overlay)
 			      (delete-overlay o)))
-			(org-overlays-in beg end))
+			(overlays-in beg end))
 		  (setq ov (make-overlay beg end))
 		  (overlay-put ov 'org-overlay-type 'org-latex-overlay)
 		  (if (featurep 'xemacs)
@@ -16687,7 +16686,7 @@ See the individual commands for more information."
      ["Previous link" org-previous-link t]
      "--"
      ["Descriptive Links"
-      (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
+      (progn (add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
       :style radio
       :selected (member '(org-link) buffer-invisibility-spec)]
      ["Literal Links"
@@ -17325,7 +17324,7 @@ and :keyword."
 			 (mapcar
 			  (lambda (x)
 			    (if (memq x org-latex-fragment-image-overlays) x))
-			  (org-overlays-at (point))))))
+			  (overlays-at (point))))))
       (push (list :latex-fragment
 		  (overlay-start o) (overlay-end o)) clist)
       (push (list :latex-preview