Browse Source

Keep compiler happy

Carsten Dominik 15 years ago
parent
commit
5dbc23baed
5 changed files with 46 additions and 29 deletions
  1. 9 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-id.el
  3. 3 1
      lisp/org-list.el
  4. 9 8
      lisp/org-timer.el
  5. 24 19
      lisp/org.el

+ 9 - 0
lisp/ChangeLog

@@ -1,5 +1,14 @@
 2009-08-03  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-list.el (org-list-send-list): Call
+	`org-list-goto-true-beginning' instead of
+	`org-list-find-true-beginning', which does not exist.
+
+	* org-timer.el (org-timer-reset-timers): Use `mapc'.
+	(org-timer-set-timer): Do not assign to heading.
+
+	* org-id.el (org-id-open): Quote function name.
+
 	* org-macs.el (org-unmodified): Turn off recording undo
 	information while running inside the macro.
 

+ 1 - 1
lisp/org-id.el

@@ -590,7 +590,7 @@ optional argument MARKERP, return the position as a new marker."
 	     '((find-file . switch-to-buffer)
 	       (find-file-other-window . switch-to-buffer-other-window)
 	       (find-file-other-frame . switch-to-buffer-other-frame))))
-	   switch-to-buffer-other-window))
+	   'switch-to-buffer-other-window))
     (if (not (equal (current-buffer) (marker-buffer m)))
 	(funcall cmd (marker-buffer m)))
     (goto-char m)

+ 3 - 1
lisp/org-list.el

@@ -36,6 +36,8 @@
 
 (defvar org-blank-before-new-entry)
 (defvar org-M-RET-may-split-line)
+(defvar org-complex-heading-regexp)
+(defvar org-odd-levels-only)
 
 (declare-function org-invisible-p "org" ())
 (declare-function org-on-heading-p "org" (&optional invisible-ok))
@@ -1174,7 +1176,7 @@ this list."
   (catch 'exit
     (unless (org-at-item-p) (error "Not at a list"))
     (save-excursion
-      (org-list-find-true-beginning)
+      (org-list-goto-true-beginning)
       (beginning-of-line 0)
       (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
 	(if maybe

+ 9 - 8
lisp/org-timer.el

@@ -30,6 +30,7 @@
 (require 'org)
 
 (declare-function org-show-notification "org-clock" (parameters))
+(declare-function org-agenda-error "org-agenda" ())
 
 (defvar org-timer-start-time nil
   "t=0 for the running timer.")
@@ -263,13 +264,13 @@ VALUE can be `on', `off', or `pause'."
 (defun org-timer-reset-timers ()
   "Reset all timers."
   (interactive)
-  (mapcar (lambda(timer) 
-	    (when (eval timer)
-	      (cancel-timer timer)
-	      (setq timer nil)))
-	  '(org-timer-timer1
-	    org-timer-timer2
-	    org-timer-timer3))
+  (mapc (lambda(timer) 
+	  (when (eval timer)
+	    (cancel-timer timer)
+	    (setq timer nil)))
+	'(org-timer-timer1
+	  org-timer-timer2
+	  org-timer-timer3))
   (message "All timers reset"))
 
 (defun org-timer-show-remaining-time ()
@@ -307,7 +308,7 @@ VALUE can be `on', `off', or `pause'."
 		     (widen)
 		     (goto-char pos)
 		     (org-show-entry)
-		     (setq heading (org-get-heading)))))
+		     (org-get-heading))))
 		((eq major-mode 'org-mode)
 		 (org-get-heading))
 		(t (error "Not in an Org buffer"))))

+ 24 - 19
lisp/org.el

@@ -565,6 +565,11 @@ new-frame        Make a new frame each time.  Note that in this case
   :tag "Org Cycle"
   :group 'org-structure)
 
+(defcustom org-cycle-skip-children-state-if-no-children t
+  "Non-nil means, skip CHILDREN state in entries that don't have any."
+  :group 'org-cycle
+  :type 'boolean)
+
 (defcustom org-cycle-max-level nil
   "Maximum level which should still be subject to visibility cycling.
 Levels higher than this will, for cycling, be treated as text, not a headline.
@@ -4935,10 +4940,11 @@ in special contexts.
 (defun org-cycle-internal-local ()
   "Do the local cycling action."
   (org-back-to-heading)
-  (let ((goal-column 0) eoh eol eos)
+  (let ((goal-column 0) eoh eol eos level has-children children-skipped)
     ;; First, some boundaries
     (save-excursion
       (org-back-to-heading)
+      (setq level (funcall outline-level))
       (save-excursion
 	(beginning-of-line 2)
 	(if (or (featurep 'xemacs) (<= emacs-major-version 21))
@@ -4953,6 +4959,10 @@ in special contexts.
 	    (or (bolp) (beginning-of-line 2))))
 	(setq eol (point)))
       (outline-end-of-heading)   (setq eoh (point))
+      (save-excursion
+	(outline-next-heading)
+	(setq has-children (and (org-at-heading-p t)
+				(> (funcall outline-level) level))))
       (org-end-of-subtree t)
       (unless (eobp)
 	(skip-chars-forward " \t\n")
@@ -4970,9 +4980,12 @@ in special contexts.
 	(goto-char eos)
 	(outline-next-heading)
 	(if (org-invisible-p) (org-flag-heading nil))))
-     ((or (>= eol eos)
-	  (not (string-match "\\S-" (buffer-substring eol eos))))
-      ;; Entire subtree is hidden in one line: open it
+     ((and (or (>= eol eos)
+	       (not (string-match "\\S-" (buffer-substring eol eos))))
+	   (or has-children
+	       (not (setq children-skipped
+			  org-cycle-skip-children-state-if-no-children))))
+      ;; Entire subtree is hidden in one line: children view
       (run-hook-with-args 'org-pre-cycle-hook 'children)
       (org-show-entry)
       (show-children)
@@ -4984,22 +4997,14 @@ in special contexts.
       (setq org-cycle-subtree-status 'children)
       (run-hook-with-args 'org-cycle-hook 'children))
      ((and (eq last-command this-command)
-	   (eq org-cycle-subtree-status 'children))
+	   (or children-skipped
+	       (eq org-cycle-subtree-status 'children)))
       ;; We just showed the children, now show everything.
-      (if (save-excursion
-	    (beginning-of-line 2)
-	    (re-search-forward org-complex-heading-regexp eos t))
-	  (progn
-	    (run-hook-with-args 'org-pre-cycle-hook 'subtree)
-	    (org-show-subtree)
-	    (message "SUBTREE")
-	    (setq org-cycle-subtree-status 'subtree)
-	    (run-hook-with-args 'org-cycle-hook 'subtree))
-	(run-hook-with-args 'org-pre-cycle-hook 'folded)
-	(hide-subtree)
-	(message "FOLDED (NO SUBTREE)")
-	(setq org-cycle-subtree-status 'folded)
-	(run-hook-with-args 'org-cycle-hook 'folded)))
+      (run-hook-with-args 'org-pre-cycle-hook 'subtree)
+      (org-show-subtree)
+      (message (if children-skipped "SUBTREE (NO CHILDREN)" "SUBTREE"))
+      (setq org-cycle-subtree-status 'subtree)
+      (run-hook-with-args 'org-cycle-hook 'subtree))
      (t
       ;; Default action: hide the subtree.
       (run-hook-with-args 'org-pre-cycle-hook 'folded)