Browse Source

Merge branch 'maint'

Bastien Guerry 13 years ago
parent
commit
8205e25c08
3 changed files with 36 additions and 15 deletions
  1. 17 12
      lisp/org-agenda.el
  2. 9 2
      lisp/org-exp.el
  3. 10 1
      lisp/org.el

+ 17 - 12
lisp/org-agenda.el

@@ -160,8 +160,8 @@ before assigned to the variables.  So make sure to quote values you do
 	   (sexp :tag "Value"))))
 	   (sexp :tag "Value"))))
 
 
 (defcustom org-agenda-before-write-hook '(org-agenda-add-entry-text)
 (defcustom org-agenda-before-write-hook '(org-agenda-add-entry-text)
-  "Hook run in temporary buffer before writing it to an export file.
-A useful function is `org-agenda-add-entry-text'."
+  "Hook run in a temporary buffer before writing the agenda to an export file.
+A useful function for this hook is `org-agenda-add-entry-text'."
   :group 'org-agenda-export
   :group 'org-agenda-export
   :type 'hook
   :type 'hook
   :options '(org-agenda-add-entry-text))
   :options '(org-agenda-add-entry-text))
@@ -169,7 +169,7 @@ A useful function is `org-agenda-add-entry-text'."
 (defcustom org-agenda-add-entry-text-maxlines 0
 (defcustom org-agenda-add-entry-text-maxlines 0
   "Maximum number of entry text lines to be added to agenda.
   "Maximum number of entry text lines to be added to agenda.
 This is only relevant when `org-agenda-add-entry-text' is part of
 This is only relevant when `org-agenda-add-entry-text' is part of
-`org-agenda-before-write-hook', which it is by default.
+`org-agenda-before-write-hook', which is the default.
 When this is 0, nothing will happen.  When it is greater than 0, it
 When this is 0, nothing will happen.  When it is greater than 0, it
 specifies the maximum number of lines that will be added for each entry
 specifies the maximum number of lines that will be added for each entry
 that is listed in the agenda view.
 that is listed in the agenda view.
@@ -902,7 +902,12 @@ to nil."
 
 
 (make-obsolete-variable 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3")
 (make-obsolete-variable 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3")
 (defcustom org-agenda-finalize-hook nil
 (defcustom org-agenda-finalize-hook nil
-  "Hook run just before displaying an agenda buffer."
+  "Hook run just before displaying an agenda buffer.
+The buffer is still writable when the hook is called.
+
+You can modify some of the buffer substrings but you should be
+extra careful not to modify the text properties of the agenda
+headlines as the agenda display heavily relies on them."
   :group 'org-agenda-startup
   :group 'org-agenda-startup
   :type 'hook)
   :type 'hook)
 
 
@@ -1851,7 +1856,8 @@ works you probably want to add it to `org-agenda-custom-commands' for good."
 (defvar org-agenda-redo-command nil)
 (defvar org-agenda-redo-command nil)
 (defvar org-agenda-query-string nil)
 (defvar org-agenda-query-string nil)
 (defvar org-agenda-mode-hook nil
 (defvar org-agenda-mode-hook nil
-  "Hook for `org-agenda-mode', run after the mode is turned on.")
+  "Hook run after `org-agenda-mode' is turned on.
+The buffer is still writable when this hook is called.")
 (defvar org-agenda-type nil)
 (defvar org-agenda-type nil)
 (defvar org-agenda-force-single-file nil)
 (defvar org-agenda-force-single-file nil)
 (defvar org-agenda-bulk-marked-entries nil
 (defvar org-agenda-bulk-marked-entries nil
@@ -2670,13 +2676,12 @@ L   Timeline for current buffer         #   List stuck projects (!=configure)
 				 ((stringp match)
 				 ((stringp match)
 				  (setq match (copy-sequence match))
 				  (setq match (copy-sequence match))
 				  (org-add-props match nil 'face 'org-warning))
 				  (org-add-props match nil 'face 'org-warning))
-				 (match
-				  (format "set of %d commands" (length match)))
-				 (t ""))))
+				 ((listp type)
+				  (format "set of %d commands" (length type))))))
 		(if (org-string-nw-p match)
 		(if (org-string-nw-p match)
 		    (add-text-properties
 		    (add-text-properties
 		     0 (length line) (list 'help-echo
 		     0 (length line) (list 'help-echo
-					   (concat "Matcher: "match)) line)))
+					   (concat "Matcher: " match)) line)))
 	      (push line lines)))
 	      (push line lines)))
 	  (setq lines (nreverse lines))
 	  (setq lines (nreverse lines))
 	  (when prefixes
 	  (when prefixes
@@ -3438,14 +3443,14 @@ generating a new one."
 	(org-agenda-entry-text-show))
 	(org-agenda-entry-text-show))
       (if (functionp 'org-habit-insert-consistency-graphs)
       (if (functionp 'org-habit-insert-consistency-graphs)
 	  (org-habit-insert-consistency-graphs))
 	  (org-habit-insert-consistency-graphs))
-      (run-hooks 'org-agenda-finalize-hook)
+      (let ((inhibit-read-only t))
+	(run-hooks 'org-agenda-finalize-hook))
       (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
       (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
       (when (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter))
       (when (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter))
 	(org-agenda-filter-apply org-agenda-tag-filter 'tag))
 	(org-agenda-filter-apply org-agenda-tag-filter 'tag))
       (when (or org-agenda-category-filter (get 'org-agenda-category-filter :preset-filter))
       (when (or org-agenda-category-filter (get 'org-agenda-category-filter :preset-filter))
 	(org-agenda-filter-apply org-agenda-category-filter 'category))
 	(org-agenda-filter-apply org-agenda-category-filter 'category))
-      (org-add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)
-      )))
+      (org-add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local))))
 
 
 (defun org-agenda-mark-clocking-task ()
 (defun org-agenda-mark-clocking-task ()
   "Mark the current clock entry in the agenda if it is present."
   "Mark the current clock entry in the agenda if it is present."

+ 9 - 2
lisp/org-exp.el

@@ -973,6 +973,8 @@ Pressing `1' will switch between these two options."
   (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
   (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
 	 (subtree-p (or (org-region-active-p)
 	 (subtree-p (or (org-region-active-p)
 			(eq org-export-initial-scope 'subtree)))
 			(eq org-export-initial-scope 'subtree)))
+	 (regb (and (org-region-active-p) (region-beginning)))
+	 (rege (and (org-region-active-p) (region-end)))
 	 (help "[t]   insert the export option template
 	 (help "[t]   insert the export option template
 \[v]   limit export to visible part of outline tree
 \[v]   limit export to visible part of outline tree
 \[1]   switch buffer/subtree export
 \[1]   switch buffer/subtree export
@@ -1053,6 +1055,10 @@ Pressing `1' will switch between these two options."
 		((not subtree-p)
 		((not subtree-p)
 		 (setq subtree-p t)
 		 (setq subtree-p t)
 		 (setq bpos (point))
 		 (setq bpos (point))
+		 (org-mark-subtree)
+		 (org-activate-mark)
+		 (setq regb (and (org-region-active-p) (region-beginning)))
+		 (setq rege (and (org-region-active-p) (region-end)))
 		 (message "Export subtree: "))))
 		 (message "Export subtree: "))))
 	(when (eq r1 ?\ )
 	(when (eq r1 ?\ )
 	  (let ((case-fold-search t)
 	  (let ((case-fold-search t)
@@ -1090,8 +1096,9 @@ Pressing `1' will switch between these two options."
 		  "-f" (symbol-name (nth 1 ass)))))
 		  "-f" (symbol-name (nth 1 ass)))))
 	  (set-process-sentinel p 'org-export-process-sentinel)
 	  (set-process-sentinel p 'org-export-process-sentinel)
 	  (message "Background process \"%s\": started" p))
 	  (message "Background process \"%s\": started" p))
-      ;; background processing not requested, or not possible
-      (if subtree-p (progn (org-mark-subtree) (org-activate-mark)))
+      ;; set the mark correctly when exporting a subtree
+      (if subtree-p (let (deactivate-mark) (push-mark rege t t) (goto-char regb)))
+
       (call-interactively (nth 1 ass))
       (call-interactively (nth 1 ass))
       (when (and bpos (get-buffer-window cbuf))
       (when (and bpos (get-buffer-window cbuf))
 	(let ((cw (selected-window)))
 	(let ((cw (selected-window)))

+ 10 - 1
lisp/org.el

@@ -5171,7 +5171,16 @@ The following commands are available:
       (require 'org-indent)
       (require 'org-indent)
       (org-indent-mode 1))
       (org-indent-mode 1))
     (unless org-inhibit-startup-visibility-stuff
     (unless org-inhibit-startup-visibility-stuff
-      (org-set-startup-visibility))))
+      (org-set-startup-visibility)))
+  ;; Try to set org-hide correctly
+  (set-face-foreground
+   'org-hide
+   (or (face-background 'default)
+       (face-background 'org-default)
+       (cdr (assoc 'background-color default-frame-alist))
+       (cdr (assoc 'background-color initial-frame-alist))
+       (cdr (assoc 'background-color window-system-default-frame-alist))
+       (face-foreground 'org-hide))))
 
 
 (when (fboundp 'abbrev-table-put)
 (when (fboundp 'abbrev-table-put)
   (abbrev-table-put org-mode-abbrev-table
   (abbrev-table-put org-mode-abbrev-table