Browse Source

Some small fixes

Carsten Dominik 16 years ago
parent
commit
24e7c62b84
7 changed files with 99 additions and 13 deletions
  1. 11 7
      doc/org.texi
  2. 19 0
      lisp/ChangeLog
  3. 1 0
      lisp/org-agenda.el
  4. 22 0
      lisp/org-compat.el
  5. 4 2
      lisp/org-exp.el
  6. 1 1
      lisp/org-html.el
  7. 41 3
      lisp/org.el

+ 11 - 7
doc/org.texi

@@ -3822,7 +3822,8 @@ with detailed subtasks on the tree@footnote{To keep subtasks out of the
 global TODO list, see the @code{org-agenda-todo-list-sublevels}.}.  To keep
 global TODO list, see the @code{org-agenda-todo-list-sublevels}.}.  To keep
 the overview over the fraction of subtasks that are already completed, insert
 the overview over the fraction of subtasks that are already completed, insert
 either @samp{[/]} or @samp{[%]} anywhere in the headline.  These cookies will
 either @samp{[/]} or @samp{[%]} anywhere in the headline.  These cookies will
-be updates each time the todo status of a child changes.  For example:
+be updates each time the todo status of a child changes, or when pressing
+@kbd{C-c C-c} on the cookie.  For example:
 
 
 @example
 @example
 * Organize Party [33%]
 * Organize Party [33%]
@@ -3970,12 +3971,13 @@ for better visibility, customize the variable
 @code{org-track-ordered-property-with-tag}.
 @code{org-track-ordered-property-with-tag}.
 @kindex C-c #
 @kindex C-c #
 @item C-c #
 @item C-c #
-Update the checkbox statistics in the current outline entry.  When
-called with a @kbd{C-u} prefix, update the entire file.  Checkbox
-statistic cookies are updated automatically if you toggle checkboxes
-with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}.  If you
-delete boxes or add/change them by hand, use this command to get things
-back into sync.  Or simply toggle any checkbox twice with @kbd{C-c C-c}.
+Update the statistics cookie in the current outline entry.  When called with
+a @kbd{C-u} prefix, update the entire file.  Checkbox statistic cookies are
+updated automatically if you toggle checkboxes with @kbd{C-c C-c} and make
+new ones with @kbd{M-S-@key{RET}}.  TODO statistics cookies update when
+changing TODO states.  If you delete boxes/entries or add/change them by
+hand, use this command to get things back into sync.  Or simply toggle any
+entry twice (checkboxes with @kbd{C-c C-c}).
 @end table
 @end table
 
 
 @node Tags, Properties and Columns, TODO Items, Top
 @node Tags, Properties and Columns, TODO Items, Top
@@ -10335,6 +10337,8 @@ drawer, offer property commands.
 If the cursor is at a footnote reference, go to the corresponding
 If the cursor is at a footnote reference, go to the corresponding
 definition, and vice versa.
 definition, and vice versa.
 @item
 @item
+If the cursor is on a statistics cookie, update it.
+@item
 If the cursor is in a plain list item with a checkbox, toggle the status
 If the cursor is in a plain list item with a checkbox, toggle the status
 of the checkbox.
 of the checkbox.
 @item
 @item

+ 19 - 0
lisp/ChangeLog

@@ -1,3 +1,22 @@
+2009-09-02  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-agenda.el (org-agenda-quit): When the agenda window is
+	dedicated, remove other windows before exiting, so that the frame
+	really will be killed.
+
+	* org-exp.el (org-export-handle-include-files): Reset START and
+	END for each loop cycle.
+
+2009-09-01  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-eval-in-calendar): Use
+	`org-select-frame-set-input-focus'.
+
+	* org-compat.el (org-select-frame-set-input-focus): New function.
+
+	* org.el (org-update-statistics-cookies): New function.
+	(org-mode-map): Bind `C-c #' to `org-update-statistics-cookies'.
+
 2009-08-31  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-08-31  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org-src.el (org-edit-fixed-width-region): Set org-src-mode only
 	* org-src.el (org-edit-fixed-width-region): Set org-src-mode only

+ 1 - 0
lisp/org-agenda.el

@@ -4800,6 +4800,7 @@ If ERROR is non-nil, throw an error, otherwise just return nil."
   (interactive)
   (interactive)
   (if org-agenda-columns-active
   (if org-agenda-columns-active
       (org-columns-quit)
       (org-columns-quit)
+    (if (window-dedicated-p) (delete-other-windows))
     (let ((buf (current-buffer)))
     (let ((buf (current-buffer)))
       (and (not (eq org-agenda-window-setup 'current-window))
       (and (not (eq org-agenda-window-setup 'current-window))
            (not (one-window-p))
            (not (one-window-p))

+ 22 - 0
lisp/org-compat.el

@@ -332,6 +332,28 @@ that can be added."
 			  string)
 			  string)
   (apply 'kill-new string args))
   (apply 'kill-new string args))
 
 
+(defun org-select-frame-set-input-focus (frame)
+  "Select FRAME, raise it, and set input focus, if possible."
+  (cond ((featurep 'xemacs)
+	 (if (fboundp 'select-frame-set-input-focus)
+	     (select-frame-set-input-focus frame)
+	   (raise-frame frame)
+	   (select-frame frame)
+	   (focus-frame frame)))
+	;; `select-frame-set-input-focus' defined in Emacs 21 will not
+	;; set the input focus.
+	((>= emacs-major-version 22)
+	 (select-frame-set-input-focus frame))
+	(t
+	 (raise-frame frame)
+	 (select-frame frame)
+	 (cond ((memq window-system '(x ns mac))
+		(x-focus-frame frame))
+	       ((eq window-system 'w32)
+		(w32-focus-frame frame)))
+	 (when focus-follows-mouse
+	   (set-mouse-position frame (1- (frame-width frame)) 0)))))
+
 (provide 'org-compat)
 (provide 'org-compat)
 
 
 ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
 ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe

+ 4 - 2
lisp/org-exp.el

@@ -2131,7 +2131,8 @@ TYPE must be a string, any of:
 	    markup (org-symname-or-string (pop params))
 	    markup (org-symname-or-string (pop params))
 	    lang (and (member markup '("src" "SRC"))
 	    lang (and (member markup '("src" "SRC"))
 		      (org-symname-or-string (pop params)))
 		      (org-symname-or-string (pop params)))
-	    switches (mapconcat '(lambda (x) (format "%s" x)) params " "))
+	    switches (mapconcat '(lambda (x) (format "%s" x)) params " ")
+	    start nil end nil)
       (delete-region (match-beginning 0) (match-end 0))
       (delete-region (match-beginning 0) (match-end 0))
       (if (or (not file)
       (if (or (not file)
 	      (not (file-exists-p file))
 	      (not (file-exists-p file))
@@ -2146,7 +2147,8 @@ TYPE must be a string, any of:
 	    (setq start (format "#+begin_%s %s\n" markup switches)
 	    (setq start (format "#+begin_%s %s\n" markup switches)
 		  end  (format "#+end_%s" markup))))
 		  end  (format "#+end_%s" markup))))
 	(insert (or start ""))
 	(insert (or start ""))
-	(insert (org-get-file-contents (expand-file-name file) prefix prefix1 markup))
+	(insert (org-get-file-contents (expand-file-name file)
+				       prefix prefix1 markup))
 	(or (bolp) (newline))
 	(or (bolp) (newline))
 	(insert (or end ""))))))
 	(insert (or end ""))))))
 
 

+ 1 - 1
lisp/org-html.el

@@ -1642,7 +1642,7 @@ lang=\"%s\" xml:lang=\"%s\">
       (push (mapconcat
       (push (mapconcat
 	     (lambda (x)
 	     (lambda (x)
 	       (setq gr (pop org-table-colgroup-info))
 	       (setq gr (pop org-table-colgroup-info))
-	       (format "%s<col align=\"%s\"></col>%s"
+	       (format "%s<col align=\"%s\" />%s"
 		       (if (memq gr '(:start :startend))
 		       (if (memq gr '(:start :startend))
 			   (prog1
 			   (prog1
 			       (if colgropen "</colgroup>\n<colgroup>" "<colgroup>")
 			       (if colgropen "</colgroup>\n<colgroup>" "<colgroup>")

+ 41 - 3
lisp/org.el

@@ -9655,6 +9655,39 @@ changes because there are uncheckd boxes in this entry."
 	      (throw 'dont-block nil)))))
 	      (throw 'dont-block nil)))))
     t)) ; do not block
     t)) ; do not block
 
 
+(defun org-update-statistics-cookies (all)
+  "Update the statistics cookie, either from TODO or from checkboxes.
+This should be called with the cursor in a line with a statistics cookie."
+  (interactive "P")
+  (if all
+      (progn
+	(org-update-checkbox-count 'all)
+	(org-map-entries 'org-update-parent-todo-statistics))
+    (if (not (org-on-heading-p))
+	(org-update-checkbox-count)
+      (let ((pos (move-marker (make-marker) (point)))
+	    end l1 l2)
+	(ignore-errors (org-back-to-heading t))
+	(if (not (org-on-heading-p))
+	    (org-update-checkbox-count)
+	  (setq l1 (org-outline-level))
+	  (setq end (save-excursion
+		      (outline-next-heading)
+		      (if (org-on-heading-p) (setq l2 (org-outline-level)))
+		      (point)))
+	  (if (and (save-excursion (re-search-forward
+				    "^[ \t]*[-+*] \\[[- X]\\]" end t))
+		   (not (save-excursion (re-search-forward
+					 ":COOKIE_DATA:.*\\<todo\\>" end t))))
+	      (org-update-checkbox-count)
+	    (if (and l2 (> l2 l1))
+		(progn
+		  (goto-char end)
+		  (org-update-parent-todo-statistics))
+	      (error "No data for statistics cookie"))))
+	(goto-char pos)
+	(move-marker pos nil)))))
+  
 (defvar org-entry-property-inherited-from) ;; defined below
 (defvar org-entry-property-inherited-from) ;; defined below
 (defun org-update-parent-todo-statistics ()
 (defun org-update-parent-todo-statistics ()
   "Update any statistics cookie in the parent of the current headline.
   "Update any statistics cookie in the parent of the current headline.
@@ -12766,7 +12799,7 @@ Also, store the cursor date in variable org-ans2."
 	(setq org-ans2 (format-time-string "%Y-%m-%d" time))))
 	(setq org-ans2 (format-time-string "%Y-%m-%d" time))))
     (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
     (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
     (select-window sw)
     (select-window sw)
-    (select-frame-set-input-focus sf)))
+    (org-select-frame-set-input-focus sf)))
 
 
 (defun org-calendar-select ()
 (defun org-calendar-select ()
   "Return to `org-read-date' with the date currently selected.
   "Return to `org-read-date' with the date currently selected.
@@ -14287,7 +14320,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 (org-defkey org-mode-map "\C-c^"    'org-sort)
 (org-defkey org-mode-map "\C-c^"    'org-sort)
 (org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
 (org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
 (org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches)
 (org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches)
-(org-defkey org-mode-map "\C-c#"    'org-update-checkbox-count)
+(org-defkey org-mode-map "\C-c#"    'org-update-statistics-cookies)
 (org-defkey org-mode-map "\C-m"     'org-return)
 (org-defkey org-mode-map "\C-m"     'org-return)
 (org-defkey org-mode-map "\C-j"     'org-return-indent)
 (org-defkey org-mode-map "\C-j"     'org-return-indent)
 (org-defkey org-mode-map "\C-c?"    'org-table-field-info)
 (org-defkey org-mode-map "\C-c?"    'org-table-field-info)
@@ -14897,6 +14930,8 @@ This command does many different things, depending on context:
 - If a function in `org-ctrl-c-ctrl-c-hook' recognizes this location,
 - If a function in `org-ctrl-c-ctrl-c-hook' recognizes this location,
   this is what we do.
   this is what we do.
 
 
+- If the cursor is on a statistics cookie, update it.
+
 - If the cursor is in a headline, prompt for tags and insert them
 - If the cursor is in a headline, prompt for tags and insert them
   into the current line, aligned to `org-tags-column'.  When called
   into the current line, aligned to `org-tags-column'.  When called
   with prefix arg, realign all tags in the current buffer.
   with prefix arg, realign all tags in the current buffer.
@@ -14948,6 +14983,9 @@ This command does many different things, depending on context:
      ((org-at-property-p)
      ((org-at-property-p)
       (call-interactively 'org-property-action))
       (call-interactively 'org-property-action))
      ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp))
      ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp))
+     ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]")
+	   (or (org-on-heading-p) (org-at-item-p)))
+      (call-interactively 'org-update-statistics-cookies))
      ((org-on-heading-p) (call-interactively 'org-set-tags))
      ((org-on-heading-p) (call-interactively 'org-set-tags))
      ((org-at-table.el-p)
      ((org-at-table.el-p)
       (require 'table)
       (require 'table)
@@ -15493,7 +15531,7 @@ such private information before sending the email.")
 	 list))
 	 list))
      nil nil
      nil nil
      "Remember to cover the basics, that is, what you expected to happen and
      "Remember to cover the basics, that is, what you expected to happen and
-what in fact did happen.  You don't know hoe to make a good report?  See
+what in fact did happen.  You don't know how to make a good report?  See
 
 
      http://orgmode.org/manual/Feedback.html#Feedback
      http://orgmode.org/manual/Feedback.html#Feedback